/* SAASYA MEN COCKPIT v2 · component kit · Picasso · 14 Oct 2026
   Needs tokens.css first. Class names are the contract (CONTRACT.txt).
   Colour modifiers (.c-*, .tile--*, .chip--*) only set --c / --c-ink / --c-tint / --c-dim. */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: var(--w-regular) var(--fs-15)/var(--lh) var(--font);
  font-feature-settings: var(--font-features); font-optical-sizing: auto;
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: var(--track-head); font-weight: var(--w-semi); line-height: var(--lh-tight); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--gold-tint); }
.num, .money { font-feature-settings: var(--num); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: -60px; z-index: var(--z-toast); background: var(--gold-fill); color: var(--on-gold); padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); }
.skip:focus { top: var(--s-4); }

/* icons: <svg class="i"><use href="design/icons.svg#i-search"/></svg> */
.i {
  width: var(--icon); height: var(--icon); flex: none;
  fill: none; stroke: currentColor; stroke-width: var(--icon-stroke);
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle;
}
.i--sm { width: var(--icon-sm); height: var(--icon-sm); }
.i--lg { width: var(--icon-lg); height: var(--icon-lg); }

/* ---------- colour modifiers (one system for tiles, chips, rings, charts) ---------- */
.c-green,  .tile--green,  .chip--green  { --c: var(--green);  --c-ink: var(--green-ink);  --c-tint: var(--green-tint);  --c-dim: var(--green-dim); }
.c-blue,   .tile--blue,   .chip--blue   { --c: var(--blue);   --c-ink: var(--blue-ink);   --c-tint: var(--blue-tint);   --c-dim: var(--blue-dim); }
.c-red,    .tile--red,    .chip--red    { --c: var(--red);    --c-ink: var(--red-ink);    --c-tint: var(--red-tint);    --c-dim: var(--red-dim); }
.c-purple, .tile--purple, .chip--purple { --c: var(--purple); --c-ink: var(--purple-ink); --c-tint: var(--purple-tint); --c-dim: var(--purple-dim); }
.c-orange, .tile--orange, .chip--orange { --c: var(--orange); --c-ink: var(--orange-ink); --c-tint: var(--orange-tint); --c-dim: var(--orange-dim); }
.c-grey,   .tile--grey,   .chip--grey   { --c: var(--grey);   --c-ink: var(--grey-ink);   --c-tint: var(--grey-tint);   --c-dim: var(--line-2); }
.c-gold,   .tile--gold,   .chip--gold   { --c: var(--gold);   --c-ink: var(--gold-ink);   --c-tint: var(--gold-tint);   --c-dim: var(--gold-tint); }

/* ---------- app shell ---------- */
.app {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100dvh;
  transition: grid-template-columns var(--d-ui) var(--ease-in-out);
}
.app[data-sidebar="rail"] { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: var(--s-6) var(--s-8) var(--s-16); flex: 1; min-width: 0; }

/* sidebar */
.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: var(--z-side);
  display: flex; flex-direction: column; gap: var(--s-1);
  background: var(--bg-side); border-right: 1px solid var(--line);
  padding: var(--s-3) var(--s-3) var(--s-4); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.sb-head { display: flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-1) 0 var(--s-2); margin-bottom: var(--s-3); }
