/* =========================
   BASE / GRID
========================= */

.stocorp-sto-color-grid-wrap{
  position:relative;
  font-family: Open Sans, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

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

.stocorp-sto-color-grid-search{
  width:260px;
  max-width:70vw;
  padding:8px 10px;
}

.stocorp-sto-color-grid-lrv input{
  width:54px;
  padding:6px 6px;
  margin-left:6px;
}

.stocorp-sto-color-grid-clear{
  padding:8px 12px;
  cursor:pointer;
}

.stocorp-sto-color-grid-collection{
  padding:8px 10px;
}

.stocorp-sto-color-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--sto-tile), 1fr));
  gap: var(--sto-gap);
}

.stocorp-sto-color-tile{
  width:100%;
  aspect-ratio:1/1;
  border:1px solid rgba(0,0,0,0.15);
  cursor:pointer;
  position:relative;
}

.stocorp-sto-color-tile:hover{
  outline:2px solid rgba(0,0,0,0.25);
  outline-offset:1px;
}

.stocorp-sto-color-tile .stocorp-sto-color-label{
  position:absolute;
  left:4px;
  bottom:3px;
  font-size:10px;
  line-height:1;
  padding:2px 4px;
  background: rgba(255,255,255,0.75);
  color:#111;
  display:none;
}

/* Add-to-palette button on tiles */
.stocorp-sto-color-tile .stocorp-add-btn{
  position:absolute;
  top:4px;
  right:4px;
  width:18px;
  height:18px;
  border:1px solid rgba(0,0,0,0.25);
  background: rgba(255,255,255,0.85);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  line-height:1;
  cursor:pointer;
}
.stocorp-sto-color-tile .stocorp-add-btn:hover{
  background: rgba(255,255,255,1);
}

/* =========================
   DETAIL POPUP (grid popup)
========================= */

.stocorp-sto-color-grid-detail{
  position:fixed;
  right:18px;
  bottom:18px;
  width:min(360px, calc(100vw - 36px));
  background:#fff;
  border:1px solid rgba(0,0,0,0.2);
  box-shadow:0 10px 30px rgba(0,0,0,0.18);
  padding:14px;
  z-index:99999;
}

.stocorp-sto-color-grid-detail-close{
  position:absolute;
  top:8px;
  right:10px;
  border:0;
  background:transparent;
  font-size:22px;
  cursor:pointer;
}

.stocorp-sto-color-grid-detail-swatch{
  width:100%;
  height:90px;
  border:1px solid rgba(0,0,0,0.15);
  margin-bottom:10px;
}

/* =========================
   DETAIL shortcode (3-column layout)
   IMPORTANT: surfaces block is OUTSIDE .stocorp-sto-color-detail-inner
   so the WRAPPER is the 3-column grid.
========================= */

/* Wrapper becomes the 3-col grid */
.stocorp-sto-color-detail-wrap{
  font-family: Open Sans, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  border:1px solid rgba(0,0,0,0.12);
  background:#fff;
  padding:18px;

  display:grid;
  /* Swatch (smaller) | Meta (wider) | Surfaces (fills) */
  grid-template-columns: 180px minmax(230px, 1.2fr) minmax(600px, 1fr);
  gap:12px;
  align-items:start;
}

/* Inner (swatch + meta) spans col 1-2 */
.stocorp-sto-color-detail-inner{
  grid-column: 1 / span 2;

  display:grid;
  grid-template-columns: 180px minmax(230px, 1.2fr) ;
  gap:24px;
  align-items:start;
}

/* Surfaces live in column 3 and must stretch full width */
.stocorp-sto-color-detail-surfaces{
  grid-column: 3;
  align-self:stretch;
  width:100%;
  margin-top:0 !important;
}
.stocorp-sto-color-surfaces-wrap{
  width:100%;
  max-width:none !important;
  box-sizing:border-box;

  border:1px solid rgba(0,0,0,0.55);
  padding:14px;
}

/* LEFT: swatch card */
.stocorp-detail-card{
  border:1px solid rgba(0,0,0,0.55);
  padding:14px;
  background:#fff;
  box-sizing:border-box;
  max-width:100%;
}

/* Swatch: keep square no matter what */
.stocorp-sto-color-detail-swatch{
  width:100%;
  aspect-ratio: 1 / 1;   /* ✅ square */
  height:auto;           /* ✅ let aspect-ratio win */
  border:1px solid rgba(0,0,0,0.55);
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,0.05),
    rgba(0,0,0,0.05) 10px,
    rgba(0,0,0,0.02) 10px,
    rgba(0,0,0,0.02) 20px
  );
}

