.stocorp-sto-color-grid-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.stocorp-sto-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sto-gap, 4px);
}

.stocorp-sto-color-tile {
    width: var(--sto-tile, 22px);
    height: var(--sto-tile, 22px);
    cursor: pointer;
    position: relative;
    /*border: 1px solid rgba(0,0,0,.2);*/
    box-sizing: border-box;
    position: relative;
}

.stocorp-sto-color-label {
    font-size: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    display: none;
}

.stocorp-sto-color-tile:hover .stocorp-sto-color-label {
    display: block;
}

/* Large swatch grid */
.stocorp-sto-color-large-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.stocorp-large-item {
    width: 100%;
    min-width: 0;
    cursor: pointer;
}

.stocorp-large-swatch {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    border: 1px solid #333;
    box-sizing: border-box;
    position: relative;
}

.stocorp-large-hpop {
    position: absolute;
    right: 6px;
    bottom: 5px;
    font-size: 15px;
    line-height: 1;
    font-weight: 900;
    color: #000;
    z-index: 3;
}

.stocorp-large-meta {
    position: absolute;
    left: 5px;
    right: 24px;
    bottom: 5px;
    z-index: 2;
    min-width: 0;
}

.stocorp-large-num {
    font-weight: 700;
    font-size: 12px;
    color: #000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
    white-space: nowrap;
    line-height: 1.05;
}

.stocorp-large-number {
    flex: 0 0 auto;
    line-height: 1;
}

.stocorp-large-name {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    line-height: 1.05;
}

.stocorp-sto-color-large-grid-hint {
    font-size: 12px;
    line-height: 1.3;
}

/* Detail */
.stocorp-sto-color-detail-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    width: 100%;
    margin: 0px 0;
}

.stocorp-sto-color-detail-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
    width: 100%;
    container-type: inline-size;
    container-name: sto-color-detail;
}

.stocorp-detail-card {
    border: 1px solid #999;
    padding: 14px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.stocorp-sto-color-detail-swatch {
    width: 100%;
    height: clamp(150px, 18vw, 240px);
    border: 1px solid #777;
    box-sizing: border-box;
}

.stocorp-detail-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
}

.stocorp-detail-swatch-caption {
    min-width: 0;
}

