/* ChemOne ERP — layout: app rail (desktop) / bottom bar + sheets (mobile); content = cards on cement-grey ground.
   Colour: cool cement neutrals, ink slate, safety-yellow signal; each brand (Hopex green, Duw Fix navy) tints its own areas. */
:root {
  --bg: #eceff0; --surface: #ffffff; --surface-2: #f5f7f7; --sunken: #e3e7e9; --line: #d7dde0; --line-2: #c5cdd1;
  --ink: #16202a; --ink-2: #47545e; --muted: #77848d;
  --signal: #e8a20c; --signal-ink: #241a00; --signal-soft: #fdf3d8;
  --brand: #1f3a5f; --brand-ink: #ffffff; --brand-soft: #e6edf6;
  --good: #11804a; --good-soft: #e1f4ea; --warn: #b26b00; --warn-soft: #fdf0d9; --bad: #c42b2b; --bad-soft: #fde6e6; --info: #2563c9; --info-soft: #e5eefc;
  --shadow: 0 1px 2px rgba(22,32,42,.06), 0 4px 14px rgba(22,32,42,.06);
  --shadow-lg: 0 18px 50px rgba(22,32,42,.22);
  --f-display: 'Anek Gujarati', 'Anek Devanagari', 'Hind Vadodara', system-ui, sans-serif;
  --f-body: 'Hind Vadodara', 'Hind', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --c1: #2f5d8a; --c2: #e8a20c; --c3: #0f7b5f; --c4: #8455c9; --c5: #d1495b; --c6: #6b7b86;
  --r: 12px; --r-sm: 8px; --rail: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e1418; --surface: #151d23; --surface-2: #1a242b; --sunken: #0b1014; --line: #26333c; --line-2: #34434d;
  --ink: #e6ecef; --ink-2: #a9b6bd; --muted: #7c8a93; --signal: #f2b730; --signal-ink: #1d1500; --signal-soft: #3a2e10;
  --brand-soft: #1c2a3a; --good: #3dbd7d; --good-soft: #12301f; --warn: #e7a94a; --warn-soft: #36290f; --bad: #f07272; --bad-soft: #3a1717; --info: #6aa1ff; --info-soft: #14243e;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25); --shadow-lg: 0 18px 50px rgba(0,0,0,.55); --c1: #6b9bd1; --c2: #f2b730; --c3: #3dbd96; --c4: #a98be0; --c5: #f07080; --c6: #93a3ad; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0e1418; --surface: #151d23; --surface-2: #1a242b; --sunken: #0b1014; --line: #26333c; --line-2: #34434d;
  --ink: #e6ecef; --ink-2: #a9b6bd; --muted: #7c8a93; --signal: #f2b730; --signal-ink: #1d1500; --signal-soft: #3a2e10;
  --brand-soft: #1c2a3a; --good: #3dbd7d; --good-soft: #12301f; --warn: #e7a94a; --warn-soft: #36290f; --bad: #f07272; --bad-soft: #3a1717; --info: #6aa1ff; --info-soft: #14243e;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25); --shadow-lg: 0 18px 50px rgba(0,0,0,.55); --c1: #6b9bd1; --c2: #f2b730; --c3: #3dbd96; --c4: #a98be0; --c5: #f07080; --c6: #93a3ad; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { font-family: var(--f-display); font-stretch: 80%; letter-spacing: -.01em; text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: 1.65rem; font-weight: 750; } h2 { font-size: 1.2rem; font-weight: 700; } h3 { font-size: 1.02rem; font-weight: 650; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono, .num { font-family: var(--f-mono); font-size: .86em; letter-spacing: -.01em; }
.tab-num, td, .kpi-v { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); }
.eyebrow { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2.5px solid var(--signal); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
.rail { position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 14px 10px; background: var(--ink); color: #e9eef1; overflow-y: auto; }
:root[data-theme="dark"] .rail { background: #0a0f12; } @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail { background: #0a0f12; } }
.org { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 6px; }
.org-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--signal); color: var(--signal-ink); display: grid; place-items: center; font: 800 15px var(--f-display); font-stretch: 75%; }
.org b { font: 700 15px/1.1 var(--f-display); font-stretch: 80%; display: block; } .org small { color: #93a3ad; font-size: 11px; }
.rail a.app { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; text-decoration: none; color: #c3ced5; font-weight: 500; font-size: 14px; }
.rail a.app:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail a.app.on { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--signal); }
.rail a.app .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 30%, transparent); color: #fff; }
.rail .grow { flex: 1; }
.me { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.05); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--brand); color: var(--brand-ink); flex: none; }
.me .who { min-width: 0; } .me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .me small { color: #93a3ad; font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; min-height: 58px; }
.topbar .title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar .title h1 { font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 2px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 12px 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 14px; white-space: nowrap; border-bottom: 2.5px solid transparent; }
.tabs a.on { color: var(--ink); border-color: var(--signal); font-weight: 600; }
.content { padding: 20px; padding-bottom: 96px; max-width: 1360px; width: 100%; margin: 0 auto; animation: rise .28s ease both; }
@keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.iconbtn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { color: var(--ink); border-color: var(--line-2); }
.badge-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.firmsw { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.firmsw button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.firmsw button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.firmsw button.on { background: var(--c, var(--ink)); color: #fff; }
.firmsw button.on i { background: #fff; }
.offline { display: none; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600; border: 0; cursor: pointer; }
.offline.show { display: inline-flex; }

/* mobile shell */
.bottom { display: none; }
.fab { position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); z-index: 25; width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--signal); color: var(--signal-ink); box-shadow: var(--shadow-lg); display: none; place-items: center; cursor: pointer; }
.fab svg.i { width: 24px; height: 24px; stroke-width: 2.2; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { padding: 8px 14px; min-height: 54px; }
  .topbar .title h1 { font-size: 1.12rem; }
  .content { padding: 14px 16px 120px; }
  .firmsw.wide { display: none; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); justify-content: space-around; }
  .bottom a, .bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 600; border: 0; background: none; cursor: pointer; min-width: 0; }
  .bottom a span, .bottom button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom .on { color: var(--ink); }
  .bottom .on svg.i { stroke: var(--signal); stroke-width: 2.2; }
  .fab.show { display: grid; }
  .hide-m { display: none !important; }
}
@media (min-width: 861px) { .show-m { display: none !important; } }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; flex-wrap: wrap; }
.card-b { padding: 10px 16px 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.sec-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi .kpi-l { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi .kpi-l .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.kpi .kpi-v { font: 750 1.7rem/1.1 var(--f-display); font-stretch: 78%; letter-spacing: -.01em; }
.kpi .kpi-s { font-size: 12.5px; color: var(--muted); }
.kpi.warn .ic { background: var(--warn-soft); color: var(--warn); } .kpi.bad .ic { background: var(--bad-soft); color: var(--bad); } .kpi.good .ic { background: var(--good-soft); color: var(--good); }
.delta { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px; } .delta.up { color: var(--good); background: var(--good-soft); } .delta.dn { color: var(--bad); background: var(--bad-soft); }

/* buttons & form */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; color: var(--ink); transition: background .12s, transform .08s; }
.btn:hover { background: var(--surface-2); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--signal)); }
.btn.signal { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: none; } .btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; } .btn.lg { height: 48px; font-size: 16px; padding: 0 20px; border-radius: 12px; }
.btn.block { width: 100%; } .btn[disabled] { opacity: .5; pointer-events: none; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; gap: 4px; }
.fld > label .req { color: var(--bad); }
.fld .help { font-size: 12px; color: var(--muted); }
.in, select.in, textarea.in { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); outline: none; transition: border .12s, box-shadow .12s; }
textarea.in { min-height: 76px; resize: vertical; }
.in:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 35%, transparent); }
.in[readonly], .in:disabled { background: var(--surface-2); color: var(--ink-2); }
.fld.err .in { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.chk input { width: 18px; height: 18px; accent-color: var(--ink); }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--sunken); border-radius: 10px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-x { display: inline-flex; gap: 6px; align-items: center; padding: 3px 6px 3px 10px; border-radius: 20px; background: var(--sunken); font-size: 13px; }
.chip-x button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: #fff; background: var(--c, var(--ink-2)); white-space: nowrap; }
.gst { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.gst.no { border-style: dashed; color: var(--warn); border-color: var(--warn); }

/* tables / list cards */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--ink); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; } .tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); }
.thumb { width: 38px; height: 46px; object-fit: contain; border-radius: 6px; background: var(--surface-2); }
.lcards { display: none; }
@media (max-width: 760px) {
  .list-table { display: none; }
  .lcards { display: flex; flex-direction: column; gap: 10px; }
  .lcard { padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; text-decoration: none; cursor: pointer; }
  .lcard .lc-main { flex: 1; min-width: 0; }
  .lcard .lc-t { font-weight: 650; display: flex; justify-content: space-between; gap: 8px; }
  .lcard .lc-t span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lcard .lc-s { color: var(--ink-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; }
}
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; stroke-width: 1.4; margin-bottom: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 180px; max-width: 420px; }
.search svg.i { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search .in { padding-left: 36px; }

/* record */
.rec-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.rec-head .grow h1 { font-size: 1.5rem; }
.rec-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; margin-top: 6px; color: var(--ink-2); font-size: 13.5px; align-items: center; }
.actbar { display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 22px; }
.dl > div { min-width: 0; } .dl dt { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; } .dl dd { margin: 0; overflow-wrap: anywhere; }
.lines td .sub { font-size: 12px; color: var(--muted); }
.totals { margin-left: auto; width: min(340px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; font-size: 14px; }
.totals .grand { font: 750 1.35rem var(--f-display); font-stretch: 80%; border-top: 1px solid var(--line); padding-top: 6px; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 8px; background: var(--info-soft); color: var(--info); }
.lock.locked { background: var(--sunken); color: var(--ink-2); }
.timeline { display: flex; gap: 0; margin: 4px 0 14px; overflow-x: auto; }
.timeline .st { flex: 1; min-width: 90px; position: relative; padding-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.timeline .st::before { content: ''; position: absolute; top: 6px; left: 0; right: 0; height: 3px; background: var(--line); }
.timeline .st::after { content: ''; position: absolute; top: 1px; left: calc(50% - 6.5px); width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-2); }
.timeline .st.done { color: var(--ink); font-weight: 600; } .timeline .st.done::before { background: var(--good); } .timeline .st.done::after { border-color: var(--good); background: var(--good); }
.timeline .st.cur::after { border-color: var(--signal); background: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }

/* modal & sheet */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10,15,20,.48); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(880px, 100%); }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; gap: 10px; }
.modal-b { padding: 8px 18px 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 680px) { .scrim { align-items: flex-end; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92dvh; animation: up .22s ease; padding-bottom: env(safe-area-inset-bottom, 0px); } @keyframes up { from { transform: translateY(40px); opacity: .5; } } }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, calc(100% - 32px)); }
@media (max-width: 860px) { .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; animation: pop .2s ease; max-width: 100%; }
.toast.bad { background: var(--bad); color: #fff; } .toast.good svg.i { color: var(--good); }
.sheet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sheet-list a { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); text-decoration: none; font-weight: 600; font-size: 13.5px; border: 1px solid var(--line); }
.sheet-list a .dot { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--c, var(--ink-2)); color: #fff; }

/* lookup dropdown */
.lookup { position: relative; }
.lookup .menu { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; }
.lookup .menu button { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; justify-content: space-between; gap: 10px; font-size: 14px; }
.lookup .menu button:hover, .lookup .menu button.hl { background: var(--sunken); }
.lookup .menu small { color: var(--muted); }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font: 11px var(--f-body); }
.chart .grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; }
.chart .hbar { transform-box: fill-box; transform-origin: left; animation: growx .7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grow { from { transform: scaleY(0); } } @keyframes growx { from { transform: scaleX(0); } }
.chart .arc { animation: dash 1s ease both; } @keyframes dash { from { stroke-dasharray: 0 1000; } }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
.meter { height: 10px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--good)); transform-origin: left; animation: growx .9s cubic-bezier(.2,.8,.2,1) both; }

