/* AHA manager panel — "the parts counter" (Apple-calm finish, Muhammad 2026-11-22).
   A calm paper workspace for a busy counter: ink text, hairline ledger rules, the logo orange only for
   the one main action and focus, and the logo navy for the "ticket stub" that carries every total.
   Part numbers are stamped in mono; money is tabular. Every colour comes from the tokens below. */
/* Apple-calm: system grey canvas, white sheets, near-black ink, generous space; the logo orange
   only for the main action and focus, the logo navy only for small brand touches. */
:root {
  --paper: #F5F5F7; --sheet: #FFFFFF; --inset: #F2F2F5; --hover: rgba(0, 0, 0, .04);
  --ink: #1D1D1F; --ink-2: #424245; --ink-3: #6E6E73; --ink-4: #A1A1A6;
  --rule: rgba(0, 0, 0, .07); --rule-2: rgba(0, 0, 0, .12); --rule-field: rgba(0, 0, 0, .14);
  --act: #E87E1E; --act-ink: #1D1D1F; --act-hover: #DA7215; --act-soft: rgba(232, 126, 30, .12); --act-text: #B25A0E;
  --stub: #FFFFFF; --stub-ink: #1D1D1F; --stub-mute: #6E6E73; --stub-rule: rgba(0, 0, 0, .1);
  --navy: #2B1A6E; --navy-soft: rgba(43, 26, 110, .08); --navy-text: #2B1A6E;
  --gold: #B8860B;
  --ok: #248A3D; --ok-soft: rgba(52, 199, 89, .14); --warn: #B25000; --warn-soft: rgba(255, 149, 0, .14); --bad: #D70015; --bad-soft: rgba(255, 59, 48, .12);
  --r-xs: 7px; --r-sm: 10px; --r: 18px; --r-lg: 22px;
  --lift: 0 0 0 .5px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04), 0 12px 32px -12px rgba(0, 0, 0, .08);
  --pop: 0 0 0 .5px rgba(0, 0, 0, .08), 0 20px 50px -12px rgba(0, 0, 0, .25);
  --side: 248px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #000000; --sheet: #1C1C1E; --inset: #2C2C2E; --hover: rgba(255, 255, 255, .06);
    --ink: #F5F5F7; --ink-2: #D1D1D6; --ink-3: #98989D; --ink-4: #636366;
    --rule: rgba(255, 255, 255, .08); --rule-2: rgba(255, 255, 255, .14); --rule-field: rgba(255, 255, 255, .16);
    --act: #F0913A; --act-ink: #1C1206; --act-hover: #F49E4D; --act-soft: rgba(240, 145, 58, .18); --act-text: #FFB571;
    --stub: #1C1C1E; --stub-ink: #F5F5F7; --stub-mute: #98989D; --stub-rule: rgba(255, 255, 255, .12);
    --navy-soft: rgba(140, 124, 240, .16); --navy-text: #B3A8F5; --gold: #FFD60A;
    --ok: #30D158; --ok-soft: rgba(48, 209, 88, .16); --warn: #FF9F0A; --warn-soft: rgba(255, 159, 10, .16); --bad: #FF453A; --bad-soft: rgba(255, 69, 58, .16);
    --lift: 0 0 0 .5px rgba(255, 255, 255, .1); --pop: 0 0 0 .5px rgba(255, 255, 255, .12), 0 24px 60px rgba(0, 0, 0, .6);
    color-scheme: dark; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 14px/1.47 -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ic { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.boot { padding: 48px; text-align: center; color: var(--ink-3); }
.logo-dot { fill: var(--navy); }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }

/* Part number stamp: the one place mono type appears, so a part number reads as a part number. */
input.mono { font-family: var(--mono); letter-spacing: .02em; }
.stamp { font: 600 12px/1 var(--mono); letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; white-space: nowrap;
  display: inline-block; padding: 3px 6px; border-radius: var(--r-xs); color: var(--ink-2);
  background: var(--inset); box-shadow: inset 0 0 0 1px var(--rule-2); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { border-inline-end: .5px solid var(--rule-2); background: color-mix(in srgb, var(--sheet) 62%, transparent); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand b { font-size: 15px; letter-spacing: .04em; font-weight: 750; }
.brand small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 500; }
/* The two areas: the shop's books and the customer apps (one tap between them). */
.area-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 14px 0 4px; border-radius: var(--r-sm);
  background: var(--inset); }
.area-switch a { display: flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 6px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-align: center; line-height: 1.2; text-decoration: none; }
.area-switch a:hover { color: var(--ink); }
.area-switch a.on { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .08); }
.area-switch a:focus-visible { outline: 2px solid var(--act); outline-offset: 1px; }
.nav-group { margin-top: 14px; }
.nav-group > span { display: block; font-size: 11px; font-weight: 600; color: var(--ink-4); padding: 0 10px 6px; }
.nav { display: grid; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2);
  text-decoration: none; font-weight: 500; transition: background-color .15s var(--ease), color .15s var(--ease); }
.nav a .ic { color: var(--ink-3); }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--act-soft); color: var(--ink); font-weight: 650; }
.nav a[aria-current="page"] .ic { color: var(--act); }
.side-foot { margin-top: auto; padding: 12px 6px 0; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--rule); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-soft); color: var(--navy-text); display: grid;
  place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-foot .who { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who small { color: var(--ink-3); display: block; font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px clamp(16px, 3vw, 32px);
  border-bottom: .5px solid var(--rule-2); }
.topbar h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.crumb { color: var(--ink-3); text-decoration: none; display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--r-sm); }
.crumb:hover { background: var(--hover); color: var(--ink); }
.content { padding: 28px clamp(16px, 3.5vw, 40px) 80px; max-width: 1360px; width: 100%; }

.sync { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px;
  font-weight: 600; background: transparent; color: var(--ok); border: 1px solid var(--rule); cursor: default; white-space: nowrap; }
.sync.off { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.sync.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; cursor: pointer; }
.sync.wait { background: var(--navy-soft); color: var(--navy-text); border-color: transparent; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: var(--sheet);
  box-shadow: var(--lift); border-radius: 999px; padding: 0 16px; min-height: 38px; cursor: pointer; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: transform .12s var(--ease), background-color .15s var(--ease); }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--act); color: var(--act-ink); box-shadow: none; }
.btn.primary:hover { background: var(--act-hover); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 16px; }
.btn.block { width: 100%; }
.icon-btn { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer;
  display: inline-grid; place-items: center; color: var(--ink-3); position: relative; }
.icon-btn::after { content: ""; position: absolute; inset: -6px; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.bad:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- Sheets (cards) ---------- */
.card { background: var(--sheet); border-radius: var(--r); box-shadow: var(--lift); }
.card.pad { padding: 18px 20px; }
.pad-in { padding: 16px 20px; }
.card-h { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 12px 22px; border-bottom: .5px solid var(--rule-2); }
.card-h h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.section { margin-top: 20px; }
.section > h2 { font-size: 14.5px; margin: 0 0 10px; font-weight: 700; }
.foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--rule); flex-wrap: wrap; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px;
  font-weight: 650; background: var(--inset); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.navy { background: var(--navy-soft); color: var(--navy-text); }