/* Caption under swatch */
.stocorp-detail-swatch-caption{ margin-top:12px; }
.stocorp-detail-swatch-caption .swatch-number{
  font-size:24px; /* cap */
  font-weight:800;
  line-height:1.05;
  color: rgba(0,0,0,0.65);
}
.stocorp-detail-swatch-caption .swatch-name{
  font-size:18px;
  font-weight:700;
  color: rgba(0,0,0,0.55);
  margin-top:4px;
}

/* Add button under swatch */
.stocorp-detail-actions{ margin-top:14px; }
.stocorp-detail-actions .stocorp-btn{
  width:100%;
  text-align:center;
  padding:16px 14px;
  font-size:12px; /* cap */
  font-weight:800;
}

/* MIDDLE: meta */
.stocorp-sto-color-detail-meta{ padding-top:6px; }

.stocorp-sto-color-detail-meta .kv{
 display: grid;
    grid-template-columns: 100px 1fr;
    gap: 5px 2px;
}
.stocorp-sto-color-detail-meta .kv .k{
  font-size:14px; /* cap */
  font-weight:900;
  letter-spacing:0.2px;
}
.stocorp-sto-color-detail-meta .kv > div:not(.k){
  font-size:18px;
  white-space:normal;
}

/* RIGHT: surfaces */
.stocorp-sto-color-surfaces-title{
  font-size:24px; /* cap */
  font-weight:900;
  line-height:1;
  color: rgba(0,0,0,0.65);
  margin-bottom:6px;
}
.stocorp-sto-color-surfaces-sub{
  font-size:14px;
  color: rgba(0,0,0,0.6);
  margin-bottom:12px;
}

.stocorp-sto-color-surfaces-add{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:10px;
  margin-bottom:12px;
  width:100%;
}
.stocorp-sto-color-surfaces-input{
  width:100%;
  min-width:0; /* ✅ prevent skinny input */
  border:1px solid rgba(0,0,0,0.2);
  padding:10px;
  font-size:14px;
}
.stocorp-sto-color-surfaces-btn{
  border:1px solid rgba(0,0,0,0.55);
  background:#6a6a6a;
  color:#fff;
  font-weight:800;
  font-size:12px; /* cap */
  padding:10px 12px;
  cursor:pointer;
}

.stocorp-sto-color-surfaces-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.stocorp-sto-color-surfaces-item{
  display:flex;
  align-items:center;
  gap:12px;
  font-size:16px;
  font-weight:700;
}
.stocorp-sto-color-surfaces-item input[type="checkbox"]{
  width:22px;
  height:22px;
}

/* Ensure NO detail text exceeds 24px */
.stocorp-sto-color-detail-wrap *{ font-size: inherit; }
.stocorp-sto-color-detail-wrap{ font-size:16px; }

/* Responsive */
@media (max-width:1100px){
  .stocorp-sto-color-detail-wrap{
    grid-template-columns: 180px 1fr;
  }
  .stocorp-sto-color-detail-inner{
    grid-column: 1 / -1;
    grid-template-columns: 180px 1fr;
  }
  .stocorp-sto-color-detail-surfaces{
    grid-column: 1 / -1;
    margin-top:18px !important;
  }
}
@media (max-width:760px){
  .stocorp-sto-color-detail-wrap{
    grid-template-columns: 1fr;
  }
  .stocorp-sto-color-detail-inner{
    grid-template-columns: 1fr;
  }
  .stocorp-sto-color-detail-surfaces{
    grid-column: 1;
    margin-top:14px !important;
  }
}


/* =========================
   EXPORT MODAL
========================= */