.sb-brand { display: flex; align-items: center; min-height: var(--h-nav); gap: 8px; min-width: 0; flex: 1; }
.sb-brand img { width: 24px; height: 24px; flex: none; }
.sb-brand b { font-weight: var(--w-semi); font-size: var(--fs-13); letter-spacing: .22em; text-transform: uppercase; color: var(--gold-ink); white-space: nowrap; }
.sb-collapse { margin-left: auto; }
.sb-label {
  display: flex; align-items: center; height: 26px; padding: 0 var(--s-3); margin-top: var(--s-3);
  font-size: var(--fs-13); color: var(--ink-3); font-weight: var(--w-medium); white-space: nowrap;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
/* the foot follows the sections directly (no gap), and on a short screen the whole sidebar scrolls as one,
   so an opened section is never squeezed into a tiny box behind History */
.sidebar .nav, .sidebar .sb-foot { flex: none; }
/* a section with two or more screens: a heading that opens and closes them */
.nav-head {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  height: var(--h-nav); padding: 0 var(--s-3); border: 0; border-radius: var(--r-sm); background: none;
  color: var(--ink-2); font: inherit; font-size: var(--fs-15); white-space: nowrap; text-align: left; cursor: pointer;
  transition: background-color var(--d-micro), color var(--d-micro);
}
.nav-head:hover { background: var(--hover); color: var(--ink); }
.nav-head .i:last-child { margin-left: auto; color: var(--ink-3); transition: transform var(--d-micro); }
.nav-head[aria-expanded="false"] .i:last-child { transform: rotate(-90deg); }
.nav-items { display: flex; flex-direction: column; gap: 2px; padding-left: var(--s-4); }
.nav-items[hidden] { display: none; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: var(--s-3);
  height: var(--h-nav); padding: 0 var(--s-3); border-radius: var(--r-sm);
  color: var(--ink-2); font-size: var(--fs-15); white-space: nowrap;
  transition: background-color var(--d-micro), color var(--d-micro);
}
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item[aria-current="page"], .nav-item.is-active { background: var(--gold-tint); color: var(--ink); font-weight: var(--w-medium); }
.nav-item[aria-current="page"] .i, .nav-item.is-active .i { color: var(--gold-ink); }
.nav-item .nav-count { margin-left: auto; }
.nav-text { transition: opacity var(--d-micro); }
.sb-foot { margin-top: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.sb-user { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 var(--s-2); border-radius: var(--r-sm); white-space: nowrap; }
.sb-user:hover { background: var(--hover); }
.sb-user .who { min-width: 0; line-height: 1.25; }
.sb-user .who b { display: block; font-weight: var(--w-medium); font-size: var(--fs-14); }
.sb-user .who span { font-size: var(--fs-13); color: var(--ink-3); }

/* rail state: icons only, words become tooltips (aria-label stays on the link) */
.app[data-sidebar="rail"] .nav-text,
.app[data-sidebar="rail"] .sb-label span,
.app[data-sidebar="rail"] .sb-brand b,
.app[data-sidebar="rail"] .nav-count,
.app[data-sidebar="rail"] .sb-user .who,
.app[data-sidebar="rail"] .theme-switch .ts-word { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.app[data-sidebar="rail"] .sb-label { height: 8px; margin-top: var(--s-2); }
.app[data-sidebar="rail"] .sb-head { flex-direction: column; height: auto; gap: var(--s-2); padding: 0; }
.app[data-sidebar="rail"] .sb-collapse { margin: 0; }
.app[data-sidebar="rail"] .nav-item, .app[data-sidebar="rail"] .sb-user { justify-content: center; padding: 0; gap: 0; }
.app[data-sidebar="rail"] .theme-switch { justify-content: center; padding: 0; gap: 0; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--s-3);
  height: var(--top-h); padding: 0 var(--s-8);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.tb-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-16); font-weight: var(--w-medium); white-space: nowrap; min-width: 0; }
.tb-title .i { color: var(--ink-2); }
.tb-mark { display: none; width: 24px; height: 24px; }
.tb-search {
  margin-left: auto; display: flex; align-items: center; gap: var(--s-2);
  width: min(320px, 32vw); height: var(--h-ctl); padding: 0 var(--s-3);
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink-3);
}
.tb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font-size: var(--fs-14); }
.tb-search input::placeholder { color: var(--ink-3); }
.tb-search:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px var(--gold-tint); }
.kbd { font-size: var(--fs-12); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: var(--r-xs); color: var(--ink-3); }
.tb-actions { display: flex; align-items: center; gap: var(--s-2); }
.dot-badge { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); margin-bottom: var(--s-5); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-22); }
.page-head p { color: var(--ink-2); margin-top: var(--s-1); }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--h-ctl); padding: 0 var(--s-4); border-radius: var(--r-sm);
  font-size: var(--fs-14); font-weight: var(--w-medium); white-space: nowrap; user-select: none;
  border: 1px solid transparent; touch-action: manipulation;
  transition: background-color var(--d-micro), border-color var(--d-micro), color var(--d-micro), scale var(--d-micro) var(--ease-out), box-shadow var(--d-micro);
}
.btn:active { scale: .97; }
.btn--primary { background: var(--gold-fill); color: var(--on-gold); }
.btn--primary:hover { background: color-mix(in srgb, var(--gold-fill) 88%, var(--ink)); }
.btn--outline { background: var(--card); border-color: var(--line-2); color: var(--ink); box-shadow: var(--shadow-1); }
.btn--outline:hover { background: var(--card-2); }
.btn--ghost { color: var(--ink-2); }
.btn--ghost:hover { background: var(--hover); color: var(--ink); }
.btn--danger { background: var(--red-tint); color: var(--red-ink); }
.btn--danger:hover { background: color-mix(in srgb, var(--red) 24%, transparent); }
.btn--link { min-height: var(--h-ctl); padding: 0; color: var(--gold-ink); font-weight: var(--w-semi); }
.btn--icon { width: var(--h-ctl); padding: 0; color: var(--ink-2); }
.btn--icon:hover { background: var(--hover); color: var(--ink); }
.btn--sm { min-height: var(--h-ctl-sm) !important; padding: 0 8px; font-size: var(--fs-13); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; scale: 1; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--on-gold); border-right-color: transparent; animation: sk-spin .7s linear infinite;
}
.btn--outline.is-busy::after, .btn--ghost.is-busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes sk-spin { to { rotate: 360deg; } }

/* ---------- chips, avatars, rings ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: var(--r-full); font-size: var(--fs-13); font-weight: var(--w-medium); white-space: nowrap;
  background: var(--c-tint, var(--grey-tint)); color: var(--c-ink, var(--ink-2));
  font-feature-settings: var(--num);
}
.chip .i { width: 12px; height: 12px; stroke-width: 2; }
.chip--up   { --c-tint: var(--green-tint); --c-ink: var(--green-ink); }
.chip--down { --c-tint: var(--red-tint);   --c-ink: var(--red-ink); }
.chip--count { height: 18px; min-width: 18px; padding: 0 6px; justify-content: center; background: var(--grey-tint); color: var(--ink-2); }
.chip--outline { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.chip--lg { height: 24px; padding: 0 10px; font-size: var(--fs-14); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: var(--avatar); height: var(--avatar); border-radius: 50%;
  background: var(--card-2); border: 1px solid var(--line); color: var(--ink-2);
  font-size: var(--fs-meta); font-weight: var(--w-semi); letter-spacing: .02em;
}
.avatar--lg { width: var(--avatar-lg); height: var(--avatar-lg); font-size: var(--fs-13); }
.avatar--gold { background: var(--gold-tint); color: var(--gold-ink); border-color: transparent; }

/* stage ring: <span class="ring ring--dot c-orange"></span> */
.ring { --c: var(--grey); position: relative; display: inline-block; flex: none; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--c); }
.ring--dashed { border-style: dashed; border-color: var(--ink-3); }
.ring--dot::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--c); }
.ring--half { background: conic-gradient(var(--c) 0 50%, transparent 0); background-clip: content-box; padding: 2px; }
.ring--done { background: var(--c); }
.ring--done::after { content: ""; position: absolute; left: 3.5px; top: 1.2px; width: 3px; height: 5.8px; border: solid var(--bg); border-width: 0 1.5px 1.5px 0; rotate: 45deg; }

/* ---------- PIPELINE BOARD (v2.2, 15 Oct: Attio reference, IMAGE 1) ---------- */
/* stage colour + ring style by data attribute: <span class="ring" data-stage="trial"></span>.
   [data-stage] on .col also colours the drop target. Progression reads left to right:
   dashed > ring > ring with dot > half > filled. */