.swatch-number {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.swatch-name {
    font-size: 13px;
}

.stocorp-detail-actions {
    margin: 0;
    flex: 0 0 auto;
}

.stocorp-btn,
.stocorp-detail-actions button,
.stocorp-sto-color-cart-actions button,
.stocorp-sto-color-surfaces-btn {
    background: #999;
    color: #fff;
    border: 0;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
}

/* Detail key/value: three across, wrapping to a second row. */
.stocorp-sto-color-detail-meta {
    width: 100%;
}

.kv {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 18px;
    font-size: 14px;
    font-weight: 500;
}

.kv-item {
    display: grid;
    grid-template-columns: minmax(58px, auto) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.kv .k {
    font-weight: 700;
    font-size: 12px;
}

.kv .k::after {
    content: ":";
}

.kv .v {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Surfaces */
.stocorp-sto-color-detail-surfaces {
    width: 100%;
    max-width: 250px;
    justify-self: end;
    background-color: #f0f0f0;
    padding: 10px;
    box-sizing: border-box;
}

.stocorp-sto-color-detail-wrap.has-sticky-surfaces .stocorp-sto-color-detail-surfaces {
    position: fixed;
    bottom: var(--sto-surfaces-top, 20px);
    right: 0px;
    width: min(250px, calc(100vw - 40px));
    z-index: 1000;
}

.stocorp-sto-color-surfaces-title {
    font-size: 20px;
    font-weight: 700;
}

.stocorp-sto-color-surfaces-sub {
    font-size: 13px;
    margin-bottom: 10px;
    color: #555;
}

.stocorp-sto-color-surfaces-add {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.stocorp-sto-color-surfaces-input {
    min-width: 60%;
}

.stocorp-sto-color-surfaces-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.stocorp-surface-del {
    margin-left: auto;
    border: 0;
    background: #999;
    cursor: pointer;
    width: 20px;
    height: 20px;
    min-width: 20px;
    padding: 0;
    line-height: 18px;
}

/* Cart / Palette */
.stocorp-sto-color-cart-wrap {
    background-color: #f0f0f0;
    padding: 10px;
    margin-top: 20px;
}

.stocorp-sto-color-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.stocorp-sto-color-cart-title {
    font-size: 22px;
    font-weight: 700;
}

.stocorp-sto-color-cart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(200px,1fr));
    gap: 12px;
}

.stocorp-cart-item {
    border: 1px solid #ddd;
    display: flex;
    gap: 10px;
    cursor: pointer;
    background: #fff;
    position: relative;
    align-items: flex-start;
    padding: 12px 34px 12px 10px;
    min-height: 72px;
}

.stocorp-cart-swatch {
    width: 48px;
    height: 48px;
    border: 1px solid #555;
    flex: 0 0 auto;
}

.stocorp-cart-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.stocorp-cart-meta .num,
.stocorp-cart-color-info .num,
.stocorp-cart-color-info .name {
    font-weight: 700;
}

.stocorp-cart-color-info {
    font-weight: 700;
    line-height: 1.25;
    padding-right: 4px;
}

.stocorp-cart-color-info .name {
    font-size: 12px;
}

.stocorp-cart-surfaces {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #d8d8d8;
    font-size: 13px;
    line-height: 1.3;
    color: #666;
}

.stocorp-cart-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #999;
    cursor: pointer;
    line-height: 16px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.stocorp-sto-color-cart-clear {
    margin-right: 5px;
    font-size: 12px;
}

/* Collection / Search */
.stocorp-sto-color-grid-collection {
    width: 100%;
    height: 50px;
    padding: 5px;
    font-weight: 700;
    background: #e0e0e0;
}

.stocorp-sto-color-grid-empty {
    padding: 10px 0;
    color: #666;
    font-size: 13px;
}

.stocorp-sto-color-grid-lrv {
    font-size: 12px;
    font-weight: 500;
    line-height: 24px;
}

.stocorp-sto-color-grid-clear {
    font-size: 12px;
}

.stocorp-sto-color-grid-global-search-row {
    flex: 0 0 100%;
    width: 100%;
    margin-bottom: 2px;
}

.stocorp-sto-color-grid-global-search-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.stocorp-sto-color-grid-global-search {
    display: block;
    width: 100%;
    height: 42px;
    margin-top: 4px;
    padding: 5px 8px;
    box-sizing: border-box;
}

.stocorp-sto-color-grid-search {
    min-width: 100%;
    height: 34px;
    padding: 5px 8px;
}

/* Export modal */
.stocorp-sto-color-export-modal {
    position: fixed;
    z-index: 2147483647;
    inset: 0;
    isolation: isolate;
}

.stocorp-sto-color-export-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
}

.stocorp-sto-color-export-panel {
    position: relative;
    background: #fff;
    width: min(680px,94vw);
    margin: 2vh auto;
    padding: 24px;
    max-height: 96vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,.35);
}

.stocorp-sto-color-export-title {
    font-size: 22px;
    font-weight: 700;
}

.stocorp-sto-color-export-form .row {
    margin: 10px 0;
}

.stocorp-sto-color-export-form .two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stocorp-sto-color-export-form input,
.stocorp-sto-color-export-form select,
.stocorp-sto-color-export-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
}

.stocorp-sto-color-export-form .row.checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stocorp-sto-color-export-form .row.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    line-height: 1.3;
}

.stocorp-sto-color-export-form .row.checks input[type="checkbox"] {
    margin: 0;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

/* Tablet and smaller: return Surfaces to the normal document flow beneath Details. */
@media (max-width: 1199px) {
    .stocorp-sto-color-detail-wrap.has-sticky-surfaces .stocorp-sto-color-detail-surfaces {
        position: static;
        bottom: auto;
        right: auto;
        width: 100%;
        max-width: 250px;
        justify-self: start;
        z-index: auto; 
        right:0px; 
    }
}

/* Mobile */
@media (max-width: 800px) {
    .stocorp-sto-color-detail-wrap,
    .stocorp-sto-color-detail-inner {
        grid-template-columns: 1fr;
    }

    .stocorp-sto-color-detail-surfaces {
        position: static !important;
        max-width: none;
        justify-self: stretch;
    }

    .kv {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stocorp-sto-color-export-form .two {
        grid-template-columns: 1fr;
    }

    .stocorp-sto-color-large-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
    }

    .stocorp-large-num {
        font-size: 10px;
        margin-top: -20px;
    }
}
.stocorp-sto-color-grid-organic {
	    font-size: 12px;
    font-weight: 500;
    line-height: 24px;
}
/* Color wheel / similar color matching */
.stocorp-sto-color-match-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 14px;
    padding: 10px;
    border: 1px solid #ddd;
    background: #fafafa;
    box-sizing: border-box;
}