/* ---------- Overview ---------- */
.greet { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.greet h2 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.greet p { margin: 2px 0 0; color: var(--ink-3); }
.greet .row { margin-inline-start: auto; }

.ledger { display: grid; grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr)); overflow: hidden; }
.ledger > div { padding: 24px 26px; min-width: 0; }
.ledger > div + div { border-inline-start: 1px solid var(--rule); }
.ledger .lab { font-size: 12px; font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.ledger .fig { font-size: 24px; font-weight: 650; margin-top: 10px; letter-spacing: -.02em; }
.ledger .alt { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.ledger a.lnk { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.ledger a.lnk:hover { color: var(--ink); }
.ledger .hero { background: transparent; }
.ledger .hero .lab { color: var(--act-text); }
.ledger .hero .fig { font-size: clamp(28px, 2.9vw, 42px); font-weight: 700; margin-top: 8px; letter-spacing: -.03em; }


.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-top: 20px; }
.attn { display: grid; }
.attn a, .attn > div { display: flex; align-items: center; gap: 12px; padding: 12px 20px; text-decoration: none; min-height: 56px; }
.attn > * + * { border-top: 1px solid var(--rule); }
.attn a:hover { background: var(--hover); }
.attn .ico { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none;
  background: var(--inset); color: var(--ink-2); }
.attn .ico.warn { background: var(--warn-soft); color: var(--warn); }
.attn .ico.bad { background: var(--bad-soft); color: var(--bad); }
.attn .ico.navy { background: var(--navy-soft); color: var(--navy-text); }
.attn .ico.ok { background: var(--ok-soft); color: var(--ok); }
.attn .t { flex: 1; min-width: 0; }
.attn .t b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .t small { color: var(--ink-3); }
.attn .v { font-weight: 700; }

/* ---------- Invoices: document tabs (Sahl's order) ---------- */
.doc-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 16px; background: var(--inset); border-radius: 12px;
  scrollbar-width: none; }
.doc-tabs .tab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 9px;
  text-decoration: none; font-weight: 600; color: var(--ink-3); white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.doc-tabs a.tab:hover { color: var(--ink); background: var(--hover); }
.doc-tabs .tab[aria-current="page"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.doc-tabs .tab.soon { color: var(--ink-4); cursor: default; }
.doc-tabs .tab small { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--sheet); color: var(--ink-4); }
.grid4 { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: end; }
.grid4 .seg { display: flex; } .grid4 .seg button { flex: 1; padding: 0 8px; white-space: nowrap; }
.print-only { display: none; }
select.auto { width: auto; }

/* ---------- Tables (ledger rules, no boxes) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: start; vertical-align: middle; }
th:first-child, td:first-child { padding-inline-start: 22px; }
th:last-child, td:last-child { padding-inline-end: 22px; }
tbody td { border-top: .5px solid var(--rule-2); }
thead th { font-size: 12px; color: var(--ink-3); font-weight: 600; background: var(--sheet); white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
td.end, th.end { text-align: end; }
td.strong { font-weight: 650; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--rule); align-items: center; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search .ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-inline-start: 36px; width: 100%; }
.seg { display: inline-flex; background: var(--inset); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 30px; padding: 0 12px; border-radius: 6px; cursor: pointer; font-weight: 600;
  color: var(--ink-3); transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

/* ---------- Fields: inset, they receive content ---------- */
label.f, div.f { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; align-content: start; }
.f > span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.f .hint { font-weight: 500; color: var(--ink-3); font-size: 12px; }
input, select, textarea { background: var(--inset); border: 0; box-shadow: none;
  border-radius: var(--r-sm); padding: 0 12px; min-height: 38px; width: 100%; font-size: 14px;
  transition: box-shadow .15s var(--ease), background-color .15s var(--ease); }
textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--act), 0 0 0 3px var(--act-soft); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--act); box-shadow: none; }
.grid2 { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid3 { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.err { background: var(--bad-soft); color: var(--bad); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 600;
  display: flex; gap: 8px; align-items: center; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; font-weight: 600;
  display: flex; gap: 8px; align-items: center; }
.okbox { background: var(--ok-soft); color: var(--ok); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 600;
  display: flex; gap: 8px; align-items: center; }
label.date { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
label.date input { width: auto; min-height: 34px; }

/* ---------- Counter (invoice editor) ---------- */
.counter { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 20px; align-items: start; }
.counter-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.doc-head { display: grid; gap: 14px 16px; grid-template-columns: minmax(220px, 2fr) auto minmax(160px, 1fr); align-items: end; padding: 16px 20px; }

/* The scan bar: the focal point of a sale. Scan, type a name or a part number, press Enter. */
.scan .bar { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; border-radius: var(--r);
  background: var(--sheet); box-shadow: var(--lift); }
.scan .bar:focus-within { box-shadow: 0 0 0 1px var(--act), 0 0 0 4px var(--act-soft); }
.scan .bar .ic { color: var(--ink-3); }
.scan .bar .combo { flex: 1; align-self: stretch; display: flex; position: static; }
.scan { position: relative; z-index: 5; }
.scan .combo .list { inset-inline: 0; }
.scan .bar input { border: 0; box-shadow: none; background: transparent; min-height: 0; height: 100%; padding: 0; font-size: 17px; font-weight: 500; }
.scan .bar input:focus { box-shadow: none; background: transparent; }
.scan kbd { font: 600 11px var(--mono); color: var(--ink-3); padding: 3px 6px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--rule-2); white-space: nowrap; }
.combo { position: relative; }
.combo .list { position: absolute; inset-inline: 0; top: calc(100% + 6px); background: var(--sheet); border-radius: var(--r);
  box-shadow: var(--pop); max-height: 380px; overflow: auto; z-index: 30; padding: 6px; transform-origin: top center;
  animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.98) translateY(-4px); } }