[data-stage="stylist"]      { --c: var(--grey); }
[data-stage="shown"]        { --c: var(--blue); }
[data-stage="quotation"]    { --c: var(--orange); }
[data-stage="advance"]      { --c: var(--purple); }
[data-stage="measurements"] { --c: var(--blue); }
[data-stage="operations"]   { --c: var(--orange); }
[data-stage="trial"]        { --c: var(--purple); }
[data-stage="alteration"]   { --c: var(--red); }
[data-stage="ready"]        { --c: var(--green); }
[data-stage="delivered"]    { --c: var(--green); }
[data-stage="lost"]         { --c: var(--grey); }
.ring[data-stage="stylist"] { border-style: dashed; border-color: var(--ink-3); }
.ring:is([data-stage="advance"], [data-stage="measurements"], [data-stage="alteration"])::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--c); }
.ring:is([data-stage="operations"], [data-stage="trial"], [data-stage="ready"]) { background: conic-gradient(var(--c) 0 50%, transparent 0); background-clip: content-box; padding: 2px; }
.ring[data-stage="delivered"] { background: var(--c); }
.ring[data-stage="delivered"]::after { content: ""; position: absolute; left: 3.5px; top: 1.2px; width: 3px; height: 5.8px; border: solid var(--bg); border-width: 0 1.5px 1.5px 0; rotate: 45deg; }
.ring[data-stage="lost"] { background: var(--c); }
.ring[data-stage="lost"]::after { content: ""; position: absolute; left: 2.5px; right: 2.5px; top: 50%; height: 1.5px; margin-top: -.75px; background: var(--bg); border-radius: 1px; }

.board {
  --board-gap: 14px;
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--col-w); gap: var(--board-gap);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: 2px;
  height: var(--board-h, calc(100dvh - 190px)); min-height: 360px;
  padding-bottom: var(--s-3); align-items: stretch; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; scroll-snap-align: start; border-radius: var(--r-md); transition: background-color var(--d-micro), box-shadow var(--d-micro); }
.col-head { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 var(--s-1) 0 var(--s-2); flex: none; }
.col-name { font-weight: var(--w-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-add { margin-left: auto; width: var(--h-ctl-sm); height: var(--h-ctl-sm); min-height: var(--h-ctl-sm); }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: var(--s-1) 2px var(--s-2); overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: none; }
.col-foot {
  display: flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-2); flex: none;
  color: var(--ink-2); font-size: var(--fs-small); font-feature-settings: var(--num); border-top: 1px solid var(--line);
}
.col-foot .i { color: var(--ink-3); }
.col-foot b { color: var(--ink); font-weight: var(--w-medium); }
/* empty: quiet words only, no box shouting */
.col-empty { padding: var(--s-5) var(--s-3); text-align: center; color: var(--ink-3); font-size: var(--fs-small); border: 1px dashed var(--line); border-radius: var(--r-md); }
/* drop target while a card is dragged over the column */
.col.is-drop { background: color-mix(in srgb, var(--c, var(--gold)) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--gold)) 45%, transparent); }
.col.is-drop .col-empty { border-color: color-mix(in srgb, var(--c, var(--gold)) 45%, transparent); color: var(--ink-2); }

/* card: <article class="card-opp"> with a stretched title link, so the kebab can be a real button */
.card-opp {
  position: relative; display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; flex: none;
  padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); cursor: pointer;
  transition: translate var(--d-micro) var(--ease-out), box-shadow var(--d-micro), border-color var(--d-micro), opacity var(--d-micro);
}
.card-opp[draggable="true"] { cursor: grab; }
.card-opp:hover { translate: 0 var(--lift); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.card-opp:active { translate: 0 0; }
.card-opp:focus-within { border-color: var(--line-2); }
.card-opp[aria-grabbed="true"], .card-opp.is-dragging { cursor: grabbing; rotate: 1.5deg; translate: 0 var(--lift); box-shadow: var(--shadow-3); border-color: var(--ring); }
/* the gap it leaves behind */
.card-opp.is-ghost { background: transparent; box-shadow: none; border: 1px dashed var(--line-2); translate: none; }
.card-opp.is-ghost > * { visibility: hidden; }
.co-title { padding-right: 22px; font-weight: var(--w-medium); color: var(--ink); line-height: var(--lh-snug); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.co-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }  /* whole card opens the order */
.co-title:focus-visible { outline: 0; }
.co-title:focus-visible::after { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-md); }
.co-menu { position: absolute; z-index: 1; top: 8px; right: 6px; width: 24px !important; min-height: 24px !important; height: 24px; border-radius: var(--r-xs); opacity: 0; transition: opacity var(--d-micro), background-color var(--d-micro); }
.card-opp:hover .co-menu, .co-menu:focus-visible, .co-menu[aria-expanded="true"] { opacity: 1; }
.co-row { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-small); color: var(--ink-2); min-width: 0; }
.co-row .i { color: var(--ink-3); width: var(--icon-sm); height: var(--icon-sm); }
.co-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-value { color: var(--ink); font-feature-settings: var(--num); }
.co-unpriced { color: var(--ink-3); }
.co-late { color: var(--red-ink); }
.co-late .i { color: var(--red-ink); }
.co-owner { color: var(--ink); }
.co-tags { display: flex; gap: 4px; flex-wrap: wrap; }
/* roles without money: the builder omits the figures; this hides any that slip through */
[data-money="off"] :is(.co-money, .col-foot) { display: none !important; }

/* phones: one column at a time, snapping */
@media (max-width: 640px) {
  .board { --col-w: calc(100vw - 56px); scroll-snap-type: x mandatory; scroll-padding-inline: 0; margin-inline: calc(var(--s-4) * -1); padding-inline: var(--s-4); scroll-padding-inline: var(--s-4); }
  .col { scroll-snap-stop: always; }
}
/* touch: the stage menu is always visible and grows to a full target (no hover on phones) */
@media (pointer: coarse) {
  .co-menu { opacity: 1; top: 4px; right: 2px; width: 36px !important; height: 36px; min-height: 36px !important; }
  .co-menu::before { content: ""; position: absolute; inset: -4px; }
}

