/* Pak Madina books on the Mac. Clean and quiet: one accent (deep green) for actions and links, numbers in ink,
   red only for a real problem, yellow only for "you must answer this". Light and dark. */
@font-face { font-family: "Atkinson Hyperlegible"; src: url(fonts/AtkinsonHyperlegible-Regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(fonts/AtkinsonHyperlegible-Bold.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(fonts/AtkinsonHyperlegible-Italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(fonts/IBMPlexMono-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(fonts/IBMPlexMono-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
/* Barlow stays for the printed invoice page only (same look as the phone's PDF). */
@font-face { font-family: "Barlow"; src: url(fonts/Barlow-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/Barlow-Medium.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/Barlow-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(fonts/Barlow-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Cond"; src: url(fonts/BarlowSemiCondensed-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Cond"; src: url(fonts/BarlowSemiCondensed-Bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #FAFAF8; --surface: #FFFFFF; --surface-2: #F2F3F0; --ink: #18211C; --ink-2: #5B645E; --line: #E4E6E1; --field: #C9CEC8;
  --accent: #1E4634; --on-accent: #FFFFFF; --bad: #A1262F; --bad-soft: #FBECEC;
  --check: #E9B524; --check-soft: #FFF6D6; --check-ink: #5E4500;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F1411; --surface: #151A17; --surface-2: #1D231F; --ink: #E8ECE7; --ink-2: #9EA8A1; --line: #29312B; --field: #3B443D;
  --accent: #8FCBA7; --on-accent: #0D1A12; --bad: #F09AA3; --bad-soft: #3A2226;
  --check: #E9B524; --check-soft: #3A3114; --check-ink: #F3D57C;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1411; --surface: #151A17; --surface-2: #1D231F; --ink: #E8ECE7; --ink-2: #9EA8A1; --line: #29312B; --field: #3B443D;
  --accent: #8FCBA7; --on-accent: #0D1A12; --bad: #F09AA3; --bad-soft: #3A2226;
  --check: #E9B524; --check-soft: #3A3114; --check-ink: #F3D57C;
  color-scheme: dark;
} }
:root {
  /* the names the older screens use, mapped onto the tokens above */
  --navy: var(--accent); --navy-dk: var(--accent); --red: var(--bad); --green: var(--ink); --amber: var(--check);
  --muted: var(--ink-2); --tint: var(--surface-2); --warm: var(--surface-2);
  --green-soft: var(--surface-2); --red-soft: var(--bad-soft); --amber-soft: var(--check-soft); --amber-ink: var(--check-ink);
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --cond: var(--body);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 20px; height: 20px; flex: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.b { font-weight: 700; }
.good { color: var(--green) !important; }
.bad { color: var(--red) !important; }
.warnc { color: var(--amber-ink) !important; }
.navy { color: var(--navy) !important; }
.mt { margin-top: 14px; }

.booting { display: grid; place-items: center; height: 100%; }
.boot { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.boot img { width: 40px; height: 40px; }
.noscript { padding: 24px; }

/* ---------------- sign in ---------------- */
.signin-wrap { min-height: 100%; display: grid; place-items: start center; padding: 40px 16px; }
.signin { width: 100%; max-width: 940px; }
.si-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.si-brand img { width: 46px; height: 46px; }
.si-brand b { display: block; font: 700 22px/1 var(--cond); color: var(--navy); }
.si-brand span { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--red); font-weight: 700; }
.signin h1 { font: 700 34px/1.1 var(--cond); color: var(--navy); margin: 0 0 8px; }
.lead { color: var(--muted); max-width: 640px; margin: 0 0 22px; font-size: 16px; }
.si-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.si-card { display: flex; flex-direction: column; gap: 10px; }
.si-h { display: flex; align-items: center; gap: 10px; color: var(--navy); }
.si-h svg { width: 24px; height: 24px; }
.si-h h2 { margin: 0; font: 700 21px/1.2 var(--cond); }
.qr { width: 230px; height: 230px; align-self: center; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; overflow: hidden; }
.qr svg { width: 100%; height: 100%; }
.qr-wait { color: var(--muted); font-size: 14px; }
.steps { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.lbl { font-weight: 600; font-size: 14px; }
textarea { width: 100%; font: 600 18px/1.5 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; text-transform: uppercase; border: 1.5px solid var(--field); border-radius: 12px; padding: 12px 14px; color: var(--navy); resize: vertical; margin-top: 6px; }
textarea:focus { border-color: var(--navy); outline: none; }
.err { color: var(--red); font-weight: 600; min-height: 1.4em; margin: 0; }
.keep { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 600; }
.keep input { width: 18px; height: 18px; accent-color: var(--navy); }
.foot { margin-top: 10px; }
.si-pin { max-width: 420px; padding: 22px; }
.si-pin form { display: flex; flex-direction: column; gap: 12px; }
.si-pin .fld { display: flex; flex-direction: column; gap: 6px; }
.si-pin .keep { margin-top: 6px; font-size: 15px; }
.si-more { margin-top: 22px; }
.si-more summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--ink-2, inherit); }
.si-more .si-grid { margin-top: 10px; }
.rk-show { font: 600 20px/1.6 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; word-spacing: .3em; overflow-wrap: anywhere; padding: 12px 14px; border: 1.5px dashed var(--field); border-radius: 12px; }

/* ---------------- buttons, pills ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent; border-radius: 12px; padding: 11px 18px; font-weight: 700; cursor: pointer; min-height: 46px; }
.btn.primary { background: var(--navy); color: var(--on-accent); }
.btn.primary:hover { background: var(--navy-dk); }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--navy); border-color: var(--field); }
.btn.ghost:hover { border-color: var(--navy); }
.btn.danger { background: var(--surface); color: var(--red); border-color: #E7B9B4; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.4; }
.pill.good { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber-ink); }
.pill.redsoft { background: var(--red-soft); color: var(--red); }
.pill.red { background: var(--red); color: var(--on-accent); }
.pill.navy { background: var(--tint); color: var(--navy); }
.pill.grey { background: var(--surface-2); color: var(--muted); }
.pill + .pill { margin-left: 6px; }

/* ---------------- shell: left rail (bottom bar under 860 px) ---------------- */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--surface); color: var(--ink); display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 0 8px 20px; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 6px; }
.brand b { display: block; font: 700 16px/1.2 var(--body); }
.brand span { font-size: 12.5px; color: var(--ink-2); }
#nav { display: grid; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 12px; color: var(--ink-2); padding: 10px 12px; border-radius: 8px; font-weight: 700; font-size: 15px; position: relative; }
#nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
#nav a.on { color: var(--accent); background: var(--surface-2); }
#nav a .short { display: none; }
#nav .badge { margin-left: auto; font-style: normal; background: var(--check); color: #2E2200; border-radius: 999px; font-size: 12px; line-height: 1; padding: 4px 7px; font-weight: 700; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 8px; }
.sync { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--field); }
.sync.ok i { background: var(--accent); }
.sync.bad i { background: var(--bad); }
.sync.bad { color: var(--bad); }
.sync small { width: 100%; color: var(--bad); }
.ro { display: flex; gap: 8px; font-size: 12px; color: var(--ink-2); margin: 0; line-height: 1.4; }
.ro svg { width: 15px; height: 15px; margin-top: 1px; }
.theme { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: var(--ink-2); font-size: 13.5px; cursor: pointer; justify-self: start; }
.theme svg { width: 16px; height: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 28px 32px 8px; }
.top-t { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top h1 { margin: 0; font: 700 28px/1.15 var(--body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.top p { margin: 3px 0 0; color: var(--ink-2); font-size: 14.5px; }
.top-a { display: flex; gap: 8px; align-items: center; }
.back { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); flex: none; }
.content { flex: 1; overflow-y: auto; padding: 16px 32px 48px; }

/* ---------------- cards, rows ---------------- */
.grid { display: grid; gap: 18px; align-items: start; }
.grid.home { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
.grid.pnl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.comp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.col { display: grid; gap: 12px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card.flush { padding: 0; overflow: hidden; }
.cap { font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.big { font: 700 42px/1.05 var(--cond); color: var(--navy); font-variant-numeric: tabular-nums; }
.hero { display: block; color: inherit; }
.hero:hover, .hero-in:hover { text-decoration: none; }
.hero-in { display: block; color: inherit; }
.minis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.minis span { background: var(--tint); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.minis span:hover { background: var(--surface-2); }
.minis small { display: block; font-size: 12.5px; color: var(--muted); }
.minis b { font-size: 17px; font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--ink); }
.row:hover { text-decoration: none; border-color: var(--field); }
.row .grow, .cust-h .grow, .pk-h .grow { flex: 1; min-width: 0; }
.row b, .cust-h b, .pk-h b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row small, .cust-h small, .pk-h small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end, .cust-h .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.big2 { font: 700 21px/1 var(--cond); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); }
.ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ic.navy { background: var(--tint); color: var(--navy); }
.ic.green { background: var(--green-soft); color: var(--green); }
.ic.amber { background: var(--amber-soft); color: var(--amber-ink); }
.ic.red { background: var(--red-soft); color: var(--red); }
.sec { font: 700 15px/1.2 var(--body); color: var(--navy); margin: 8px 0 8px; }
.feed { display: grid; gap: 8px; }
.day { font-size: 14px; color: var(--navy); margin: 10px 0 0; position: sticky; top: -22px; background: var(--bg); padding: 6px 0 2px; z-index: 1; }
.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r); padding: 12px 14px; }
.banner.warn { background: var(--amber-soft); color: var(--amber-ink); }
.banner b { display: block; }
.banner span { font-size: 13.5px; }
.banner:hover { text-decoration: none; }
.empty { display: grid; gap: 4px; text-align: center; padding: 40px 16px; color: var(--muted); }
.empty b { color: var(--ink); font-size: 17px; }

/* ---------------- P&L lines ---------------- */
.pl-line { display: flex; align-items: center; gap: 6px; padding: 8px 0 6px; color: var(--ink); }
.pl-line:hover { text-decoration: none; }
a.pl-line:hover .l { text-decoration: underline; }
.pl-line .l { flex: 1; min-width: 0; }
.pl-line .l small { display: block; color: var(--muted); font-size: 12.5px; }
.pl-line .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-line svg { width: 14px; height: 14px; color: var(--muted); }
.pl-line.bold .l { font-weight: 700; }
.pl-line.bold .v { font-weight: 700; font-size: 16.5px; }
.pl-line.sub { padding: 3px 0 3px 14px; }
.pl-line.sub .l { color: var(--muted); font-size: 14px; }
.rule { height: 1px; background: var(--line); margin: 10px 0 2px; }
.rule.navy { height: 1.5px; background: var(--navy); }
.warnline { display: block; color: var(--amber-ink); font-size: 13px; font-weight: 600; padding-bottom: 4px; }
.okline { display: flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; font-size: 13.5px; margin: 8px 0 0; }
.okline svg { width: 16px; height: 16px; }
.textlink { display: inline-block; margin-top: 8px; font-weight: 700; }

.pnl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg a { padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg a:hover { text-decoration: none; color: var(--navy); }
.seg a[aria-selected="true"] { background: var(--navy); color: var(--on-accent); }
.seg.wide { margin-bottom: 14px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper b { min-width: 170px; text-align: center; color: var(--navy); }
.ib { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.custom { display: flex; align-items: center; gap: 8px; }
select, input[type=date], .search input { font: 600 14px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--field); border-radius: 10px; padding: 8px 10px; min-height: 40px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; margin-top: 4px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend i.amber { background: var(--amber); } .legend i.green { background: var(--green); }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--field); }
.chart .b-amber { fill: var(--amber); } .chart .b-green { fill: var(--green); } .chart .b-red { fill: var(--red); opacity: .85; }
.chart .revline { stroke: var(--navy); stroke-width: 2; }
.chart text { font: 600 12px var(--body); text-anchor: middle; }
.chart .mlab { fill: var(--muted); }
.chart .plab { fill: var(--green); font: 700 13px var(--cond); }
.chart .llab { fill: var(--red); font: 700 13px var(--cond); }

/* ---------------- lists ---------------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--field); border-radius: 10px; padding-left: 10px; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { color: var(--muted); width: 18px; height: 18px; }
.search input { border: 0; flex: 1; min-width: 0; outline: none; }
.totals { display: flex; gap: 28px; margin: 4px 0 14px; }
.totals small { display: block; color: var(--muted); font-size: 12.5px; }
.totals b { font: 700 24px/1.1 var(--cond); color: var(--navy); font-variant-numeric: tabular-nums; }
table.list { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.list th { text-align: left; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr[data-href] { cursor: pointer; }
.list tbody tr[data-href]:hover td { background: var(--surface-2); }
.list .n { text-align: right; }
.list td.wrap { white-space: normal; }
.list a { font-weight: 600; }
.list.tight td, .list.tight th { padding: 7px 10px; }
.list tfoot td { font-weight: 600; padding: 8px 10px; border-top: 1px solid var(--line); }
.mini-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); color: var(--ink); }
.mini-row:first-of-type { border-top: 0; }
.mini-row small { display: block; color: var(--muted); font-size: 12.5px; }
.mini-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-row.link:hover { text-decoration: none; background: var(--surface-2); }
.cust-h, .pk-h { display: flex; align-items: center; gap: 12px; color: var(--ink); padding-bottom: 6px; }
.cust-h:hover, .pk-h:hover { text-decoration: none; }
.cust, .pickup { margin-bottom: 10px; }
.total-card { margin-top: 14px; }
.st { display: flex; gap: 6px; margin-bottom: 8px; }
.note { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0; white-space: pre-wrap; }
details summary { cursor: pointer; font-weight: 600; }
details pre { white-space: pre-wrap; font: 13px/1.5 ui-monospace, Menlo, monospace; color: var(--muted); max-height: 360px; overflow: auto; }

/* ---------------- invoice + bill pages ---------------- */
.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.inv-side { display: grid; gap: 12px; position: sticky; top: 0; }
.sheet-wrap { overflow: hidden; }
.bill-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.photo { display: grid; gap: 12px; place-items: center; min-height: 160px; }
.photo img { max-width: 100%; max-height: 78vh; border-radius: 8px; border: 1px solid var(--line); display: block; }

/* The invoice page itself, in points so it prints on Letter exactly like the phone's PDF. */
.sheet { --accent: #1E4634; --cond: "Barlow Cond", "Barlow", "Arial Narrow", Arial, sans-serif; width: 612pt; min-height: 792pt; background: #fff; color: #1D2B34; position: relative; padding: 39pt 42pt 70pt; transform-origin: top left; box-shadow: 0 0 0 1px var(--line); font-family: "Barlow", Arial, sans-serif; font-size: 10.5pt; line-height: 1.25; }
.sheet .lab { font-size: 7.5pt; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #5E6970; }
.sheet .lab.red { color: #7A2632; font-size: 7.9pt; }
.iv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18pt; }
.iv-brand { display: flex; align-items: flex-start; gap: 10.5pt; min-width: 0; }
.iv-logo { height: 48pt; max-width: 124pt; object-fit: contain; flex: none; }
.iv-logo.sq { width: 48pt; }
.iv-name { font: 700 23.25pt/1 var(--cond); color: var(--accent); margin-top: 1pt; }
.iv-tag { font-size: 7.9pt; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #7A2632; margin-top: 6pt; }
.iv-contact { font-size: 9pt; color: #5E6970; margin-top: 3pt; max-width: 270pt; line-height: 1.3; }
/* Halal sticker: inline after the tagline, 2.2× its font size (owner's pick) */
.iv-tag { display: flex; align-items: center; gap: 3pt; margin-top: 3pt; }
.iv-halal { width: 2.2em; height: 2.2em; flex: none; }
.iv-title { text-align: right; flex: none; }
.iv-title .t { font: 700 34.5pt/.95 var(--cond); letter-spacing: .14em; color: var(--accent); margin-right: -.14em; }
.iv-title .no { font: 600 14.25pt/1 var(--cond); letter-spacing: .03em; color: #7A2632; margin-top: 7pt; }
.iv-rule { height: 2.25pt; background: var(--accent); margin-top: 14pt; position: relative; }
.iv-rule span { position: absolute; left: 0; top: 0; height: 2.25pt; width: 57pt; background: #7A2632; }
.iv-meta { display: grid; grid-template-columns: repeat(4, 1fr); background: #F4F1EB; margin-top: 13.5pt; }
.iv-meta > div { padding: 8.25pt 9pt 9pt 12pt; border-left: .75pt solid #E3DED4; min-height: 42.75pt; }
.iv-meta > div:first-child { border-left: 0; }
.iv-meta .val { font-size: 11.25pt; font-weight: 600; margin-top: 4pt; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iv-meta .val.big { font: 700 16.5pt/1 var(--cond); color: var(--accent); margin-top: 2pt; }
.iv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 30pt; margin-top: 18pt; position: relative; }
.iv-parties .pn { font: 700 15.75pt/1.15 var(--cond); color: var(--accent); margin-top: 4pt; }
.iv-parties .pl { font-size: 9.75pt; color: #5E6970; margin-top: 2pt; line-height: 1.35; }
.iv-stamp { position: absolute; left: 466pt; top: 27pt; transform: translate(-50%, -50%) rotate(-9deg); border: 2.25pt solid #14632E; color: #14632E; border-radius: 4.5pt; background: rgba(255,255,255,.85); text-align: center; padding: 5pt 12pt 6pt; }
.iv-stamp b { display: block; font: 700 30pt/1 var(--cond); letter-spacing: .22em; margin-right: -.22em; }
.iv-stamp span { font-size: 7.5pt; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.iv-items { width: 100%; border-collapse: collapse; margin-top: 18pt; table-layout: fixed; font-variant-numeric: tabular-nums; }
.iv-items .c-ix { width: 27pt; } .iv-items .c-pr { width: 243pt; } .iv-items .c-cs { width: 40pt; } .iv-items .c-kg { width: 60pt; } .iv-items .c-pc { width: 75pt; } .iv-items .c-am { width: 83pt; }
.iv-items thead { display: table-header-group; }
.iv-items th { font-size: 7.9pt; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); text-align: left; padding: 0 0 4pt; border-bottom: 1.5pt solid var(--accent); }
.iv-items th:first-child, .iv-items td.ix { padding-left: 7.5pt; }
.iv-items th:last-child, .iv-items td:last-child { padding-right: 7.5pt; }
.iv-items td { padding: 8.25pt 0; border-bottom: .75pt solid #D8DDDF; vertical-align: top; font-size: 10.5pt; }
.iv-items tbody tr:nth-child(even) td { background: #FAF9F6; }
.iv-items tr { break-inside: avoid; }
.iv-items .n { text-align: right; white-space: nowrap; }
.iv-items td.ix { color: #5E6970; }
.iv-items td.pr b { display: block; font-weight: 600; }
.iv-items td.pr span { display: block; font-size: 8.6pt; color: #5E6970; margin-top: 1.5pt; }
.iv-items td.amt { font-weight: 600; }
.iv-sum { display: grid; grid-template-columns: 281pt 217.5pt; justify-content: space-between; margin-top: 16pt; break-inside: avoid; }
.iv-left .wt { font-size: 9.75pt; color: #5E6970; }
.iv-pay { border: .75pt solid #D8DDDF; padding: 11.25pt; margin-top: 10.5pt; }
.iv-pay .m { font-size: 11.25pt; font-weight: 600; margin-top: 5pt; }
.iv-pay .e { font-size: 11.25pt; font-weight: 700; color: var(--accent); margin-top: 3pt; }
.iv-pay .s { font-size: 9pt; color: #5E6970; margin-top: 4pt; }
.iv-tot .row { all: unset; display: flex; justify-content: space-between; font-size: 10.5pt; padding: 4.5pt 0 3.5pt; border-bottom: .75pt solid #D8DDDF; font-variant-numeric: tabular-nums; }
.iv-tot .row span:first-child { color: #5E6970; }
.iv-box { background: var(--accent); color: #fff; padding: 12pt 13.5pt; margin-top: 9pt; }
.iv-box.paid { background: #14632E; }
.iv-box .bx-l { font-size: 7.9pt; font-weight: 700; letter-spacing: .14em; color: rgba(255,255,255,.8); }
.iv-box .bx-v { font: 700 27pt/1.05 var(--cond); margin-top: 5pt; font-variant-numeric: tabular-nums; }
.iv-box .bx-s { font-size: 9pt; color: rgba(255,255,255,.9); margin-top: 3pt; }
.iv-notes { margin-top: 15pt; break-inside: avoid; }
.iv-notes p { margin: 4pt 0 0; font-size: 9.75pt; white-space: pre-wrap; }
.iv-pod { display: grid; grid-template-columns: 1fr 1fr; gap: 30pt; margin-top: 21pt; break-inside: avoid; }
.iv-pod .sig { height: 60pt; border-bottom: 1.1pt solid #1D2B34; margin-top: 9pt; position: relative; }
.iv-pod .sig img { position: absolute; left: 6pt; bottom: 4pt; max-width: 85%; max-height: 53pt; }
.iv-pod .cap { font-size: 8.6pt; color: #5E6970; margin-top: 4pt; letter-spacing: 0; text-transform: none; font-weight: 400; }
.iv-foot { position: absolute; left: 42pt; right: 42pt; bottom: 18pt; border-top: .75pt solid #D8DDDF; padding-top: 8pt; display: flex; justify-content: space-between; align-items: flex-start; gap: 16pt; }
.iv-foot .ty { font: 600 12.75pt/1.1 var(--cond); color: var(--accent); }
.iv-foot .c { font-size: 8.25pt; color: #5E6970; text-align: right; line-height: 1.35; }
.iv-foot .c.mid { text-align: left; }
.iv-foot .c b { color: #1D2B34; font-weight: 600; }

/* ---------------- editing: forms, pop-ups, editors ---------------- */
.fld { display: grid; gap: 5px; min-width: 0; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.fld input, .fld select, .fld textarea, .editor input, .editor select, .editor textarea { font: 500 15px var(--body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--field); border-radius: 10px; padding: 9px 11px; min-height: 42px; width: 100%; }
.fld textarea, .editor textarea { resize: vertical; line-height: 1.4; text-transform: none; letter-spacing: normal; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .editor input:focus, .editor select:focus, .editor textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(23,56,76,.12); }
.editor input.bad, .stepper-in.bad { border-color: var(--red) !important; background: var(--red-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); flex: none; }
.check input[type=date] { min-height: 34px; padding: 4px 8px; width: auto; }
.check.small { font-size: 13px; font-weight: 500; color: var(--muted); margin: 2px 0 6px; }
.form { display: grid; gap: 12px; }
.narrow { max-width: 760px; }
.btn.primary.sm, .btn.danger.sm { min-height: 38px; padding: 7px 14px; font-size: 14px; }
.btn.ghost[disabled] { opacity: .5; cursor: default; }
label.btn { cursor: pointer; }
.top-a .btn.primary { color: var(--on-accent); }
.top-a a.btn:hover { text-decoration: none; }
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act-grid .btn { width: 100%; }
.end-row { display: inline-flex; align-items: center; gap: 6px; }
.x { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.x:hover { background: var(--red-soft); color: var(--red); }
.linkish { color: var(--navy); text-decoration: underline; cursor: pointer; }
.mini-row > a { color: var(--ink); }
.ed-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.ed-actions.left { justify-content: flex-start; margin: 0 0 12px; }
.tabs { margin-bottom: 16px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: min(560px, calc(100vw - 32px)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: var(--surface); }

dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(19,48,31,.45); }
.m-form { padding: 22px 24px 18px; display: grid; gap: 12px; }
.m-form h2 { margin: 0; font: 700 23px/1.2 var(--cond); color: var(--navy); }
.m-body { display: grid; gap: 12px; }
.m-actions { display: flex; justify-content: flex-end; gap: 10px; }
.send-btns { display: grid; gap: 8px; }
.sigpad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1.5px dashed var(--field); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }

.editor { display: grid; gap: 14px; }
.ed-top { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.ed-top .full { grid-column: 1 / -1; margin: 0; }
.repeat { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--tint); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.chip { border: 1.5px solid var(--navy); background: var(--surface); color: var(--navy); font-weight: 700; border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.chip:hover { background: var(--tint); }
.chip.ghost { border-style: dashed; color: var(--muted); border-color: var(--field); }
.tablewrap { overflow-x: auto; }
table.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 960px; }
.lines th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line); }
.lines td { padding: 8px 6px 2px; vertical-align: top; }
.lines .n { text-align: right; }
.lines td.ix { color: var(--muted); padding-top: 18px; }
.lines td.b { padding-top: 18px; font-size: 16px; }
.lines td.pn { min-width: 200px; }
.lines td.pn input { font-weight: 700; }
.lines td.pn input.sm { margin-top: 4px; font-size: 13px; font-weight: 500; min-height: 32px; padding: 5px 9px; }
.lines input.num { width: 104px; text-align: right; }
.lines td [data-out="kg"] { display: inline-block; padding-top: 10px; font-weight: 600; }
.lines td > .muted { display: inline-block; padding-top: 10px; }
.seg.mini { padding: 2px; border-radius: 10px; }
.seg.mini button { border: 0; background: none; font: 600 12.5px var(--body); color: var(--muted); padding: 7px 9px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg.mini button[aria-pressed="true"] { background: var(--navy); color: var(--on-accent); }
.stepper-in { display: inline-flex; align-items: center; border: 1.5px solid var(--field); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper-in button { width: 34px; height: 40px; border: 0; background: var(--tint); color: var(--navy); font-size: 20px; font-weight: 700; cursor: pointer; }
.stepper-in input { width: 54px !important; border: 0 !important; border-radius: 0 !important; text-align: center; min-height: 40px !important; padding: 0 !important; box-shadow: none !important; }
.wrow td { padding: 0 6px 10px; border-bottom: 1px solid var(--line); }
.wrow [data-out="warn"] { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.wrow [data-out="warn"] span { color: var(--amber-ink); font-weight: 600; }
.wrow [data-out="warn"] span.math { color: var(--muted); font-weight: 500; }
.ed-bottom { display: flex; gap: 20px; align-items: flex-end; }
.ed-bottom .grow { flex: 1; }
.ed-tot { text-align: right; display: grid; gap: 2px; }
.ed-tot span { color: var(--muted); font-size: 14px; }
.ed-tot b { font: 700 34px/1.05 var(--cond); color: var(--navy); font-variant-numeric: tabular-nums; }
.bill-ed { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.links input.num { width: 110px; text-align: right; font: 500 14px var(--body); border: 1.5px solid var(--field); border-radius: 8px; padding: 6px 8px; }
.links td { vertical-align: top; }
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-prev { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); }
.row-toggle { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.row-toggle .check { padding-bottom: 10px; }
.swatches { display: flex; gap: 12px; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 40px; height: 40px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.swatch input:checked + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.swatch input:focus-visible + span { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ---------------- payments ---------------- */
.act-row { display: flex; flex-wrap: wrap; gap: 8px; }
.alloc { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.alloc-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.alloc-row:has(input:checked) { border-color: var(--navy); }
.alloc-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); flex: none; }
.alloc-row .grow { flex: 1; min-width: 0; }
.alloc-row b { display: block; }
.alloc-row small { display: block; color: var(--muted); font-size: 12.5px; }
.alloc-row input.num { width: 104px; text-align: right; font: 600 14px var(--body); border: 1.5px solid var(--field); border-radius: 8px; padding: 6px 8px; }
.alloc-row input.num:disabled { opacity: .45; }
.alloc-tot { margin: 0; text-align: right; font-size: 15px; }
.alloc-tot b { font: 700 22px var(--cond); color: var(--navy); }

/* ---------------- Analytics ---------------- */
.a-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 16px; }
.a-filters .fld { min-width: 150px; }
.a-filters .fld input, .a-filters .fld select { min-height: 40px; padding: 7px 10px; font-size: 14px; }
.a-ptext { margin: 0 0 10px; }
.ms { position: relative; }
.ms summary { list-style: none; cursor: pointer; border: 1.5px solid var(--field); border-radius: 10px; padding: 9px 12px; background: var(--surface); font-size: 14px; min-height: 40px; }
.ms summary::-webkit-details-marker { display: none; }
.ms[open] summary { border-color: var(--navy); }
.ms-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(19,48,31,.18); padding: 10px; }
.ms-list { max-height: 260px; overflow: auto; display: grid; gap: 6px; padding: 2px; }
.ms-list .check { font-weight: 500; font-size: 14px; }
.ms-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.insights ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.insights li { padding: 8px 12px 8px 30px; border-radius: 10px; position: relative; font-size: 14.5px; }
.insights li::before { position: absolute; left: 11px; top: 8px; font-weight: 700; }
.insights li.good { background: var(--green-soft); color: var(--green); } .insights li.good::before { content: "▲"; font-size: 11px; top: 10px; }
.insights li.bad { background: var(--red-soft); color: var(--red); } .insights li.bad::before { content: "!"; }
.insights li.warn { background: var(--amber-soft); color: var(--amber-ink); } .insights li.warn::before { content: "!"; }
.insights li.info { background: var(--tint); color: var(--navy); } .insights li.info::before { content: "•"; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 8px; }
.tile { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--ink); align-content: start; }
a.tile:hover { text-decoration: none; border-color: var(--field);  }
.t-l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.t-v { font: 700 25px/1.15 var(--cond); color: var(--navy); font-variant-numeric: tabular-nums; }
.t-s { font-size: 12px; color: var(--muted); }
.dl { font-size: 12.5px; font-weight: 700; }
.dl.up { color: var(--green); } .dl.down { color: var(--red); } .dl.flat { color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 10px; }
.charts .wide2 { grid-column: 1 / -1; }
.chart2 { width: 100%; height: auto; display: block; }
.chart2 .grid { stroke: var(--line); }
.chart2 .ax { font: 500 11px var(--body); fill: var(--muted); }
.chart2 .ln { fill: none; stroke: var(--navy); stroke-width: 2; }
.chart2 .dot { fill: var(--surface); stroke: var(--navy); stroke-width: 2; }
.b-amber { fill: var(--amber); background: var(--amber); } .b-green { fill: var(--green); background: var(--green); } .b-red { fill: var(--red); background: var(--red); } .b-navy { fill: var(--navy); background: var(--navy); }
.legend i.navyl { background: var(--navy); height: 3px; width: 14px; border-radius: 2px; }
.hbars { display: grid; gap: 8px; }
.hb { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hb-l small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.hb-t { background: var(--bg); border-radius: 6px; height: 14px; overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 6px; }
.hb b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 8px; }
.rep-card { display: grid; gap: 4px; color: var(--ink); }
.rep-card:hover { text-decoration: none; border-color: var(--navy); }
.rep-card b { color: var(--navy); font-size: 16px; }
.rep-card span { font-size: 13.5px; color: var(--muted); }
.rep-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 6px 0 12px; flex-wrap: wrap; }
.rep-head h2 { margin: 0; font: 700 24px/1.2 var(--cond); color: var(--navy); }
.rep-head p { margin: 2px 0 0; }
.rep-act { display: flex; gap: 8px; flex-wrap: wrap; }
table.rep td { white-space: nowrap; }
table.rep tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1.5px solid var(--navy); padding: 10px 14px; }
.builder { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.builder .full { grid-column: 1 / -1; }
.mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip input { position: absolute; opacity: 0; }
.mchip span { display: inline-block; border: 1.5px solid var(--field); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; background: var(--surface); }
.mchip input:checked + span { background: var(--navy); border-color: var(--navy); color: var(--on-accent); }
.mchip input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.print-only { display: none; }

/* ---------------- narrow screens ---------------- */
@media (max-width: 1100px) {
  .grid.home, .grid.pnl, .inv-layout, .bill-layout, .bill-ed { grid-template-columns: minmax(0, 1fr); }
  .ed-top { grid-template-columns: 1fr 1fr; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .inv-side { position: static; }
}
@media (max-width: 760px) {
  .top { padding: 18px 16px 6px; flex-wrap: wrap; }
  .top h1 { font-size: 24px; }
  .content { padding: 12px 16px 110px; }
  .si-grid, .grid.comp, .row2, .ed-top { grid-template-columns: minmax(0, 1fr); }
  .ed-bottom { flex-direction: column; align-items: stretch; }
  .card.flush { overflow-x: auto; }
  .top-a span { display: none; }
}

/* ---------------- printing: only the invoice ---------------- */
@page { size: letter; margin: 0; }
@media print {
  body { background: #fff; }
  .side, .top, .inv-side, .boot, .toast, dialog, .a-filters, .tabs, .rep-act, .builder { display: none !important; }
  .print-only { display: block; }
  .print-only h1 { font: 700 20pt/1.2 var(--cond); color: #1E4634; margin: 0; }
  .content:has(.rep-head) { padding: 0.5in !important; }
  .app, .main, .content, .inv-layout { display: block; height: auto; overflow: visible; padding: 0; margin: 0; }
  .sheet-wrap { overflow: visible; height: auto !important; }
  .sheet { transform: none !important; box-shadow: none; min-height: 792pt; }
  .iv-foot { position: fixed; bottom: 22pt; }
}

/* Accounting 101 legend under ledger reports */
.a101 { margin-top: 14px; }
.a101 summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.a101 table { margin-top: 10px; }
.a101 ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.6; }
small.block { display: block; }

/* the hidden attribute always wins over display rules like .btn */
[hidden] { display: none !important; }

/* "Desktop was updated" bar (only when a reload has to wait for an edit) */
.upd { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--surface); padding: 10px 12px 10px 18px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-weight: 600; }
.upd .btn.primary { background: var(--surface); color: var(--ink); }

/* ---------- supplier invoice line items & cost allocation ---------- */
.okc { color: var(--green); font-weight: 600; }
.cap-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.cap-row .cap { margin: 0; }
.pad { padding: 0 16px; }
.card.flush .cap.pad, .card.flush .cap-row.pad { padding-top: 14px; }
.card.flush p.pad { padding-bottom: 12px; }
.tscroll { overflow-x: auto; margin: 0 -4px; }
.lines-ed td { padding: 4px 4px; vertical-align: middle; }
.lines-ed input, .lines-ed select { width: 100%; min-width: 0; font: 500 14px var(--body); border: 1.5px solid var(--field); border-radius: 8px; padding: 6px 8px; background: var(--surface); }
.lines-ed td:first-child select { min-width: 150px; }
.lines-ed input[data-f="description"] { min-width: 170px; }
.lines-ed input.num { width: 92px; text-align: right; }
.lines-ed input.num.s { width: 64px; }
.lines-ed input.bad-in { border-color: var(--amber); background: var(--amber-soft); }
.lines-ed tfoot td { font-weight: 700; padding: 8px 4px; }
.checks { list-style: none; padding: 0; margin: 4px 0 10px; display: grid; gap: 3px; font-size: 13.5px; }
.det { margin: 4px 0 8px; }
.det summary { cursor: pointer; color: var(--navy); font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.sumtab { border-top: 2px solid var(--line); }
.sumtab td, .sumtab th { font-size: 13.5px; }
.sumtab td.n b { font-weight: 700; }
.al-line { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.al-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.al-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.al-row input.num { width: 110px; text-align: right; font: 600 15px var(--body); border: 1.5px solid var(--field); border-radius: 8px; padding: 7px 9px; }
.al-cost { margin-left: auto; font-size: 16px; color: var(--navy); }
.seg.sm { padding: 2px; border-radius: 10px; }
.seg.sm button { border: 0; background: none; padding: 6px 11px; border-radius: 8px; font: 600 13.5px var(--body); color: var(--muted); cursor: pointer; }
.seg.sm button[aria-checked="true"] { background: var(--navy); color: var(--on-accent); }
.fld.inline { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }
.fld.inline span { margin: 0; white-space: nowrap; }
.al-tot { display: flex; justify-content: space-between; align-items: center; border-top: 2px solid var(--line); padding-top: 10px; margin-top: 6px; font-weight: 600; }
.al-tot b { font-size: 18px; color: var(--navy); }
.cb { border-top: 1px solid var(--line); padding: 4px 0 8px; }
.cb .mini-row { border-top: 0; padding-bottom: 2px; }
.sub-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); padding: 1px 0 1px 10px; }
.cov { font-size: 13px; display: grid; gap: 2px; margin: 6px 0; padding: 8px 10px; background: var(--tint); border-radius: 10px; }
.pick { display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.pick-row { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; cursor: pointer; font: 500 14.5px var(--body); color: var(--ink); }
.pick-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pick-row:hover { border-color: var(--navy); }
.banner .linkish { margin-top: 4px; }
.banner > div > span { display: block; }
.banner:not(.warn) { background: var(--tint); color: var(--navy); }
.bill-ed > .span2 { grid-column: 1 / -1; }
.bill-layout > .span2 { grid-column: 1 / -1; }
.bill-layout > .span2 > .card { margin: 0; }
button.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* home: gross profit received, pending + margin right-aligned under it */
.gp-block { display: inline-flex; flex-direction: column; align-items: flex-end; }
.gp-sub { margin-top: 2px; }
.pl-line .v small.pct { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; }
/* supplier's item vs your product */
.prod { display: inline-block; background: var(--tint); color: var(--navy); font-weight: 700; border-radius: 6px; padding: 2px 8px; font-size: 13.5px; white-space: nowrap; }
.prod.none { background: var(--amber-soft); color: var(--amber-ink); }
.code { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lines-ed select.prodsel { background: var(--tint); border-color: var(--navy); font-weight: 700; color: var(--navy); }
.lines-ed select.prodsel.none { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-ink); }
.altab tr.grp td { border-top: 2px solid var(--line); }
.al-line.off { opacity: .6; }
.al-line .al-h { flex-direction: row; align-items: flex-start; gap: 10px; cursor: pointer; }
.al-line .al-h input[type=checkbox] { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.al-line .al-h .grow { display: flex; flex-direction: column; gap: 3px; }
.pdfview { width: 100%; height: 640px; border: 0; border-radius: 10px; background: var(--surface-2); display: block; margin-bottom: 8px; }
.iv-parties.paid { min-height: 54pt; }

/* HDR Portal credit (sign-in page + side bar) */
.powered { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #6b7780); margin: 14px 0 0; }
.powered a { color: inherit; text-decoration: none; font-weight: 700; }
.side-foot .powered { margin-top: 10px; color: rgba(255,255,255,.6); }
/* Last swatch = your own colour: the native colour picker covers the circle (invisible), a "+" shows it's custom. */
.swatch { position: relative; }
.swatch.custom input[type="color"] { position: absolute; inset: 0; width: 40px; height: 40px; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch.custom span { display: grid; place-items: center; }
.swatch.custom span::after { content: "+"; color: #fff; font: 700 20px/1 var(--cond); text-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* Simple view: big numbers, few words, high contrast, read-only. */
.simple { display: grid; gap: 16px; max-width: 760px; margin: 0 auto; }
.sv-alert { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-radius: 16px; font: 700 22px/1.3 var(--body); }
.sv-alert svg { width: 30px; height: 30px; flex: none; }
.sv-alert.ok { background: #E6F2EA; color: #14532D; }
.sv-alert.warn { background: #FFF1D6; color: #7A4B00; }
.sv-alert.bad { background: #FBE3E3; color: #8A1C1C; }
.sv-card { background: var(--surface); border: 2px solid #D5DDD8; border-radius: 18px; padding: 22px 24px; }
.sv-card h2 { margin: 0 0 6px; font: 700 22px/1.2 var(--body); color: #1B1F1D; }
.sv-card p { margin: 8px 0 0; font-size: 19px; color: #3A433E; }
.sv-card p.bad { color: #8A1C1C; font-weight: 700; }
.sv-big { font: 700 clamp(40px, 9vw, 60px)/1.05 var(--cond); color: #111; font-variant-numeric: tabular-nums; }
.sv-big.bad { color: #B42318; } .sv-big.good { color: #14632E; }
.sv-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sv-two small { font-size: 19px; color: #3A433E; }
.sv-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.sv-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; font-size: 20px; padding: 8px 0; border-top: 1px solid #E3E8E5; }
.sv-list li b { font: 700 24px/1 var(--cond); }
.sv-list li small { grid-column: 1 / -1; color: #8A1C1C; font-size: 16px; }
.sv-btn { display: block; text-align: center; padding: 20px; border-radius: 16px; background: var(--navy); color: var(--on-accent); font: 700 22px/1 var(--body); text-decoration: none; }
.sv-btn:focus-visible { outline: 4px solid var(--amber); outline-offset: 3px; }
@media (max-width: 520px) { .sv-two { grid-template-columns: 1fr; } .sv-card { padding: 18px; } }

/* List import */
.imp-prev { display: grid; gap: 8px; }
.imp-prev .card.flush { max-height: 280px; overflow: auto; }
.file-btn { justify-self: start; }

/* Opening balances */
.ob-eq { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; }
.ob-eq span { display: grid; }
.ob-eq small { color: var(--muted); font-size: 12px; }
.ob-eq b { font: 700 22px/1.1 var(--cond); font-variant-numeric: tabular-nums; }
.ob-eq .op { font: 700 22px/1.1 var(--cond); color: var(--muted); }
.ob-eq .tot b { color: var(--navy); }
.ob-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card .pad { padding: 14px 16px; margin: 0; }

/* ================================================================== refresh v1 (clean): overrides for older screens */
body { background: var(--bg); }
a { color: var(--accent); }
.big, .t-v, .totals b, .amt.big2, .ed-tot b, .alloc-tot b, .ob-eq .tot b, .al-cost, .al-tot b, .rep-card b, .stepper b,
.signin h1, .si-brand b, .si-h, .m-form h2, .rep-head h2, .sec, .day, .print-only h1 { color: var(--ink); }
.big, .t-v, .totals b, .amt.big2, .ed-tot b, .alloc-tot b, .ob-eq b, .ob-eq .op, .sv-big, .sv-list li b { font-family: var(--body); font-variant-numeric: tabular-nums; }
.big { font-weight: 700; font-size: 38px; letter-spacing: -.01em; }
.signin h1, .m-form h2, .rep-head h2, .si-h h2 { font-family: var(--body); }
.card, .row, .tile, .seg, .ib, .ms-pop, .pick-row { box-shadow: none; }
.card, .row, .tile { border-radius: 10px; }
.btn { border-radius: 10px; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn.ghost { color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--field); }
.btn.danger { background: var(--surface); border-color: var(--line); }
.list th { background: transparent; }
.minis span { background: var(--surface-2); }
.ic.navy, .ic.green, .ic.amber { background: var(--surface-2); color: var(--ink-2); }
.pill.good { background: transparent; color: var(--ink-2); padding-left: 0; padding-right: 0; }
.pill.navy { background: var(--surface-2); color: var(--ink-2); }
.dot.amber { background: var(--field); }
.banner:not(.warn) { background: var(--surface-2); color: var(--ink); }
.fld input:focus, .fld select:focus, .fld textarea:focus, .editor input:focus, .editor select:focus, .editor textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { color: var(--ink); background: var(--surface); }
.prod { background: var(--surface-2); color: var(--ink); }
.lines-ed select.prodsel { background: var(--surface); border-color: var(--field); color: var(--ink); }
.cov { background: var(--surface-2); }
/* Simple view in the same quiet look (and dark-safe) */
.sv-alert.ok { background: var(--surface-2); color: var(--ink); }
.sv-alert.warn { background: var(--check-soft); color: var(--check-ink); }
.sv-alert.bad { background: var(--bad-soft); color: var(--bad); }
.sv-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sv-card h2 { color: var(--ink); }
.sv-card p { color: var(--ink-2); }
.sv-card p.bad { color: var(--bad); }
.sv-big { color: var(--ink); font-weight: 700; }
.sv-big.bad { color: var(--bad); } .sv-big.good { color: var(--ink); }
.sv-two small { color: var(--ink-2); }
.sv-list li { border-top-color: var(--line); }
.sv-list li small { color: var(--bad); }
.sv-btn { background: var(--accent); color: var(--on-accent); }
.photo-src img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-src p { margin: 8px 0 0; }
.warnc svg { width: 15px; height: 15px; vertical-align: -2px; }

/* ================================================================== refresh v1: new screens (pm-) */
.pm-screen { display: grid; gap: 20px; max-width: 1100px; }
.pm-screen.narrow { max-width: 720px; }
.pm-h2 { font: 700 15px/1.3 var(--body); color: var(--ink-2); margin: 8px 0 -8px; }
.pm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.linkish { color: var(--accent); }

/* Today: three numbers, one action line */
.pm-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pm-nums a { display: grid; gap: 4px; padding: 22px 24px 22px 0; color: var(--ink); align-content: start; }
.pm-nums a + a { padding-left: 24px; border-left: 1px solid var(--line); }
.pm-nums a:hover { text-decoration: none; }
.pm-nums a:hover .lab { color: var(--accent); }
.pm-nums .lab { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.pm-nums .big { font: 700 clamp(30px, 3.6vw, 44px)/1.05 var(--body); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.pm-nums .sub { font-size: 14px; color: var(--ink-2); }
.pm-act { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 17px; font-weight: 700; }
.pm-act:hover { text-decoration: none; color: var(--accent); }
.pm-act > span { flex: 1; min-width: 0; }
.pm-act svg { color: var(--ink-2); }
.pm-act.bad, .pm-act.bad svg { color: var(--bad); }

/* plain rows (Full books, photo inbox) */
.pm-rows { display: grid; border-top: 1px solid var(--line); }
.pm-rows > a, .pm-rowi { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--line); color: var(--ink); }
.pm-rows > a:hover { text-decoration: none; }
.pm-rows > a:hover b { color: var(--accent); }
.pm-rows > a > span, .pm-rowi .grow { flex: 1; min-width: 0; color: var(--ink); }
.pm-rowi .grow:hover { text-decoration: none; }
.pm-rows b { display: block; font-size: 16px; }
.pm-rows small { display: block; color: var(--ink-2); font-size: 13.5px; margin-top: 1px; }
.pm-rows svg { color: var(--ink-2); width: 18px; height: 18px; }

/* Add a photo: two choices */
.pm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pm-choice { display: flex; align-items: center; gap: 14px; text-align: left; padding: 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; min-height: 84px; }
.pm-choice:hover { border-color: var(--accent); }
.pm-choice svg { width: 26px; height: 26px; color: var(--accent); }
.pm-choice b { display: block; font-size: 17px; }
.pm-choice small { display: block; color: var(--ink-2); font-size: 14px; }
.pm-choice[disabled] { opacity: .55; cursor: default; }

/* Capture review: photo left, fields right */
.pm-cap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; max-width: 1240px; }
.pm-photo { position: sticky; top: 0; display: grid; place-items: center; background: var(--surface-2); border-radius: 10px; padding: 12px; min-height: 240px; }
.pm-photo img { display: block; max-width: 100%; max-height: calc(100vh - 150px); border-radius: 4px; }
.pm-stack { display: grid; gap: 16px; min-width: 0; }
.pm-fields { display: grid; gap: 4px; }
.pm-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pm-field > label { font-weight: 700; color: var(--ink-2); font-size: 14px; }
.pm-field input, .pm-line input { width: 100%; min-width: 0; font: 400 16px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--field); border-radius: 8px; padding: 9px 11px; min-height: 44px; }
.pm-field input:focus, .pm-line input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.pm-field .hint { grid-column: 2; }
.pm-field.flag { background: var(--check-soft); border-left: 4px solid var(--check); border-bottom-color: transparent; padding: 12px 12px 12px 10px; border-radius: 0 8px 8px 0; margin: 4px 0; }
.pm-field .why { grid-column: 1 / -1; display: grid; gap: 8px; font-size: 15px; color: var(--ink); }
.pm-field.flag .why { color: var(--check-ink); }
.pm-field.done .why { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.pm-field.done .why svg { width: 16px; height: 16px; color: var(--ink-2); }
.pm-field .why .btn { min-height: 40px; padding: 7px 14px; font-size: 14.5px; }
.pm-field .why select { font: 400 14.5px var(--body); min-height: 40px; }
.btn.check { background: var(--check); color: #2E2200; border-color: transparent; }
.btn.tiny { min-height: 0; padding: 2px 8px; font-size: 13px; border-radius: 6px; }
.btn.big { font-size: 17px; min-height: 52px; padding: 12px 24px; }
.pm-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; color: var(--ink); font-size: 14.5px; border-bottom: 1px solid var(--line); }
.pm-note svg { color: var(--bad); margin-top: 2px; }
.pm-lines { display: grid; gap: 0; padding: 6px 0 2px; border-bottom: 1px solid var(--line); }
.pm-lhead, .pm-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(88px, 1fr) minmax(76px, .9fr) minmax(88px, 1fr) 28px 28px; gap: 8px; align-items: center; }
.pm-lhead { font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 4px 0; }
.pm-lhead span:nth-child(n+2):nth-child(-n+4) { text-align: right; }
.pm-line { padding: 4px 0; }
.pm-line input.n { text-align: right; font-variant-numeric: tabular-nums; padding: 9px 8px; }
.pm-line .q { display: flex; gap: 4px; align-items: center; min-width: 0; }
.pm-unit { border: 0; background: none; color: var(--ink-2); font: 700 13px var(--body); cursor: pointer; padding: 4px 2px; }
.pm-line .st { display: grid; place-items: center; font-size: 11px; }
.pm-line .st svg { width: 18px; height: 18px; }
.pm-line.flag > input, .pm-line.flag .q input { border-color: var(--check); }
.pm-lwhy { grid-column: 1 / -1; margin: 2px 0 6px !important; display: block !important; }
.pm-ltot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; }
.pm-ltot b { font-variant-numeric: tabular-nums; }
.pm-confirm { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line); }
.pm-reading { display: grid; gap: 12px; }
.pm-skel { height: 44px; border-radius: 8px; background: var(--surface-2); animation: pm-pulse 1.2s ease-in-out infinite; }
@keyframes pm-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pm-skel { animation: none; } }
.pm-done { display: grid; gap: 10px; justify-items: start; }
.pm-done h2 { margin: 0; font: 700 20px/1.3 var(--body); }
.pm-done .big { font-size: 34px; margin: 0; }
.pm-done p { margin: 0; }
.pm-notes { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14.5px; }

/* ---------------- tablet and phone width: bottom bar ---------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .side .brand, .side-foot { display: none; }
  #nav { grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; gap: 0; }
  #nav a { flex-direction: column; gap: 2px; padding: 7px 2px; font-size: 11.5px; text-align: center; border-radius: 8px; }
  #nav a.on { background: transparent; }
  #nav a .long { display: none; }
  #nav a .short { display: inline; }
  #nav .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; font-size: 10.5px; padding: 2px 5px; }
  .main { height: auto; }
  .content { overflow: visible; padding-bottom: 110px; }
  .pm-cap { grid-template-columns: minmax(0, 1fr); }
  .pm-photo { position: relative; }
  .pm-photo img { max-height: 42vh; }
  .pm-confirm { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .inv-side { position: static; }
}
@media (max-width: 600px) {
  .pm-nums { grid-template-columns: minmax(0, 1fr); border-bottom: 0; }
  .pm-nums a { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .pm-nums a + a { padding-left: 0; border-left: 0; }
  .pm-choices { grid-template-columns: minmax(0, 1fr); }
  .pm-field { grid-template-columns: minmax(0, 1fr); }
  .pm-field .hint { grid-column: 1; }
  .pm-lhead { display: none; }
  .pm-line { grid-template-columns: repeat(3, minmax(0, 1fr)) 24px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .pm-line > input.d { grid-column: 1 / 4; }
  .pm-line .st { grid-column: 4; grid-row: 1; }
  .pm-line .x { grid-column: 4; grid-row: 2; }
  .pm-confirm .btn.big { flex: 1; }
  .top-a .btn span { display: none; }
}

/* ================================================================== refresh v2: month book, match, cheque planner, detail panel */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.r { background: var(--bad); } .dot.y { background: var(--check); }
.pm-monthnav { display: inline-flex; gap: 4px; }
.pm-monthnav .btn { min-width: 40px; padding: 7px 8px; }
.pm-attn { justify-self: start; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 15px var(--body); cursor: pointer; }
.pm-attn[aria-pressed="true"] { border-color: var(--ink); }
.pm-attn .muted { font-weight: 400; }
.pm-seg { display: none; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.pm-seg button { flex: 1; min-height: 40px; border: 0; background: none; border-radius: 7px; font: 700 14px var(--body); color: var(--ink-2); cursor: pointer; }
.pm-seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.pm-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pm-col { min-width: 0; }
.pm-col.in { padding-right: 28px; border-right: 1px solid var(--line); }
.pm-col.out { padding-left: 28px; }
.pm-colh { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.pm-colh h2 { margin: 0; font: 700 20px var(--body); color: var(--ink); }
.pm-grp { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.pm-grp h3 { margin: 0 0 4px; font: 700 16px var(--body); }
.pm-ln { display: grid; grid-template-columns: 10px 64px minmax(0, 1fr) auto; gap: 0 10px; align-items: center; width: 100%; min-height: 40px; padding: 4px 4px; border: 0; background: none; text-align: left; border-radius: 6px; font: 400 15.5px var(--body); color: var(--ink); font-variant-numeric: tabular-nums; }
button.pm-ln { cursor: pointer; }
/* a payment / credit under its invoice or bill: indented and quieter, so the document row stays the anchor */
.pm-ln.sub { padding-left: 28px; min-height: 32px; font-size: 14.5px; color: var(--ink-2); }
button.pm-ln:hover { background: var(--surface-2); }
.pm-ln .d { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.pm-ln .no { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-ln .a { text-align: right; min-width: 96px; white-space: nowrap; }
.pm-ln.pay .no, .pm-ln.carry { color: var(--ink-2); }
.pm-ln .why { grid-column: 3 / -1; font-size: 13.5px; color: var(--ink-2); line-height: 1.3; padding-bottom: 2px; }
.pm-ln .why.bad { color: var(--bad); }
.pm-owes { display: flex; justify-content: space-between; gap: 10px; padding: 8px 4px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm-owes span:first-child { font-weight: 400; color: var(--ink-2); }
.pm-none { padding: 16px 0; margin: 0; }
.pm-tot { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 12px; padding: 16px 0 0; }
.pm-tot span { display: block; color: var(--ink-2); font-size: 13px; }
.pm-tot b { font-weight: 400; font-size: 15px; font-variant-numeric: tabular-nums; }
.pm-tot div:last-child b { font-weight: 700; }
.pm-close { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }

/* detail panel (right side; full width on a phone) */
dialog.pm-panel { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(500px, 100vw); height: 100%; max-height: none; max-width: none; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; }
dialog.pm-panel::backdrop { background: rgba(10, 14, 11, .3); }
.pm-ph { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.pm-ph b { font-size: 18px; display: block; }
.pm-ph .muted { font-size: 14px; display: block; }
.pm-pb { padding: 20px 20px 40px; display: grid; gap: 18px; }
.pm-pb .pm-h2 { margin: 4px 0 -10px; }
.pm-issue { display: grid; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--check-soft); color: var(--check-ink); }
.pm-issue.bad { background: transparent; border: 1px solid var(--bad); color: var(--ink); }
.pm-issue .btn { justify-self: start; }
.pm-well { background: var(--surface-2); border-radius: 10px; padding: 12px; display: grid; place-items: center; min-height: 120px; }
.pm-well img { display: block; max-width: 100%; max-height: 60vh; border-radius: 4px; }
.pm-nophoto { color: var(--bad); font-weight: 700; margin: 0; }
.pm-facts { margin: 0; display: grid; }
.pm-facts div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pm-facts dt { color: var(--ink-2); }
.pm-facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.pm-step { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pm-step.ok { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 8px 0; }
.pm-step.ok svg { width: 16px; height: 16px; }
.pm-step ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14.5px; }
.pm-step li { overflow-wrap: anywhere; }
.pm-step.bad > b { color: var(--ink); }
.pm-step.bad > b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 8px; vertical-align: 2px; }
.pm-acts { display: inline-flex; gap: 12px; margin-left: 10px; flex-wrap: wrap; }
.pm-accr { display: grid; gap: 10px; margin-top: 6px; }
.pm-in { width: 100%; min-height: 40px; font: 400 15px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--field); border-radius: 8px; padding: 7px 10px; }

/* match */
.pm-pair { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); gap: 16px; align-items: start; }
.pm-side { display: grid; gap: 4px; min-width: 0; }
.pm-side .k { color: var(--ink-2); font-size: 14px; }
.pm-side .t { font-size: 19px; font-weight: 700; }
.pm-side .amt { font-size: 22px; font-variant-numeric: tabular-nums; }
.pm-side .pm-well { margin-top: 10px; }
.pm-arrow { align-self: center; justify-self: center; color: var(--ink-2); }
.pm-result { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pm-result .lab { color: var(--ink-2); font-size: 15px; }
.pm-result .v { font-size: clamp(24px, 3vw, 32px); line-height: 1.15; font-variant-numeric: tabular-nums; }
.pm-result .v small { font-size: 16px; color: var(--ink-2); }
.pm-warn { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--check-soft); color: var(--check-ink); }
.pm-warn.bad { background: transparent; border: 1px solid var(--bad); color: var(--ink); }

/* cheque planner */
.pm-plan > * { max-width: 780px; }
.pm-answer { margin: 0; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.2; letter-spacing: -.01em; }
.pm-asub { margin: -8px 0 0; color: var(--ink-2); font-size: 17px; }
.pm-asub.bad { color: var(--bad); }
.pm-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.pm-inputs label { display: grid; gap: 6px; color: var(--ink-2); font-size: 14px; }
.pm-inputs input, .pm-inputs select { min-height: 48px; width: 100%; min-width: 0; border: 1px solid var(--field); border-radius: 8px; padding: 8px 12px; font: 400 18px var(--body); color: var(--ink); background: var(--surface); font-variant-numeric: tabular-nums; }
.pm-quick { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; margin-top: -6px; }
.pm-quick label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.pm-quick input { width: 18px; height: 18px; accent-color: var(--accent); }
.pm-chart svg { display: block; width: 100%; height: 110px; overflow: visible; }
.pm-ticks { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.pm-days { border-top: 1px solid var(--line); }
.pm-day { display: grid; grid-template-columns: 88px minmax(0, 1fr) 110px 110px; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; font-variant-numeric: tabular-nums; }
.pm-day.hd { color: var(--ink-2); font-size: 13px; padding: 8px 0; }
.pm-day .dd { font-weight: 700; }
.pm-day .dd.sub { visibility: hidden; }
.pm-day .w2 { min-width: 0; overflow-wrap: anywhere; }
.pm-day .amt, .pm-day .bal { text-align: right; white-space: nowrap; }
.pm-day .bal.low { color: var(--bad); font-weight: 700; }
.pm-day.mine { background: var(--surface-2); }
.pm-day.mine .w2 { font-weight: 700; }
.pm-rowi .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 860px) {
  .pm-seg { display: flex; }
  .pm-cols { grid-template-columns: minmax(0, 1fr); }
  .pm-col.in, .pm-col.out { padding: 0; border: 0; }
  .pm-cols[data-show="in"] .pm-col.out, .pm-cols[data-show="out"] .pm-col.in { display: none; }
  .pm-colh { display: none; }
  .pm-inputs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .pm-ln { grid-template-columns: 10px 54px minmax(0, 1fr) auto; gap: 0 8px; }
  .pm-ln .a { min-width: 0; }
  .pm-tot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pm-pair { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pm-arrow { transform: rotate(90deg); justify-self: start; margin: 4px 0; }
  .pm-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  .pm-result > div:last-child { grid-column: 1 / -1; }
  .pm-day { grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; font-size: 15px; }
  .pm-day .dd { grid-column: 1 / -1; margin-bottom: -6px; font-size: 14px; }
  .pm-day .dd.sub, .pm-day.hd .dd { display: none; }
  .pm-rowi { flex-wrap: wrap; }
  .pm-acts { margin-left: 0; }
}

/* Hisaab: per party, an open group and a paid group, separated by space (owner rules 22 Nov) */
.pm-nums.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pm-party { padding: 18px 0 16px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.pm-partyh { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pm-partyh h3 { margin: 0; font: 700 17px var(--body); }
.pm-partyh > span { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-sub { display: grid; }
.pm-subh { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); padding: 0 4px 2px; font-variant-numeric: tabular-nums; }
details.pm-sub > summary { cursor: pointer; list-style: none; padding: 6px 4px; border-radius: 6px; }
details.pm-sub > summary::-webkit-details-marker { display: none; }
details.pm-sub > summary span:first-child::before { content: "▸ "; }
details.pm-sub[open] > summary span:first-child::before { content: "▾ "; }
details.pm-sub > summary:hover { background: var(--surface-2); }
.pm-empty { margin: 0; padding: 4px 4px 0 24px; }
.pm-ln .no .pd { color: var(--ink-2); font-size: 13.5px; margin-left: 10px; }
a.pm-ln { color: var(--ink); text-decoration: none; }
.pm-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; font-size: 13.5px; color: var(--ink-2); padding: 0 4px; font-variant-numeric: tabular-nums; }
.pm-foot b { color: var(--ink); font-weight: 400; }
.pm-foot span:last-child b { font-weight: 700; }
/* the paper as the engine has it (paper stays white, like the real paper) */
.pm-paper { background: #FFFFFF; color: #1B1B1B; border: 1px solid #DADADA; border-radius: 4px; padding: 14px 16px; font-size: 14px; }
.pm-paper .pp-h { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; border-bottom: 1.5px solid #1B1B1B; padding-bottom: 6px; }
.pm-paper .pp-h span { color: #555; }
.pm-paper table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pm-paper th { text-align: left; font-size: 12px; color: #555; font-weight: 700; padding: 4px 4px; border-bottom: 1px solid #BBB; }
.pm-paper td { padding: 6px 4px; border-bottom: 1px solid #EEE; vertical-align: top; }
.pm-paper td small { display: block; color: #666; font-size: 12px; }
.pm-paper .n { text-align: right; white-space: nowrap; }
.pm-paper .pp-tot { display: flex; justify-content: flex-end; gap: 14px; margin-top: 8px; font-size: 15px; }
.pm-paper .pp-none { margin: 10px 0 0; color: #A1262F; font-weight: 700; }
@media (max-width: 600px) {
  .pm-nums.two { grid-template-columns: minmax(0, 1fr); }
  .pm-paper { padding: 10px; font-size: 13px; }
  .pm-paper th, .pm-paper td { padding: 5px 2px; }
  .pm-foot { justify-content: flex-start; }
}
.pm-side .pm-well { min-height: 90px; }
.pm-side .pm-well img { max-height: 300px; }

/* Hisaab view toggle (By customer | Pending / Paid) and month arrows with names (visible on the phone too) */
.pm-seg.on { display: inline-flex; }
.pm-seg a { flex: 1; display: grid; place-items: center; min-height: 40px; padding: 0 14px; border-radius: 7px; font: 700 14px var(--body); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.pm-seg a[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.pm-monthnav { display: inline-flex; gap: 6px; }
.pm-monthnav .btn { min-width: 64px; padding: 7px 10px; font-size: 15px; }
.pm-pick { display: grid; gap: 0; max-height: 60vh; overflow: auto; border-top: 1px solid var(--line); }
.pm-pick label { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 48px; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-variant-numeric: tabular-nums; }
.pm-pick label:hover { background: var(--surface-2); }
.pm-pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.pm-pick small { display: block; color: var(--ink-2); font-size: 14px; }
.pm-pick label.sugg b::after { content: " · suggested"; font-weight: 400; color: var(--ink-2); }
.pm-list2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.pm-list2 h2 { margin: 0 0 6px; font: 700 15px var(--body); color: var(--ink-2); }
.pm-bills td, .pm-bills th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
.pm-bills { width: 100%; border-collapse: collapse; }
.pm-bills .n { text-align: right; white-space: nowrap; }
.pm-bills input { width: 18px; height: 18px; accent-color: var(--accent); }
@media (max-width: 860px) { .pm-list2 { grid-template-columns: minmax(0, 1fr); } }
