  /* Steel Ledger · app shell. Sidebar on laptop, bottom tab bar on phone. One colour per business, one colour per entry type. */
:root {
  --ground: #EEF2F6;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --ink: #142233;
  --ink-soft: #384657;
  --muted: #66727F;
  --faint: #8E99A6;
  --brand: #1F4166;
  --brand-tint: #E8EFF7;
  --accent: #B4601A;
  --accent-tint: #FBEEDF;
  --good: #12805C;
  --good-tint: #E4F4EC;
  --bad: #B23A3A;
  --bad-tint: #F9E9E9;
  --warn: #9A6100;
  --warn-tint: #FFF4DC;
  --border: #DFE4EA;
  --border-strong: #C9D1DB;
  --head: #1F4166;
  --mast-1: #10243A;
  --mast-2: #24496F;
  --t-sale: #1F4166;
  --t-pur: #B4601A;
  --t-rec: #12805C;
  --t-paid: #4E6075;
  --scrim: rgba(10,18,28,.5);
  --shadow: 0 1px 2px rgba(19,43,69,.06), 0 10px 28px -14px rgba(19,43,69,.22);
  --r: 14px;
  --r-sm: 10px;
  --f-display: "Sora", system-ui, -apple-system, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0A1018; --surface: #111B27; --surface-2: #0E1620;
    --ink: #ECF1F6; --ink-soft: #C3CCD6; --muted: #8A96A3; --faint: #6D7987;
    --brand: #7AA6D6; --brand-tint: #16263A; --accent: #E39A55; --accent-tint: #2A1D10;
    --good: #4FC79B; --good-tint: #12261D; --bad: #EE8A8A; --bad-tint: #2B1616; --warn: #F0BE5A; --warn-tint: #2A2210;
    --border: #243245; --border-strong: #33465F; --head: #1E3A5A; --mast-1: #0B1826; --mast-2: #1C3A5A;
    --t-sale: #2C5A8C; --t-pur: #B4601A; --t-rec: #13785A; --t-paid: #4E6075;
    --scrim: rgba(0,0,0,.6);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 32px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0A1018; --surface: #111B27; --surface-2: #0E1620;
  --ink: #ECF1F6; --ink-soft: #C3CCD6; --muted: #8A96A3; --faint: #6D7987;
  --brand: #7AA6D6; --brand-tint: #16263A; --accent: #E39A55; --accent-tint: #2A1D10;
  --good: #4FC79B; --good-tint: #12261D; --bad: #EE8A8A; --bad-tint: #2B1616; --warn: #F0BE5A; --warn-tint: #2A2210;
  --border: #243245; --border-strong: #33465F; --head: #1E3A5A; --mast-1: #0B1826; --mast-2: #1C3A5A;
  --t-sale: #2C5A8C; --t-pur: #B4601A; --t-rec: #13785A; --t-paid: #4E6075;
  --scrim: rgba(0,0,0,.6);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 32px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; text-wrap: balance; color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side { background: linear-gradient(180deg, var(--mast-1), var(--mast-2)); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.logo { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-weight: 800; font-size: 15px; color: #fff; flex: none; }
.logo b { color: #F0B47A; }
.side .brand-t { font-family: var(--f-display); font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.side .brand-t small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 11.5px; color: rgba(255,255,255,.65); }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; color: rgba(255,255,255,.78); padding: 10px 12px; border-radius: 10px; font-weight: 500; text-align: left; }
.nav-btn svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-btn[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; }
.side .spacer { flex: 1; }
.side .install { border: 1px dashed rgba(255,255,255,.35); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 24px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: color-mix(in srgb, var(--ground) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.search-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); min-width: 240px; font-size: 14px; }
.search-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 13px; font-weight: 600; }
.av { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: 12px; flex: none; }
.view { padding: 22px 24px 40px; max-width: 1120px; width: 100%; }
.bottom { display: none; }
.demo-strip { background: var(--warn-tint); color: var(--warn); font-size: 12.5px; padding: 6px 24px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }

/* ---------- Common blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-h h3 { font-size: 15.5px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.grid2 > .panel { margin-top: 0; }
.k { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); padding: 9px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--head); border-color: var(--head); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--head); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .03em; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.chip.c { background: var(--brand-tint); color: var(--brand); }
.chip.s { background: var(--accent-tint); color: var(--accent); }
.chip.void { background: var(--bad-tint); color: var(--bad); }
.chip.off { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip.auto { background: var(--good-tint); color: var(--good); }
.bal { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal small { display: block; font-family: var(--f-body); font-size: 11px; font-weight: 500; text-align: right; }
.bal.pos small { color: var(--muted); }
.bal.adv { color: var(--good); }
.bal.zero { color: var(--faint); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.empty b { display: block; color: var(--ink); font-family: var(--f-display); margin-bottom: 4px; }

/* ---------- Dashboard ---------- */
.hero { background: radial-gradient(120% 140% at 90% -20%, rgba(214,128,52,.24), transparent 55%), linear-gradient(135deg, var(--mast-1), var(--mast-2)); color: #fff; border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hero .k { color: rgba(255,255,255,.66); }
.hero .fig { font-family: var(--f-display); font-weight: 700; font-size: 28px; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero .sub { font-size: 12px; color: rgba(255,255,255,.66); margin-top: 2px; }
.hero .net .fig { color: #F0B47A; }
.actions4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.act { border: 0; border-radius: 14px; padding: 16px 14px; color: #fff; display: flex; align-items: center; gap: 12px; text-align: left; box-shadow: var(--shadow); }
.act svg { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.act b { font-family: var(--f-display); font-size: 17px; display: block; line-height: 1.1; }
.act small { font-size: 12px; opacity: .8; }
.act:active { transform: translateY(1px); }
.t-sale-bg { background: var(--t-sale); } .t-pur-bg { background: var(--t-pur); } .t-rec-bg { background: var(--t-rec); } .t-paid-bg { background: var(--t-paid); }
.tiles4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; border-top: 3px solid var(--c, var(--brand)); }
.tile .fig { font-family: var(--f-display); font-weight: 700; font-size: 19px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .n { font-size: 12px; color: var(--muted); }

/* ---------- Lists ---------- */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--border); background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.list > .row:first-child { border-top: 0; }
button.row:hover { background: var(--surface-2); }
.row .main-t { flex: 1; min-width: 0; }
.row .name, .row .meta { display: block; }
.row .name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; font-family: var(--f-display); font-weight: 700; font-size: 12px; }
.row.voided .name, .row.voided .amt { text-decoration: line-through; color: var(--faint); }
.amt { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.amt.plus { color: var(--ink); }
.amt.minus { color: var(--good); }
.rank { font-family: var(--f-mono); font-size: 12px; color: var(--faint); width: 18px; flex: none; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.input, input[type="text"], input[type="tel"], input[type="date"], input[type="search"], select, textarea { width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 15px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- Statement ---------- */
.party-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.party-head h2 { font-size: 22px; }
.party-head .meta { color: var(--muted); font-size: 13.5px; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.outstanding { text-align: right; }
.outstanding .fig { font-family: var(--f-display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.outstanding .fig.adv { color: var(--good); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.stmt-row { display: grid; grid-template-columns: 86px 1fr auto auto; gap: 14px; align-items: center; padding: 11px 4px; border-top: 1px solid var(--border); }
.stmt-row.head { border-top: 0; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 0; }
.stmt-row .d { font-family: var(--f-mono); font-size: 13px; color: var(--ink-soft); }
.stmt-row .p b { font-weight: 600; color: var(--ink); }
.stmt-row .p .meta { font-size: 12.5px; color: var(--muted); }
.stmt-row .a, .stmt-row .b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; min-width: 104px; }
.stmt-row .b { font-weight: 600; color: var(--ink); }
.stmt-row.voided .a, .stmt-row.voided .p b { text-decoration: line-through; color: var(--faint); }
.stmt-row.voided .b { color: var(--faint); }
.stmt-row.opening { background: var(--surface-2); }
.stmt-row.closing { border-top: 2px solid var(--border-strong); font-weight: 700; }
.voidlink { border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); background: var(--surface); color: var(--bad); font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; margin-left: 8px; }
.voidlink:hover { background: var(--bad-tint); }
.void-reason { color: var(--bad); font-size: 12px; }

/* ---------- Reports ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rep-card { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; }
.rep-card:hover { border-color: var(--brand); }
.rep-card .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-tint); display: grid; place-items: center; flex: none; }
.rep-card .ic svg { width: 19px; height: 19px; stroke: var(--brand); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rep-card b { font-family: var(--f-display); font-size: 14.5px; display: block; color: var(--ink); }
.rep-card span { font-size: 12.5px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .chipbtn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.filters .chipbtn[aria-pressed="true"] { background: var(--head); border-color: var(--head); color: #fff; }
.filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.filters input[type="date"] { width: auto; padding: 6px 8px; font-size: 13.5px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-sm); margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
th { background: var(--head); color: #fff; text-align: left; font-family: var(--f-display); font-weight: 600; font-size: 12.5px; padding: 10px 14px; white-space: nowrap; }
td { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--ink-soft); }
tbody tr:nth-child(even) td { background: var(--surface-2); }
td.n, th.n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.n { color: var(--ink); }
tfoot td { font-weight: 700; color: var(--ink); background: var(--brand-tint); border-top: 2px solid var(--border-strong); }
td.link { color: var(--brand); font-weight: 600; cursor: pointer; }

/* ---------- Sheet (modal) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
.sheet { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; color: #fff; position: sticky; top: 0; z-index: 2; }
.sheet-head.plain { color: var(--ink); background: var(--surface); border-bottom: 1px solid var(--border); }
.sheet-head h3 { color: inherit; font-size: 17px; flex: 1; }
.sheet-head .x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255,255,255,.16); color: inherit; font-size: 20px; line-height: 1; }
.sheet-head.plain .x { background: var(--surface-2); }
.sheet-body { padding: 18px 20px 22px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > .lab, .field > label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.opt { font-weight: 400; color: var(--faint); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amt-in { font-family: var(--f-display); font-size: 26px; font-weight: 700; padding: 10px 14px; letter-spacing: -.01em; }
.words { font-size: 13px; color: var(--brand); font-weight: 500; min-height: 18px; }
.pick-list { border: 1px solid var(--border); border-radius: 10px; max-height: 236px; overflow: auto; }
.pick-list .row { padding: 10px 12px; }
.picked { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.picked .main-t { flex: 1; min-width: 0; }
.preview-bal { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; background: var(--brand-tint); border-radius: 10px; padding: 12px 14px; }
.preview-bal .arrow { color: var(--muted); font-size: 18px; }
.preview-bal .k { font-size: 10px; }
.preview-bal b { font-family: var(--f-mono); font-size: 15px; display: block; font-variant-numeric: tabular-nums; }
.preview-bal div:last-child { text-align: right; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opts button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; }
.opts button[aria-pressed="true"] { background: var(--head); border-color: var(--head); color: #fff; }
.msg { font-size: 13.5px; border-radius: 10px; padding: 10px 12px; }
.msg:empty { display: none; }
.msg.err { background: var(--bad-tint); color: var(--bad); }
.msg.warn { background: var(--warn-tint); color: var(--warn); }
.msg.ok { background: var(--good-tint); color: var(--good); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 90% at 85% 0%, rgba(214,128,52,.22), transparent 55%), linear-gradient(160deg, var(--mast-1), var(--mast-2)); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 28px 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.login-card .logo { background: var(--head); border: 0; width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }
.login-card h1 { font-size: 22px; margin-top: 14px; }
.user-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin-top: 10px; }
.user-btn:hover { border-color: var(--brand); }
.user-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.user-row .user-btn { margin-top: 0; min-width: 0; }
.user-row .user-btn b, .user-row .user-btn small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .user-btn > span:last-child { min-width: 0; }
@media (max-width: 340px) { .user-row { grid-template-columns: 1fr; } }
.user-btn b { display: block; color: var(--ink); }
.user-btn small { color: var(--muted); }
.note { font-size: 12.5px; color: var(--muted); margin-top: 16px; }

/* ---------- PIN + approvals ---------- */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 14px 0 6px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); }
.pin-dots span.on { background: var(--head); border-color: var(--head); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.keypad button { height: 56px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); font-family: var(--f-display); font-size: 22px; font-weight: 600; color: var(--ink); }
.keypad button:active { background: var(--brand-tint); }
.keypad button.fn { font-size: 15px; color: var(--muted); }
.chip.pend { background: var(--warn-tint); color: var(--warn); }
.chip.edit { background: var(--brand-tint); color: var(--brand); }
.voidlink.edit { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.voidlink.edit:hover { background: var(--brand-tint); }
.voidlink.req { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.voidlink.req:hover { background: var(--warn-tint); }
.req-card { border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r-sm); padding: 14px 16px; background: var(--surface-2); }
.req-card + .req-card { margin-top: 10px; }
.req-card.approved { border-left-color: var(--good); }
.req-card.rejected { border-left-color: var(--bad); }
.req-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.req-top b { font-family: var(--f-display); color: var(--ink); }
.diff { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0; font-size: 13.5px; }
.diff dt { color: var(--muted); }
.diff dd { margin: 0; font-family: var(--f-mono); font-size: 13px; color: var(--ink); }
.diff dd s { color: var(--faint); margin-right: 6px; }
.banner { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; background: var(--warn-tint); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--ink); border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; font-family: var(--f-body); }

/* ---------- Tests ---------- */
.test { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.test:first-child { border-top: 0; }
.test .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; }
.test .st.pass { background: var(--good); } .test .st.fail { background: var(--bad); }
.test .exp { color: var(--muted); font-size: 12.5px; }

/* ---------- Phone ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .search-btn { min-width: 0; padding: 0; width: 38px; justify-content: center; }
  .search-btn span, .user-chip span.nm { display: none; }
  .user-chip { padding: 3px; }
  .view { padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .demo-strip { padding: 6px 16px; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bottom .nav-btn { flex-direction: column; gap: 3px; color: var(--muted); font-size: 11px; padding: 6px 2px; align-items: center; text-align: center; }
  .bottom .nav-btn[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }
  .hero { grid-template-columns: 1fr 1fr; padding: 16px; }
  .hero .net { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.14); padding-top: 12px; display: flex; justify-content: space-between; align-items: baseline; }
  .hero .fig { font-size: 22px; }
  .actions4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .act { padding: 16px 12px; }
  .tiles4 { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .rep-grid { grid-template-columns: 1fr; }
  .stmt-row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .stmt-row .d { grid-column: 1; grid-row: 1; font-size: 12px; }
  .stmt-row .p { grid-column: 1; grid-row: 2; }
  .stmt-row .a { grid-column: 2; grid-row: 1; min-width: 0; }
  .stmt-row .b { grid-column: 2; grid-row: 2; min-width: 0; }
  .stmt-row.head { display: none; }
  .outstanding { text-align: left; }
  .sheet { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .two { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* =================== Steel Ledger additions =================== */
/* Each business gets its own colour, taken from its logo */
:root[data-co="msm"] { --mast-1: #2A1012; --mast-2: #7A2416; --head: #8E2A1B; --co-accent: #E2711D; }
:root[data-co="msc"] { --mast-1: #071E31; --mast-2: #0B4C70; --head: #0B5577; --co-accent: #12A396; }
.bottom { grid-template-columns: repeat(6, 1fr) !important; }
.bottom .nav-btn { font-size: 10.5px !important; }

.co-logo { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.co-logo img { width: 34px; height: 34px; object-fit: contain; }
.side .switch { margin: -8px 8px 14px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); border-radius: 9px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.side .switch:hover { background: rgba(255,255,255,.14); color: #fff; }
.side .switch svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.co-chip { display: none; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; font-family: var(--f-display); font-weight: 700; font-size: 12.5px; color: var(--ink); }
.co-chip img { width: 28px; height: 28px; border-radius: 50%; background: #fff; object-fit: contain; padding: 2px; border: 1px solid var(--border); }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-tint); }
.sync.off i { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }

/* business picker */
.biz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.biz { text-align: left; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); padding: 16px; display: grid; gap: 10px; align-content: start; }
.biz:hover { border-color: var(--brand); }
.biz .co-logo { width: 54px; height: 54px; border-radius: 14px; border: 1px solid var(--border); }
.biz .co-logo img { width: 46px; height: 46px; }
.biz b { font-family: var(--f-display); font-size: 16px; color: var(--ink); line-height: 1.2; }
.biz small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.login-card.wide { width: min(560px, 100%); }
.login-head { display: flex; align-items: center; gap: 12px; }
.login-head .co-logo { width: 52px; height: 52px; border: 1px solid var(--border); }
.login-head .co-logo img { width: 44px; height: 44px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); gap: 10px; align-content: center; }

/* estimates list */
.est-row .no { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.chip.open { background: var(--brand-tint); color: var(--brand); }
.chip.conv { background: var(--good-tint); color: var(--good); }

/* estimate editor */
.est-head { display: grid; grid-template-columns: 140px 150px 1fr 170px; gap: 12px; }
.est-grid { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.erow { display: grid; grid-template-columns: 44px minmax(180px, 2.6fr) minmax(70px, .8fr) minmax(96px, 1fr) minmax(96px, 1fr) minmax(120px, 1.2fr) 40px; grid-template-areas: "sl desc nos wt rate amt del"; align-items: center; border-top: 1px solid var(--border); }
.erow:first-child { border-top: 0; }
.erow.head { background: var(--head); color: #fff; font-family: var(--f-display); font-weight: 600; font-size: 12.5px; }
.erow.head > span { padding: 10px 8px; }
.erow > * { min-width: 0; }
.erow .sl { grid-area: sl; text-align: center; font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.erow .c-desc { grid-area: desc; } .erow .c-nos { grid-area: nos; } .erow .c-wt { grid-area: wt; } .erow .c-rate { grid-area: rate; }
.erow .c-amt { grid-area: amt; text-align: right; padding: 0 10px; font-family: var(--f-mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.erow .c-del { grid-area: del; text-align: center; }
.erow input { border: 0; border-radius: 0; border-left: 1px solid var(--border); background: transparent; padding: 10px 8px; font-size: 14.5px; height: 44px; }
.erow input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: -2px; background: var(--surface); }
.erow input.n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.erow .c-rate input, .erow .c-amt { background: color-mix(in srgb, #FFE45C 22%, transparent); }
.erow.head .c-rate, .erow.head .c-amt { background: transparent; }
.erow.head .sl, .erow.head .c-amt { color: #fff; font-family: var(--f-display); font-size: 12.5px; }
.erow .lab-m { display: none; }
.del-row { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 17px; line-height: 1; }
.del-row:hover { color: var(--bad); border-color: var(--bad); }
.est-foot { display: grid; grid-template-columns: 1fr 360px; gap: 18px; margin-top: 16px; align-items: start; }
.tot { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.tot > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 14.5px; }
.tot > div:first-child { border-top: 0; }
.tot b { font-family: var(--f-display); color: var(--ink); }
.tot .v { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.tot input { width: 150px; text-align: right; font-family: var(--f-mono); padding: 7px 10px; }
.tot .hl { background: color-mix(in srgb, #FFE45C 30%, var(--surface)); }
.tot .grand { background: var(--head); color: #fff; }
.tot .grand b, .tot .grand .v { color: #fff; font-size: 17px; }
.est-words { font-size: 13px; color: var(--brand); font-weight: 500; margin-top: 8px; }
.est-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.locked { background: var(--good-tint); color: var(--good); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }

/* printed estimate (hidden on screen) */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 11pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.pe-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #222; padding-bottom: 8px; }
.pe-head h1 { font-family: Arial, Helvetica, sans-serif; font-size: 20pt; margin: 0 0 4px; color: #000; }
.pe-head div div { font-size: 10.5pt; line-height: 1.45; }
.pe-head img { width: 84px; height: 84px; object-fit: contain; }
.pe-title { text-align: center; font-weight: 700; letter-spacing: .2em; font-size: 12pt; margin: 10px 0 8px; }
.pe-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 24px; font-size: 10.5pt; margin-bottom: 10px; }
.pe-table { width: 100%; border-collapse: collapse; font-size: 10.5pt; min-width: 0; }
.pe-table th, .pe-table td { border: 1px solid #555; padding: 5px 7px; color: #000; background: #fff; }
.pe-table th { font-weight: 700; text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: 10.5pt; }
.pe-table td.c { text-align: center; } .pe-table td.r { text-align: right; white-space: nowrap; }
.pe-table tbody tr:nth-child(n) td { background: #fff; }
.pe-table .y { background: #FFFF00 !important; }
.pe-table tfoot td { font-weight: 700; }
.pe-words { margin-top: 8px; font-size: 10.5pt; }
.pe-notes { margin-top: 6px; font-size: 10pt; white-space: pre-wrap; }
.pe-sign { display: flex; justify-content: space-between; margin-top: 46px; font-size: 10.5pt; }
.pe-sign span { border-top: 1px solid #000; padding-top: 4px; min-width: 200px; text-align: center; }
.pe-foot { margin-top: 18px; font-size: 9pt; color: #444; text-align: center; }

@media (max-width: 900px) {
  .co-chip { display: inline-flex; }
  .sync span { display: none; }
  .est-head { grid-template-columns: 1fr 1fr; }
  .est-foot { grid-template-columns: 1fr; }
  .erow.head { display: none; }
  .erow { grid-template-columns: 34px 1fr 1fr 1fr 34px; grid-template-areas: "sl desc desc desc del" ". nos wt rate ." ". amt amt amt ."; padding: 8px 0; gap: 6px 0; }
  .erow input { border: 1px solid var(--border); border-radius: 8px; height: 40px; background: var(--surface); margin-right: 6px; }
  .erow .c-desc input { margin-right: 0; }
  .erow .c-rate input { margin-right: 0; }
  .erow .lab-m { display: block; font-size: 10.5px; color: var(--muted); font-family: var(--f-mono); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 2px 2px; }
  .erow .c-amt { background: transparent; padding: 2px 0 0; }
  .erow .c-rate input { background: color-mix(in srgb, #FFE45C 22%, var(--surface)); }
}
@media (max-width: 520px) {
  .biz-grid { grid-template-columns: 1fr; }
  .est-head { grid-template-columns: 1fr 1fr; }
  .est-head .field:nth-child(3), .est-head .field:nth-child(4) { grid-column: 1 / -1; }
  .tot input { width: 130px; }
}