/* ---------- LIST TABLE (no rules, no header band: interface, not ledger) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-14); }
.table th {
  text-align: left; font-weight: var(--w-medium); color: var(--ink-3); font-size: var(--fs-13);
  height: var(--h-head); padding: 0 var(--s-3); white-space: nowrap;
}
.table td { height: var(--h-row); padding: 0 var(--s-3); white-space: nowrap; }
.table tbody tr { cursor: pointer; }
.table tbody tr td:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.table tbody tr td:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.table tbody tr:hover td { background: var(--hover); }
.table .t-num { text-align: right; font-feature-settings: var(--num); }
.table th[aria-sort] { cursor: pointer; }
.cell-who { display: flex; align-items: center; gap: var(--s-3); }
.cell-who b { display: block; font-weight: var(--w-medium); color: var(--ink); }
.cell-who > div > span { display: block; color: var(--ink-3); font-size: var(--fs-13); }

/* ---------- DASHBOARD ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-5); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

.dcard {
  position: relative; display: flex; flex-direction: column; gap: var(--s-5); min-width: 0;
  padding: var(--s-6); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
  transition: translate var(--d-ui) var(--ease-out), box-shadow var(--d-ui), border-color var(--d-ui);
}
a.dcard:hover, .dcard[data-hover]:hover { translate: 0 var(--lift); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.dcard-head { display: flex; align-items: flex-start; gap: var(--s-3); }
.dcard-head .tile { margin-right: var(--s-1); }
.dcard-title { font-size: var(--fs-18); font-weight: var(--w-semi); letter-spacing: var(--track-head); line-height: var(--lh-tight); }
.dcard-sub { color: var(--ink-2); font-size: var(--fs-14); margin-top: 2px; }
.dcard-menu { margin: -8px -10px 0 auto; }
.dcard-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: auto; }
.dcard-foot b { font-size: var(--fs-18); font-weight: var(--w-semi); font-feature-settings: var(--num); }
.dcard-inset { background: var(--card-2); border-radius: var(--r-lg); padding: var(--s-4); }

/* icon tile: <span class="tile tile--green"><svg class="i"><use href="#i-coin-rupee"/></svg></span> */
.tile {
  display: inline-grid; place-items: center; flex: none; width: var(--tile); height: var(--tile);
  border-radius: 10px; background: var(--c-tint, var(--grey-tint)); color: var(--c-ink, var(--ink-2));
}
.tile .i { width: var(--icon-lg); height: var(--icon-lg); }
.tile--sm { width: var(--tile-sm); height: var(--tile-sm); border-radius: 8px; }
.tile--sm .i { width: var(--icon); height: var(--icon); }

/* stat */
.stat { display: flex; flex-direction: column; gap: var(--s-2); }
.stat-label { color: var(--ink-2); font-size: var(--fs-14); }
.stat-value { font-size: var(--fs-28); font-weight: var(--w-semi); letter-spacing: var(--track-fig); line-height: 1.1; font-feature-settings: var(--num); }
.stat-value--xl { font-size: var(--fs-34); }
.stat-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }

/* earning rows */
.earn { display: flex; flex-direction: column; gap: var(--s-4); }
.earn-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); }
.earn-row b { display: block; font-weight: var(--w-medium); }
.earn-row > div:not(.earn-fig) > span { display: block; font-size: var(--fs-13); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.earn-fig { text-align: right; font-feature-settings: var(--num); }
.earn-fig b { font-weight: var(--w-semi); }
.earn-fig .delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-13); color: var(--c-ink); }

/* monthly bars: .bars > .bar[style="--v:.62"] (> .bar-val, .bar-fill, .bar-x) */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s-3); align-items: end; height: 168px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bar-fill { width: 100%; max-width: 32px; height: calc(var(--v, .5) * (100% - 40px)); min-height: 4px; border-radius: 8px; background: var(--c-dim, var(--green-dim)); transform-origin: bottom; }
.bar.is-best .bar-fill { background: var(--c, var(--green)); }
.bar-val { white-space: nowrap; font-size: var(--fs-12); color: var(--ink-3); font-feature-settings: var(--num); }
.bar.is-best .bar-val { color: var(--ink); font-weight: var(--w-semi); }
.bar-x { font-size: var(--fs-12); color: var(--ink-3); }

/* pill bars (track + fill): .pills > .pill[style="--v:.7"] > .pill-fill */
.pills { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-2); height: 108px; }
.pill { position: relative; flex: 1; max-width: 28px; height: 100%; border-radius: var(--r-full); background: var(--chart-track); overflow: hidden; }
.pill-fill { position: absolute; inset: auto 0 0; height: calc(var(--v, .5) * 100%); border-radius: var(--r-full); background: var(--c, var(--blue)); transform-origin: bottom; }
/* stacked pills: .spills > .spill > .spill-a[style=--v] + .spill-b[style=--v] */
.spills { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-2); height: 108px; }
.spill { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; flex: 1; max-width: 22px; height: 100%; }
.spill-a, .spill-b { height: calc(var(--v, .3) * 100%); border-radius: var(--r-full); transform-origin: bottom; }
.spill-a { background: var(--green); }
.spill-b { background: var(--purple); }

/* line chart: .line-chart (rendered by SaasyaKit.line or hand-written SVG) */
.line-chart { position: relative; height: 116px; }
.line-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.line-chart .lc-grid line { stroke: var(--chart-grid); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.line-chart .lc-path { fill: none; stroke: var(--c, var(--green)); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.line-chart .lc-area { fill: var(--c, var(--green)); opacity: .08; }
.lc-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--c, var(--green)); }
.lc-dot.is-last { background: var(--c, var(--green)); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c, var(--green)) 22%, transparent); }