.stocorp-sto-color-match-tools label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.stocorp-sto-color-match-color {
    width: 44px;
    height: 34px;
    padding: 0;
    border: 1px solid #999;
    cursor: pointer;
}

.stocorp-sto-color-match-threshold {
    min-height: 34px;
}

.stocorp-sto-color-match-apply,
.stocorp-sto-color-match-clear {
    min-height: 24px;
    padding: 3px 5px;
    border: 1px solid #777;
    background: #fff;
    cursor: pointer;
	color:#000;
}

.stocorp-sto-color-match-status {
    font-size: 12px;
    font-weight: 700;
}

/* Custom cross-browser color matcher (avoids native browser color input) */
.stocorp-sto-custom-picker{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:flex-start;
  color:#000;
}
.stocorp-sto-color-match-label{
  font-weight:600;
  margin-bottom:2px;
}
.stocorp-sto-picker-row{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.stocorp-sto-color-preview{
  width:34px;
  height:34px;
  border:1px solid #777;
  box-sizing:border-box;
}
.stocorp-sto-color-match-color{
  width:90px;
  padding:7px 8px;
  border:1px solid #aaa;
  border-radius:3px;
  font-family:monospace;
  text-transform:uppercase;
}
.stocorp-sto-color-eyedropper{
  padding:3px 5px;
  border:1px solid #888;
  border-radius:3px;
  background:#f6f6f6;
  cursor:pointer;
	color:#000;
	font-size:11px;
}
.stocorp-sto-color-eyedropper:hover{
  background:#e9e9e9;
}
.stocorp-sto-picker-panel{
  display:block;
  width:100%;
  max-width:620px;
}
.stocorp-sto-color-square{
  width:100%;
  max-width:520px;
  height:135px;
  border:1px solid #777;
  cursor:crosshair;
  touch-action:none;
  display:block;
}
.stocorp-sto-hue-label{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:12px;
  font-weight:600;
}
.stocorp-sto-color-hue{
  width:160px;
}


.stocorp-sto-color-paste-hex{
  padding:7px 10px;
  border:1px solid #888;
  border-radius:3px;
  background:#fff;
  cursor:pointer;
}
.stocorp-sto-color-powertoys-note{
  font-size:12px;
  color:#111;
  line-height:1.35;
  max-width:520px;
}

.stocorp-sto-color-powertoys-note a{
  color:#111;
  text-decoration:underline;
  font-weight:700;
}

.stocorp-sto-photo-match{
  border-top:1px solid #e2e2e2;
  padding-top:8px;
  margin-top:2px;
  width:100%;
  max-width:620px;
}
.stocorp-sto-photo-upload-label{
  display:inline-flex !important;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border:1px dashed #888;
  border-radius:3px;
  background:#fff;
  cursor:pointer;
}
.stocorp-sto-photo-upload{
  max-width:220px;
}
.stocorp-sto-photo-preview-wrap{
  margin-top:8px;
}
.stocorp-sto-photo-preview{
  max-width:220px;
  max-height:140px;
  border:1px solid #ddd;
  object-fit:contain;
  background:#fff;
}
.stocorp-sto-photo-colors{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
  align-items:center;
}
.stocorp-sto-photo-color-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid #bbb;
  background:#fff;
  padding:5px 7px;
  border-radius:3px;
  cursor:pointer;
  font-size:12px;
}
.stocorp-sto-photo-color-chip{
  width:22px;
  height:22px;
  border:1px solid #777;
  display:inline-block;
}
.stocorp-sto-photo-status{
  width:100%;
  font-size:12px;
  color:#555;
}

/* Removed legacy hue slider / paste HEX controls from the updated color selector. */
.stocorp-sto-hue-label, .stocorp-sto-color-hue, .stocorp-sto-color-paste-hex{display:none !important;}