.combo .opt { padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 3px 16px; align-items: center; }
.combo .opt .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo .opt .meta { grid-column: 1; display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 12.5px; }
.combo .opt .pr { grid-row: 1 / span 2; grid-column: 2; font-weight: 650; }
.combo .opt .st { grid-row: 1 / span 2; grid-column: 3; }
.combo .opt[aria-selected="true"], .combo .opt:hover { background: var(--act-soft); }
.combo .none { padding: 14px; color: var(--ink-3); text-align: center; }

.lines td, .lines th { padding: 10px 8px; }
.lines td:first-child, .lines th:first-child { padding-inline-start: 22px; }
.lines td:last-child, .lines th:last-child { padding-inline-end: 14px; }
.lines .no { width: 40px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.lines .nm b { display: block; font-weight: 650; }
.lines .nm .meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; color: var(--ink-3); font-size: 12px; }
.lines input { min-height: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.lines .price input { width: 104px; }
.lines input.need { box-shadow: inset 0 0 0 1.5px var(--warn); background: var(--warn-soft); }
.lines .sum { text-align: end; font-weight: 700; white-space: nowrap; }
.lines .rm { width: 48px; text-align: end; }
.stepper { display: inline-flex; align-items: center; border-radius: 999px; background: var(--inset); overflow: hidden; }
.stepper button { width: 30px; height: 34px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 16px; font-weight: 600; }
.stepper button:hover { color: var(--ink); background: var(--hover); }
.stepper input { width: 44px; box-shadow: none; background: transparent; border-radius: 0; padding: 0 4px; }
.stepper input:focus { box-shadow: none; background: var(--sheet); }
.lines-empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.lines-empty b { display: block; color: var(--ink-2); font-size: 14.5px; margin-bottom: 2px; }

/* The ticket stub: every total lives here, always in view. Perforated top edge. */
.stub { position: sticky; top: 88px; background: var(--stub); color: var(--stub-ink); border-radius: var(--r-lg); padding: 24px 22px 22px;
  display: grid; gap: 14px; box-shadow: var(--lift); }
.stub::before { content: ""; position: absolute; inset-inline: 22px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--act); }
.stub-lines { display: grid; gap: 6px; }
.big-amount { font-size: 22px !important; font-weight: 700; min-height: 52px !important; }
.stub .ttl { font-size: 12px; font-weight: 600; color: var(--stub-mute); }
.stub .ln { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--stub-mute); }
.stub .ln b { color: var(--stub-ink); font-weight: 650; }
.stub .grand { border-top: .5px solid var(--stub-rule); padding-top: 14px; display: grid; gap: 2px; }
.stub .grand .fig { font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stub .grand small { color: var(--stub-mute); }
.stub .f, .stub .f > span { color: var(--stub-mute); }




.stub .seg { display: flex; }
.stub .seg button { flex: 1; }

.stub .due { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--inset); color: var(--stub-mute); }
.stub .due b { color: var(--stub-ink); }
.stub .due.owe { background: var(--warn-soft); } .stub .due.owe b { color: var(--warn); }