/* donut: svg.donut viewBox 0 0 120 120, circle.donut-track + circle.donut-arc pathLength=100 style --v:.62 */
.donut-wrap { position: relative; width: 150px; aspect-ratio: 1; margin-inline: auto; }
.donut { width: 100%; height: 100%; rotate: -90deg; }
.donut circle { fill: none; stroke-width: 12; }
.donut-track { stroke: var(--chart-track); }
.donut-arc { stroke: var(--c, var(--red)); stroke-linecap: round; stroke-dasharray: calc(var(--v, .5) * 100) 100; }
.donut-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-label b { font-size: var(--fs-22); font-weight: var(--w-semi); letter-spacing: var(--track-fig); font-feature-settings: var(--num); }
.donut-label span { font-size: var(--fs-13); color: var(--ink-3); }

/* split card: In-house vs Third-party designer */
.split { display: grid; grid-template-columns: 1fr 1px 1fr; gap: var(--s-5); align-items: start; }
.split-rule { align-self: stretch; background: var(--line); }
.split-side { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.split-side .stat-value { font-size: var(--fs-22); }
.meter { height: 8px; border-radius: var(--r-full); background: var(--chart-track); overflow: hidden; display: flex; gap: 3px; }
.meter > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--c); transform-origin: left; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: var(--s-4); font-size: var(--fs-13); color: var(--ink-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* progress: "3 of 7 done today" */
.progress { height: 6px; border-radius: var(--r-full); background: var(--chart-track); overflow: hidden; }
.progress > i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--gold-fill); border-radius: inherit; }

/* ---------- FORMS ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--fs-13); font-weight: var(--w-medium); color: var(--ink-2); }
.field-label .req { color: var(--gold-ink); }
.input, .select, .textarea {
  width: 100%; min-height: var(--h-ctl); padding: 0 var(--s-3);
  background: var(--field-bg); border: 1px solid var(--field-line); border-radius: var(--r-sm); color: var(--ink);
  font-size: var(--fs-15); outline: 0; transition: border-color var(--d-micro), box-shadow var(--d-micro);
}
.textarea { padding: 8px var(--s-3); min-height: 80px; resize: vertical; line-height: var(--lh); }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px var(--gold-tint); }
.input-group { position: relative; }
.input-group > .i, .input-group > .prefix { position: absolute; left: var(--s-3); top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.input-group > .input { padding-left: 32px; }
.input.money { text-align: right; }
.field-hint { font-size: var(--fs-13); color: var(--ink-3); }
.field-error { display: none; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--red-ink); }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--red); }
.field.is-invalid .field-error { display: flex; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.form-grid .full { grid-column: 1 / -1; }

/* segmented control (sliding pill) */
.seg { position: relative; display: inline-flex; padding: 3px; gap: 2px; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; }
.seg button { position: relative; z-index: 1; min-height: 26px; padding: 0 12px; border-radius: 6px; font-size: var(--fs-14); color: var(--ink-2); transition: color var(--d-micro); }
.seg button[aria-pressed="true"] { color: var(--ink); font-weight: var(--w-medium); }
.seg-pill { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 6px; background: var(--seg-pill); box-shadow: var(--shadow-2); border: 1px solid var(--line-2); transition: translate var(--d-ui) var(--ease-out), width var(--d-ui) var(--ease-out); }

/* switch (spring) */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 28px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 32px; height: 18px; border-radius: var(--r-full); background: var(--line-2); transition: background-color var(--d-ui); flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: translate var(--d-ui) cubic-bezier(.34, 1.56, .64, 1); }
.switch input:checked + .switch-track { background: var(--gold-fill); }
.switch input:checked + .switch-track::after { translate: 14px 0; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ring); outline-offset: 2px; }
/* a control that cannot be changed looks it (JOB 9 gate, 16 Oct): the locked Owner row, and every other disabled control */
.switch:has(input:disabled) { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: .45; cursor: not-allowed; }
.select:disabled, select:disabled, .input:disabled { opacity: .45; cursor: not-allowed; }

/* checkbox (drawn tick) */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 28px; }
.check input { appearance: none; margin: 0; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-2); background: var(--card); display: grid; place-items: center; cursor: pointer; transition: background-color var(--d-micro), border-color var(--d-micro); }
.check input::after { content: ""; width: 4px; height: 8px; border: solid var(--on-gold); border-width: 0 2px 2px 0; rotate: 45deg; translate: 0 -1px; scale: 0; transition: scale var(--d-micro) var(--ease-out); }
.check input:checked { background: var(--gold-fill); border-color: var(--gold-fill); }
.check input:checked::after { scale: 1; }

/* ---------- theme switch (sidebar) ---------- */
.theme-switch { display: flex; align-items: center; gap: 8px; min-height: var(--h-nav); padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--fs-14); width: 100%; white-space: nowrap; }
.theme-switch:hover { background: var(--hover); color: var(--ink); }
.ts-track { position: relative; width: 28px; height: 16px; border-radius: var(--r-full); background: var(--card-2); border: 1px solid var(--line-2); flex: none; }
.ts-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold-fill); translate: var(--ts-x) 0; transition: translate var(--d-ui) cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- THEME PICKER: 4 presets (theme.js wires it) ----------
   <div class="theme-pick" role="radiogroup" aria-label="Theme">
     <button type="button" class="tp-opt" role="radio" aria-checked="true" data-theme-set="dark">
       <span class="tp-sw" data-sw="dark"></span><span class="tp-name">Dark</span></button> ... light, ivory, midnight
   </div>
   Add .theme-pick--lg on an account / settings page. In the folded sidebar it becomes a 2 x 2 of swatches. */
