/* stockroom -- shell + component kit. Phone first (375-430 px), then a
   left rail and wider grids from 900 px. Views add their own
   views/<view>.css and compose these classes; they don't restyle them. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; overflow-x: clip; }   /* clip, not hidden: hidden kills position:sticky */
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.4 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--brand); text-decoration: none; }
[hidden] { display: none !important; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
     stroke-linecap: round; stroke-linejoin: round; }
.i.fill { fill: currentColor; stroke: none; }
.num, .money { font-variant-numeric: tabular-nums; }
.rounded { font-family: var(--f-num); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell -- */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 10px) var(--gutter) 10px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  display: flex; align-items: center; gap: 6px; min-height: 56px;
}
.topbar.scrolled { box-shadow: 0 1px 0 var(--line); }
.topbar .back { margin-left: -10px; }
.topbar h1 { margin: 0; font: 700 30px/1.1 var(--f-ui); letter-spacing: -.025em; flex: 1; min-width: 0;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar.small h1 { font-size: 19px; letter-spacing: -.01em; }
.topbar .top-actions { display: flex; gap: 4px; align-items: center; }
.view { padding: 2px var(--gutter) 24px; max-width: 1120px; margin: 0 auto; }
.view-sub { color: var(--muted); font-size: 14px; margin: -4px 2px 12px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);
  backdrop-filter: saturate(1.8) blur(18px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(6, 1fr);
}
/* phone: five tabs + More; the rail (>= 900 px) lists every destination.
   Scoped under .tabbar so these beat the plain .tab rule below. */
.tabbar .tab-extra, .tabbar .tab-sep { display: none; }
.tab-more .i { stroke-width: 2.4; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
       font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: var(--faint); position: relative; }
.tab .i { width: 25px; height: 25px; stroke-width: 1.7; }
.tab[aria-current="page"] { color: var(--brand); }
.tab[aria-current="page"] .i { stroke-width: 2; }
.tab .badge { position: absolute; top: 5px; left: calc(50% + 6px); }
.brand-mark { display: none; }

.fab {
  position: fixed; z-index: 31; right: var(--gutter);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(23, 24, 28, .28), 0 1px 0 rgba(255, 255, 255, .12) inset;
  transition: transform .15s var(--ease);
}
.fab .i { width: 26px; height: 26px; }
.fab:active { transform: scale(.94); }
.fab .badge { position: absolute; top: 2px; right: 2px; }

@media (min-width: 900px) {
  .app { padding-left: var(--rail-w); padding-bottom: 40px; }
  .tabbar {
    top: 0; right: auto; width: var(--rail-w); height: auto; padding: 18px 0 0;
    grid-template-columns: 1fr; grid-auto-rows: 72px; align-content: start;
    border-top: 0; border-right: 1px solid var(--line); background: rgba(255, 255, 255, .7);
  }
  .brand-mark { display: grid; place-items: center; height: 64px; margin-bottom: 8px; }
  .tab { font-size: 11px; border-radius: 14px; margin: 0 10px; }
  .tab:hover { background: var(--paper-2); }
  .tabbar .tab-extra { display: flex; }
  .tabbar .tab-more { display: none; }
  .tabbar .tab-sep { display: block; height: 1px; background: var(--line); margin: 10px 22px; align-self: center; }
  .fab { bottom: 28px; right: 28px; }
  .topbar { padding-top: 22px; }
}

/* ----------------------------------------------------------- sections -- */
.section { margin-top: 24px; }
.section:first-child { margin-top: 6px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 9px; min-height: 22px; }
.sec-head h2 { margin: 0; flex: 1; font: 650 13px/1.2 var(--f-ui); letter-spacing: .06em;
               text-transform: uppercase; color: var(--muted); }
.sec-head .link { font-size: 14.5px; font-weight: 600; color: var(--brand); display: inline-flex; align-items: center; gap: 2px; }
.sec-head .link .i { width: 16px; height: 16px; }

/* ---------------------------------------------------------- cards/list -- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); }
.card.pad { padding: 16px; }
.card.tap { transition: transform .12s var(--ease); }
.card.tap:active { transform: scale(.985); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 900px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .grid-4-wide { grid-template-columns: repeat(4, 1fr); }
}

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 58px; position: relative;
       width: 100%; text-align: left; color: inherit; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 62px; border-top: 1px solid var(--line); }
.list.flat .row + .row::before { left: 14px; }
button.row:active, a.row:active, .row.tap:active { background: var(--paper); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-size: 15.5px; font-weight: 600; letter-spacing: -.005em; line-height: 1.25;
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .trail { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.row .trail .v { font: 650 16px/1.2 var(--f-num); }
.row .trail .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .chev { color: var(--line-2); width: 18px; height: 18px; margin-right: -4px; }
.row .gauge { margin-top: 7px; }

/* ----------------------------------------------------------- avatars -- */
.av { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
      background: var(--hb, var(--paper-2)); color: var(--hf, var(--ink-2)); font: 700 13.5px/1 var(--f-ui); letter-spacing: .02em; }
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }
.glyph { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
         background: var(--hb, var(--paper-2)); color: var(--hf, var(--ink-2)); }