.dock { display: none; }

/* ---------- Product editor ---------- */
.steps { display: flex; gap: 4px; padding: 5px; background: var(--inset); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--rule); margin-bottom: 16px; }
.steps button { flex: 1; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 6px 12px;
  border-radius: var(--r-sm); color: var(--ink-3); font-weight: 600; text-align: start; min-height: 46px; }
.steps button .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  box-shadow: inset 0 0 0 1.5px currentColor; flex: none; }
.steps button[aria-current="step"] { background: var(--sheet); color: var(--ink); box-shadow: var(--lift); }
.steps button[aria-current="step"] .n { background: var(--act); color: var(--act-ink); box-shadow: none; }
.steps small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-4); }
.prod { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.photo { aspect-ratio: 1; border-radius: var(--r); background: var(--inset); position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--rule-2); display: grid; place-items: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .icon-btn { position: absolute; top: 6px; inset-inline-end: 6px; background: rgba(255, 255, 255, .94); color: #1F1A3D; box-shadow: var(--lift); }
.photo.add { cursor: pointer; color: var(--ink-3); background: transparent; box-shadow: none; border: 1.5px dashed var(--rule-2); }
.photo.add:hover { background: var(--hover); color: var(--ink); }
.photo.add span { display: grid; justify-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.photo .main-tag { position: absolute; bottom: 6px; inset-inline-start: 6px; }
.photo.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .6); }
.peek { position: sticky; top: 84px; display: grid; gap: 14px; }
.peek .thumb { aspect-ratio: 4 / 3; border-radius: var(--r-sm); background: var(--inset); display: grid; place-items: center; overflow: hidden; color: var(--ink-4); }
.peek .thumb img { width: 100%; height: 100%; object-fit: cover; }
.peek h3 { margin: 0; font-size: 16px; }
.price-pair { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.step-foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--rule); }