.theme-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.tp-opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  padding: 5px 0 4px; border-radius: var(--r-sm); color: var(--ink-3); letter-spacing: -.01em;
  font-size: var(--fs-label); font-weight: var(--w-medium); line-height: 1.2;
  transition: background-color var(--d-micro), color var(--d-micro);
}
.tp-opt:hover { background: var(--hover); color: var(--ink); }
.tp-opt[aria-checked="true"] { color: var(--ink); }
.tp-sw {
  position: relative; display: block; width: 100%; max-width: 40px; height: 20px; border-radius: 6px;
  background: linear-gradient(135deg, var(--sw-a) 0 55%, var(--sw-b) 55% 100%);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: outline-color var(--d-micro);
  outline: 1.5px solid transparent; outline-offset: 2px;
}
.tp-sw::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--sw-g); }
.tp-opt[aria-checked="true"] .tp-sw { outline-color: var(--ring); }
.tp-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-sw[data-sw="dark"]     { --sw-a: var(--sw-dark-bg);     --sw-b: var(--sw-dark-card);     --sw-g: var(--sw-dark-gold); }
.tp-sw[data-sw="light"]    { --sw-a: var(--sw-light-bg);    --sw-b: var(--sw-light-card);    --sw-g: var(--sw-light-gold); }
.tp-sw[data-sw="ivory"]    { --sw-a: var(--sw-ivory-bg);    --sw-b: var(--sw-ivory-card);    --sw-g: var(--sw-ivory-gold); }
.tp-sw[data-sw="midnight"] { --sw-a: var(--sw-midnight-bg); --sw-b: var(--sw-midnight-card); --sw-g: var(--sw-midnight-gold); }
.theme-pick--lg { gap: var(--s-3); max-width: 440px; }
.theme-pick--lg .tp-opt { gap: var(--s-2); padding: var(--s-2); font-size: var(--fs-small); border: 1px solid var(--line); background: var(--card); }
.theme-pick--lg .tp-opt[aria-checked="true"] { border-color: var(--ring); }
.theme-pick--lg .tp-sw { max-width: none; height: 44px; border-radius: 8px; }
.theme-pick--lg .tp-sw::after { width: 10px; height: 10px; right: 7px; bottom: 7px; }
.theme-pick--lg .tp-opt[aria-checked="true"] .tp-sw { outline-color: transparent; }
.app[data-sidebar="rail"] .sidebar .theme-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.app[data-sidebar="rail"] .sidebar .tp-name { display: none; }
.app[data-sidebar="rail"] .sidebar .tp-opt { padding: 4px 1px; }
.app[data-sidebar="rail"] .sidebar .tp-sw { height: 14px; border-radius: 4px; }
.app[data-sidebar="rail"] .sidebar .tp-sw::after { display: none; }

/* ---------- EMPTY STATE ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-10) var(--s-6); }
.empty h3 { font-size: var(--fs-18); }
.empty p { color: var(--ink-2); max-width: 36ch; }
.empty .btn { margin-top: var(--s-2); }

/* ---------- TOAST ---------- */
.toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: var(--s-6); translate: -50% 0; display: flex; flex-direction: column; gap: var(--s-2); width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: var(--s-3); padding: 10px 10px 10px var(--s-4);
  background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  font-size: var(--fs-14);
}
.toast .tile { width: 24px; height: 24px; border-radius: 7px; }
.toast .tile .i { width: var(--icon-sm); height: var(--icon-sm); }
.toast-msg { flex: 1; min-width: 0; }
.toast-undo { color: var(--gold-ink); font-weight: var(--w-semi); padding: 0 var(--s-3); min-height: var(--h-ctl); border-radius: var(--r-sm); }
.toast-undo:hover { background: var(--gold-tint); }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--gold); transform-origin: left; opacity: .7; }

/* ---------- HISTORY PANEL ---------- */
.history { display: flex; flex-direction: column; }
.history-day { font-size: var(--fs-13); color: var(--ink-3); font-weight: var(--w-medium); padding: var(--s-3) 0 var(--s-2); }
.history-item { position: relative; display: grid; grid-template-columns: var(--avatar) minmax(0, 1fr); gap: var(--s-3); padding-bottom: var(--s-4); }
.history-item::before { content: ""; position: absolute; left: 10.5px; top: 26px; bottom: 4px; width: 1px; background: var(--line-2); }
.history-item:last-child::before { display: none; }
.history-item p { font-size: var(--fs-14); line-height: var(--lh-snug); }
.history-item p b { font-weight: var(--w-medium); }
.history-item time { display: block; font-size: var(--fs-13); color: var(--ink-3); margin-top: 2px; }
.history-change { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--fs-13); color: var(--ink-2); flex-wrap: wrap; }
.history-change s { color: var(--ink-3); }

/* ---------- MODAL (native <dialog class="modal">) ---------- */
.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0;
  background: var(--raised); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-3);
}
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal[open] { animation: sk-modal-in var(--d-ui) var(--ease-out); }
.modal[open]::backdrop { animation: sk-fade var(--d-ui) var(--ease-out); }
.modal.is-closing { animation: sk-modal-out var(--d-exit) var(--ease-in) forwards; }
.modal-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-5) 0 var(--s-6); }
.modal-head h2 { font-size: var(--fs-18); }
.modal-head .btn--icon { margin-left: auto; }
.modal-body { padding: var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6) var(--s-6); }
@keyframes sk-modal-in { from { opacity: 0; scale: .96; translate: 0 8px; } }
@keyframes sk-modal-out { to { opacity: 0; scale: .97; } }
@keyframes sk-fade { from { opacity: 0; } }