.glyph .i { width: 21px; height: 21px; }
.glyph.sm { width: 30px; height: 30px; border-radius: 9px; }
.glyph.sm .i { width: 17px; height: 17px; }
.glyph.lg { width: 52px; height: 52px; border-radius: 15px; }
.glyph.lg .i { width: 28px; height: 28px; }

/* --------------------------------------------------------------- kpis -- */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1);
       padding: 14px 14px 13px; min-width: 0; }
.kpi .label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .value { font: 700 27px/1.05 var(--f-num); letter-spacing: -.02em; margin-top: 7px; font-variant-numeric: tabular-nums;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value.xl { font-size: 40px; }
.kpi .foot { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font: 650 12.5px/1 var(--f-ui); display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.delta .i { width: 13px; height: 13px; stroke-width: 2.4; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }
.big-num { font: 700 44px/1 var(--f-num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- gauges -- */
/* bar: a track that fills. --fill is set inline (0-100%). tone-* colours it. */
.bar { position: relative; height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.bar.thin { height: 5px; }
.bar.thick { height: 12px; }
.bar > .fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: inherit;
               background: var(--t, var(--brand)); transition: width .6s var(--ease); }
.bar > .fill.soft { background: var(--tm, var(--brand-mid)); }
.bar > .hatch { position: absolute; top: 0; bottom: 0; width: 0; transition: width .6s var(--ease), left .6s var(--ease);
                background: repeating-linear-gradient(135deg, var(--info) 0 2.5px, transparent 2.5px 5.5px); opacity: .6; }
.bar > .tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); opacity: .35; }
.bar-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 5px;
              font-variant-numeric: tabular-nums; }

/* ring: an SVG gauge from ui.js ring(); the arc animates in */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--paper-2); fill: none; }
.ring .arc { stroke: var(--t, var(--brand)); fill: none; stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .center .v { font: 700 20px/1 var(--f-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring .center .l { font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 600; }

/* spark: an inline SVG area chart from ui.js spark() */
.spark { display: block; width: 100%; overflow: visible; }
.spark .area { fill: var(--tt, var(--brand-tint)); }
.spark .line { fill: none; stroke: var(--t, var(--brand)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: var(--t, var(--brand)); }

/* hbar list: label, a bar that fills, a value -- for rankings */
.hbars { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.hbar .top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.hbar .name { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .val { font: 650 14.5px/1 var(--f-num); font-variant-numeric: tabular-nums; }
.hbar .meta { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* -------------------------------------------------------------- pills -- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px;
        font: 650 11.5px/1 var(--f-ui); letter-spacing: .01em; white-space: nowrap;
        background: var(--tt, var(--paper-2)); color: var(--t, var(--ink-2)); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.solid { background: var(--t); color: #fff; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff;
         font: 700 11px/18px var(--f-ui); text-align: center; box-shadow: 0 0 0 2px #fff; }
.badge.brand { background: var(--brand); }

/* ------------------------------------------------------------ buttons -- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 16px;
       border-radius: 12px; font: 600 15.5px/1 var(--f-ui); letter-spacing: -.005em; white-space: nowrap;
       background: var(--card); color: var(--ink); border: 1px solid var(--line-2);
       transition: transform .1s var(--ease), background .15s; user-select: none; -webkit-user-select: none; }
.btn .i { width: 19px; height: 19px; }
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: transparent;
               box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 4px 14px rgba(42, 69, 201, .28); }
.btn.primary:active { background: var(--brand-ink); }
.btn.ink { background: var(--ink); color: #fff; border-color: transparent; }
.btn.soft { background: var(--tt, var(--brand-tint)); color: var(--t, var(--brand)); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 0 10px; }
.btn.danger { color: var(--bad); }
.btn.lg { height: 54px; font-size: 17px; border-radius: 15px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; gap: 5px; }
.btn.sm .i { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn.busy { color: transparent !important; position: relative; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
                   border: 2.2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn:not(.primary):not(.ink).busy::after { border-color: var(--line-2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--ink-2);
            flex: none; position: relative; }
.icon-btn::before { content: ""; position: absolute; inset: -2px; }  /* 44px hit area */
.icon-btn:active { background: var(--paper-2); }
.icon-btn .i { width: 22px; height: 22px; }
.icon-btn.round { border-radius: 50%; background: var(--card); border: 1px solid var(--line); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

/* quick actions: big tinted tiles */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px 10px;
                border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh-1);
                font: 600 12.5px/1.1 var(--f-ui); color: var(--ink-2); transition: transform .12s var(--ease); }
.quick button:active { transform: scale(.96); }
.quick .glyph { width: 44px; height: 44px; border-radius: 14px; background: var(--tt); color: var(--t); }
.quick .glyph .i { width: 23px; height: 23px; }
.quick button.hero { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(42, 69, 201, .3); }
.quick button.hero .glyph { background: rgba(255, 255, 255, .16); color: #fff; }

/* ------------------------------------------------------------ chips/seg -- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter));
                padding: 2px var(--gutter) 4px; scroll-padding: var(--gutter); }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; flex: none;
        border-radius: 99px; background: var(--card); border: 1px solid var(--line-2);
        font: 600 14.5px/1 var(--f-ui); color: var(--ink); white-space: nowrap; transition: transform .1s var(--ease); }
.chip:active { transform: scale(.96); }
.chip .i { width: 17px; height: 17px; }
.chip .n { font-family: var(--f-num); color: var(--muted); font-weight: 650; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .7); }
.chip.sm { height: 32px; padding: 0 11px; font-size: 13.5px; }
.chip.tinted { background: var(--hb); color: var(--hf); border-color: transparent; }
.chip .av, .chip .glyph { margin-left: -8px; }

.seg { display: flex; background: var(--paper-2); border-radius: 11px; padding: 2px; gap: 2px; }
.seg button { flex: 1; height: 34px; border-radius: 9px; font: 600 13.5px/1 var(--f-ui); color: var(--ink-2); white-space: nowrap; padding: 0 8px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 24, 28, .12), 0 0 0 .5px rgba(23, 24, 28, .05); }

/* -------------------------------------------------------------- forms -- */
.field { display: block; margin-top: 14px; }
.field > .lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
                font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 2px 6px; }
.input, .select, .textarea {
  width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card);
  padding: 0 14px; font: 400 16px/1.3 var(--f-ui); color: var(--ink); outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 104px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
          background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.input-group { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); height: 48px; overflow: hidden; }
.input-group:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.input-group .input { border: 0; box-shadow: none !important; height: 100%; }
.input-group .affix { padding: 0 12px; color: var(--muted); font-weight: 600; font-size: 15px; white-space: nowrap; }
.input-group .affix:first-child { padding-right: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { position: relative; }
.search .i { position: absolute; left: 13px; top: 50%; margin-top: -10px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 40px; background: var(--paper-2); border-color: transparent; height: 44px; }
.search .input:focus { background: var(--card); }
.search .clear { position: absolute; right: 2px; top: 2px; }

/* stepper: - n + */
.stepper { display: inline-flex; align-items: center; height: 44px; border-radius: 12px; background: var(--paper-2); flex: none; }
.stepper button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-2); border-radius: 12px; }
.stepper button:active { background: var(--paper-3); }
.stepper .n { min-width: 36px; text-align: center; font: 700 18px/1 var(--f-num); font-variant-numeric: tabular-nums; }
.stepper.sm { height: 34px; border-radius: 10px; }
.stepper.sm button { width: 34px; height: 34px; }
.stepper.sm .n { font-size: 15px; min-width: 26px; }

/* qty pad: big number keys for "how many" */
.qtypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qtypad button { height: 66px; border-radius: 16px; background: var(--paper-2); display: flex; flex-direction: column;
                 align-items: center; justify-content: center; gap: 2px; transition: transform .1s var(--ease), background .15s; }
.qtypad button .k { font: 700 28px/1 var(--f-num); }
.qtypad button .u { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.qtypad button:active { transform: scale(.95); background: var(--brand); color: #fff; }
.qtypad button:active .u { color: rgba(255, 255, 255, .8); }

/* tiles: large choice cards (variants, styles) */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { text-align: left; padding: 13px 14px; min-height: 86px; border-radius: 16px; background: var(--card);
        border: 1.5px solid var(--line); box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 4px;
        transition: transform .1s var(--ease), border-color .15s; position: relative; }
.tile:active { transform: scale(.97); border-color: var(--brand); }
.tile[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); }
.tile .big { font: 700 21px/1.1 var(--f-num); letter-spacing: -.015em; }
.tile .small { font-size: 12.5px; color: var(--muted); }
.tile .corner { position: absolute; top: 10px; right: 10px; }
.tile.add { border-style: dashed; border-color: var(--line-2); box-shadow: none; background: transparent; color: var(--brand);
            align-items: center; justify-content: center; flex-direction: row; font-weight: 600; }

/* ------------------------------------------------------------- sheets -- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(17, 18, 22, .34); opacity: 0; transition: opacity .22s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - var(--safe-t) - 18px);
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--sh-3);
  display: flex; flex-direction: column; transform: translateY(104%); transition: transform .3s var(--ease);
  outline: none;
}
.sheet.open { transform: translateY(0); }
.sheet.tall { height: calc(100dvh - var(--safe-t) - 18px); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px 18px; flex: none; min-height: 52px; touch-action: none; }
.sheet-head h3 { margin: 0; flex: 1; min-width: 0; font: 700 19px/1.2 var(--f-ui); letter-spacing: -.015em;
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head .step-back { margin-left: -10px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 2px 16px 18px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 10px 16px calc(12px + var(--safe-b));
              border-top: 1px solid var(--line); background: var(--card); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn.lg.primary { flex: 2; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 92vw); max-height: 86vh;
           border-radius: 22px; opacity: 0; transform: translate(-50%, -47%) scale(.98);
           transition: transform .24s var(--ease), opacity .2s; }
  .sheet.open { opacity: 1; transform: translate(-50%, -50%); }
  .sheet.tall { height: 86vh; }
  .sheet .grab { display: none; }
  .sheet-head { padding-top: 12px; }
  .sheet-foot { padding-bottom: 14px; border-radius: 0 0 22px 22px; }
}
body.sheet-open { overflow: hidden; }

/* -------------------------------------------------------------- toast -- */
.toasts { position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
          display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 var(--gutter); }
/* a sheet covers the bottom of the screen (sheet-foot buttons, fields); while
   one's open, toasts float to the top instead -- still above the scrim/sheet
   by z-index, just clear of what a sheet is showing */
body.sheet-open .toasts { top: calc(var(--safe-t) + 10px); bottom: auto; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: max-content;
         background: var(--ink); color: #fff; border-radius: 14px; padding: 11px 12px 11px 15px;
         box-shadow: 0 8px 28px rgba(0, 0, 0, .22); font-size: 14.5px; font-weight: 500;
         animation: toast-in .28s var(--ease); }
.toast .i { width: 19px; height: 19px; color: #7EE0AE; }
.toast.err .i { color: #FF9A92; }
.toast button { color: #A9BAFF; font-weight: 700; padding: 6px 4px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (min-width: 900px) { .toasts { bottom: 28px; padding-left: var(--rail-w); } }

/* ------------------------------------------------------------- misc -- */
.empty { text-align: center; padding: 30px 16px; color: var(--muted); font-size: 14.5px; display: grid; justify-items: center; gap: 10px; }
.empty .i { width: 30px; height: 30px; color: var(--faint); }
.empty .btn { margin-top: 4px; }
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--paper-2) 0%, #F1EEE8 50%, var(--paper-2) 100%);
        background-size: 200% 100%; animation: skel 1.3s ease-in-out infinite; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.note-text { white-space: pre-wrap; font-size: 14.5px; color: var(--ink-2); }

/* timeline: a stamped event list */
.timeline { position: relative; margin: 0; padding: 0 0 0 20px; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 1px; }
.timeline li { position: relative; padding: 4px 0 12px; }
.timeline li::before { content: ""; position: absolute; left: -19px; top: 9px; width: 10px; height: 10px; border-radius: 50%;
                       background: var(--card); border: 2.5px solid var(--t, var(--line-2)); }
.timeline .t-title { font-weight: 600; font-size: 14.5px; }
.timeline .t-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* the line tray used by receive / order / purchase flows (pickers.js) */
.tray { display: grid; gap: 8px; }
.tray-line { display: grid; gap: 10px; padding: 11px 12px; border-radius: 14px;
             background: var(--paper); border: 1px solid var(--line); animation: pop-in .25s var(--ease); }
.tray-line .tl-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tray-line .main { flex: 1; min-width: 0; }
.tray-line .title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-line .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                  font-variant-numeric: tabular-nums; }
.tray-line .tl-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tray-line .tl-money { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border-radius: 10px;
                       background: var(--card); border: 1px solid var(--line-2); color: var(--muted); font-size: 14px; font-weight: 600; }
.tray-line .tl-money:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.tray-line .money-in { width: 76px; border: 0; outline: none; background: none; font: 600 16px/1 var(--f-num); color: var(--ink);
                       text-align: right; padding: 0; }
.tray-total { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 4px 0; font-weight: 600; }
.tray-total .v { font: 700 20px/1 var(--f-num); font-variant-numeric: tabular-nums; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }

.step-dots { display: flex; gap: 5px; justify-content: center; margin: 2px 0 10px; }
.step-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); transition: all .2s; }
.step-dots span.on { width: 18px; border-radius: 3px; background: var(--brand); }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(380px, 100%); padding: 28px 22px 22px; text-align: center; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--brand); color: #fff; display: grid; place-items: center;
               box-shadow: 0 8px 24px rgba(42, 69, 201, .3); }
.login .logo .i { width: 34px; height: 34px; }
.login h1 { font: 700 24px/1.2 var(--f-ui); letter-spacing: -.02em; margin: 0 0 18px; }
.login .err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