/* QR label: drawn at real millimetres so the preview is what prints. */
.label-sheet { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
.label-stage { padding: 22px; border-radius: var(--r); background: var(--inset); display: grid; place-items: center; min-width: 260px; }
.qr-label { background: #fff; color: #000; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1), 0 4px 14px rgba(31, 26, 61, .12);
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2.5mm; padding: 2.5mm; overflow: hidden; }
.qr-label svg { display: block; }
.qr-label .txt { min-width: 0; display: grid; gap: 1.2mm; text-align: start; }
.qr-label .nm { font-weight: 700; font-size: 3mm; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.qr-label .pn { font: 700 2.8mm/1 var(--mono); direction: ltr; unicode-bidi: isolate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-label .br { font-size: 2.2mm; font-weight: 800; letter-spacing: .12em; }
.qr-label.s50x30 { width: 50mm; height: 30mm; } .qr-label.s50x30 svg { width: 25mm; height: 25mm; }
.qr-label.s40x25 { width: 40mm; height: 25mm; } .qr-label.s40x25 svg { width: 20mm; height: 20mm; } .qr-label.s40x25 .nm { font-size: 2.5mm; -webkit-line-clamp: 2; }
.qr-label.s60x40 { width: 60mm; height: 40mm; } .qr-label.s60x40 svg { width: 34mm; height: 34mm; } .qr-label.s60x40 .nm { font-size: 3.6mm; }
.print-labels { display: none; }

/* ---------- Reports and statements ---------- */
.report tfoot th { border-top: 1.5px solid var(--rule-2); font-weight: 700; color: var(--ink); background: var(--inset); padding-top: 14px; padding-bottom: 14px; }
.report td.end, .report th.end { white-space: nowrap; }
.warn-t { color: var(--warn); } .bad-t { color: var(--bad); font-weight: 650; }
.report tr.carry td { background: var(--inset); font-weight: 600; }
.stmt-who { font-size: 16px; margin-top: 4px; }
.stmt-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--rule); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 18px; }
.stmt-sum > div { background: var(--sheet); padding: 12px 16px; font-weight: 650; font-size: 16px; }
.stmt-sum small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 2px; }
.stmt-sum .end-bal { background: var(--inset); }
.stmt-foot { margin: 16px 0 0; }
@media (max-width: 820px) { .stmt-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Dashboard tiles and chart ---------- */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 20px; }
.tile { background: var(--sheet); border-radius: var(--r); box-shadow: var(--lift); padding: 18px 20px; display: grid; gap: 4px; text-decoration: none;
  position: relative; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.tile:hover { transform: translateY(-2px); box-shadow: var(--pop); }
.tile .lab { font-size: 12.5px; font-weight: 600; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.tile .fig { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.tile .alt { font-size: 12.5px; color: var(--ink-3); }
.tile .go { position: absolute; top: 18px; inset-inline-end: 18px; font-size: 12px; color: var(--ink-4); font-weight: 600; opacity: 0; transition: opacity .15s; }
.tile:hover .go { opacity: 1; }
.tile.hero { grid-column: span 2; }
.tile.hero .lab { color: var(--act-text); }
.tile.hero .fig { font-size: clamp(30px, 3vw, 42px); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding: 16px 20px 18px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px; }
.bar:hover { background: var(--hover); }
.bar .col { width: 100%; height: var(--h, 0%); min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--act); opacity: .85; }
.bar .col.zero { background: var(--rule-2); }
.bar:hover .col { opacity: 1; }
@media (max-width: 820px) { .tile.hero { grid-column: auto; } }

/* ---------- App section ---------- */
.req-list { display: grid; }
.req { display: flex; align-items: center; gap: 14px; padding: 14px 20px; flex-wrap: wrap; }
.req + .req { border-top: .5px solid var(--rule-2); }
.req .t { flex: 1; min-width: 200px; } .req p { margin: 4px 0 0; }
.thumb-cell { width: 56px; } .thumb-cell img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.cat-img-btn { border: 1.5px dashed var(--rule-2); background: transparent; border-radius: var(--r-sm); padding: 0; cursor: pointer; width: 120px; height: 80px; }
.cat-img { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-3); overflow: hidden; border-radius: var(--r-sm); }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.chat { display: grid; gap: 8px; padding: 20px; max-height: 60vh; overflow-y: auto; }
.bubble { max-width: 75%; justify-self: start; background: var(--inset); padding: 10px 14px; border-radius: 16px 16px 16px 4px; white-space: pre-wrap; }
.bubble.me { justify-self: end; background: var(--act-soft); border-radius: 16px 16px 4px 16px; }
.bubble small { display: block; color: var(--ink-4); font-size: 11px; margin-top: 4px; }
.chat-send { display: flex; gap: 10px; padding: 14px 20px; border-top: .5px solid var(--rule-2); align-items: flex-end; }
.chat-send textarea { min-height: 44px; }

/* ---------- Shipments ---------- */
.ship-ref { font-size: 15px; padding: 6px 10px; }
.ship-title { margin: 12px 0 4px; font-size: 22px; }

/* ---------- Staff and preparation ---------- */
.perm-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 10px; align-items: start; }
.perm-group { border: 0; margin: 0; padding: 14px 16px; border-radius: var(--r-sm); background: var(--inset); display: grid; gap: 4px; align-content: start; }
.perm-group legend { font-weight: 700; font-size: 13px; color: var(--ink); padding: 0; float: left; width: 100%; margin-bottom: 4px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); cursor: pointer; min-height: 32px; }
.prep-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.prep-list { display: grid; gap: 10px; padding: 12px; }
.prep-card { background: var(--inset); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 8px; }
.prep-head { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; cursor: pointer; text-align: start; width: 100%; }
.prep-lines { display: grid; gap: 2px; }
.prep-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.prep-lines > div:last-of-type .prep-line { border-bottom: 0; }
.prep-line .q { font-weight: 800; min-width: 36px; }
.prep-line .grow { flex: 1; min-width: 0; }
.prep-line.done .grow { color: var(--ink-3); text-decoration: line-through; }
.prep-step { display: inline-flex; align-items: center; gap: 4px; }
.prep-count { min-width: 40px; text-align: center; font-weight: 700; }
@media (max-width: 960px) { .prep-board { grid-template-columns: 1fr; } }