/* menu (use with the native popover attribute) */
.menu { margin: 0; padding: 4px; min-width: 184px; background: var(--raised); color: var(--ink); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-3); }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 0 8px; border-radius: var(--r-xs); font-size: var(--fs-14); color: var(--ink-2); }
.menu button:hover { background: var(--hover); color: var(--ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- BOTTOM NAV (phones) ---------- */
.bottomnav { display: none; }

/* ---------- motion hooks (motion.js) ---------- */
/* content is visible without JS; only .sk-motion (added by the head snippet) hides before reveal */
.sk-motion [data-enter] > * { opacity: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .span-3 { grid-column: span 6; } .span-4 { grid-column: span 6; } .span-5, .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .app, .app[data-sidebar="rail"] { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--s-4); }
  .tb-mark { display: block; }
  .tb-search { width: auto; flex: 0 1 220px; }
  .page { padding: var(--s-5) var(--s-4) calc(var(--s-16) + 64px); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: var(--z-side); inset: auto 0 0;
    padding: 6px var(--s-2) calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-side) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; border-radius: 10px; font-size: var(--fs-meta); color: var(--ink-3); }
  .bottomnav a[aria-current="page"] { color: var(--gold-ink); }
  .bottomnav a[aria-current="page"] .i { background: var(--gold-tint); }
  .bottomnav .i { width: 36px; height: 24px; padding: 4px 10px; border-radius: var(--r-full); }
}
@media (max-width: 640px) {
  :root { --col-w: 84vw; }
  .tb-search { display: none; }
  .tb-actions { margin-left: auto; }
  .tb-title { font-size: var(--fs-15); }
  .tb-title .i { display: none; }
  .toolbar .btn--primary { display: none; } /* the top bar + does it on phones */
  .dash { gap: var(--s-4); }
  .span-3, .span-4, .span-6 { grid-column: span 12; }
  .dcard { padding: var(--s-5); border-radius: 18px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-rule { height: 1px; }
  .stat-value--xl { font-size: var(--fs-28); }
  .modal { width: calc(100vw - 16px); margin-bottom: 8px; }
  .hide-sm { display: none !important; }
}

/* ===================================================================
   GRC ENTRY v1 (15 Oct 2026). Purchase: a whole Vendor bill typed in one sitting.
   Reference: their ERP Orbit, Goods Receipt Challan (refs/orbit-grc-image4.jpg, orbit-add-item-image11.jpg).
   Dense, keyboard-first. Editable cells carry a soft fill; computed cells have none (muted words).
   =================================================================== */
.grc { display: flex; flex-direction: column; gap: var(--s-4); }
.grc-top { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.grc-top h2 { font-size: var(--fs-card); font-weight: var(--w-semi); letter-spacing: var(--track-head); font-feature-settings: var(--num); }
.grc-top .spacer { flex: 1; }
.grc-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
/* header: 4 columns of compact fields */
.grc-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); padding: var(--s-4); }
.grc-fields .span-2 { grid-column: span 2; }
.grc-pair { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: var(--s-2); }
.grc-fields .input[readonly] { background: transparent; border-style: dashed; color: var(--ink-2); font-feature-settings: var(--num); cursor: default; }
.grc-fields .input[readonly]:focus { box-shadow: none; border-color: var(--line-2); }
/* file drop that sits in the grid like an input */
.drop { position: relative; display: flex; align-items: center; gap: var(--s-2); min-height: var(--h-ctl); padding: 0 var(--s-3); border: 1px dashed var(--line-2); border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--fs-small); cursor: pointer; transition: border-color var(--d-micro), background-color var(--d-micro); }
.drop:hover, .drop.is-over { border-color: var(--ring); background: var(--gold-tint); color: var(--ink); }
.drop:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .i { flex: none; color: var(--ink-3); }
.drop-files { display: flex; flex-wrap: wrap; gap: 4px; }
.drop-file { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 4px 0 8px; border-radius: var(--r-full); background: var(--grey-tint); color: var(--ink); font-size: var(--fs-label); }
.drop-file a { color: var(--gold-ink); font-weight: var(--w-medium); padding: 0 4px; }

/* lines card: toolbar, grid, totals */
.grc-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.grc-bar .spacer { flex: 1; }
.grc-note { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: var(--fs-label); }
.lg-wrap { position: relative; overflow-x: auto; overscroll-behavior-x: contain; padding: var(--s-2) 0; scroll-snap-type: x mandatory; scroll-padding-left: var(--lg-sticky, 278px); }
/* JOB 5 Part 4 gate fix: scrolling snaps a whole column to the sticky edge, so no column ever sits half under Item name */
.lg thead th { scroll-snap-align: start; }
.lg { border-collapse: separate; border-spacing: 0 2px; width: max-content; min-width: 100%; font-size: var(--fs-small); }
.lg th { height: var(--h-head); padding: 0 8px; text-align: left; white-space: nowrap; font-size: var(--fs-label); font-weight: var(--w-medium); color: var(--ink-3); background: var(--card); }
.lg td { height: 34px; padding: 0 2px; white-space: nowrap; vertical-align: middle; background: var(--card); }
.lg .t-num { text-align: right; }
.lg tbody tr:hover > td { background: color-mix(in srgb, var(--card) 92%, var(--ink)); }
/* sticky # and Item name; the shadow shows when lines scroll under them */
.lg tr > :nth-child(1) { position: sticky; left: 0; z-index: 2; width: 52px; min-width: 52px; padding-left: var(--s-4); }
.lg tr > :nth-child(2) { position: sticky; left: 52px; z-index: 3; background: var(--card); box-shadow: 8px 0 8px -8px rgba(0, 0, 0, .35); }
.lg td:nth-child(1) { color: var(--ink-3); font-feature-settings: var(--num); padding-right: 6px; }
/* widths: put one on the th */
.lg .w-xs { min-width: 56px; } .lg .w-s { min-width: 72px; } .lg .w-m { min-width: 96px; } .lg .w-l { min-width: 156px; } .lg .w-xl { min-width: 210px; }
/* an input that looks like a cell */
.cell-in { display: block; width: 0; min-width: 100%; height: 30px; padding: 0 8px; border: 0; border-radius: var(--r-xs); background: var(--cell-bg, color-mix(in srgb, var(--ink) 6%, var(--card))); color: var(--ink); font-size: var(--fs-small); outline: 0; transition: box-shadow var(--d-micro), background-color var(--d-micro); }
.cell-in::placeholder { color: var(--ink-3); }
.cell-in:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.cell-in:focus { box-shadow: inset 0 0 0 2px var(--ring); background: var(--card); }
select.cell-in { appearance: none; padding-right: 22px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.t-num .cell-in { text-align: right; font-feature-settings: var(--num); }
.cell-in[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--red); }
/* computed (read-only) cells: no fill, muted */
.lg td.is-calc { padding: 0 8px; color: var(--ink-2); font-feature-settings: var(--num); }
.lg td.is-calc.is-net { color: var(--ink); font-weight: var(--w-medium); }
.lg td.is-na { padding: 0 8px; color: var(--ink-3); }
.lg-act { display: flex; align-items: center; gap: 2px; padding-right: var(--s-3); }
.lg-expand { display: none; }
/* row error: red bar on the left + the sentence under the row */
.lg tr.is-error > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.lg tr.lg-msg > td { height: auto; padding: 0 0 6px; background: var(--card); }
.lg-msg-in { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 6px; padding-left: calc(var(--s-4) + 40px); color: var(--red-ink); font-size: var(--fs-small); white-space: normal; }
/* locked after Submit */
.lg.is-locked .cell-in { background: transparent; pointer-events: none; color: var(--ink); }
.lg.is-locked select.cell-in { background-image: none; }