/* login */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-art { background: var(--ink); color: #eef3f5; padding: 40px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; inset: auto -10% -30% 30%; height: 70%; background: repeating-linear-gradient(-35deg, rgba(255,255,255,.04) 0 14px, transparent 14px 28px); pointer-events: none; }
.auth-art h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); font-weight: 800; font-stretch: 75%; line-height: 1; max-width: 12ch; }
.auth-art h1 em { font-style: normal; color: var(--signal); }
.auth-art p { color: #b5c3cb; max-width: 46ch; margin: 0; }
.auth-brands { display: flex; gap: 12px; flex-wrap: wrap; }
.auth-brands img { height: 54px; border-radius: 10px; background: #fff; padding: 4px; }
.auth-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: auto; position: relative; z-index: 1; }
.auth-facts div { border-top: 1px solid rgba(255,255,255,.15); padding-top: 10px; font-size: 13px; color: #b5c3cb; }
.auth-facts b { display: block; font: 750 1.5rem var(--f-display); font-stretch: 78%; color: #fff; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-box h2 { font-size: 1.6rem; }
.demo-users { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.demo-users button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 10px; cursor: pointer; font-size: 12.5px; line-height: 1.25; }
.demo-users button:hover { border-color: var(--ink-2); }
.demo-users b { display: block; font-size: 13px; }
.otp { letter-spacing: .5em; font-family: var(--f-mono); font-size: 1.3rem; text-align: center; }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 13.5px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); } .notice.bad { background: var(--bad-soft); color: var(--bad); } .notice.good { background: var(--good-soft); color: var(--good); }
@media (max-width: 860px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-art { padding: 26px 20px 22px; gap: 14px; } .auth-art h1 { font-size: 2rem; } .auth-facts { display: none; } .auth-art p { display: none; } .auth-brands img { height: 40px; } }

/* shop (dealer portal) */
.brandbar { border-radius: var(--r); padding: 18px 20px; color: #fff; background: var(--brand); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; position: relative; overflow: hidden; }
.brandbar::after { content: ''; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: color-mix(in srgb, var(--brand-accent, #fff) 30%, transparent); }
.brandbar img { height: 52px; border-radius: 10px; background: #fff; padding: 3px; position: relative; z-index: 1; }
.brandbar .grow { position: relative; z-index: 1; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.prod { display: flex; flex-direction: column; overflow: hidden; }
.prod .pimg { height: 170px; max-width: 100%; display: grid; place-items: center; overflow: hidden; background: linear-gradient(160deg, var(--surface-2), var(--sunken)); }
.prod .pimg img { height: 86%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.14)); transition: transform .25s; }
.prod:hover .pimg img { transform: translateY(-3px) rotate(-2deg); }
.prod .pb { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prod .pn { font-weight: 650; line-height: 1.25; }
.prod .pp { font: 750 1.25rem var(--f-display); font-stretch: 80%; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.stepper button { width: 36px; height: 36px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; font-weight: 600; }
.stepper input { width: 54px; height: 36px; border: 0; text-align: center; font-weight: 700; background: var(--surface); }
.cartbar { position: sticky; bottom: 12px; z-index: 15; margin-top: 16px; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); flex-wrap: wrap; }
@media (max-width: 860px) { .cartbar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }
.gauge-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }

/* attendance */
.att-row { display: grid; grid-template-columns: minmax(0, 1.4fr) auto 90px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.att-row:last-child { border-bottom: 0; }
.att-st { display: flex; gap: 4px; flex-wrap: wrap; }
.att-st button { border: 1px solid var(--line-2); background: var(--surface); padding: 5px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 700; cursor: pointer; min-width: 36px; }
.att-st button.on[data-s="Present"] { background: var(--good); color: #fff; border-color: var(--good); }
.att-st button.on[data-s="Absent"] { background: var(--bad); color: #fff; border-color: var(--bad); }
.att-st button.on[data-s="Half Day"], .att-st button.on[data-s="Partial"] { background: var(--warn); color: #fff; border-color: var(--warn); }
.att-st button.on[data-s="Leave"], .att-st button.on[data-s="Holiday"] { background: var(--info); color: #fff; border-color: var(--info); }
@media (max-width: 680px) { .att-row { grid-template-columns: minmax(0, 1fr) 80px; } .att-row .att-st { grid-column: 1 / -1; order: 3; } }
.punch-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 760px) { .punch-hero { grid-template-columns: minmax(0, 1fr); } }
.cam { aspect-ratio: 3 / 4; max-width: 100%; max-height: 420px; width: 100%; background: #0b1014; border-radius: 14px; overflow: hidden; display: grid; place-items: center; color: #8a979f; position: relative; }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; }
.clock { font: 800 3rem/1 var(--f-display); font-stretch: 75%; letter-spacing: -.02em; }

/* permission editor */
.perm-tbl td, .perm-tbl th { padding: 6px 8px; text-align: center; }
.perm-tbl td:first-child, .perm-tbl th:first-child { text-align: left; }
.perm-tbl input { width: 17px; height: 17px; accent-color: var(--ink); }
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 1px dashed var(--line-2); }
.tree > ul { padding-left: 0; border: 0; }
.tree li { margin: 8px 0; }
.tree .node { display: inline-flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); min-width: 220px; max-width: 100%; }
.tree .node b { font-size: 14px; }
.reason { font-size: 12.5px; color: var(--ink-2); }

/* invoice print */
.doc { background: #fff; color: #111; padding: 28px; border-radius: 10px; border: 1px solid var(--line); font-size: 13px; }
.doc table { width: 100%; border-collapse: collapse; } .doc th, .doc td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; } .doc th { background: #f2f4f5; font-size: 11px; text-transform: uppercase; }
.doc .r { text-align: right; } .doc h2 { font-size: 20px; }
.doc .stripe { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--fc), var(--fa)); margin-bottom: 16px; }
@media print { body * { visibility: hidden; } .doc, .doc * { visibility: visible; } .doc { position: absolute; inset: 0; border: 0; } }

.skel { background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* responsive fixes */
.chart.cols { max-height: 290px; }
td .mono, .tbl td:first-child .mono { white-space: nowrap; }
.tbl td.nm { white-space: nowrap; font-family: var(--f-mono); font-size: 13px; }
.brandbar .grow { min-width: min(260px, 100%); }
.gauge-wrap > .grow { min-width: min(260px, 100%); }
@media (max-width: 680px) {
  .brandbar { flex-direction: column; align-items: flex-start; padding: 16px; }
  .brandbar h1 { font-size: 1.4rem; }
  .brandbar img { height: 42px; }
  .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .prod .pb { padding: 10px; } .prod .pp { font-size: 1.1rem; }
  .prod .pimg { height: 130px; }
  .prod .prow { flex-direction: column; align-items: stretch; gap: 8px; }
  .prod .pb > .row:first-child { flex-wrap: wrap; gap: 4px; }
  .gauge-wrap { flex-direction: column; align-items: stretch; }
  .gauge-wrap > svg { align-self: center; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; } .kpi .kpi-v { font-size: 1.35rem; }
  .toolbar .in[type=date] { flex: 1; min-width: 0; }
  .rec-head .actbar { width: 100%; }
}
.cam .upl { background: transparent; color: #e6ecef; border-color: rgba(255,255,255,.35); }

.firmsw button.on[data-firm=""] { color: var(--bg); }

#app { min-height: 100vh; min-height: 100dvh; }
.auth { min-height: 100vh; min-height: 100dvh; }
.auth-form { background: var(--bg); }

/* =====================================================================
   v2 THEME LAYER — brandable (primary / accent / sidebar / corners / font)
   ===================================================================== */
:root {
  --primary: #1f3b73; --primary-ink: #fff; --accent: #f2a516; --accent-ink: #1a1300; --display-stretch: 80%;
  --primary-deep: color-mix(in srgb, var(--primary) 62%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 9%, var(--surface));
  --r-btn: 10px; --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-radius="sharp"] { --r: 6px; --r-sm: 4px; --r-btn: 6px; }
:root[data-radius="soft"] { --r: 14px; --r-sm: 9px; --r-btn: 10px; }
:root[data-radius="round"] { --r: 22px; --r-sm: 14px; --r-btn: 999px; }
h1, h2, h3, h4, .kpi .kpi-v, .totals .grand, .clock, .prod .pp { font-stretch: var(--display-stretch); }
.btn { border-radius: var(--r-btn); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); box-shadow: 0 6px 16px -8px var(--primary); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 86%, #000); }
.btn.signal { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 8px 20px -10px var(--accent); }
.btn.signal:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.card { border-radius: var(--r); }
.in, select.in, textarea.in { border-radius: min(var(--r-sm), 12px); }
.in:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
:focus-visible { outline-color: var(--accent); }
.tabs a.on { border-color: var(--accent); }
.seg button.on { color: var(--primary); }
.chk input, .perm-tbl input { accent-color: var(--primary); }
.avatar { background: var(--primary); color: var(--primary-ink); }
.pill.info { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: color-mix(in srgb, var(--primary) 80%, var(--ink)); }

/* background glow */
.main { background: radial-gradient(1100px 320px at 30% -160px, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%); }

/* ---- sidebar variants ---- */
.rail { background: color-mix(in srgb, var(--primary) 20%, #0a0f15); gap: 4px; }
:root[data-sidebar="brand"] .rail { background: linear-gradient(185deg, var(--primary) 0%, var(--primary-deep) 100%); }
:root[data-sidebar="light"] .rail { background: var(--surface); color: var(--ink); border-right: 1px solid var(--line); }
:root[data-sidebar="light"] .rail a.app { color: var(--ink-2); }
:root[data-sidebar="light"] .rail a.app:hover { background: var(--sunken); color: var(--ink); }
:root[data-sidebar="light"] .rail a.app.on { background: var(--primary-soft); color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
:root[data-sidebar="light"] .rail a.app .dot { color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
:root[data-sidebar="light"] .org small, :root[data-sidebar="light"] .me small { color: var(--muted); }
:root[data-sidebar="light"] .me { background: var(--surface-2); }
:root[data-sidebar="light"] .org { border-color: var(--line); }
.rail a.app.on { background: rgba(255,255,255,.13); box-shadow: inset 3px 0 0 var(--accent); }
.rail a.app { transition: background .15s, transform .15s; }
.rail a.app:hover { transform: translateX(2px); }
.rail .org { text-decoration: none; }
.rail .org small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.org-mark { background: var(--accent); color: var(--accent-ink); border-radius: calc(var(--r-sm) + 2px); flex: none; display: grid; place-items: center; font: 800 15px var(--f-display); }
.brand-logo { border-radius: 9px; background: #fff; padding: 3px; object-fit: contain; max-width: 120px; }
.rail-create { margin: 6px 4px 10px; width: calc(100% - 8px); height: 42px; }

/* ---- top bar ---- */
.topbar .title { flex: 0 1 auto; }
.search-pill { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 14px; min-width: 300px; max-width: 420px; flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: var(--r-btn); cursor: pointer; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.search-pill:hover { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.search-pill span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-pill kbd { font: 600 11px var(--f-mono); padding: 3px 6px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); }
.firmsw button.on[data-firm=""] { color: var(--primary-ink); }
.tabmore { position: relative; align-self: center; }
.tabmore summary { list-style: none; cursor: pointer; padding: 9px 12px 10px; color: var(--ink-2); font-weight: 500; font-size: 14px; display: flex; gap: 4px; align-items: center; }
.tabmore summary::-webkit-details-marker { display: none; }
.tabmore .menu { position: absolute; z-index: 45; top: 100%; left: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .15s ease; }
.tabmore .menu a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); border: 0; font-size: 14px; }
.tabmore .menu a:hover { background: var(--primary-soft); }
.tabs { overflow: visible; flex-wrap: nowrap; }
@media (max-width: 860px) { .tabs { overflow-x: auto; } .tabmore { display: none; } }

/* ---- hero ---- */
.hero { position: relative; overflow: hidden; isolation: isolate; border-radius: calc(var(--r) + 4px); padding: clamp(18px, 3vw, 28px); color: #fff; display: flex; gap: 20px; align-items: stretch; flex-wrap: wrap;
  background: radial-gradient(520px 260px at 100% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 65%), radial-gradient(420px 220px at 0% 120%, color-mix(in srgb, var(--primary) 50%, #7c3aed 20%), transparent 70%), linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 24px 50px -24px color-mix(in srgb, var(--primary) 70%, #000); animation: rise .5s var(--ease) both; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle, rgba(255,255,255,.14) 1px, transparent 1.6px) 0 0 / 18px 18px; -webkit-mask-image: linear-gradient(110deg, transparent 30%, #000 100%); mask-image: linear-gradient(110deg, transparent 30%, #000 100%); }
.hero-main { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.hero .eyebrow { color: rgba(255,255,255,.75); }
.hero h1 { color: #fff; font-size: clamp(1.6rem, 3.4vw, 2.5rem); font-weight: 800; line-height: 1.05; }
.hero p { margin: 0; color: rgba(255,255,255,.85); max-width: 60ch; }
.hero p a { color: #fff; font-weight: 600; text-decoration-color: color-mix(in srgb, var(--accent) 80%, #fff); text-underline-offset: 3px; }
.hero-stat { flex: 0 1 300px; min-width: 220px; padding: 16px 18px; border-radius: var(--r); background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(8px); color: #fff; text-decoration: none; display: flex; flex-direction: column; gap: 4px; transition: transform .2s var(--ease), background .2s; }
a.hero-stat:hover { transform: translateY(-3px); background: rgba(255,255,255,.18); }
.hero-stat .big { font: 800 clamp(2rem, 4.5vw, 3rem)/1 var(--f-display); font-stretch: var(--display-stretch); letter-spacing: -.02em; }
.hero-stat .hero-sub { font-size: 13px; color: rgba(255,255,255,.8); }
.hero-stat .spark { height: 46px; margin-top: auto; }
.hero-logo { height: 46px; width: auto; align-self: flex-start; background: #fff; border-radius: 10px; padding: 4px; margin-bottom: 4px; }
.meter.on-dark { background: rgba(255,255,255,.2); margin: 6px 0 2px; }
.glassbtn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.glassbtn:hover { background: rgba(255,255,255,.22); }
.chip-in { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13.5px; text-decoration: none; box-shadow: 0 8px 20px -10px #000; }
.chip-in.on { background: #22c55e; color: #052e16; } .chip-in.done { background: rgba(255,255,255,.16); color: #fff; box-shadow: none; }

/* ---- quick tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-weight: 650; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; box-shadow: var(--shadow); }
.tile:hover { transform: translateY(-4px); box-shadow: 0 16px 30px -16px color-mix(in srgb, var(--c) 60%, #000); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.tile .ti { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 65%, #000)); box-shadow: 0 8px 16px -8px var(--c); }
.tile .ti svg.i { width: 22px; height: 22px; }
@media (max-width: 680px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } .tile { align-items: center; text-align: center; padding: 10px 4px; font-size: 11.5px; gap: 7px; box-shadow: none; } .tile .ti { width: 46px; height: 46px; border-radius: 15px; } }

/* ---- KPI cards ---- */
.kpi .kpi-l .ic { background: var(--primary-soft); color: var(--primary); }
.kpi .spark { width: 100%; height: 34px; margin-top: 4px; }
.kpi { overflow: hidden; }
.stagger > * { animation: rise .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .04s } .stagger > *:nth-child(3) { animation-delay: .08s } .stagger > *:nth-child(4) { animation-delay: .12s }
.stagger > *:nth-child(5) { animation-delay: .16s } .stagger > *:nth-child(6) { animation-delay: .2s } .stagger > *:nth-child(7) { animation-delay: .24s } .stagger > *:nth-child(n+8) { animation-delay: .28s }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- command palette ---- */
.cmdk-modal { width: min(640px, 100%); align-self: flex-start; margin-top: 8vh; }
.cmdk-modal .modal-h { display: none; }
.cmdk-modal .modal-b { padding: 0; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 6px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmdk-in input { border: 0; outline: none; background: transparent; font-size: 17px; padding: 14px 0; flex: 1; color: var(--ink); }
.cmdk .res { max-height: 56vh; overflow: auto; padding: 6px 8px 8px; }
.cmdk .res a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.cmdk .res a.hl, .cmdk .res a:hover { background: var(--primary-soft); }
.cmdk .res a > svg.i:last-child { color: var(--muted); }
.cmdk .ci { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); flex: none; }
.cmdk-foot { padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12px; }

/* ---- mobile bottom bar with raised Create ---- */
@media (max-width: 860px) {
  .bottom { align-items: flex-end; padding-top: 4px; }
  .bottom .plus { flex: none !important; width: 56px; height: 56px; margin: -24px 6px 2px; border-radius: 18px !important; background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)) !important; color: var(--accent-ink) !important; box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--accent) 70%, #000); display: grid !important; place-items: center; }
  .bottom .plus svg.i { width: 26px; height: 26px; stroke-width: 2.4; }
  .bottom .on { color: var(--primary); }
  .bottom .on svg.i { stroke: var(--primary); }
  .hero-stat { flex-basis: 100%; }
  .search-pill { display: none; }
}

/* ---- login v2 ---- */
.auth2 { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); background: color-mix(in srgb, var(--primary) 30%, #070b12); color: #fff; overflow: hidden; isolation: isolate; }
.auth2 .mesh { position: absolute; inset: -25%; z-index: -2; filter: blur(40px) saturate(1.2);
  background: radial-gradient(38% 46% at 18% 22%, color-mix(in srgb, var(--primary) 90%, transparent), transparent 70%), radial-gradient(30% 40% at 78% 12%, color-mix(in srgb, var(--accent) 70%, transparent), transparent 70%), radial-gradient(42% 50% at 55% 92%, color-mix(in srgb, var(--primary) 55%, #7c3aed 25%), transparent 72%), radial-gradient(25% 30% at 95% 70%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%);
  animation: drift 20s ease-in-out infinite alternate; }
@keyframes drift { 0% { transform: translate(0, 0) rotate(0deg) scale(1); } 100% { transform: translate(4%, -3%) rotate(6deg) scale(1.08); } }
.auth2 .grain { position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle, rgba(255,255,255,.09) 1px, transparent 1.6px) 0 0 / 22px 22px; -webkit-mask-image: linear-gradient(90deg, #000, transparent 75%); mask-image: linear-gradient(90deg, #000, transparent 75%); }
.auth2 .pitch { padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.auth2 .pitch h1 { font-size: clamp(2.3rem, 5vw, 4.4rem); line-height: .96; font-weight: 800; max-width: 13ch; color: #fff; text-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth2 .pitch p { margin: 0; font-size: 1.05rem; color: rgba(255,255,255,.82); max-width: 48ch; }
.auth2 .firm-pill { height: 46px; background: #fff; border-radius: 12px; padding: 4px 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.showcase { margin-top: auto; display: flex; align-items: flex-end; gap: 4px; min-height: 160px; }
.showcase img { width: clamp(70px, 9vw, 112px); height: auto; filter: drop-shadow(0 22px 26px rgba(0,0,0,.45)); animation: float 7s ease-in-out infinite; transform-origin: bottom center; }
.showcase img:nth-child(2) { animation-delay: -1.2s; margin-bottom: 18px; } .showcase img:nth-child(3) { animation-delay: -2.4s; }
.showcase img:nth-child(4) { animation-delay: -3.6s; margin-bottom: 26px; } .showcase img:nth-child(5) { animation-delay: -4.8s; } .showcase img:nth-child(6) { animation-delay: -6s; margin-bottom: 12px; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }
.auth2 .panel { display: flex; align-items: center; justify-content: center; padding: 28px 20px; min-width: 0; }
.glass { width: min(450px, 100%); background: color-mix(in srgb, var(--surface) 95%, transparent); color: var(--ink); border-radius: calc(var(--r) + 10px); padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 40px 90px -20px rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(18px); animation: pop .5s var(--ease) both; max-height: calc(100dvh - 40px); overflow: auto; }
.glass h2 { font-size: 1.8rem; font-weight: 800; }
.glass a { color: var(--primary); font-weight: 600; text-decoration: none; }
.glass a:hover { text-decoration: underline; }
.glass .btn.primary.lg { height: 50px; font-size: 16px; }
.demo-box { border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; }
.demo-box summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.demo-box summary::-webkit-details-marker { display: none; }
.demo-box .demo-users { margin-top: 10px; max-height: 250px; overflow: auto; }
.demo-users button { transition: border-color .15s, background .15s; }
.demo-users button:hover { border-color: var(--primary); background: var(--primary-soft); }
@media (max-width: 900px) {
  .auth2 { grid-template-columns: minmax(0, 1fr); }
  .auth2 .pitch { padding: 26px 20px 4px; gap: 12px; }
  .auth2 .pitch h1 { font-size: 2.1rem; }
  .auth2 .pitch p, .showcase { display: none; }
  .auth2 .firm-pill { height: 36px; }
  .auth2 .panel { align-items: flex-start; padding: 14px 14px 28px; }
  .glass { padding: 20px; max-height: none; }
}

/* ---- branding page ---- */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.preset { border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 10px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; }
.preset:hover { transform: translateY(-2px); }
.preset.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.preset .pv { display: flex; height: 34px; border-radius: 8px; overflow: hidden; }
.preset .pv i:first-child { flex: 3; background: linear-gradient(135deg, var(--p), color-mix(in srgb, var(--p) 60%, #000)); }
.preset .pv i:last-child { flex: 1; background: var(--a); }
.preset b { font-size: 13.5px; } .preset small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.swatch { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); flex: none; cursor: pointer; }
.mock { display: grid; grid-template-columns: 54px 1fr; height: 220px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.mock-rail { background: color-mix(in srgb, var(--primary) 20%, #0a0f15); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
:root[data-sidebar="brand"] .mock-rail { background: linear-gradient(185deg, var(--primary), var(--primary-deep)); }
:root[data-sidebar="light"] .mock-rail { background: var(--surface); border-right: 1px solid var(--line); }
.mock-rail i { width: 26px; height: 8px; border-radius: 4px; background: rgba(160,170,180,.45); }
.mock-rail i.on { background: var(--accent); }
.mock-logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 800 11px var(--f-display); overflow: hidden; }
.mock-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.mock-main { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.mock-hero { border-radius: var(--r-sm); padding: 12px; color: #fff; display: flex; justify-content: space-between; align-items: flex-end; background: radial-gradient(200px 100px at 100% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent), linear-gradient(135deg, var(--primary), var(--primary-deep)); font-family: var(--f-display); }
.mock-hero span { font: 800 22px var(--f-display); }
.mock-row { display: flex; gap: 6px; }
.mock-btn { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: var(--r-btn); background: var(--accent); color: var(--accent-ink); }
.mock-btn.ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.mock-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex: 1; }
.mock-cards i { border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }

.contact-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 22px; max-width: 640px; font-size: 13px; color: rgba(255,255,255,.82); }
.contact-strip > div { display: flex; flex-direction: column; gap: 1px; }
.contact-strip b { color: #fff; font-size: 13.5px; }
.contact-strip .addr { grid-column: 1 / -1; flex-direction: row; gap: 6px; align-items: flex-start; color: rgba(255,255,255,.7); }
.hero p svg.i { width: 14px; height: 14px; vertical-align: -2px; }
@media (max-width: 900px) { .contact-strip { display: none; } }

/* mobile: navigation lives in the bottom bar + More sheet, no scrolling tab strip on top */
@media (max-width: 860px) {
  .tabs { display: none !important; }
  .main .top > .show-m { padding: 4px 14px 8px !important; }
  .main .top > .show-m .firmsw { width: 100%; justify-content: stretch; }
  .main .top > .show-m .firmsw button { flex: 1; justify-content: center; }
}

/* product photos: always show the whole pack, never cropped */
.prod .pimg { height: auto !important; aspect-ratio: 4 / 3; display: block; position: relative; overflow: hidden; }
.prod .pimg img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 12px; box-sizing: border-box; object-fit: contain; object-position: center; }
@media (max-width: 860px) { .prod .pimg { aspect-ratio: 1 / 1; } .prod .pimg img { padding: 10px; } }

/* back / home in top bar */
.topbar .title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar .title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn svg.i { width: 22px; height: 22px; stroke-width: 2.4; }
.home-mark { display: inline-flex; text-decoration: none; margin-right: 4px; }
@media (min-width: 861px) { .home-mark { display: none !important; } }

/* editable cart */
.cart-lines { display: flex; flex-direction: column; gap: 10px; }
.cart-line { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.cart-line img { width: 52px; height: 52px; object-fit: contain; background: var(--surface-2); border-radius: 10px; padding: 4px; box-sizing: border-box; }
.cart-line .cn { font-weight: 650; line-height: 1.25; font-size: 14px; }
.cart-line .cs { font-size: 12.5px; color: var(--muted); }
.cart-line .ca { font-weight: 700; text-align: right; white-space: nowrap; }
.cart-line .cq { grid-column: 2 / 4; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-line .stepper button, .cart-line .stepper input { height: 34px; }
.cart-line .rm { border: 0; background: none; color: var(--bad, #c0392b); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 6px; }
.cart-line .rm svg.i { width: 16px; height: 16px; }

/* single-firm login */
.auth2 .firm-pill.big { height: 64px; padding: 8px 14px; border-radius: 16px; }
.auth2 .cert { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; opacity: .85; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); padding: 6px 12px; border-radius: 999px; }
.auth2 .cert svg.i { width: 16px; height: 16px; }
.glass-firm { display: none; justify-content: center; }
.glass-firm img { height: 48px; background: #fff; border-radius: 12px; padding: 4px 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
@media (max-width: 860px) { .auth2.one-firm .glass-firm { display: flex; } .auth2 .firm-pill.big { height: 48px; } }
.auth2 .cert { align-self: flex-start; }
@media (max-width: 860px) { .auth2.one-firm .pitch .firm-pill.big { display: none; } }

/* GPS punch */
.geo-card { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.geo-ring { position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.geo-ring svg.i { width: 28px; height: 28px; position: relative; z-index: 1; }
.geo-ring span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid currentColor; opacity: .35; animation: geoPulse 1.8s ease-out infinite; }
.geo-ring.ok { background: color-mix(in srgb, var(--good, #16a34a) 16%, transparent); color: var(--good, #16a34a); }
.geo-ring.far { background: color-mix(in srgb, var(--bad, #dc2626) 14%, transparent); color: var(--bad, #dc2626); }
.geo-ring.ok span, .geo-ring.far span { animation: none; opacity: .5; }
@keyframes geoPulse { from { transform: scale(.8); opacity: .6; } to { transform: scale(1.5); opacity: 0; } }
.geo-status { margin-top: 6px; font-weight: 650; display: block; }
.geo-status svg.i { width: 16px; height: 16px; vertical-align: -3px; }
.geo-status.ok { color: var(--good, #16a34a); } .geo-status.far { color: var(--bad, #dc2626); }

/* order board */
.ob-tabs { display: none; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ob-tabs::-webkit-scrollbar { display: none; }
.ob-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font: 600 13px var(--f-body); color: var(--ink-2, var(--ink)); cursor: pointer; }
.ob-tabs button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ob-tabs button b { background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.ob-tabs button.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--ink); }
.ob-board { display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.ob-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; min-width: 0; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.ob-col header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; padding: 12px 12px 10px; border-bottom: 3px solid var(--c); }
.ob-col header small { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
.ob-h { font: 700 15px var(--f-display); display: flex; align-items: center; gap: 7px; }
.ob-h i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.ob-count { background: var(--c); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 20px; }
.ob-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.ob-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .15s; }
.ob-card:hover { box-shadow: 0 8px 22px -12px rgba(0,0,0,.35); transform: translateY(-1px); }
.ob-card.sel { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.ob-no { font-size: 12px; color: var(--muted); }
.ob-cust { font-weight: 700; line-height: 1.25; }
.ob-meta { font-size: 12.5px; color: var(--muted); }
.ob-meta svg.i { width: 13px; height: 13px; vertical-align: -2px; }
.ob-fig { font-size: 13px; }
.ob-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ob-acts .btn { flex: 1; justify-content: center; }
.ob-chk { display: inline-flex; padding: 2px; cursor: pointer; }
.ob-chk input { width: 18px; height: 18px; accent-color: var(--primary); }
.ob-empty { text-align: center; color: var(--muted); padding: 22px 8px; font-size: 13px; }
.ob-empty svg.i { width: 22px; height: 22px; opacity: .5; }
.ob-bulk { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--ink, #111); color: #fff; padding: 10px 14px; border-radius: 16px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.45); }
.ob-bulk .btn:not(.signal) { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
@media (max-width: 860px) {
  .ob-tabs { display: flex; }
  .ob-board { display: block; overflow: visible; }
  .ob-col { display: none; max-height: none; background: none; border: 0; }
  .ob-col.on { display: flex; }
  .ob-col header { padding: 4px 2px 10px; }
  .ob-list { padding: 0; overflow: visible; }
  .ob-bulk { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* stock: scales to any number of godowns */
.goodc { color: var(--good, #16a34a); } .warnc { color: var(--warn, #d97706); } .badc { color: var(--bad, #dc2626); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: 600 13px var(--f-body); cursor: pointer; color: var(--ink); }
.chip b { background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.chip.on { background: var(--primary); color: var(--primary-ink, #fff); border-color: var(--primary); }
.chip.on b { background: rgba(255,255,255,.22); }
.chip svg.i { width: 14px; height: 14px; }
.sk-list { display: flex; flex-direction: column; gap: 8px; }
.sk-row { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: box-shadow .15s; }
.sk-row:hover { box-shadow: 0 8px 22px -14px rgba(0,0,0,.35); }
.sk-row.open { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.sk-main { display: grid; grid-template-columns: minmax(220px, 2.2fr) 80px 80px 120px 140px minmax(180px, 2fr) 24px; gap: 12px; align-items: center; padding: 10px 14px; }
.sk-prod { display: flex; gap: 10px; align-items: center; min-width: 0; }
.sk-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-num { text-align: right; display: flex; flex-direction: column; }
.sk-num small, .gstats small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.sk-num b { font: 700 1.05rem var(--f-display); }
.sk-av b { font-size: 1.45rem; }
.sk-av.good b { color: var(--good, #16a34a); } .sk-av.warn b { color: var(--warn, #d97706); } .sk-av.bad b { color: var(--bad, #dc2626); }
.sk-unit { font-size: 11px; color: var(--muted); }
.sk-lvl { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sk-lvl .meter { width: 100%; }
.sk-where { display: flex; gap: 5px; flex-wrap: wrap; }
.gchip { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.gchip b { margin-left: 3px; }
.gchip.more { color: var(--muted); }
.sk-caret { color: var(--muted); transition: transform .2s; }
.sk-row.open .sk-caret { transform: rotate(180deg); }
.sk-detail { border-top: 1px dashed var(--line); padding: 12px 14px 14px; cursor: default; }
.sk-gtbl { display: flex; flex-direction: column-reverse; gap: 4px; max-width: 720px; }
.sk-g { display: grid; grid-template-columns: minmax(130px, 1.4fr) minmax(80px, 2fr) 70px 70px 80px; gap: 10px; align-items: center; font-size: 13.5px; }
.sk-g.head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sk-g.zero { opacity: .45; }
.sk-g .r { text-align: right; }
.sk-gbar { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.sk-gbar i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.gcard { display: flex; flex-direction: column; gap: 10px; padding: 14px; cursor: pointer; }
.gstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gstats > div { display: flex; flex-direction: column; } .gstats b { font: 700 1.15rem var(--f-display); }
.gtop { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--line); padding-top: 8px; }
.sk-matrix th.stick, .sk-matrix td.stick { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--line); min-width: 220px; }
.sk-matrix th { white-space: nowrap; }
@media (max-width: 1100px) { .sk-main { grid-template-columns: minmax(200px, 2fr) 70px 70px 110px 120px 24px; } .sk-where { grid-column: 1 / -2; } }
@media (max-width: 860px) {
  .sk-main { grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; padding: 12px; }
  .sk-prod { grid-column: 1 / -1; }
  .sk-num { text-align: left; }
  .sk-lvl, .sk-where { grid-column: 1 / -1; }
  .sk-lvl { flex-direction: row; align-items: center; } .sk-lvl .meter { flex: 1; }
  .sk-caret { display: none; }
  .sk-g { grid-template-columns: 1fr 60px 60px 64px; } .sk-gbar { display: none; }
  .sk-tools .seg { width: 100%; } .sk-tools .seg button { flex: 1; }
  .kpis .kpi[data-show] .kpi-v { font-size: 1.5rem; }
}
.ob-board { grid-template-columns: repeat(5, minmax(220px, 1fr)); }
.ob-no { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 860px) { .toolbar > select.in { flex: 1 1 140px; width: auto !important; } }
.ob-why { margin-top: 2px; } .ob-why .pill { white-space: normal; } .ob-why svg.i { width: 13px; height: 13px; vertical-align: -2px; }

/* PIN pad */
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 6px 0 4px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); transition: background .15s, transform .15s; }
.pin-dots i.on { background: var(--primary); transform: scale(1.1); }
.pin-dots.shake { animation: pinShake .4s; }
.pin-dots.shake i { border-color: var(--bad, #dc2626); }
@keyframes pinShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px 22px; justify-content: center; margin: 8px 0; }
.pin-pad button { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font: 600 26px var(--f-display); color: var(--ink); cursor: pointer; transition: background .1s, transform .1s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pin-pad button:active { background: color-mix(in srgb, var(--primary) 15%, var(--surface)); transform: scale(.94); }
.pin-pad button[data-k="del"] { border: 0; background: none; }
.pin-pad button[data-k="del"] svg.i { width: 26px; height: 26px; }
@media (max-width: 380px) { .pin-pad { grid-template-columns: repeat(3, 64px); gap: 10px 18px; } .pin-pad button { width: 64px; height: 64px; } }

/* big, thumb-friendly quantity stepper */
.stepper.big { border-radius: 14px; border-color: var(--line-2, var(--line)); background: var(--surface); }
.stepper.big button { width: 44px; height: 44px; font-size: 22px; line-height: 1; color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; }
.stepper.big button:active { background: color-mix(in srgb, var(--primary) 22%, var(--surface)); }
.stepper.big input { width: 56px; height: 44px; font: 700 17px var(--f-body); -moz-appearance: textfield; }
.stepper.big input::-webkit-outer-spin-button, .stepper.big input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.big input[readonly] { cursor: pointer; caret-color: transparent; }
.stepper.big input:not([readonly]) { box-shadow: inset 0 0 0 2px var(--primary); }
.prod .prow .stepper.big { width: 100%; } .prod .prow .stepper.big input { flex: 1; width: auto; }
.cart-line .stepper.big button, .cart-line .stepper.big input { height: 42px; }
.modal:focus { outline: none; }
.pin-msg { min-height: 20px; text-align: center; font-size: 14px; font-weight: 600; color: var(--bad, #dc2626); opacity: 0; transition: opacity .2s; }
.pin-msg.show { opacity: 1; }

/* loading feedback */
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.busy-bar::before { content: ''; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent, #f2a516), var(--primary)); animation: busyMove 1s ease-in-out infinite; }
.busy-bar.on { opacity: 1; } .busy-bar.done { opacity: 0; }
@keyframes busyMove { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading svg { opacity: 0; }
.btn.loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2.5px solid currentColor; border-color: var(--primary-ink, #fff) var(--primary-ink, #fff) transparent transparent; animation: spin .7s linear infinite; }
.btn:not(.primary):not(.signal):not(.danger).loading::after { border-color: var(--primary) var(--primary) transparent transparent; }
.spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--primary); border-right-color: transparent; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.pin-msg.ok { color: var(--primary); }
.glass.signing .pin-pad { opacity: .35; pointer-events: none; transition: opacity .2s; }
.glass.signing .pin-dots i { background: var(--primary); animation: dotPulse .9s ease-in-out infinite; }
.glass.signing .pin-dots i:nth-child(2) { animation-delay: .1s; } .glass.signing .pin-dots i:nth-child(3) { animation-delay: .2s; } .glass.signing .pin-dots i:nth-child(4) { animation-delay: .3s; }
@keyframes dotPulse { 50% { transform: scale(.6); opacity: .5; } }
.auth2.leaving { animation: authOut .22s ease-in forwards; }
@keyframes authOut { to { opacity: 0; transform: scale(.98); } }
.shell.entering { animation: shellIn .35s ease-out; }
@keyframes shellIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#view.enter > * { animation: viewIn .22s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .busy-bar::before, .auth2.leaving, .shell.entering, #view.enter > *, .glass.signing .pin-dots i { animation: none !important; } }
/* stepper inside product cards: keep − [n] + on one line at any width */
.prod .prow { flex-wrap: wrap; gap: 8px; }
.prod .prow .stepper.big { display: flex; width: 100%; min-width: 0; }
.prod .prow .stepper.big button { flex: 0 0 44px; }
.prod .prow .stepper.big input { flex: 1 1 0; width: 0; min-width: 0; }
.cart-line .stepper.big { display: inline-flex; }
.cart-line .stepper.big input { flex: 0 0 56px; width: 56px; }

/* filter chips + period picker (mobile-first: chips scroll sideways, each opens a sheet) */
.fbar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; -webkit-overflow-scrolling: touch; }
.fbar::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2, var(--line)); background: var(--surface); color: var(--ink); font: 600 13.5px var(--f-body); cursor: pointer; white-space: nowrap; max-width: 240px; }
.fchip span { overflow: hidden; text-overflow: ellipsis; }
.fchip svg.i { width: 16px; height: 16px; flex: none; opacity: .75; }
.fchip.on { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 55%, transparent); color: var(--primary); }
.fchip.on svg.i { opacity: 1; }
.fchip.ghost { border-style: dashed; color: var(--muted); }
.fchip .fx { font-style: normal; margin-left: 2px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--primary) 18%, transparent); font-size: 11px; }
.toolbar .fchip { height: 42px; }
.rng { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.rng-b { padding: 12px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 600 14px var(--f-body); color: var(--ink); cursor: pointer; text-align: left; }
.rng-b.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary); }
.rng-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rng-custom .fld { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.rng-custom .in { width: 100%; min-width: 0; }
.sheet-pick { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.sheet-pick button { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 600 14.5px var(--f-body); color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-pick button small { color: var(--muted); font-weight: 500; }
.sheet-pick button.on { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.rep-head { display: flex; align-items: center; gap: 10px; }
.rep-pick { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; color: var(--ink); min-width: 0; }
.rep-pick > svg.i:first-child { width: 22px; height: 22px; color: var(--primary); flex: none; }
.rep-pick span { display: flex; flex-direction: column; min-width: 0; } .rep-pick small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.rep-pick b { font: 700 16px var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-list a.on { background: color-mix(in srgb, var(--primary) 10%, transparent); }
/* never squash a native date field to "dd/" */
input.in[type=date] { min-width: 150px; }
@media (max-width: 860px) { .toolbar input.in[type=date] { flex: 1 1 150px; } .rng { grid-template-columns: 1fr 1fr; } }
.punch-flag { margin-top: 6px; font-size: 13px; color: var(--warn, #b45309); font-weight: 600; }
.punch-flag svg.i { width: 14px; height: 14px; vertical-align: -2px; }
.pr-flag { margin: 8px 0; font-size: 13.5px; color: var(--warn, #b45309); font-weight: 600; }
.pr-flag svg.i { width: 14px; height: 14px; vertical-align: -2px; }
.pr-card.rej { opacity: .8; border-color: color-mix(in srgb, var(--bad, #dc2626) 40%, var(--line)); }

/* record payment */
.rp { padding-bottom: 90px; }
.rp-amt { font: 700 26px var(--f-display); height: 56px; }
.rp-fin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.rp-fin small, .rp-item small { display: block; color: var(--muted); font-size: 12px; }
.rp-fin b { font: 700 15px var(--f-display); }
.rp-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rp-modes button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 600 13px var(--f-body); color: var(--ink); cursor: pointer; }
.rp-modes button svg.i { width: 22px; height: 22px; }
.rp-modes button.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary); }
.rp-list { display: flex; flex-direction: column; gap: 6px; }
.rp-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rp-item.pick { grid-template-columns: auto 1fr auto; cursor: pointer; }
.rp-item.pick input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
.rp-item.on { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.rp-item .r { text-align: right; }
.rp-in { width: 120px; height: 38px; text-align: right; margin-top: 4px; }
.rp-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 -8px 24px -16px rgba(0,0,0,.35); }
.rp-bar b { font: 700 20px var(--f-display); display: block; } .rp-bar small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 860px) { .rp-bar { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); } .rp-modes button span { font-size: 12px; } }
.cp-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cp-types button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13px var(--f-body); cursor: pointer; text-align: center; }
.cp-types button svg.i { width: 22px; height: 22px; }
.cp-types button.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary); }
.cp-ord { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.cp-ord small { display: block; color: var(--muted); font-size: 12.5px; }
@media (max-width: 420px) { .cp-types { grid-template-columns: repeat(2, 1fr); } }
.bk-n { font-size: 12.5px; word-break: break-all; margin-top: 2px; }
.bk-amt { font: 700 18px var(--f-display); white-space: nowrap; color: var(--good, #15803d); }
.bk-sug { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
table.pl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.pl td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
table.pl td.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.pl td.neg { color: var(--ink-2, var(--muted)); }
table.pl tr.tot td { font-weight: 700; border-top: 2px solid var(--line-2, var(--line)); background: var(--surface-2); }
table.pl tr.big td { font: 800 18px var(--f-display); }
.pl-side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pl-side div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; } .pl-side small { display: block; color: var(--muted); font-size: 12px; }
.sess { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.sess-r { display: grid; grid-template-columns: 26px 1fr 1fr auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; background: var(--surface); }
.sess-r.open { border-color: color-mix(in srgb, var(--good, #16a34a) 50%, var(--line)); }
.sess-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.sess-r svg.i { width: 14px; height: 14px; }
.sess-t { font-size: 13.5px; color: var(--muted); text-align: right; }

/* report builder & dashboards */
.rb-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.rb-types button { padding: 14px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 600 14px var(--f-body); color: var(--ink); cursor: pointer; text-align: left; }
.rb-types button:hover { border-color: var(--primary); }
.rb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary); font: 600 13px var(--f-body); }
.rb-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 2px 6px; font-size: 13px; border-radius: 50%; }
.rb-flt { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.rb-aggs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.rb-agg { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.rb-agg.on { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.rb-agg select { width: auto; height: 34px; }
.rb-ct { flex-wrap: wrap; }
.tbl tr.grp td { background: var(--surface-2); }
.tbl tr.sub td:first-child { padding-left: 22px; color: var(--ink-2, var(--muted)); }
.dgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.dc-S { grid-column: span 1; } .dc-M { grid-column: span 2; } .dc-L { grid-column: span 4; }
.dc .card-h h3 { font-size: 15px; }
.dlist { text-decoration: none; color: var(--ink); }
.dcomp { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 1100px) { .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dc-M, .dc-L { grid-column: span 2; } }
@media (max-width: 600px) { .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .dc-S { grid-column: span 1; } .dc-M, .dc-L { grid-column: span 2; } }

/* ---------- CRM: dealer 360, price list, enquiry routing ---------- */
.d3-who { display: flex; flex-direction: column; margin-bottom: 10px; } .d3-who b { font-size: 17px; }
.d3-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; } .d3-flags .pill { font-size: 12.5px; padding: 5px 10px; }
.d3-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 760px) { .d3-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.d3-kpis > div { background: var(--sunken); border-radius: var(--r-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.d3-kpis span { font-size: 12px; color: var(--muted); } .d3-kpis b { font-size: 19px; font-variant-numeric: tabular-nums; } .d3-kpis small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d3-kpis > .bad { background: var(--bad-soft); } .d3-kpis > .bad b { color: var(--bad); }
.d3-bar { height: 5px; border-radius: 9px; background: color-mix(in srgb, var(--line) 70%, transparent); margin-top: 5px; overflow: hidden; } .d3-bar i { display: block; height: 100%; background: var(--good); border-radius: 9px; } .d3-bar.warn i { background: var(--warn); } .d3-bar.bad i { background: var(--bad); }
.d3-st { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.d3-orders, .lr-list, .dp-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; margin-top: 6px; }
.d3-o, .lr-d, .dp-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; background: var(--surface); min-height: 52px; }
.d3-o:last-child, .lr-d:last-child, .dp-row:last-child { border-bottom: 0; }
.d3-o:active, .lr-d:active { background: var(--sunken); }
.d3-o .grow, .lr-d .grow, .dp-row .grow { display: flex; flex-direction: column; min-width: 0; gap: 2px; } .d3-o .grow b, .lr-d .grow b, .dp-row .grow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d3-o .r, .dp-row .r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; } .dp-row .r small.good { color: var(--good); font-weight: 600; }
.lr-d small .pill { margin-right: 4px; font-size: 11.5px; } .lr-d .btn { flex-shrink: 0; }
.d3-dl { margin-top: 12px; } .d3-chart { margin-top: 10px; } .d3-chart .card-b { padding: 0; }
.d3-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; } .d3-acts .btn { flex: 1 1 auto; justify-content: center; } .d3-acts .btn.ghost { flex: 0 0 auto; }
.dp-tools { display: flex; gap: 8px; } .dp-tools .search { max-width: none; }
.lr-steps { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.lr-steps span { flex: 1 1 0; min-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); text-align: center; }
.lr-steps i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-style: normal; font-weight: 700; font-size: 12px; }
.lr-steps .ok { color: var(--ink); } .lr-steps .ok i { background: var(--good); color: #fff; } .lr-steps .ok i svg { width: 14px; height: 14px; stroke: #fff; }
.lr-route { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--sunken); border-radius: var(--r-sm); } .lr-route .grow { display: flex; flex-direction: column; min-width: 0; } .lr-route .r { display: flex; flex-direction: column; align-items: flex-end; }
.search.big { max-width: none; } .search.big .in { height: 52px; font-size: 18px; padding-left: 42px; } .search.big svg.i { top: 16px; left: 14px; }
.dp-tools { flex-wrap: wrap; } .dp-tools .search { min-width: 0; flex: 1 1 160px; } .dp-tools select.in { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.dp-row .grow b { white-space: normal; overflow: visible; line-height: 1.25; } .dp-row .grow small { word-break: break-word; }
.dp-row .r small { text-align: right; max-width: 110px; }

/* ---------- enquiry stages, pipeline, dealer enquiries ---------- */
.spath { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.spath::-webkit-scrollbar { display: none; }
.sp { flex: 1 0 auto; min-width: 84px; position: relative; border: 0; background: var(--sunken); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; padding: 10px 14px 10px 18px; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); white-space: nowrap; cursor: default; min-height: 40px; }
.sp:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); padding-left: 12px; border-radius: 8px 0 0 8px; }
.sp.end { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%); border-radius: 0 8px 8px 0; }
.sp.done { background: color-mix(in srgb, var(--good) 22%, var(--surface)); color: var(--ink); }
.sp.cur { background: var(--primary); color: #fff; }
.sp.won { background: var(--good); color: #fff; } .sp.lost { background: var(--bad); color: #fff; }
.sp.tap { cursor: pointer; } .sp.tap:not(.cur):hover, .sp.tap:not(.cur):active { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.stg-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.stg-pick button { flex: 1 1 calc(50% - 8px); min-height: 46px; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-sm); font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.stg-pick button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep, var(--primary)); }
.stg-pick button.won.on { border-color: var(--good); background: var(--good-soft); color: var(--good); } .stg-pick button.lost.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.seg-tabs { display: flex; gap: 4px; background: var(--sunken); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.seg-tabs button { flex: 1; border: 0; background: none; padding: 10px 8px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; min-height: 42px; }
.seg-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); } .seg-tabs b { margin-left: 4px; font-variant-numeric: tabular-nums; color: var(--muted); }
.stg-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; padding-bottom: 2px; }
.stg-tabs::-webkit-scrollbar { display: none; }
.stg-tabs button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; min-height: 38px; }
.stg-tabs button b { color: var(--muted); margin-left: 3px; } .stg-tabs button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); } .stg-tabs button.on b { color: inherit; opacity: .75; }
.stg-tabs button.won.on { background: var(--good); border-color: var(--good); } .stg-tabs button.lost.on { background: var(--bad); border-color: var(--bad); }
.pl-list { display: flex; flex-direction: column; }
.pl-row { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; align-items: flex-start; }
.pl-row:last-child { border-bottom: 0; } .pl-row:active { background: var(--sunken); }
.pl-row .grow { display: flex; flex-direction: column; gap: 3px; min-width: 0; } .pl-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pl-row small .bad, .pl-row td.bad, td.bad { color: var(--bad); font-weight: 600; }
.pl-row .r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.acts li { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.acts li:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 38px; bottom: -4px; width: 2px; background: var(--line); }
.acts i { width: 32px; height: 32px; border-radius: 50%; background: var(--sunken); display: grid; place-items: center; flex-shrink: 0; } .acts i svg { width: 16px; height: 16px; }
.acts li.dl i { background: var(--info-soft); color: var(--info); } .acts li.won i { background: var(--good-soft); color: var(--good); } .acts li.lost i { background: var(--bad-soft); color: var(--bad); }
.acts div { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 14px; } .acts div span { color: var(--ink-2); } .acts small { font-size: 12px; }
.enq .card-b { padding-top: 14px; } .enq-h { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; } .enq-n { font-size: 17px; }
.enq-dl { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.enq-dl > div { display: flex; gap: 10px; align-items: flex-start; } .enq-dl dt { color: var(--muted); padding-top: 1px; } .enq-dl dd { margin: 0; line-height: 1.4; } .enq-dl dd.good { color: var(--good); font-weight: 600; }
.enq-more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; } .enq-more summary { cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 6px 0; color: var(--ink-2); }

.modal [hidden], .stack > [hidden], .fld[hidden] { display: none !important; }
/* shop stepper: never let the quantity box collapse (wide screens size the stepper to its content) */
.prod .prow .stepper.big input { flex: 1 1 60px; width: 60px; min-width: 48px; }
.prod .prow .pact { min-width: 148px; }

/* real pack photos: blend their white studio background into the card */
img[src*="img/products/"] { mix-blend-mode: multiply; filter: none !important; }
.prod .pimg img[src*="img/products/"] { padding: 6px; }

/* ---- product-wise stock entry / transfer ---- */
.sm-list { display: flex; flex-direction: column; gap: 8px; }
.sm-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sm-row.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.sm-row.none { opacity: .62; }
.sm-row .thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.sm-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sm-info b { font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.sm-info small { font-size: 12px; }
.sm-now { color: var(--ink-2); }
.sm-after { font-weight: 700; color: var(--good, #16a34a); } .sm-after.bad { color: var(--bad, #dc2626); }
.sm-sug { border: 0; background: none; padding: 0 2px; color: var(--primary); font-weight: 600; font-size: 12px; cursor: pointer; text-decoration: underline; }
.sm-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.sm-tools .search { flex: 1 1 200px; min-width: 0; }
.sm-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; }
.sm-route .iconbtn { margin-bottom: 2px; }
.sm .rp-bar { z-index: 6; flex-wrap: wrap; }
.sm-row .stepper.big { flex: none; }
@media (max-width: 480px) { .sm-row { grid-template-columns: 40px minmax(0, 1fr); } .sm-row .thumb { width: 40px; height: 40px; } .sm-row .stepper.big, .sm-row > .pill { grid-column: 1 / -1; justify-self: end; } .sm .rp-bar { gap: 8px; padding: 10px 12px; } .sm .rp-bar .grow { flex: 1 1 100%; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; } .sm .rp-bar .grow b { font-size: 15px; white-space: nowrap; } .sm .rp-bar .grow small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sm .rp-bar .btn { flex: 1 1 0; min-height: 46px; justify-content: center; } }
/* generic line editor: the product dropdown must be able to drop below the table */
.lines-edit { overflow: visible; }
.lines-edit .tbl { width: 100%; }
.lines-edit .tbl td { vertical-align: top; }
@media (max-width: 700px) { .lines-edit thead { display: none; } .lines-edit .tbl tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); } .lines-edit .tbl td { display: block; min-width: 0 !important; padding: 0; border: 0; } .lines-edit .tbl td:first-child { grid-column: 1 / -1; } .lines-edit .tbl td:last-child { justify-self: end; } }

/* ---- Home: business overview ---- */
.bh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bh-head h1 { font-size: clamp(1.35rem, 3vw, 1.9rem); margin: 2px 0 0; }
.bh-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; }
.bh-seg { display: flex; overflow-x: auto; max-width: 100%; scrollbar-width: none; } .bh-seg::-webkit-scrollbar { display: none; }
.bh-seg button { white-space: nowrap; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; } .bh-seg button[disabled] { opacity: .55; cursor: default; }
.bh-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; } .bh-filters .fbar { display: contents; }
#bhbody.bh-loading { opacity: .55; transition: opacity .15s; pointer-events: none; }
.bh-notes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.bh-notes li { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--line-2); font-size: 14px; }
.bh-notes li.good { border-left-color: var(--good, #16a34a); } .bh-notes li.bad { border-left-color: var(--bad, #dc2626); } .bh-notes li.warn { border-left-color: var(--warn, #d97706); } .bh-notes li.info { border-left-color: var(--info, #2563eb); }
.bh-today { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.bh-t { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: inherit; min-width: 0; }
.bh-t small { color: var(--ink-2); font-size: 12.5px; } .bh-t b { font: 750 1.3rem/1.15 var(--f-display); } .bh-t span { font-size: 12px; color: var(--muted); }
.bh-t.warn { border-color: color-mix(in srgb, var(--warn, #d97706) 55%, var(--line)); } .bh-t.warn b { color: var(--warn, #b45309); }
.bh-t.bad { border-color: color-mix(in srgb, var(--bad, #dc2626) 50%, var(--line)); } .bh-t.bad span { color: var(--bad, #dc2626); font-weight: 600; }
.bh-k .kpi-s { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.bh-d { font-weight: 700; font-size: 12.5px; color: var(--muted); white-space: nowrap; } .bh-d.up { color: var(--good, #16a34a); } .bh-d.dn { color: var(--bad, #dc2626); }
.bh-trend { width: 100%; height: auto; } .bh-trend .bh-cl { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; } .bh-trend .bh-ca { fill: color-mix(in srgb, var(--primary) 12%, transparent); stroke: none; }
.bh-trend .bh-pl { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; } .bh-trend .bh-dot { fill: var(--primary); } .bh-trend .bh-cbar { fill: var(--primary); } .bh-trend .bh-pbar { fill: color-mix(in srgb, var(--muted) 45%, transparent); }
.bh-leg { margin-top: 6px; } .bh-leg i { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--primary); vertical-align: middle; margin-right: 6px; border-radius: 0; background: none; } .bh-leg i.prev { border-top: 2px dashed var(--muted); }
.bh-cmp { display: grid; gap: 12px; } .bh-cr { display: grid; gap: 3px; text-decoration: none; color: inherit; min-width: 0; }
.bh-cn { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13.5px; } .bh-cn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } .bh-cn span { white-space: nowrap; font-weight: 600; }
.bh-bar { height: 9px; border-radius: 6px; background: var(--sunken); overflow: hidden; } .bh-bar i { display: block; height: 100%; border-radius: 6px; background: var(--primary); }
.bh-bar.prev { height: 5px; } .bh-bar.prev i { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.bh-pl-list { display: grid; gap: 4px; } .bh-p { display: grid; grid-template-columns: 22px 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; } .bh-p:last-child { border-bottom: 0; }
.bh-p .thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: var(--surface-2); } .bh-p b { font-size: 13.5px; display: block; overflow-wrap: anywhere; } .bh-p small { font-size: 12px; display: block; } .bh-p .r { text-align: right; white-space: nowrap; }
.bh-rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--good, #16a34a) 16%, var(--surface)); color: var(--good, #15803d); } .bh-rank.slow { background: color-mix(in srgb, var(--warn, #d97706) 18%, var(--surface)); color: var(--warn, #b45309); }
@media (max-width: 600px) { .bh-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } .bh-today { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bh-head .btn { display: none; } }

/* desktop tab strip never pushes the page wider than the window: tabs shrink with an ellipsis, "More" opens leftwards */
@media (min-width: 861px) { .tabs { min-width: 0; max-width: 100%; } .tabs > a { flex: 0 1 auto; min-width: 48px; overflow: hidden; text-overflow: ellipsis; } .tabmore { flex: none; } .tabmore .menu { left: auto; right: 0; } }

/* Home banner: headline figure with a chart that scales with the panel */
.bh-hero { align-items: stretch; } .bh-hero .hero-main { min-width: 0; } .bh-hero #bhsub { opacity: .9; } .bh-hero #bhatt { font-size: 14px; }
.bh-hstat { flex: 1 1 340px; max-width: 460px; min-width: 0; display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.bh-hstat .hero-sub b { font-weight: 800; } .bh-hstat .up { color: #8af0b4; } .bh-hstat .dn { color: #ffb0b0; }
.bh-hchart { width: 100%; height: clamp(64px, 9vw, 96px); display: block; margin-top: 6px; overflow: visible; }
.bh-hchart path { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; } .bh-hchart .c { stroke: #fff; stroke-width: 2.4; } .bh-hchart .a { fill: rgba(255,255,255,.16); stroke: none; } .bh-hchart .p { stroke: rgba(255,255,255,.6); stroke-width: 1.6; stroke-dasharray: 5 5; }
.bh-hleg { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; opacity: .85; } .bh-hleg i { display: inline-block; width: 16px; border-top: 2.4px solid #fff; vertical-align: middle; margin-right: 5px; } .bh-hleg i.p { border-top: 1.6px dashed rgba(255,255,255,.75); }
.bh-hmini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.18); }
.bh-hmini div { display: flex; flex-direction: column; min-width: 0; } .bh-hmini small { font-size: 11.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bh-hmini b { font: 750 1.05rem/1.2 var(--f-display); } .bh-hmini span { font-size: 11.5px; font-weight: 700; }
@media (max-width: 860px) { .bh-hero { flex-direction: column; gap: 14px; } .bh-hero .hero-main { flex: 0 0 auto; } .bh-hstat { max-width: none; flex: 0 0 auto; } }

/* Home banner: profit panel */
.bh-hstat .big.neg { color: #ffb0b0; }
.bh-pnl { display: grid; gap: 8px; margin-top: 8px; } .bh-pr { display: grid; gap: 3px; } .bh-pr small { font-size: 11.5px; opacity: .85; }
.bh-pb { display: flex; align-items: center; gap: 8px; min-width: 0; } .bh-pb i { display: block; height: 12px; border-radius: 6px; background: #fff; flex: 0 0 auto; max-width: calc(100% - 78px); transition: width .4s ease; }
.bh-pb i.cost { background: #ffcf86; } .bh-pb i.net { background: #8af0b4; } .bh-pb i.neg { background: #ffb0b0; } .bh-pb b { font-size: 12.5px; white-space: nowrap; }
.bh-pb.prev i { height: 6px; background: rgba(255,255,255,.45); } .bh-pb.prev b { font-weight: 500; opacity: .75; font-size: 11.5px; }
.bh-hnote { font-size: 11.5px; opacity: .8; margin-top: 6px; } .bh-hlink { color: #fff; font-size: 12.5px; font-weight: 600; margin-top: 6px; display: inline-flex; gap: 4px; align-items: center; text-underline-offset: 3px; }

/* Home banner, compact: greeting + period picker on one line, one row of figures, one line of notes */
.hero.bh-hero { display: block; padding: clamp(14px, 2vw, 20px) clamp(16px, 2.4vw, 24px); }
.bh-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.bh-hero h1 { font-size: clamp(1.25rem, 2.2vw, 1.7rem); margin: 2px 0 0; } .bh-hi { min-width: 0; }
.bh-pick { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; max-width: 100%; }
.bh-hero .seg { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); } .bh-hero .seg button { color: rgba(255,255,255,.88); padding: 6px 11px; font-size: 13px; }
.bh-hero .seg button.on { background: #fff; color: var(--ink, #0f172a); } .bh-hero .seg button[disabled] { opacity: .6; }
.bh-cmpline { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .95; max-width: 100%; min-width: 0; } .bh-cmpline > span { white-space: nowrap; opacity: .8; } .bh-cmpline .seg button { padding: 4px 9px; font-size: 12px; }
.bh-stats { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 10px; margin-top: 14px; }
.bh-st { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16); }
.bh-st small { font-size: 12px; opacity: .85; } .bh-st > b { font: 780 1.35rem/1.15 var(--f-display); white-space: nowrap; } .bh-st.lead > b { font-size: 1.75rem; } .bh-st > b.neg { color: #ffb0b0; }
.bh-sd { font-size: 11.5px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .bh-sd i { font-style: normal; font-weight: 800; } .bh-sd i.up { color: #8af0b4; } .bh-sd i.dn { color: #ffb0b0; } .bh-sd u { text-decoration: none; font-weight: 800; }
.bh-sb { display: block; height: 6px; border-radius: 4px; background: rgba(255,255,255,.10); margin-top: 5px; overflow: hidden; } .bh-sb i { display: block; height: 100%; border-radius: 4px; background: #fff; transition: width .4s ease; } .bh-sb i.neg { background: #ffb0b0; }
.bh-sb.prev { height: 3px; margin-top: 3px; } .bh-sb.prev i { background: rgba(255,255,255,.55); }
.bh-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; margin-top: 12px; font-size: 13px; } .bh-foot #bhsub { opacity: .85; } .bh-foot a { color: #fff; font-weight: 600; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.5); } .bh-foot > a { display: inline-flex; gap: 5px; align-items: center; text-decoration: none; opacity: .9; }
.bh-fline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .bh-fline .eyebrow { flex: none; }
@media (max-width: 900px) { .bh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bh-st.lead > b { font-size: 1.45rem; } .bh-pick { align-items: stretch; width: 100%; } .bh-top { align-items: stretch; } .bh-foot .grow { display: none; } }
@media (max-width: 420px) { .bh-st > b { font-size: 1.15rem; } .bh-st.lead > b { font-size: 1.3rem; } .bh-sd { font-size: 11px; } }

/* Home: cards fill their row (no orphan card), chart drawn at real size */
.bh .kpis, .bh .bh-today { display: flex; flex-wrap: wrap; } .bh .kpis > * { flex: 1 1 165px; } .bh .bh-today > * { flex: 1 1 128px; }
.bh-tw { overflow: hidden; } .bh-tw .bh-trend { display: block; width: 100%; height: auto; max-width: 100%; } .bh-trend .bh-val { font-size: 11px; font-weight: 700; fill: var(--ink-2); }
@media (max-width: 600px) { .bh .kpis > *, .bh .bh-today > * { flex: 1 1 calc(50% - 10px); } }

/* Home banner: figures are links to the detail; the two "open" buttons stay together */
a.bh-st { text-decoration: none; color: inherit; transition: background .15s, transform .15s; } a.bh-st:hover, a.bh-st:focus-visible { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.bh-st small { display: flex; justify-content: space-between; align-items: center; gap: 6px; } .bh-st small em { opacity: .55; display: inline-flex; } .bh-st small em .i { width: 14px; height: 14px; } a.bh-st:hover small em { opacity: 1; }
.bh-foot { align-items: center; } .bh-links { display: inline-flex; gap: 8px; margin-left: auto; flex: none; flex-wrap: wrap; } .bh-links .btn { white-space: nowrap; }
@media (max-width: 900px) { .bh-links { margin-left: 0; width: 100%; } .bh-links .btn { flex: 1 1 auto; justify-content: center; } }

.bh-note { font-style: normal; opacity: .8; font-size: 12px; }

/* Shop cart bar: the wrapper floats above the footer (the bar itself is replaced on every + / −, and a sticky
   element can only float inside its own parent, so the bar alone stayed at the end of the list) */
#cartslot { position: sticky; bottom: 12px; z-index: 15; }
#cartslot:empty { display: none; }
#cartslot .cartbar { position: static; }
@media (max-width: 860px) { #cartslot { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); } #cartslot .cartbar { flex-wrap: nowrap; gap: 10px; padding: 10px 12px; } #cartslot .cartbar .grow { min-width: 0; } #cartslot .cartbar b { white-space: nowrap; } }

/* supplier at a glance */
.s360 .s3-h { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.s3-list { display: grid; gap: 6px; } .s3-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.s3-row .grow { min-width: 0; display: flex; flex-direction: column; } .s3-row small { font-size: 12px; } .s3-row .r { text-align: right; display: flex; flex-direction: column; white-space: nowrap; }
@media (max-width: 600px) { .s3-row { flex-wrap: wrap; } .s3-row .btn { flex: 1 1 100%; justify-content: center; } }

/* record header: the name keeps a readable width; when the buttons do not fit beside it they move to their own row */
.rec-head > .grow { flex: 1 1 280px; min-width: min(280px, 100%); } .rec-head > .grow h1 { overflow-wrap: anywhere; }
.rec-head > .actbar { flex: 0 1 auto; justify-content: flex-end; max-width: 100%; }
@media (max-width: 1100px) { .rec-head > .actbar { flex-basis: 100%; justify-content: flex-start; } }

/* ---------- quick guide: tour, help, next step ---------- */
.tour { position: fixed; inset: 0; z-index: 9000; }
.tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .62); outline: 3px solid var(--accent, #f59e0b); outline-offset: 2px; transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-card { position: fixed; background: var(--surface); color: var(--text); border-radius: 16px; padding: 16px 16px 12px; box-shadow: 0 18px 48px rgba(0, 0, 0, .32); transition: left .25s, top .25s; }
.tour-card h3 { margin: 4px 0 6px; font-size: 1.08rem; } .tour-card p { margin: 0 0 10px; line-height: 1.5; font-size: 14.5px; }
.tour-card .row { gap: 6px; flex-wrap: wrap; }
.tour-dots { display: flex; gap: 5px; margin: 4px 0 10px; } .tour-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); } .tour-dots i.on { width: 18px; background: var(--primary); }
.tour-fl { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 8px; } .tour-fl li small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.tour-invite, .next-card { position: fixed; z-index: 800; right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); display: flex; gap: 10px; align-items: flex-start; padding: 12px 10px 12px 14px; border-radius: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, .22); animation: tiIn .3s ease; }
.tour-invite p, .next-card p { margin: 2px 0 8px; font-size: 13.5px; line-height: 1.45; } .next-card p { margin: 2px 0 0; } .next-card small { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.next-card { align-items: center; border-left: 4px solid var(--primary); }
.ti-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); flex: none; }
@keyframes tiIn { from { transform: translateY(12px); opacity: 0; } }
@media (max-width: 860px) { .tour-invite, .next-card { left: 16px; right: 16px; width: auto; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
.gh-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; } .gh-nav .gh-tour { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.gh-card h3 { margin: 0 0 10px; font-size: 1.15rem; }
.gh-sec { margin: 0 0 12px; } .gh-sec > b, .gh-next > b { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.gh-sec p, .gh-next p { margin: 4px 0 0; line-height: 1.5; } .gh-sec ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; line-height: 1.45; }
.gh-next { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 8%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); margin: 0 0 12px; display: grid; gap: 6px; justify-items: start; }
.gh-flow { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; background: var(--surface); } .gh-flow summary { cursor: pointer; padding: 12px 14px; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .gh-flow summary::-webkit-details-marker { display: none; }
.gh-steps { list-style: none; margin: 0; padding: 0 14px 12px; display: grid; gap: 10px; }
.gh-steps li { display: flex; gap: 10px; opacity: .72; } .gh-steps li.can { opacity: 1; } .gh-steps li.here .gh-n { background: var(--accent, #f59e0b); }
.gh-steps p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.45; }
.gh-n { width: 24px; height: 24px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; margin-top: 1px; }
.gh-go { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; font-weight: 700; margin-top: 4px; }
.gh-app { margin: 0 0 12px; } .gh-row { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: inherit; cursor: pointer; font: inherit; } .gh-row:hover { background: var(--surface-2); } .gh-row small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
/* the "what's next" card sits above the toast area so the success message and the next step are both readable */
.next-card { bottom: 92px; }
@media (max-width: 860px) { .next-card { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }
.gh-next.other { background: var(--surface-2); border-color: var(--line); } .gh-next .pill, .next-card .nx-by { display: inline-flex; gap: 5px; align-items: center; margin-top: 6px; font-weight: 700; }
/* "Needs your attention" stays one line: it scrolls sideways instead of making the banner taller */
.bh-foot #bhatt { flex: 1 1 260px; min-width: 0; white-space: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); padding-right: 18px; }
.bh-foot #bhatt::-webkit-scrollbar { display: none; }
.bh-foot #bhatt { order: 3; flex-basis: 100%; }
/* login showcase: transparent pack cut-outs, all the same height so bags and buckets line up */
.showcase { gap: 14px; flex-wrap: nowrap; overflow: hidden; }
.showcase img { width: auto; height: clamp(96px, 11vw, 150px); max-width: 22%; object-fit: contain; }
/* transparent cut-outs need no "multiply" (that hid white photo backgrounds, but darkens packs on the dark login page) */
img[src*="/sku/cut/"] { mix-blend-mode: normal; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .5)) !important; }
/* a dashboard list that needs action now (raw material to buy): red frame and header, the "to buy" column stands out */
.card.list-bad { border: 1.5px solid color-mix(in srgb, var(--bad) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 10%, transparent), var(--shadow); }
.card.list-bad > .card-h { background: color-mix(in srgb, var(--bad) 9%, var(--surface)); border-radius: 12px 12px 0 0; }
.card.list-bad > .card-h h3 { color: var(--bad); display: flex; align-items: center; gap: 8px; }
.card.list-bad .list-note { margin: 10px 18px 2px; font-size: 13.5px; color: var(--ink-2, var(--muted)); }
.card.strong-1 tbody td:nth-child(2) { font-weight: 800; color: var(--bad); }
.card.list-bad tbody td:first-child a { font-weight: 600; }
/* phones: the "act now" tables at the top of the dashboard become stacked cards — every column readable, no sideways scroll */
@media (max-width: 640px) {
  .card.list-top .tbl-wrap { overflow: visible; }
  .card.list-top table.tbl, .card.list-top .tbl tbody { display: block; }
  .card.list-top .tbl thead { display: none; }
  .card.list-top .tbl tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .card.list-top .tbl td { display: flex; flex-direction: column; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .card.list-top .tbl td::before { content: attr(data-l); font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .card.list-top .tbl td:first-child { grid-column: 1 / -1; font-size: 15px; font-weight: 700; }
  .card.list-top .tbl td:first-child::before { display: none; }
  .card.list-top .tbl td[data-l=""]::before { display: none; }
  .card.list-top .tbl td:has(.cell-btn) { grid-column: 1 / -1; }
  .card.list-top .tbl td a.cell-btn { display: inline-flex; justify-content: center; padding: 8px 12px; border-radius: 10px; background: var(--primary); color: #fff; text-decoration: none; font-weight: 700; }
  .card.list-top .list-note { margin: 8px 14px 0; }
}
/* action links in dashboard tables (Dispatch →, Pack →, Order from …) look like small buttons */
a.cell-btn { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 8px; background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); font-weight: 700; text-decoration: none; white-space: nowrap; }
a.cell-btn:hover { background: var(--primary); color: #fff; }

/* ---------- WhatsApp: chat panel, inbox, suggestion review ---------- */
.wa { overflow: hidden; display: flex; flex-direction: column; }
.wa-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #075e54; color: #fff; flex-wrap: wrap; }
.wa-h small { display: block; opacity: .85; font-size: 12px; } .wa-h b { font-size: 15px; }
.wa-av { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; background: rgba(255,255,255,.18); font-weight: 800; font-size: 13px; flex: none; }
.wa-list .wa-av, .wa-row .wa-av { background: color-mix(in srgb, #25d366 18%, var(--surface)); color: #075e54; }
.wa-tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; background: rgba(255,255,255,.18); color: #fff; }
.wa-tag.closed { background: #f97316; } .wa-tag.open { background: #16a34a; } .wa-tag.co { background: #7c3aed; } .wa-tag.api { background: #0e7490; }
.wa-tabs { padding: 8px 12px 0; flex-wrap: wrap; } .wa-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #25d366; color: #fff; font-style: normal; font-size: 11px; font-weight: 800; }
.wa-from { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); font-size: 13px; } .wa-from select { flex: 1; min-width: 0; }
.wa-body { background: #efeae2; padding: 14px 12px; max-height: 460px; min-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
:root[data-theme="dark"] .wa-body { background: #0b141a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-body { background: #0b141a; } }
.wa-m { max-width: min(78%, 520px); padding: 7px 10px 5px; border-radius: 10px; background: #fff; color: #111b21; box-shadow: 0 1px 1px rgba(0,0,0,.08); align-self: flex-start; overflow-wrap: anywhere; }
.wa-m.out { align-self: flex-end; background: #d9fdd3; }
.wa-t { font-size: 14px; line-height: 1.45; } .wa-au { display: block; font-size: 12px; color: #0e7490; margin-bottom: 2px; }
.wa-meta { font-size: 11px; color: #667781; text-align: right; margin-top: 2px; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.wa-src { font-weight: 800; color: #b45309; text-transform: uppercase; font-size: 10px; letter-spacing: .04em; } .wa-tick.read { color: #53bdeb; } .wa-tick.failed { color: #dc2626; }
.wa-media { font-size: 13px; display: flex; gap: 6px; align-items: center; color: #3b4a54; margin-bottom: 2px; }
.wa-sug { display: grid; gap: 4px; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.7); border: 1px dashed #94a3b8; text-decoration: none; color: #111b21; font-size: 13px; }
.wa-sug.new { border: 1.5px solid #f59e0b; background: #fffbeb; } .wa-sug small { color: #475569; } .wa-sug .btn { justify-self: start; }
.wa-foot { padding: 10px 12px; display: grid; gap: 8px; border-top: 1px solid var(--line); background: var(--surface); }
.wa-comp { display: flex; gap: 8px; align-items: flex-end; } .wa-comp textarea { flex: 1; resize: vertical; min-height: 40px; max-height: 160px; }
.wa-closed { padding: 10px 12px; border-radius: 10px; background: #fee2e2; color: #991b1b; font-size: 13.5px; }
.wa-tp { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; } .wa-tp > div { display: grid; gap: 6px; flex: 1; } .wa-tp small { color: var(--muted); }
.wa-inbox { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 14px; align-items: start; }
.wa-list .wa-rows { max-height: 70vh; overflow-y: auto; } .wa-list .card-b { border-bottom: 1px solid var(--line); }
.wa-row { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; color: inherit; font: inherit; align-items: flex-start; }
.wa-row:hover, .wa-row.on { background: var(--surface-2); } .wa-row .grow { min-width: 0; display: grid; gap: 1px; } .wa-row small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-r { display: grid; justify-items: end; gap: 4px; flex: none; } .wa-r small { font-size: 11px; color: var(--muted); } .wa-pend { color: #b45309; font-weight: 700; }
.wa-quote { margin: 12px 0 0; padding: 12px 14px; border-left: 4px solid #25d366; background: #f0fdf4; border-radius: 8px; color: #14532d; font-size: 14.5px; line-height: 1.5; }
@media (max-width: 860px) { .wa-inbox { grid-template-columns: 1fr; } .wa-inbox.has-open .wa-list { display: none; } .wa-inbox:not(.has-open) .wa-pane { display: none; } .wa-body { max-height: 58vh; } .wa-m { max-width: 88%; } }
@media (max-width: 600px) { .wa-h .grow { flex: 1 1 calc(100% - 50px); } .wa-h .wa-tag { margin-left: 46px; } .wa-h .wa-tag + .wa-tag { margin-left: 0; } }
/* review screen on phones: each item is a small card — product on top, then packs, rate, amount */
@media (max-width: 640px) {
  .wa-lines, .wa-lines tbody { display: block; } .wa-lines thead { display: none; }
  .wa-lines tr { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .wa-lines td { display: block; padding: 0; border: 0; min-width: 0 !important; }
  .wa-lines td:first-child { grid-column: 1 / -1; } .wa-lines td:first-child select { width: 100%; }
}
.wac-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); } .wac-row .grow { display: grid; gap: 2px; min-width: 220px; } .wac-row small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; } .wac-row .in { width: 220px; }
.wac-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; } .wac-opt { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 8px; align-content: start; } .wac-opt p { margin: 0; font-size: 13.5px; }
.wa-tag.dark { color: #fff; }
@media (max-width: 600px) { .wac-row .in { width: 100%; } }

/* ---------- Travel Map ---------- */
.trk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.trk-map { height: min(68vh, 620px); border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; z-index: 0; }
.trk-map.nomap { display: grid; place-items: center; }
.trk-side .card-b { max-height: min(68vh, 620px); overflow: auto; }
.trk-row { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.trk-row:hover { background: var(--surface-2); }
.trk-row small { display: block; color: var(--muted); font-size: 12px; }
.trk-row .r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.trk-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--sunken); color: var(--ink-2); flex: none; }
.trk-av.good { background: var(--good-soft); color: var(--good); } .trk-av.info { background: var(--info-soft); color: var(--info); } .trk-av.warn { background: var(--warn-soft); color: var(--warn); } .trk-av.bad { background: var(--bad-soft); color: var(--bad); }
.trk-pin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--f-body, system-ui); color: #fff; background: #64748b; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.trk-pin.s-good { background: #11804a; } .trk-pin.s-info, .trk-pin.s-stop { background: #2563c9; } .trk-pin.s-warn { background: #b26b00; } .trk-pin.s-bad { background: #c42b2b; } .trk-pin.s-idle { background: #64748b; }
.trk-pin.s-visit { background: #7c3aed; } .trk-pin.s-start { background: #0f766e; } .trk-pin.s-end { background: #334155; } .trk-pin.old { opacity: .6; }
.trk-pin.now { animation: trkpulse 2s infinite; }
@keyframes trkpulse { 0% { box-shadow: 0 0 0 0 rgba(17,128,74,.5); } 70% { box-shadow: 0 0 0 12px rgba(17,128,74,0); } 100% { box-shadow: 0 0 0 0 rgba(17,128,74,0); } }
.trk-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.trk-kpis > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.trk-kpis b { font-size: 20px; } .trk-kpis small { font-size: 12px; color: var(--ink-2); }
.trk-kpis > div.warn { border-color: var(--warn); background: var(--warn-soft); }
.trk-tl { display: flex; flex-direction: column; gap: 0; padding: 6px 0 !important; }
.trk-ev { display: grid; grid-template-columns: 62px 1fr; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.trk-ev[data-stop] { cursor: pointer; } .trk-ev[data-stop]:hover { background: var(--surface-2); }
.trk-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--info); color: #fff; font-size: 11px; font-weight: 700; }
.warn-t { color: var(--warn); } .bad-t { color: var(--bad); }
tr.sel td { background: var(--surface-2); }
.trk-chip { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.12); font-size: 12px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.trk-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: trkpulse 2s infinite; }
.trk-chip.off { color: var(--bad); border-color: var(--bad); } .trk-chip.off .dot { background: var(--bad); animation: none; }
@media (min-width: 861px) { .trk-chip { bottom: 16px; left: auto; right: 16px; transform: none; } }
@media (max-width: 860px) {
  .trk-grid { grid-template-columns: 1fr; }
  .trk-map { height: 52vh; }
  .trk-side .card-b { max-height: none; }
  .trk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.trk-dnav { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.dp-in { display: flex; align-items: center; gap: 4px; flex: none; } .dp-in span { color: var(--muted); font-size: 13px; }
.dp-in .in { width: 104px; text-align: right; padding: 6px 8px; }
.dp-row.changed { background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.dp-src { min-width: 92px; } .dp-err { color: var(--bad); font-size: 12px; } .dp-err:empty { display: none; }
.dp-save { position: sticky; bottom: 8px; z-index: 5; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--warn); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
@media (max-width: 600px) { .dp-row { flex-wrap: wrap; } .dp-row .grow { flex: 1 1 100%; } .dp-src { flex: 1; min-width: 0; align-items: flex-start; } .dp-src small { text-align: left; max-width: none; } }
.dp-save[hidden] { display: none; }
@media (max-width: 860px) { .dp-save { bottom: calc(92px + env(safe-area-inset-bottom)); } }

/* ---------- pack labels & scanning ---------- */
.lbl-preview { max-height: 46vh; overflow: auto; background: var(--surface-2); border-radius: 10px; padding: 10px; }
.labels { display: flex; flex-wrap: wrap; gap: 8px; }
.lbl { width: 50mm; height: 25mm; box-sizing: border-box; padding: 1.4mm 1.8mm; background: #fff; color: #000; border: 1px dashed #bbb; border-radius: 2px; display: grid; grid-template-columns: 1fr 15.5mm; grid-template-rows: 1fr auto; column-gap: 1.5mm; overflow: hidden; font: 6.6pt/1.18 system-ui, sans-serif; }
.lbl-t { min-width: 0; display: flex; flex-direction: column; gap: .2mm; } .lbl-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbl-t .lbl-p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lbl-q { width: 15.5mm; height: 15.5mm; align-self: start; } .lbl-q svg { width: 100%; height: 100%; display: block; }
.lbl-s { grid-column: 1 / -1; font: 700 8.4pt/1 ui-monospace, Menlo, monospace; letter-spacing: .3px; text-align: center; padding-top: .6mm; white-space: nowrap; }
.labels.a4 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; } .labels.a4 .lbl { width: auto; height: 33mm; grid-template-columns: 1fr 21mm; font-size: 8pt; } .labels.a4 .lbl-q { width: 21mm; height: 21mm; } .labels.a4 .lbl-s { font-size: 10pt; }
@media print {
  body.printing-labels * { visibility: hidden; }
  body.printing-labels .labels, body.printing-labels .labels * { visibility: visible; }
  body.printing-labels .labels { position: absolute; left: 0; top: 0; gap: 0; }
  body.printing-labels .labels.roll .lbl { border: 0; page-break-after: always; break-after: page; margin: 0; }
  body.printing-labels .labels.a4 { width: 100%; gap: 3mm; } body.printing-labels .labels.a4 .lbl { border: 0; break-inside: avoid; }
}
.scan-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12.5px; }
.scan-cam { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; } .scan-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.trc-tl { display: flex; flex-direction: column; gap: 0; }
.trc-ev { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 8px 0; position: relative; }
.trc-ev::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.trc-ev:first-child::before { top: 14px; } .trc-ev:last-child::before { bottom: calc(100% - 14px); }
.trc-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--good); border: 2px solid var(--surface); position: relative; z-index: 1; }
.trc-ev.out .trc-dot { background: var(--info); } .trc-ev.bad .trc-dot { background: var(--bad); }
.trc-ev small { display: block; }

/* ---------- Sync ---------- */
.sy-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px !important; }
.sy-st { display: flex; align-items: center; gap: 10px; } .sy-st .i { width: 28px; height: 28px; padding: 5px; border-radius: 50%; }
.sy-st.on .i { background: var(--good-soft); color: var(--good); } .sy-st.off .i { background: var(--warn-soft); color: var(--warn); }
.sy-st small { display: block; }
.sy-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm, 10px); overflow: hidden; }
.sy-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); } .sy-row:last-child { border-bottom: 0; }
.sy-row .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .sy-row.bad { background: color-mix(in srgb, var(--bad-soft) 55%, var(--surface)); }
.sy-err { color: var(--bad); } .sy-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.offline.bad { background: var(--bad); color: #fff; }
@media (max-width: 600px) { .sy-row { flex-wrap: wrap; } .sy-acts { width: 100%; justify-content: flex-start; } }
.offline.ok { background: var(--good-soft); color: var(--good); }
.offbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--warn-soft); color: var(--warn); font-size: 13px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.offbar[hidden] { display: none; } .offbar span { flex: 1; min-width: 0; } .offbar a { font-weight: 700; color: inherit; }
.sy-pref { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; } .sy-pref input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.sy-pref span { display: flex; flex-direction: column; gap: 2px; }
.sy-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; } .sy-counts > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; } .sy-counts b { font-size: 18px; } .sy-counts small { color: var(--ink-2); font-size: 12px; }

.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--primary, #1f3b73); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* pack label with a Code 128 barcode under the text + QR */
.lbl.codes-both, .lbl.codes-bar { grid-template-rows: 1fr 5.2mm auto; }
.lbl.codes-both { grid-template-columns: 1fr 11.5mm; } .lbl.codes-both .lbl-q { width: 11.5mm; height: 11.5mm; }
.lbl.codes-bar { grid-template-columns: 1fr; }
.lbl-b { grid-column: 1 / -1; height: 5.2mm; margin-top: .4mm; } .lbl-b svg { width: 100%; height: 100%; display: block; }
.lbl.codes-both .lbl-s, .lbl.codes-bar .lbl-s { font-size: 7.2pt; padding-top: .3mm; }
.labels.a4 .lbl.codes-both { grid-template-columns: 1fr 16mm; grid-template-rows: 1fr 7mm auto; } .labels.a4 .lbl.codes-both .lbl-q { width: 16mm; height: 16mm; }
.labels.a4 .lbl.codes-bar { grid-template-rows: 1fr 8mm auto; } .labels.a4 .lbl-b { height: auto; }