/* ---------- Printed document ---------- */
.paper { padding: 32px; }
.paper .table-wrap { margin-inline: -32px; }
.paper-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--ink);
  padding-bottom: 14px; margin-bottom: 18px; }
.paper-h h2 { margin: 0; font-size: 22px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; margin-bottom: 18px; }
.meta div small { display: block; color: var(--ink-3); font-size: 12px; }
.totals { margin-inline-start: auto; width: min(340px, 100%); margin-top: 16px; }
.totals .line { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { border-top: 2px solid var(--ink); font-weight: 800; font-size: 18px; margin-top: 4px; padding-top: 10px; }
.summary { display: grid; gap: 12px; }
.summary .line { display: flex; justify-content: space-between; padding: 6px 0; }
.summary .grand { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 12px; font-size: 20px; font-weight: 800; }

/* ---------- Sign-in ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(400px, 100%); padding: 32px; }
.login .brand { justify-content: center; padding-bottom: 6px; }
.login h1 { text-align: center; font-size: 22px; margin: 4px 0 4px; }
.login p { text-align: center; color: var(--ink-3); margin: 0 0 22px; }
.login form { display: grid; gap: 14px; }
.login .btn.block { margin-top: 6px; min-height: 44px; }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--sheet); color: var(--ink);
  box-shadow: var(--pop); }
dialog::backdrop { background: rgba(20, 16, 36, .4); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h2 { margin: 0; font-size: 17px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger .hero { grid-column: 1 / -1; }
  .ledger > div:nth-child(2) { border-inline-start: 0; }
  .ledger > div:nth-child(n+2) { border-top: 1px solid var(--rule); }
  .split, .prod { grid-template-columns: 1fr; }
  .peek { position: static; }
}
@media (max-width: 960px) {
  .counter { grid-template-columns: 1fr; }
  .stub { position: static; }
  .doc-head { grid-template-columns: 1fr; }
  /* The total and the post button stay reachable while scrolling the lines. */
  .dock { display: flex; position: sticky; bottom: 0; z-index: 20; margin: 16px calc(-1 * clamp(16px, 3vw, 32px)) -72px;
    padding: 12px clamp(16px, 3vw, 32px) calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--sheet) 80%, transparent); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); border-top: .5px solid var(--rule-2); color: var(--ink);
    align-items: center; gap: 12px; }
  .dock .fig { font-size: 20px; font-weight: 750; flex: 1; }
  .dock small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 15; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; gap: 4px;
    overflow-x: auto; background: var(--paper); border-inline-end: 0; border-bottom: 1px solid var(--rule); }
  .brand { padding: 0 4px 0 8px; } .brand small { display: none; }
  .nav-group { margin: 0; display: contents; }
  .nav-group > span { display: none; }
  .nav { display: contents; }
  .nav a { white-space: nowrap; }
  .side-foot { margin: 0; border: 0; padding: 0; }
  .side-foot .who, .side-foot .avatar { display: none; }
  .topbar { position: static; }
  .ledger { grid-template-columns: 1fr; }
  .ledger > div { border-inline-start: 0 !important; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps small { display: none; }
  .label-sheet { grid-template-columns: 1fr; }
  .lines .price input { width: 96px; }
  .lines .no { display: none; }
  .scan kbd { display: none; }
}
.line-item { display: inline-flex; align-items: center; gap: 10px; }
.line-thumb { width: 40px; height: 40px; border-radius: var(--r-xs); object-fit: cover; background: var(--inset); flex: none; }
.line-thumb.empty { display: inline-block; }
@media print {
  .print-only { display: block; }
  .side, .topbar, .no-print, .sync, .dock { display: none !important; }
  .shell { display: block; }
  body, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .content { padding: 0; max-width: none; }
  body.printing-labels #app { display: none !important; }
  body.printing-labels .print-labels { display: block; }
  .print-labels .qr-label { box-shadow: none; border-radius: 0; break-after: page; margin: 0; }
  .print-labels.s50x30 .qr-label { page: label-50x30; }
  .print-labels.s40x25 .qr-label { page: label-40x25; }
  .print-labels.s60x40 .qr-label { page: label-60x40; }
}
@page label-50x30 { size: 50mm 30mm; margin: 0; }
@page label-40x25 { size: 40mm 25mm; margin: 0; }
@page label-60x40 { size: 60mm 40mm; margin: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Permissions, by the panel's two areas. */
.jobs { display: grid; gap: 8px; }
.btn.job { flex-direction: column; align-items: flex-start; min-height: 48px; padding: 6px 12px; gap: 0; }
.btn.job small { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.access-line { margin: 4px 0 0; color: var(--ink-2); }
.perm-area { border: .5px solid var(--rule-2); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.perm-area-h { display: flex; align-items: baseline; gap: 10px; }
.perm-area-h h3 { margin: 0; font-size: 15px; }
.perm-area-h small { color: var(--ink-3); }
.sync.up { background: var(--act); color: var(--act-ink); font-weight: 700; }
.sync.up:hover { background: var(--act-hover); }

/* App dashboard, as simple as possible: what waits, four numbers, the rest folded. */
.todo { display: grid; }
.todo a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 18px; color: var(--ink); text-decoration: none;
  border-top: 1px solid var(--rule); }
.todo a:first-child { border-top: 0; }
.todo a:hover { background: var(--hover); }
.todo a .t { flex: 1; min-width: 0; font-weight: 600; }
.todo a .ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--inset); color: var(--ink-2); flex: none; }
.todo a.main .ico { background: var(--act-soft); color: var(--act-text); }
.allgood { display: flex; align-items: center; gap: 10px; padding: 18px; color: var(--ok); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 4px; padding: 16px 18px; border-radius: var(--r); background: var(--sheet); box-shadow: var(--lift); color: var(--ink); text-decoration: none; }
a.kpi:hover { box-shadow: var(--pop); }
.kpi .lab { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.kpi .fig { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.kpi .alt { font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 960px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
details.fold { border-radius: var(--r); background: var(--sheet); box-shadow: var(--lift); }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary > span:first-child { flex: 1; display: grid; gap: 2px; }
details.fold > summary small { color: var(--ink-3); font-weight: 500; }
details.fold > summary:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; border-radius: var(--r); }
.fold-arrow { width: 10px; height: 10px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .2s var(--ease); margin-top: -4px; }
details.fold[open] .fold-arrow { transform: rotate(-135deg); margin-top: 4px; }
details.fold > .stack { padding: 0 14px 14px; }
details.fold .card { box-shadow: none; border: .5px solid var(--rule-2); }
details.more-filters > summary { cursor: pointer; color: var(--act-text); font-weight: 600; font-size: 13px; width: max-content; }
details.more-filters[open] > summary { margin-bottom: 10px; }
.fees { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
