/* stockroom -- stock, style detail, count, catalog (stock.js). Scoped under
   .view-stock (all four routes use the Stock tab) and .st-sheet (the sheets
   stock.js opens). Tokens only. */

/* ------------------------------------------------------------ the list -- */
.view-stock .st-list > .st-search { margin: 2px 0 12px; }
.view-stock .st-stats { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 8px; margin-top: 4px; }
.view-stock .st-stat { display: grid; align-content: space-between; gap: 6px; min-width: 0; min-height: 66px; padding: 10px 11px 10px;
                       text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
                       box-shadow: var(--sh-1); transition: transform .12s var(--ease), background .15s, border-color .15s; }
.view-stock .st-stat:active { transform: scale(.97); }
.view-stock .st-stat .l { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-stock .st-stat .v { font: 700 23px/1 var(--f-num); letter-spacing: -.02em; color: var(--t); font-variant-numeric: tabular-nums;
                          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-stock .st-stat[data-f="all"] .v { color: var(--ink); }
.view-stock .st-stat.zero .v { color: var(--faint); }
.view-stock .st-stat[aria-pressed="true"]:not([data-f="all"]) { background: var(--tt); border-color: var(--t); box-shadow: 0 0 0 1px var(--t) inset; }
.view-stock .st-stat[aria-pressed="true"]:not([data-f="all"]) .l { color: var(--t); }
.view-stock .st-list > .chips { margin-top: 12px; }
.view-stock .st-groups { display: grid; gap: 12px; margin-top: 14px; }
.view-stock .st-empty { padding: 10px 0; }

/* a product card: header, then its styles */
.view-stock .st-prod { align-self: start; }
.view-stock .st-phead { display: flex; align-items: center; gap: 10px; padding: 10px 14px 9px; min-height: 48px; width: 100%;
                        text-align: left; color: inherit; border-bottom: 1px solid var(--line); background: var(--card); }
.view-stock .st-pname { font: 650 15.5px/1.2 var(--f-ui); letter-spacing: -.01em; min-width: 0;
                        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-stock .st-pchem { font-size: 12.5px; color: var(--faint); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.view-stock .st-row { min-height: 70px; padding-top: 12px; padding-bottom: 12px; }
.view-stock .st-row .gauge { margin-top: 8px; }
.view-stock .st-row .trail { display: grid; justify-items: end; gap: 5px; }
.view-stock .st-qty { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.view-stock .st-qty .n { font: 700 22px/1 var(--f-num); letter-spacing: -.02em; }
.view-stock .st-qty .u { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.view-stock .st-qty.neg .n { color: var(--bad); }
.view-stock .st-catlink { margin-top: 18px; }

@media (min-width: 900px) {
  .view-stock .st-stats { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .view-stock .st-stat { min-height: 76px; padding: 13px 15px; }
  .view-stock .st-stat .v { font-size: 28px; }
  .view-stock .st-stat:hover { border-color: var(--line-2); }
  .view-stock .st-groups { display: block; columns: 2; column-gap: 14px; }
  .view-stock .st-groups > * { break-inside: avoid; margin-bottom: 14px; }
  .view-stock .st-groups > .st-empty { column-span: all; }
  .view-stock .st-catlink { max-width: calc(50% - 7px); margin-top: 4px; }
}

/* ------------------------------------------------------ style detail -- */
.view-stock .st-hero { padding: 16px; }
.view-stock .st-hero-top { display: flex; align-items: center; gap: 12px; }
.view-stock .st-hero-label { font: 700 21px/1.15 var(--f-num); letter-spacing: -.015em; }
.view-stock .st-hero-per { font-size: 13px; color: var(--muted); margin-top: 3px; }
.view-stock .st-hero-num { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; }
.view-stock .st-hero-num .big-num { font-size: 52px; }
.view-stock .st-hero-noun { font-size: 16px; font-weight: 600; color: var(--muted); }
.view-stock .st-hero-units { font-size: 13px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.view-stock .st-splitwrap { margin-top: 14px; }
.view-stock .st-split { display: flex; gap: 2px; height: 12px; border-radius: 99px; overflow: hidden; background: var(--paper-2); }
.view-stock .st-split .seg { flex: 1 1 0; min-width: 4px; }
.view-stock .st-split .seg.free, .view-stock .st-legend .sw.free { background: var(--t); }
.view-stock .st-split .seg.free.soft, .view-stock .st-legend .sw.free.soft { background: var(--tm); }
.view-stock .st-split .seg.held, .view-stock .st-legend .sw.held { background: var(--ink-2); opacity: .55; }
.view-stock .st-split .seg.short, .view-stock .st-legend .sw.short {
  background: repeating-linear-gradient(135deg, var(--bad) 0 2.5px, var(--bad-tint) 2.5px 5.5px); }
.view-stock .st-split .seg.in, .view-stock .st-legend .sw.in {
  background: repeating-linear-gradient(135deg, var(--info) 0 2.5px, var(--info-tint) 2.5px 5.5px); }
.view-stock .st-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 9px; font-size: 13px; color: var(--muted); }
.view-stock .st-legend .item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.view-stock .st-legend b { color: var(--ink); font: 650 13.5px/1 var(--f-num); font-variant-numeric: tabular-nums; }
.view-stock .st-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.view-stock .st-hero-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 16px; }
.view-stock .st-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.view-stock .st-kpis .kpi .value { font-size: 24px; }
.view-stock .st-kpis .kpi.tone-bad .value { color: var(--bad); }
.view-stock .st-kpis .kpi.tone-warn .value { color: var(--warn); }
.view-stock .st-kpis .kpi .foot { white-space: normal; overflow: visible; display: block; line-height: 1.3; }

/* 12 months: in grows up, out grows down */
.view-stock .st-months { padding: 14px 14px 10px; }
.view-stock .st-mlegend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.view-stock .st-mlegend .item { display: inline-flex; align-items: center; gap: 6px; }
.view-stock .st-mlegend b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.view-stock .st-mlegend .sw { width: 10px; height: 10px; border-radius: 3px; }
.view-stock .st-mlegend .sw.in { background: var(--ok); }
.view-stock .st-mlegend .sw.out { background: var(--brand); }
.view-stock .st-mgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.view-stock .st-mcol { display: grid; grid-template-rows: 52px 38px auto; justify-items: center; min-width: 0; }
.view-stock .st-mcol .up, .view-stock .st-mcol .dn { width: 100%; max-width: 22px; display: flex; }
.view-stock .st-mcol .up { align-items: flex-end; border-bottom: 1px solid var(--line-2); }
.view-stock .st-mcol .dn { align-items: flex-start; }
.view-stock .st-mcol .up span, .view-stock .st-mcol .dn span { display: block; width: 100%; }
.view-stock .st-mcol .up span { background: var(--ok); border-radius: 4px 4px 1px 1px; opacity: .85; }
.view-stock .st-mcol .dn span { background: var(--brand); border-radius: 1px 1px 4px 4px; opacity: .8; }
.view-stock .st-mcol .lab { font-size: 11px; color: var(--faint); font-weight: 600; margin-top: 5px; }
.view-stock .st-mcol.now .lab { color: var(--ink); }
.view-stock .st-mcol.now .up span, .view-stock .st-mcol.now .dn span { opacity: 1; }

/* the ledger */
.view-stock .st-ledger .row { min-height: 60px; padding-right: 6px; }
.view-stock .st-ledger .row + .row::before { left: 56px; }
.view-stock .st-mv .sub { font-variant-numeric: tabular-nums; white-space: normal; overflow: visible; text-overflow: clip; }
.view-stock .st-mvq { font: 650 15.5px/1.2 var(--f-num); color: var(--ink-2); white-space: nowrap; }
.view-stock .st-mvq.pos { color: var(--ok); }
.view-stock .st-mv.voided .title, .view-stock .st-mv.voided .st-mvq { text-decoration: line-through; color: var(--faint); }
.view-stock .st-mv.voided .sub { color: var(--faint); }
.view-stock .st-mv-gap { width: 40px; flex: none; }
.view-stock .st-ref { font-weight: 600; }
.view-stock .st-detail > div > .section:first-child { margin-top: 12px; }

/* ----------------------------------------------------------- suppliers -- */
.view-stock .st-suplist .row + .row::before { left: 56px; }
.view-stock .st-sup-lead { position: relative; display: inline-flex; flex: none; }
.view-stock .st-star { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%;
                       background: var(--card); box-shadow: 0 0 0 1.5px var(--card); display: grid; place-items: center; }
.view-stock .st-star svg { width: 10px; height: 10px; fill: var(--warn); }
.st-sheet .st-sup-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; }
.st-sheet .st-sup-head > div { display: grid; gap: 1px; min-width: 0; }
.st-sheet .st-sup-head b { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-sheet .st-sup-head span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-sheet .st-sup-meta { margin-top: 4px; font-size: 13px; color: var(--muted); }

@media (min-width: 600px) {
  .view-stock .st-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .view-stock .st-detail > :last-child { margin-top: 0; }
}

/* --------------------------------------------------------------- count -- */
.view-stock .st-cprog { position: sticky; top: 60px; z-index: 15; margin: -2px calc(-1 * var(--gutter)) 0; padding: 4px var(--gutter) 12px;
                        background: var(--paper); }
.view-stock .st-cp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; margin-bottom: 7px; }
.view-stock .st-cp-n { font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.view-stock .st-cp-off { font-weight: 650; color: var(--warn); }
.view-stock .st-cp-bar { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.view-stock .st-cp-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width .35s var(--ease); }
.view-stock .st-cprog.all .st-cp-bar span { background: var(--ok); }
.view-stock .st-cfilter { margin: 4px 0 0; }
.view-stock .st-count .st-groups { margin-top: 12px; }
.view-stock .st-crow { gap: 8px; min-height: 64px; padding: 10px 10px 10px 14px; }
.view-stock .st-crow .sub { font-variant-numeric: tabular-nums; }
.view-stock .st-crow.match .sub { color: var(--ok); font-weight: 600; }
.view-stock .st-crow.off .sub { color: var(--warn); font-weight: 600; }
.view-stock .st-ok { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
                     border: 1.5px solid var(--line-2); color: var(--muted); background: var(--card); transition: transform .1s var(--ease), background .15s; }
.view-stock .st-ok .i { width: 22px; height: 22px; stroke-width: 2.2; }
.view-stock .st-ok:active { transform: scale(.94); }
.view-stock .st-ok[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: var(--card); }
.view-stock .st-cfoot { margin-top: 18px; }
.view-stock .st-cstart { display: grid; place-items: center; padding: 18px 0; }
.view-stock .st-cstart-card { width: min(420px, 100%); padding: 26px 20px 20px; display: grid; justify-items: center; gap: 6px; text-align: center; }
.view-stock .st-cstart-card .glyph { margin-bottom: 6px; }
.view-stock .st-cstart-n { font: 700 24px/1.2 var(--f-num); letter-spacing: -.015em; }
.view-stock .st-cstart-last { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.view-stock .st-cstart-card .btn { width: 100%; }
@media (min-width: 900px) {
  .view-stock .st-cprog { top: 72px; }
  .view-stock .st-cfoot { display: flex; justify-content: flex-end; }
  .view-stock .st-cfoot .btn { width: 320px; }
}

/* the typeable stepper (count rows + adjust sheet) */
.view-stock .st-ns, .st-sheet .st-ns { display: inline-flex; align-items: center; height: 44px; border-radius: 12px; background: var(--paper-2); flex: none; }
.view-stock .st-ns button, .st-sheet .st-ns button { width: 40px; height: 44px; display: grid; place-items: center; color: var(--ink-2); border-radius: 12px; }
.view-stock .st-ns button:active, .st-sheet .st-ns button:active { background: var(--paper-3); }
.view-stock .st-ns .st-ns-in, .st-sheet .st-ns .st-ns-in {
  width: 46px; height: 36px; border: 0; border-radius: 9px; background: transparent; text-align: center; outline: none;
  font: 700 18px/1 var(--f-num); font-variant-numeric: tabular-nums; color: var(--ink); padding: 0; }
.view-stock .st-ns .st-ns-in:focus, .st-sheet .st-ns .st-ns-in:focus { background: var(--card); box-shadow: 0 0 0 2px var(--brand); }
.view-stock .st-ns.pending .st-ns-in { color: var(--faint); }

/* ------------------------------------------------------------- catalog -- */
.view-stock .st-cat-seg { margin: 2px 0 2px; }
.view-stock .st-cat-seg .seg { max-width: 360px; }
.view-stock .st-cat-tools { display: flex; align-items: center; gap: 6px; margin: 10px 0 14px; }
.view-stock .st-cat-tools .search { flex: 1; min-width: 0; }
.view-stock .st-cat-tools .btn.ghost { flex: none; white-space: nowrap; }
.view-stock .st-cat .st-phead { gap: 2px; padding: 4px 6px 4px 14px; }
.view-stock .st-phead-tap { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; min-height: 44px;
                            padding: 6px 2px; text-align: left; color: inherit; }
.view-stock .st-phead-tap:active { background: var(--paper); }
.view-stock .st-psub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-stock .st-pchev { width: 18px; height: 18px; color: var(--faint); flex: none; transition: transform .15s var(--ease); }
.view-stock .st-pchev.open { transform: rotate(180deg); }
.view-stock .st-cat .row { min-height: 54px; }
.view-stock .st-cat.archived .st-phead .glyph { filter: grayscale(1); opacity: .6; }
.view-stock .st-addstyle { color: var(--brand); font-weight: 600; font-size: 15px; min-height: 50px; gap: 10px; }
.view-stock .st-addstyle .i { width: 19px; height: 19px; }

/* --------------------------------------------------------------- sheets -- */
.st-sheet .st-kv { margin: 0; }
.st-sheet .st-kv dd { overflow-wrap: anywhere; }
.st-sheet .st-menu .row + .row::before { left: 56px; }
.st-sheet .st-adj-head, .st-sheet .st-edit-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; }
.st-sheet .st-adj-name { font-weight: 650; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-sheet .st-adj-sub { font-size: 13px; color: var(--muted); margin-top: 1px; font-variant-numeric: tabular-nums; }
.st-sheet .st-edit-head > div { display: grid; gap: 1px; min-width: 0; }
.st-sheet .st-edit-head b { font-size: 15.5px; }
.st-sheet .st-edit-head span { font-size: 13px; color: var(--muted); }
.st-sheet .st-adj-units { margin-top: 10px; }
.st-sheet .st-adj-qty { display: flex; justify-content: center; margin-top: 18px; }
.st-sheet .st-adj-qty .st-ns { height: 60px; border-radius: 16px; }
.st-sheet .st-adj-qty .st-ns button { width: 64px; height: 60px; border-radius: 16px; }
.st-sheet .st-adj-qty .st-ns button .i { width: 24px; height: 24px; }
.st-sheet .st-adj-qty .st-ns-in { width: 96px; height: 48px; font-size: 32px; }
.st-sheet .st-adj-preview { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px;
                            font-size: 14.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-sheet .st-adj-preview .i { width: 16px; height: 16px; color: var(--faint); }
.st-sheet .st-adj-preview b { color: var(--ink); font-weight: 650; }
.st-sheet .st-adj-preview b.neg { color: var(--bad); }
.st-sheet .st-fstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.st-sheet .st-fstat { display: grid; gap: 4px; padding: 12px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); }
.st-sheet .st-fstat .v { font: 700 24px/1 var(--f-num); color: var(--t, var(--ink)); font-variant-numeric: tabular-nums; }
.st-sheet .st-fstat .l { font-size: 12px; font-weight: 600; color: var(--muted); }
.st-sheet .st-flist .row + .row::before { left: 56px; }
.st-sheet .st-flist .sub { white-space: normal; overflow: visible; text-overflow: clip; }
.st-sheet .st-fdelta { font: 650 15px/1 var(--f-num); white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-sheet .st-fdelta.neg { color: var(--bad); }
.st-sheet .st-fdelta.pos { color: var(--ok); }
.st-sheet .st-fnone { margin-top: 8px; }