/* The standalone similar-color shortcode contains only the finder UI.
   Its internal data grid is never displayed; matches are broadcast to [sto_color_large_grid]. */
.stocorp-sto-color-similar-wrap .stocorp-sto-color-finder-data-grid {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

@media (max-width: 520px) {
    .stocorp-detail-heading-row {
        align-items: flex-start;
    }

    .kv {
        grid-template-columns: 1fr;
    }
}


/* Responsive detail metadata based on the width of the detail component,
   not only the browser viewport. This prevents wrapping and overlap when
   the shortcode is placed in a narrow WPBakery/Gutenberg column. */
@container sto-color-detail (max-width: 680px) {
    .kv {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 20px;
    }

    .kv-item {
        grid-template-columns: max-content minmax(0, 1fr);
        align-items: baseline;
        gap: 4px;
    }

    .kv .k,
    .kv .v {
        display: block;
        width: auto;
        line-height: 16px;
    }
}

@container sto-color-detail (max-width: 440px) {
    .stocorp-detail-heading-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .stocorp-detail-actions,
    .stocorp-detail-actions .stocorp-btn,
    .stocorp-detail-actions button {
        width: 100%;
        box-sizing: border-box;
    }

    .kv {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .kv-item {
        grid-template-columns: max-content minmax(0, 1fr);
        align-items: baseline;
        gap: 4px;
        padding: 8px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.14);
    }

    .kv-item:last-child {
        border-bottom: 0;
    }
}

/* Fallback for browsers without container-query support. */
@supports not (container-type: inline-size) {
    @media (max-width: 800px) {
        .kv-item {
            grid-template-columns: 1fr;
            gap: 3px;
        }
    }

    @media (max-width: 520px) {
        .stocorp-detail-heading-row {
            flex-direction: column;
            align-items: stretch;
        }

        .stocorp-detail-actions,
        .stocorp-detail-actions .stocorp-btn,
        .stocorp-detail-actions button {
            width: 100%;
            box-sizing: border-box;
        }
    }
}

html.sto-color-modal-open,
html.sto-color-modal-open body {
    overflow: hidden !important;
}

@media (max-width: 600px) {
    .stocorp-sto-color-export-form .two {
        grid-template-columns: 1fr;
    }
    .stocorp-sto-color-export-panel {
        width: 96vw;
        margin: 2vh auto;
        padding: 18px;
    }
}

/* v2.1.34: Similar Colors below the selected color */
.stocorp-sto-color-similar-section {
    margin-top: 18px;
    width: 100%;
}

.stocorp-sto-color-similar-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.stocorp-sto-color-similar-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.stocorp-sto-color-similar-item {
    appearance: none;
    border: 1px solid #d4d4d4;
    background: #fff;
    padding: 0;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}

.stocorp-sto-color-similar-swatch {
    position: relative;
    width: 100%;
    aspect-ratio: 1.35 / 1;
    min-height: 72px;
}

.stocorp-sto-color-similar-number {
    padding: 7px 8px;
    font-size: 14px;
    font-weight: 700;
    color: #555 !important;
    background: #fff;
    line-height: 1.25;
}

.stocorp-sto-color-similar-swatch .stocorp-large-hpop {
    position: absolute;
    top: 6px;
    right: 6px;
}

/* v2.1.33: Surface Library is optional and lives under My Color Palette */
.stocorp-sto-color-surface-library {
    margin-top: 12px;
    border-top: 1px solid #d8d8d8;
    padding-top: 12px;
}

.stocorp-sto-color-surface-library .stocorp-sto-color-surfaces-wrap {
    width: 100%;
    max-width: none;
}

.stocorp-sto-color-surface-library-toggle.is-active {
    outline: 2px solid rgba(0,0,0,.12);
}

/* The old detail-side/floating Surface panel is retired. */
.stocorp-sto-color-detail-surfaces {
    position: static !important;
    display: none !important;
}

@media (max-width: 900px) {
    .stocorp-sto-color-similar-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .stocorp-sto-color-similar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stocorp-sto-color-cart-header {
        align-items: flex-start;
        gap: 10px;
    }
    .stocorp-sto-color-cart-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
    }
}