.stocorp-sto-color-export-modal{
  position:fixed;
  inset:0;
  z-index:9999;
  font-family:Open Sans,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

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

.stocorp-sto-color-export-panel{
  position:relative;
  width:min(760px,calc(100% - 24px));
  margin:30px auto;
  background:#fff;
  border:1px solid rgba(0,0,0,0.25);
  padding:18px;
}

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

.stocorp-sto-color-export-sub{
  color:rgba(0,0,0,0.65);
  margin-bottom:14px;
  font-size:14px;
  line-height:1.4;
}

.stocorp-sto-color-export-form .row{
  margin-bottom:10px;
  display:grid;
  gap:10px;
}

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

@media (max-width:560px){
  .stocorp-sto-color-export-form .row.two{ grid-template-columns:1fr; }
}

.stocorp-sto-color-export-form input,
.stocorp-sto-color-export-form select,
.stocorp-sto-color-export-form textarea{
  width:100%;
  border:1px solid rgba(0,0,0,0.2);
  padding:10px;
  font-size:13px;
  background:#fff;
  color:#333;
  outline:none;
}

.stocorp-sto-color-export-form textarea{
  min-height:120px;
  resize:vertical;
}

.stocorp-sto-color-export-form .row.checks{
  gap:6px;
}

.stocorp-sto-color-export-form .row.checks label{
  display:flex;
  gap:10px;
  align-items:center;
  font-size:13px;
  color:#333;
}

.stocorp-sto-color-export-form .row.error{
  color:#b00020;
  font-size:13px;
}

.stocorp-sto-color-export-form .row.actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

/* =========================
   LARGE GRID
========================= */

.stocorp-sto-color-large-grid-wrap{
  margin-top: 18px;
  font-family: Open Sans, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.stocorp-sto-color-large-grid-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:10px;
}

.stocorp-sto-color-large-grid-title{
  font-size:18px;
  font-weight:700;
  color:#111;
}

.stocorp-sto-color-large-grid-hint{
  font-size:12px;
  color: rgba(0,0,0,0.6);
}

.stocorp-large-item{
  display:flex;
  flex-direction:column;
}

.stocorp-large-swatch{
  border:1px solid rgba(0,0,0,0.25);
}

.stocorp-large-meta{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.stocorp-large-num{
  font-weight:700;
  color:#111;
  font-size:14px;
}

.stocorp-large-item.is-selected .stocorp-large-swatch{
  outline: 3px solid rgba(0,0,0,0.6);
  outline-offset: 2px;
}

/* =========================
   SQUARE-OFF OVERRIDES
   (you had this — kept)
========================= */

.stocorp-sto-color-grid-wrap *,
.stocorp-sto-color-detail-wrap *,
.stocorp-sto-color-cart-wrap *{
  border-radius: 0 !important;
}


/* Swatch itself */
.stocorp-sto-color-detail-swatch{
  width:100%;
  max-height:150px;
  border:1px solid rgba(0,0,0,0.55);
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,0.05),
    rgba(0,0,0,0.05) 10px,
    rgba(0,0,0,0.02) 10px,
    rgba(0,0,0,0.02) 20px
  );
}

/* Caption under swatch */
.stocorp-detail-swatch-caption{
  margin-top:12px;
}
.stocorp-detail-swatch-caption .swatch-number{
  font-size:24px; /* never above 24 */
  font-weight:800;
  line-height:1.05;
  color: rgba(0,0,0,0.65);
}
.stocorp-detail-swatch-caption .swatch-name{
  font-size:18px;
  font-weight:700;
  color: rgba(0,0,0,0.55);
  margin-top:4px;
}

/* Button under swatch */
.stocorp-detail-actions{
  margin-top:14px;
}
.stocorp-detail-actions .stocorp-btn{
  width:100%;
  text-align:center;
  padding:16px 14px;
  font-size:14px; /* cap */
  font-weight:800;
}

/* Ensure NO detail text exceeds 24px */
.stocorp-sto-color-detail-wrap *{
  font-size: inherit;
}
.stocorp-sto-color-detail-wrap{
  font-size:16px;
}
.stocorp-sto-color-detail-wrap .stocorp-sto-color-surfaces-title{
  font-size:24px;
}
.stocorp-sto-color-detail-wrap .stocorp-sto-color-detail-meta .kv .k{
  font-size:20px;
}
.stocorp-sto-color-detail-wrap .stocorp-sto-color-detail-meta .kv > div:not(.k){
  font-size:18px;
}

/* Responsive: keep surfaces below only when narrow */
@media (max-width:1100px){
  .stocorp-sto-color-detail-wrap{
    grid-template-columns: 360px 1fr;
  }
  .stocorp-sto-color-detail-inner{
    grid-column: 1 / -1;
  }
  .stocorp-sto-color-detail-surfaces{
    grid-column: 1 / -1;
    margin-top:18px !important;
  }
}
@media (max-width:760px){
  .stocorp-sto-color-detail-wrap{
    grid-template-columns: 1fr;
  }
  .stocorp-sto-color-detail-inner{
    grid-template-columns: 1fr;
  }
  .stocorp-sto-color-detail-surfaces{
    grid-column: 1;
    margin-top:14px !important;
  }
}
/* =========================
   CART SWATCH FIX (restore swatch visibility)
========================= */

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

.stocorp-cart-item{
  border:1px solid rgba(0,0,0,0.12);
  overflow:hidden;
  background:#fff;
}

.stocorp-cart-swatch{
  display:block;          /* ✅ important: empty div must be block */
  width:100%;
  height:56px;            /* ✅ restores visible swatch */
  min-height:56px;        /* ✅ prevents collapse */
  border-bottom:1px solid rgba(0,0,0,0.08);
  background-size:cover;  /* harmless, helps if gradients ever used */
  background-position:center;
}
/* =========================================================
   RESTORE: CART / PALETTE CONTAINER + EXPORT MODAL
   Paste at VERY BOTTOM of sto-color-grid.css
========================================================= */