/* totals bar: pinned to the bottom of the screen while the grid is in view */
.lg-totals { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-8); padding: var(--s-3) var(--s-4); background: var(--raised); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.lg-tot { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lg-tot span { font-size: var(--fs-label); color: var(--ink-3); }
.lg-tot b { font-size: var(--fs-body); font-weight: var(--w-medium); font-feature-settings: var(--num); }
.lg-tot.is-net { margin-left: auto; text-align: right; }
.lg-tot.is-net b { font-size: var(--fs-card); font-weight: var(--w-semi); }

/* after Submit: barcodes made */
.grc-done { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-4); padding: var(--s-5); }
.grc-done h3 { font-size: var(--fs-card); font-weight: var(--w-semi); }
.grc-done p { color: var(--ink-2); margin-top: 2px; }
.grc-codes { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.grc-codes li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s-4); align-items: center; min-height: 34px; padding: 0 var(--s-3); border-radius: var(--r-sm); background: var(--card-2); }
.grc-codes b { font-weight: var(--w-medium); }
.grc-codes code { font: inherit; font-size: var(--fs-small); color: var(--ink-2); font-feature-settings: var(--num); }
.grc-done-foot { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-4); }

@media (max-width: 1100px) { .grc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* phones: each line becomes a card; # Item name, Qty and Net show, the rest opens with "All fields" */
@media (max-width: 640px) {
  .grc-fields { grid-template-columns: minmax(0, 1fr); }
  .grc-fields .span-2 { grid-column: auto; }
  .grc-pair { grid-template-columns: minmax(0, 1fr); }
  .grc-bar .grc-note { order: 9; flex-basis: 100%; }
  .lg-wrap { overflow: visible; padding: var(--s-2) var(--s-3); }
  .lg, .lg tbody, .lg tr, .lg td { display: block; width: auto; min-width: 0; }
  .lg thead { display: none; }
  .lg tbody tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--s-3); margin-bottom: var(--s-2); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
  .lg tbody tr:hover > td { background: none; }
  .lg tr > :nth-child(1), .lg tr > :nth-child(2) { position: static; box-shadow: none; padding: 0; width: auto; min-width: 0; }
  .lg td { height: auto; padding: 0; background: none; }
  .lg td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: var(--fs-label); color: var(--ink-3); }
  .lg td.is-calc, .lg td.is-na { padding: 0; }
  .lg td:nth-child(1) { display: none; }
  .lg td:nth-child(2) { grid-column: 1 / -1; padding-right: 88px; }
  .lg td:not(.lg-key) { display: none; }
  .lg tr.is-open td:not(:nth-child(1)) { display: block; }
  .lg td.lg-actcell { position: absolute; top: var(--s-2); right: var(--s-2); }
  .lg td.lg-actcell::before { display: none; }
  .lg-act { padding: 0; }
  .lg-expand { display: inline-flex; }
  .lg tr.is-open .lg-expand .i { rotate: 180deg; }
  .lg tr.is-error { box-shadow: inset 3px 0 0 var(--red); }
  .lg tr.is-error > td:first-child { box-shadow: none; }
  .lg tr.lg-msg { display: block; padding: 0 var(--s-1) var(--s-3); margin-top: calc(-1 * var(--s-2)); border: 0; background: none; }
  .lg tr.lg-msg > td { display: block; padding: 0; background: none; }
  .lg-msg-in { padding-left: 0; }
  .lg-totals { position: static; gap: var(--s-2) var(--s-5); }
  .lg .t-num { text-align: left; }
  .lg-tot.is-net { margin-left: 0; text-align: left; flex-basis: 100%; }
  .grc-done { grid-template-columns: minmax(0, 1fr); }
  .grc-codes li { grid-template-columns: minmax(0, 1fr) auto; }
  .grc-codes code { grid-column: 1 / -1; grid-row: 2; padding-bottom: 6px; }
}
@media (pointer: coarse) {
  .cell-in { height: var(--tap); font-size: 16px; }
  .drop { min-height: var(--tap); }
}

/* touch screens: compact look stays, every target grows back to 44px; inputs go to 16px so iOS never zooms */
@media (pointer: coarse) {
  :root { --top-h: 56px; }
  .btn, .btn--link, .toast-undo { min-height: var(--tap); }
  .btn--icon { width: var(--tap); }
  .btn--sm { min-height: 34px !important; }
  .nav-item, .nav-head, .theme-switch { height: auto; min-height: var(--tap); }
  .sb-user, .sb-brand { min-height: var(--tap); }
  .input, .select { min-height: var(--tap); }
  .input, .select, .textarea, .tb-search input { font-size: 16px; }
  .seg button { min-height: 38px; }
  .switch, .check, .menu button, .tp-opt { min-height: var(--tap); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}