.stocorp-sto-color-cart-wrap{
  font-family: Open Sans, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  border:1px solid rgba(0,0,0,0.12);
  background:#fff;
  padding:14px;
  box-sizing:border-box;
  width:100%;
}

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

.stocorp-sto-color-cart-title{
  font-size:18px;
  font-weight:800;
  color:#111;
}

.stocorp-sto-color-cart-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.stocorp-sto-color-cart-actions button{
  border:1px solid rgba(0,0,0,0.35);
  background:#fff;
  color:#333;
  padding:8px 10px;
  cursor:pointer;
  font-weight:600;
}

.stocorp-sto-color-cart-actions button:hover{
  background:#f2f2f2;
  color:#111;
  border-color: rgba(0,0,0,0.5);
}

/* Grid of palette items */
.stocorp-sto-color-cart-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap:10px;
}

/* Each palette item */
.stocorp-cart-item{
  border:1px solid rgba(0,0,0,0.12);
  background:#fff;
  overflow:hidden;
  box-sizing:border-box;
}

/* THIS is the swatch block that people often "lose" */
.stocorp-cart-swatch{
  height:56px;
  border-bottom:1px solid rgba(0,0,0,0.08);
  background:#eee; /* fallback */
}

/* Meta under swatch */
.stocorp-cart-meta{
  padding:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.stocorp-cart-meta .num{
  font-weight:800;
  font-size:13px;
  color:#111;
}

.stocorp-cart-meta .row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}

/* Remove X */
.stocorp-cart-remove{
  width:26px;
  height:26px;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(0,0,0,0.35);
  background:#fff;
  color:#333;
  cursor:pointer;
  font-size:16px;
  line-height:1;
}

.stocorp-cart-remove:hover{
  background:#f2f2f2;
  color:#111;
  border-color: rgba(0,0,0,0.5);
}

/* Optional surfaces line (if your JS appends it) */
.stocorp-cart-surfaces{
  font-size:11px;
  color: rgba(0,0,0,0.65);
  line-height:1.2;
}

/* Empty state */
.stocorp-sto-color-cart-empty{
  color: rgba(0,0,0,0.65);
  padding:10px 0 0 0;
}

/* =========================================================
   EXPORT MODAL (restored)
========================================================= */

.stocorp-sto-color-export-modal{
  position:fixed;
  inset:0;
  z-index:9999;
  font-family:Open Sans,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

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

.stocorp-sto-color-export-panel{
  position:relative;
  width:min(760px,calc(100% - 24px));
  margin:30px auto;
  background:#fff;
  border:1px solid rgba(0,0,0,0.25);
  padding:18px;
  box-sizing:border-box;
}

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

.stocorp-sto-color-export-sub{
  color:rgba(0,0,0,0.65);
  margin-bottom:14px;
  font-size:14px;
  line-height:1.4;
}

.stocorp-sto-color-export-form .row{
  margin-bottom:10px;
  display:grid;
  gap:10px;
}

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

@media (max-width:560px){
  .stocorp-sto-color-export-form .row.two{ grid-template-columns:1fr; }
}

.stocorp-sto-color-export-form input,
.stocorp-sto-color-export-form select,
.stocorp-sto-color-export-form textarea{
  width:100%;
  border:1px solid rgba(0,0,0,0.2);
  padding:10px;
  font-size:13px;
  background:#fff;
  color:#333;
  outline:none;
  box-sizing:border-box;
}

.stocorp-sto-color-export-form textarea{
  min-height:120px;
  resize:vertical;
}

.stocorp-sto-color-export-form .row.checks{
  gap:6px;
}

.stocorp-sto-color-export-form .row.checks label{
  display:flex;
  gap:10px;
  align-items:center;
  font-size:13px;
  color:#333;
}

.stocorp-sto-color-export-form .row.error{
  color:#b00020;
  font-size:13px;
}

.stocorp-sto-color-export-form .row.actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

/* =========================================================
   If you are using the "square-off overrides", keep them.
   If not, remove this block.
========================================================= */
.stocorp-sto-color-grid-wrap *,
.stocorp-sto-color-detail-wrap *,
.stocorp-sto-color-cart-wrap *{
  border-radius: 0 !important;
}
.stocorp-sto-color-surfaces-item{
  display:flex;
  align-items:center;
  gap:10px;
}

.stocorp-sto-color-surfaces-item .stocorp-surface-name{
  flex:1;
}

.stocorp-surface-del{
  width:26px;
  height:26px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(0,0,0,0.35);
  background:#fff;
  color:#333;
  cursor:pointer;
  font-size:18px;
  line-height:1;
}

.stocorp-surface-del:hover{
  background:#f2f2f2;
  border-color: rgba(0,0,0,0.5);
  color:#111;
}
