/* Staff receipts and public verification. Loads after tokens.css (fonts, colours, spacing). */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--t-m); line-height: var(--lh-body); color: var(--ink); background: var(--ivory); }
h1, h2 { line-height: var(--lh-tight); font-weight: 600; margin: 0 0 var(--s4); text-wrap: balance; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-l); margin-top: var(--s6); }
p { margin: 0 0 var(--s4); }
a { color: var(--ink); text-underline-offset: 3px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; overflow-wrap: anywhere; }
small { color: var(--ink-2); }
.muted { color: var(--ink-2); font-size: var(--t-s); }
:focus-visible { outline: 2px solid var(--logo-gold); outline-offset: 2px; }

/* Top bar: brand, grouped menus (Dashboard, Sales, Finance, Administration), Issue receipt and the account menu.
   Menus are <details> elements: they open with Enter or Space, and admin.js adds Escape, outside-click
   closing and arrow keys. Below 900 px the groups move into one Menu panel. */
.bar { position: relative; padding: var(--s2) 0; min-height: 60px; background: var(--plan-green); color: var(--paper); border-bottom: 1px solid var(--logo-gold); }
.bar-inner { display: flex; align-items: center; gap: var(--s2) var(--s4); min-height: 44px; }   /* .l-wrap: the same columns as the page body */
.bar a { color: var(--paper); text-decoration: none; }
.bar-brand { display: flex; align-items: center; gap: var(--s2); min-height: 44px; font-weight: 600; color: var(--gold-light) !important; white-space: nowrap; }
.bar-brand img { width: 32px; height: auto; }
.bar-nav { display: flex; align-items: center; gap: var(--s1); flex: 1; }
.bar summary { list-style: none; }
.bar summary::-webkit-details-marker { display: none; }
.nav-top { display: flex; align-items: center; gap: var(--s1); min-height: 44px; padding: 0 var(--s3); color: var(--paper); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
summary.nav-top::after { content: ""; width: 0; height: 0; margin-left: var(--s1); border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.nav-menu[open] > summary.nav-top::after { transform: translateY(-2px) rotate(180deg); }
.nav-top:hover, .nav-menu[open] > .nav-top { color: var(--gold-light); }
.nav-top[aria-current="page"], .nav-top.is-current { color: var(--gold-light); border-bottom-color: var(--gold-light); }
.nav-menu { position: relative; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.nav-menu > .menu-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 230px; padding: var(--s1) 0; background: var(--paper); border: 1px solid var(--ink); box-shadow: 0 8px 20px rgba(12,33,28,.2); }
.nav-menu > .menu-right { left: auto; right: 0; }
.menu-list a, .menu-list button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 var(--s4); color: var(--ink) !important; font: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover, .menu-list a:focus-visible, .menu-list button:focus-visible { background: var(--ivory); }
.menu-list a[aria-current="page"] { font-weight: 600; background: #f3ecd9; box-shadow: inset 3px 0 0 var(--plan-green); }
.menu-who { display: grid; padding: var(--s2) var(--s4) var(--s3); border-bottom: 1px solid var(--rule); color: var(--ink); }
.menu-who small { color: var(--ink-2); }
.btn-issue { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); margin-left: auto; font-weight: 600; color: var(--plan-green) !important; background: var(--gold-light); border: 1px solid var(--gold-light); border-radius: var(--radius); white-space: nowrap; }
.btn-issue:hover { background: var(--paper); }
.btn-issue.is-current { box-shadow: 0 0 0 2px var(--paper); }
.account-button { gap: var(--s2); font-size: var(--t-s); }
.account-button small { color: var(--gold-light); }
.nav-mobile { display: none; }
.nav-mobile-button { display: flex; align-items: center; min-height: 44px; padding: 0 var(--s3); color: var(--paper); border: 1px solid rgba(255,255,255,.45); border-radius: var(--radius); cursor: pointer; font-weight: 600; }
.nav-mobile[open] .nav-mobile-button { background: var(--paper); color: var(--plan-green); }
.mobile-panel { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; max-height: calc(100vh - 60px); overflow-y: auto; padding: var(--s2) var(--margin) var(--s5); background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--ink); box-shadow: 0 8px 20px rgba(12,33,28,.2); }
.mobile-panel h2 { margin: var(--s4) 0 var(--s1); font-size: var(--t-s); color: var(--ink-2); }
.mobile-panel .menu-list a, .mobile-panel .menu-list button { padding: 0 var(--s2); border-bottom: 1px solid var(--rule); }
.mobile-panel .menu-who { padding: var(--s2); }
@media (max-width: 1000px) {
  .bar-nav, .account-menu { display: none; }
  .nav-mobile { display: block; }
  .btn-issue { padding: 0 var(--s3); }
}
@media (max-width: 400px) {
  .bar { gap: var(--s2); }
  .bar-brand { font-size: var(--t-s); }
}
/* Breadcrumbs on deeper pages */
.crumbs ol { display: flex; flex-wrap: wrap; gap: var(--s1); list-style: none; margin: 0 0 var(--s3); padding: 0; font-size: var(--t-s); color: var(--ink-2); }
.crumbs li + li::before { content: "›"; margin-right: var(--s1); color: var(--ink-2); }
.crumbs a { color: var(--ink-2); }

.main { padding: var(--s6) 0 var(--s8); }   /* .l-wrap sets the width: the header, body and menus share one container */
.narrow .main, .main.narrow { max-width: 560px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: var(--s2) var(--s4); font: inherit; font-weight: 600; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--ivory); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { color: var(--paper); background: var(--plan-green); border-color: var(--plan-green); }
.btn-primary:hover { background: var(--plan-green-2); }
.btn-danger { color: var(--paper); background: var(--error); border-color: var(--error); }
.btn-danger:hover { background: #8f1e18; }
.btn-small { min-height: 36px; padding: var(--s1) var(--s3); font-size: var(--t-s); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

.form { display: grid; gap: var(--s4); max-width: 720px; }
.form fieldset { border: 0; border-top: 1px solid var(--rule); margin: 0; padding: var(--s4) 0 0; display: grid; gap: var(--s4); }
.form legend { font-weight: 600; padding: 0 var(--s2) 0 0; }
.row { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: grid; gap: var(--s1); }
.field > span { font-weight: 600; font-size: var(--t-s); }
.field small { font-size: var(--t-xs); }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: var(--s2) var(--s3); font: inherit; color: var(--ink); background: var(--paper); border: 1px solid #93a39f; border-radius: var(--radius); }
.field input[readonly], .field textarea[readonly], .field select:disabled { background: var(--ivory); color: var(--ink-2); }
.form-error { margin: 0; padding: var(--s3); color: var(--error); background: #fbeceb; border-left: 3px solid var(--error); }
.notice { padding: var(--s3); background: #e6f3ec; border-left: 3px solid var(--whatsapp); }
.review { padding: var(--s4); background: var(--paper); border: 1px solid var(--ink); }
.review h2 { margin-top: 0; }
.review dl, .facts { display: grid; gap: var(--s2); margin: 0 0 var(--s4); }
.review dl div, .facts div { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: var(--s3); }
.review dt, .facts dt { color: var(--ink-2); font-size: var(--t-s); }
.review dd, .facts dd { margin: 0; font-weight: 600; }

/* Lists and summaries */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); margin-bottom: var(--s5); }
.filters .field { min-width: 180px; flex: 1; }
.filters .field:first-child { flex: 2; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--rule); }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); vertical-align: top; }
.table thead th { background: var(--ivory); font-weight: 600; white-space: nowrap; }
.table tfoot th { border-top: 2px solid var(--ink); }
.table .num { text-align: right; white-space: nowrap; }
.row-actions { white-space: nowrap; }
.tag { display: inline-block; padding: 0 var(--s2); font-size: var(--t-xs); font-weight: 600; border: 1px solid currentColor; border-radius: 2px; }
.tag-issued { color: var(--whatsapp); }
.tag-cancelled { color: var(--error); }
.empty { padding: var(--s6); text-align: center; background: var(--paper); border: 1px dashed #93a39f; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; margin: 0 0 var(--s5); background: var(--rule); border: 1px solid var(--rule); }
.totals div { padding: var(--s4); background: var(--paper); }
.totals dt { font-size: var(--t-s); color: var(--ink-2); }
.totals dd { margin: 0; font-size: var(--t-xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.trail { padding-left: var(--s5); font-size: var(--t-s); }
.trail span { color: var(--ink-2); }
.print-only { display: none; }

/* Receipt page */
.toolbar { display: grid; gap: var(--s3); margin-bottom: var(--s5); }
.toolbar-status p { margin: 0 0 var(--s2); }
.pdf-hint { margin: 0; font-size: var(--t-s); }
.sheet-frame { overflow: hidden; }
.receipt-side { max-width: 148mm; }
.receipt-side section { margin-top: var(--s5); }

/* The A5 sheet: black on white, sized in millimetres for print. */
.sheet { position: relative; width: 148mm; min-height: 210mm; padding: 9mm 10mm 8mm; margin: 0 auto 0 0; background: #fff; color: #000; box-shadow: 0 1px 4px rgba(12,33,28,.18);
  font-size: 9pt; line-height: 1.35; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; overflow: hidden; }
.sheet dl { margin: 0; }
.sheet dd { margin: 0; }
.sheet-head { text-align: center; }
.sheet-logo { display: block; width: 30mm; height: auto; margin: 0 auto 2.5mm; }
.sheet-head h1 { font-size: 13pt; margin: 0 0 3mm; letter-spacing: .02em; }
.sheet-ids { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5mm 4mm; padding: 2.5mm 0; border-top: 1.5pt solid #000; border-bottom: .5pt solid #000; }
.sheet-ids .wide { grid-column: 1 / -1; }
.sheet-ids dt, .sheet-rows dt, .sheet-amount span { font-size: 7pt; color: #333; }
.sheet-ids .serial { font-size: 12pt; font-weight: 600; letter-spacing: .02em; }
.sheet .mono { font-size: 8pt; }
.sheet-rows { display: grid; gap: 1.2mm; padding: 2.5mm 0; border-bottom: .5pt solid #000; }
.sheet-rows div { display: grid; grid-template-columns: 28mm 1fr; gap: 3mm; align-items: baseline; }
.sheet-rows dd { font-size: 10pt; }
.sheet-amount { padding: 2.5mm 3mm; margin: 2.5mm 0; border: 1.5pt solid #000; }
.sheet-amount .figures { display: flex; justify-content: space-between; align-items: baseline; gap: 3mm; }
.sheet-amount strong { font-size: 16pt; }
.sheet-amount .words { margin: 1mm 0 0; font-size: 9.5pt; font-weight: 600; }
.sheet-staff { border-top: 0; }
.sheet-codes { display: grid; grid-template-columns: 27mm 1fr; gap: 5mm; align-items: start; padding: 3mm 0; }
.sheet-codes figure { margin: 0; }
.sheet-codes svg { display: block; width: 100%; height: auto; }
.qr figcaption { text-align: center; font-size: 7pt; margin-top: 1mm; }
.barcode svg { height: 13mm; width: 100%; }
.barcode figcaption { text-align: center; margin-top: 1mm; letter-spacing: .08em; }
.verify-note { margin: 2mm 0 0; font-size: 7pt; color: #333; }
.sheet-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; margin-top: auto; padding-top: 12mm; font-size: 8pt; }
.sheet-signs .line { display: block; border-top: .75pt solid #000; margin-bottom: 1mm; }
.sheet-foot { margin-top: 4mm; padding-top: 2mm; border-top: .5pt solid #000; text-align: center; font-size: 7.5pt; }
.stamp { position: absolute; top: 88mm; left: 50%; transform: translateX(-50%) rotate(-18deg); padding: 2mm 6mm; font-size: 30pt; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: #000; border: 2.5pt solid #000; background: rgba(255,255,255,.75); pointer-events: none; }

/* Public verification */
.verify .main { padding-top: var(--s7); }
.verdict { padding: var(--s5); margin-bottom: var(--s5); background: var(--paper); border: 2px solid; }
.verdict.is-valid { border-color: var(--whatsapp); }
.verdict.is-cancelled { border-color: var(--error); background: #fbeceb; }
.verdict-status { font-size: var(--t-2xl); font-weight: 600; margin-bottom: var(--s2); }
.is-valid .verdict-status { color: var(--whatsapp); }
.is-cancelled .verdict-status { color: var(--error); }
.facts { background: var(--paper); padding: var(--s4); border: 1px solid var(--rule); }
.facts dd small { display: block; font-weight: 400; }

/* Inventory (staff only) */
.notice-info { background: var(--paper); border-left-color: var(--logo-gold); font-size: var(--t-s); }
.tag-open { color: var(--whatsapp); }
.tag-company { color: #5a4a8a; }
.tag-hold { color: #8a5a00; }
.tag-sold { color: var(--ink-2); }
.totals-compact { grid-template-columns: repeat(4, 1fr); }
.totals-compact div { padding: var(--s2) var(--s3); }
.totals-compact dd { font-size: var(--t-l); }
.inventory { display: grid; gap: var(--s5); align-items: start; }
.inventory-table tr[aria-current="true"] td { background: #f3ecd9; }
.inventory-table td:first-child a { font-weight: 600; }
.unit { padding: var(--s4); background: var(--paper); border: 1px solid var(--ink); }
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.unit h2 { margin: 0 0 var(--s3); }
.unit h3 { font-size: var(--t-m); margin: var(--s5) 0 var(--s3); }
.unit .facts { padding: 0; border: 0; }
.unit-form { margin-top: var(--s5); }
.unit .facts dd small { display: block; font-weight: 400; }
.choice { display: flex !important; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.choice label { display: flex; align-items: center; gap: var(--s2); min-height: 44px; }
.choice input { width: 20px; height: 20px; accent-color: var(--plan-green); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.history li { padding-left: var(--s3); border-left: 2px solid var(--rule); }
.history p { margin: 0; }
.empty-left { text-align: left; }
.issues { margin: var(--s3) 0 0; padding-left: var(--s5); font-size: var(--t-s); }
@media (min-width: 1024px) {
  .inventory.has-unit { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .inventory.has-unit .unit { grid-column: 2; grid-row: 1; position: sticky; top: var(--s4); max-height: calc(100vh - 2 * var(--s4)); overflow-y: auto; }
  .inventory.has-unit .inventory-list { grid-column: 1; grid-row: 1; }
}
@media (max-width: 640px) {
  .hide-s { display: none; }
  .totals-compact { grid-template-columns: repeat(2, 1fr); }
  .filters .field { min-width: 140px; }
}

/* Customers, bookings and ledgers (staff only) */
.tag-draft { color: var(--ink-2); }
.tag-active { color: var(--whatsapp); }
.tag-completed { color: var(--plan-green); }
h1 .tag { font-size: var(--t-s); vertical-align: middle; }
.totals dd.sub { font-size: var(--t-s); font-weight: 400; color: var(--ink-2); }
.totals .is-alert { box-shadow: inset 3px 0 0 var(--error); }
.totals .is-alert dd:not(.sub) { color: var(--error); }
.overdue { color: var(--error); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.section-head h2 { margin-bottom: var(--s3); }
.section-head > a { display: inline-flex; align-items: center; min-height: 44px; }
.split { display: grid; gap: 0 var(--gutter); }
.split > section { min-width: 0; }
.pre { white-space: pre-wrap; }
.panel { margin: var(--s4) 0; padding: var(--s4); background: var(--paper); border: 1px solid var(--rule); max-width: 720px; }
.panel h3 { font-size: var(--t-m); margin: 0 0 var(--s2); }
.panel p { margin-bottom: var(--s3); }
.panel-danger { border-color: #e2b8b5; }
details.panel > summary { cursor: pointer; font-weight: 600; min-height: 32px; }
details.panel[open] > summary { margin-bottom: var(--s4); }
.duplicates { padding: var(--s3); background: #fbf3e2; border-left: 3px solid var(--logo-gold); display: grid; gap: var(--s3); }
.duplicates p, .duplicates ul { margin: 0; }
.duplicates ul { padding-left: var(--s5); font-size: var(--t-s); }
.plan-preview { margin: 0; min-height: 1.4em; font-size: var(--t-s); color: var(--ink-2); }
.plan-preview.is-bad { color: var(--error); font-weight: 600; }
.tag-historical { color: #5a4a8a; }
.lines { display: grid; gap: var(--s3); }
.line-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(160px, 2fr) auto; gap: var(--s2) var(--s3); align-items: end; }
.line-row .btn { min-height: 44px; }
.check { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--t-s); }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--plan-green); flex: none; }
@media (max-width: 640px) {
  .line-row { grid-template-columns: 1fr 1fr; padding-bottom: var(--s3); border-bottom: 1px solid var(--rule); }
  .plan-table th, .plan-table td { padding: var(--s1) var(--s2); font-size: var(--t-xs); }
  .line-row .field:nth-child(3) { grid-column: 1 / -1; }
  .line-row .btn { grid-column: 1 / -1; justify-self: start; }
}
.tabs { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); margin-bottom: var(--s4); border-bottom: 1px solid var(--rule); }
.tabs a { padding: var(--s2) 0; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { border-bottom-color: var(--plan-green); font-weight: 600; }
.ledger-table .kind { font-weight: 600; }
.ledger-table tr.is-reversed td { color: var(--ink-2); }
.plan-table tr.is-overdue td { background: #fbeceb; }
.exports { margin-top: var(--s7); }
@media (min-width: 1024px) {
  .split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

@media (max-width: 640px) {
  /* The ledger becomes one block per entry on phones. */
  .ledger-table thead { display: none; }
  .ledger-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1) var(--s3); padding: var(--s3); border-bottom: 1px solid var(--rule); }
  .ledger-table td { padding: 0; border: 0; }
  .ledger-table .l-no::before { content: "Entry "; }
  .ledger-table .l-no { grid-column: 1; color: var(--ink-2); }
  .ledger-table .l-date { grid-column: 2 / -1; text-align: right; }
  .ledger-table .l-entry { grid-column: 1 / -1; }
  .ledger-table .l-amt { text-align: left; font-size: var(--t-xs); }
  .ledger-table .l-amt::before { content: attr(data-label); display: block; font-size: var(--t-xs); color: var(--ink-2); }
  .ledger-table .l-act { grid-column: 1 / -1; }
  .ledger-table .l-act:empty { display: none; }
}

/* Booking page: lead figures, transactions as cards, collapsed panels */
.totals-lead { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.totals-lead div:first-child dd:not(.sub) { font-size: var(--t-2xl); }
.notice-draft { background: #fbf3e2; border-left-color: var(--logo-gold); }
.tag-dishonoured { color: var(--error); }
.totals .is-pending { box-shadow: inset 3px 0 0 var(--logo-gold); }
.pending-head { font-size: var(--t-m); margin: var(--s5) 0 var(--s2); }
.txns-pending { border-color: var(--logo-gold); }
.instrument { display: grid; gap: var(--s3); }
.instrument-panel .facts { margin-bottom: var(--s3); }
.verdict.is-pending { border-color: var(--logo-gold); background: #fbf3e2; }
.is-pending .verdict-status { color: #7a5a00; }
.sheet-warning { margin: -1mm 0 3mm; font-size: 8.5pt; font-weight: 600; }
.sheet.is-provisional .sheet-head h1, .sheet.is-dishonoured .sheet-head h1 { font-size: 11.5pt; border: 1.2pt solid #000; padding: 1.5mm 3mm; display: inline-block; }
.panel-wide { max-width: none; }
.panel-wide > summary, details.panel > summary { display: flex; align-items: center; min-height: 44px; }
.actions-panel { margin-top: var(--s6); }
.actions-panel h2 { margin-top: 0; }
.txns { list-style: none; margin: 0 0 var(--s4); padding: 0; background: var(--paper); border: 1px solid var(--rule); }
.txn { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; gap: var(--s1) var(--s4); padding: var(--s3); border-bottom: 1px solid var(--rule); align-items: start; }
.txn:last-child { border-bottom: 0; }
.txn p { margin: 0; }
.txn-date strong { display: block; font-variant-numeric: tabular-nums; }
.txn-date small, .txn-plot, .txn-correction { font-size: var(--t-xs); color: var(--ink-2); }
.txn-correction { color: var(--error); }
.txn-amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; display: grid; gap: var(--s2); justify-items: end; }
.txn-amount.struck { text-decoration: line-through; color: var(--ink-2); }
.txn-amount.struck .btn { text-decoration: none; }
.txn.is-reversed .txn-main strong { color: var(--ink-2); }
.by-plot { margin-top: var(--s3); }
.nowrap { white-space: nowrap; }
.show-s { display: none; }
.ownership { margin-bottom: var(--s4); }
/* Plot selector: a searchable dropdown */
.plot-picker { display: grid; gap: var(--s3); }
.picker-filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.picked { padding: var(--s3); background: var(--paper); border: 1px solid var(--rule); }
.picked p { margin: 0 0 var(--s2); }
.picked p:last-child { margin: 0; }
.picked ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.picked li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); font-weight: 600; }
.combo { position: relative; }
.combo-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; list-style: none; margin: 2px 0 0; padding: 0; max-height: min(60vh, 520px); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--ink); box-shadow: 0 6px 18px rgba(12,33,28,.18); }
.combo-option { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.5fr) minmax(150px, 1.5fr); gap: var(--s1) var(--s3); align-items: center;
  min-height: 48px; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); cursor: pointer; }
.combo-option:hover, .combo-option.is-active { background: #f3ecd9; }
.combo-option.is-held { cursor: not-allowed; color: var(--ink-2); }
.combo-empty { padding: var(--s3); color: var(--ink-2); }
.combo-count { margin: var(--s1) 0 0; min-height: 1.2em; }
.pick-meta { font-size: var(--t-s); color: var(--ink-2); }
.pick-status small { display: block; font-size: var(--t-xs); color: var(--ink-2); }
@media (max-width: 640px) {
  .btn-small { min-height: 44px; }
  .totals-lead div:first-child { grid-column: 1 / -1; }
  .totals-lead div:first-child dd:not(.sub) { font-size: var(--t-xl); }
  .totals dd { overflow-wrap: anywhere; }
  .show-s { display: inline; }
  .txn { grid-template-columns: 1fr auto; }
  .txn-main { grid-column: 1 / -1; grid-row: 2; }
  .combo-option { grid-template-columns: 1fr; gap: 2px; }
}

/* A4 customer statement: black on white, sized in millimetres for print. */
.statement { width: 100%; max-width: 186mm; padding: 10mm; background: #fff; color: #000; box-shadow: 0 1px 4px rgba(12,33,28,.18); font-size: 9.5pt; line-height: 1.4; font-variant-numeric: tabular-nums; }
.statement h1 { font-size: 15pt; margin: 0 0 1mm; }
.statement h2 { font-size: 11pt; margin: 6mm 0 2mm; }
.statement p, .statement dl, .statement dd { margin: 0; }
.st-head { display: flex; justify-content: space-between; align-items: center; gap: 6mm; padding-bottom: 4mm; border-bottom: 1.5pt solid #000; }
.st-head img { width: 30mm; height: auto; }
.st-head div { text-align: right; }
.st-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; padding: 4mm 0; border-bottom: .5pt solid #000; }
.st-parties dt { font-size: 7.5pt; color: #333; margin-bottom: 1mm; }
.st-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm 6mm; margin-top: 4mm; padding: 3mm; border: 1.5pt solid #000; }
.st-summary dt { font-size: 7.5pt; color: #333; }
.st-summary dd { font-weight: 600; font-size: 10.5pt; }
.statement .table-wrap { border: 0; background: none; }
.statement .table { font-size: 8.5pt; }
.statement .table th, .statement .table td { padding: 1.2mm 2mm; border-bottom: .5pt solid #999; }
.statement .table thead th { background: none; border-bottom: 1pt solid #000; }
.statement .table tfoot th { border-top: 1pt solid #000; }
.statement .plan-table tr.is-overdue td { background: none; font-weight: 600; }
.st-booking { break-before: auto; margin-top: 8mm; }
.st-booking h2 { border-top: 1.5pt solid #000; padding-top: 3mm; }
.statement h3 { font-size: 10pt; margin: 4mm 0 2mm; }
.st-foot { margin-top: 6mm; padding-top: 3mm; border-top: .5pt solid #000; font-size: 7.5pt; display: grid; gap: 1.5mm; }
@media (max-width: 640px) {
  .statement { padding: var(--s3); box-shadow: none; border: 1px solid var(--rule); }
  .st-parties, .st-summary { grid-template-columns: 1fr 1fr; }
  .st-head img { width: 22mm; }
}

@media (max-width: 640px) {
  h1 { font-size: var(--t-xl); }
  .sheet { box-shadow: none; border: 1px solid var(--rule); }
}

@page { size: A4 portrait; margin: 12mm; }
@page receipt { size: A5 portrait; margin: 0; }
@media print {
  body { background: #fff; }
  .bar, .no-print, .filters, .page-head .actions { display: none !important; }
  .print-only { display: block; }
  .main { padding: 0; width: auto; max-width: none; }
  .receipt-page .main { padding: 0; }
  .sheet-frame { overflow: visible; }
  .sheet { box-shadow: none; border: 0; margin: 0; width: 148mm; height: 210mm; min-height: 0; zoom: 1 !important; page: receipt; }
  .table-wrap { border: 0; overflow: visible; }
  .statement-page .main { padding: 0; }
  .statement { max-width: none; width: auto; padding: 0; box-shadow: none; border: 0; }
  .statement tr, .st-summary, .st-parties { break-inside: avoid; }
  .statement thead { display: table-header-group; }
}

/* Related records and contextual actions */
.related { margin: 0 0 var(--s3); font-size: var(--t-s); color: var(--ink-2); }
.unit-actions { margin: 0 0 var(--s3); }
.totals dt a { color: inherit; text-underline-offset: 3px; }
.export-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); max-width: 760px; }
.export-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4); background: var(--paper); border: 1px solid var(--rule); }
.export-list p { margin: 0; }

.notice-warning { background: #fbeceb; border-left-color: var(--error); }
.warning { color: var(--error); font-size: var(--t-s); font-weight: 600; margin: var(--s1) 0; }

/* Dashboard: metric cards, the exceptions strip, recent receipts beside "Attention needed", all on the page grid */
.dash-head { align-items: flex-start; margin-bottom: var(--s5); }
.dash-head h1 { margin-bottom: var(--s1); }
.dash-date { margin: 0; color: var(--ink-2); font-size: var(--t-s); }
.metrics { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gutter); }
.metrics > li { grid-column: span 4; min-width: 0; }
.metric { display: grid; align-content: start; gap: var(--s1); height: 100%; padding: var(--s4); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); text-decoration: none; }
.metric:hover { border-color: var(--ink-2); }
.metric:hover .metric-label { text-decoration: underline; text-underline-offset: 3px; }
.metric-label { font-size: var(--t-s); color: var(--ink-2); }
.metric-value { font-size: var(--t-xl); font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-sub { font-size: var(--t-xs); color: var(--ink-2); }
.metric.is-pending { box-shadow: inset 3px 0 0 var(--logo-gold); }
.strip { list-style: none; margin: 0 0 var(--s6); padding: 0; display: flex; flex-wrap: wrap; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.strip > li { flex: 1 1 180px; min-width: 0; background: var(--paper); }
.strip a { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s2); min-height: 44px; padding: var(--s2) var(--s4); text-decoration: none; }
.strip a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.strip span { font-size: var(--t-s); color: var(--ink-2); }
.strip strong { font-variant-numeric: tabular-nums; }
.strip small { font-size: var(--t-xs); }
.strip .is-alert strong { color: var(--error); }
.dash-work { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--s6) var(--gutter); margin-bottom: var(--s6); }
.dash-work > section, .dash-inventory { grid-column: 1 / -1; min-width: 0; }
.dash-work h2, .dash-inventory h2 { margin-top: 0; }
.receipts-table td small { display: block; color: var(--ink-2); font-size: var(--t-xs); }
.receipts-table .c-receipt a, .receipts-table .c-booking, .receipts-table .c-receipt small { white-space: nowrap; }
.receipts-table .c-receipt a { font-weight: 600; }
.dash-work .receipts-table .c-customer .clamp { max-width: 22ch; }
.receipts-table .c-customer .clamp { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipts-table .is-void .c-amount { color: var(--ink-2); }
.tag-official { color: var(--whatsapp); }
.tag-pending { color: var(--gold-text); }
.tag-realised { color: var(--plan-green); }
.attn-panel { padding: var(--s3) var(--s4); background: var(--paper); border: 1px solid var(--rule); }
.attn + .attn { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--ink); }
.attn h3 { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin: 0 0 var(--s1); font-size: var(--t-m); }
.attn-count { font-size: var(--t-s); font-weight: 400; color: var(--ink-2); }
.attn-list { list-style: none; margin: 0; padding: 0; }
.attn-list li { display: grid; gap: 2px; padding: var(--s2) 0; border-top: 1px solid var(--rule); }
.attn-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s3); text-decoration: none; }
.attn-list a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.attn-list b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.attn-list span { grid-column: 1 / -1; font-size: var(--t-xs); color: var(--ink-2); }
.attn-list em { font-style: normal; font-size: var(--t-xs); color: var(--ink-2); }
.attn-list em.is-due { color: var(--error); }
.attn-list em.is-ready { color: var(--gold-text); }
.attn-note { margin: 0 0 var(--s1); font-size: var(--t-s); }
.attn-more { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--t-s); }
.attn-empty { margin: 0; padding: var(--s5) var(--s4); color: var(--ink-2); background: var(--paper); border: 1px solid var(--rule); }
.changes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 var(--gutter); font-size: var(--t-s); }
.changes li { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--rule); }
.changes a { font-weight: 600; }
.changes small { grid-column: 1 / -1; color: var(--ink-2); font-size: var(--t-xs); }
.dash-cashier { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--s4) var(--gutter); margin-bottom: var(--s6); }
.dash-cashier > * { min-width: 0; }
.lookup { display: grid; align-content: start; gap: var(--s3); padding: var(--s4); background: var(--paper); border: 1px solid var(--rule); }
.lookup h2 { margin: 0; font-size: var(--t-m); }
.lookup .btn { justify-self: start; }
@media (min-width: 1024px) {
  .metrics > li { grid-column: span 3; }
  .dash-work > .dash-recent { grid-column: span 8; }
  .dash-work > .dash-attention { grid-column: span 4; }
}
/* Below the two-column layout the receipts table becomes one block per receipt: no horizontal scrolling. */
@media (max-width: 1023px) {
  .stack-table thead { display: none; }
  .stack-table tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s1) var(--s3); padding: var(--s3); border-bottom: 1px solid var(--rule); }
  .stack-table tr:last-child { border-bottom: 0; }
  .stack-table td { padding: 0; border: 0; }
  .receipts-table .c-receipt { grid-column: 1 / 3; grid-row: 1; }
  .receipts-table .c-amount { grid-column: 3; grid-row: 1; font-weight: 600; }
  .receipts-table .c-amount small { font-weight: 400; }
  .receipts-table .c-customer { grid-column: 1 / -1; grid-row: 2; }
  .receipts-table .c-customer .clamp { max-width: none; white-space: normal; }
  .receipts-table .c-status { grid-column: 1 / 3; grid-row: 3; }
  .receipts-table .c-booking { grid-column: 3; grid-row: 3; text-align: right; font-size: var(--t-xs); align-self: center; }
}
@media (max-width: 640px) {
  .metric-value { font-size: var(--t-l); }
  .strip > li { flex-basis: 45%; }
  .dash-head .actions { width: 100%; }
  .dash-head .actions .btn { flex: 1; }
}

/* Receipts before booking (awaiting allocation) */
.paths { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 var(--s4); border: 1px solid var(--plan-green); width: fit-content; max-width: 100%; }
.paths a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--s4); color: var(--plan-green); text-decoration: none; font-weight: 600; font-size: var(--t-s); }
.paths a + a { border-left: 1px solid var(--plan-green); }
.paths a[aria-current="page"] { background: var(--plan-green); color: var(--ivory); }
.tag-awaiting { color: var(--gold-text); }
.allocation-preview { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s4); margin: 0 0 var(--s4); }
.allocation-preview div { display: contents; }
.allocation-preview dt { color: var(--ink-2); font-size: var(--t-s); }
.allocation-preview dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.allocation-preview[hidden] { display: none; }
.choice label small { color: var(--ink-2); }
.view-switch { font-size: var(--t-s); }
.view-switch a { display: inline-flex; align-items: center; min-height: 44px; }
.view-switch a[aria-current="page"] { font-weight: 600; color: var(--ink); text-decoration: none; }
.unallocated-table td small { display: block; color: var(--ink-2); font-size: var(--t-xs); }
.unallocated-table .c-receipt a { font-weight: 600; white-space: nowrap; }
@media (max-width: 1023px) {
  .unallocated-table .c-receipt { grid-column: 1 / 3; grid-row: 1; }
  .unallocated-table .c-amount { grid-column: 3; grid-row: 1; font-weight: 600; }
  .unallocated-table .c-customer { grid-column: 1 / -1; grid-row: 2; }
  .unallocated-table .c-plot { grid-column: 1; grid-row: 3; }
  .unallocated-table .c-method { grid-column: 2; grid-row: 3; }
  .unallocated-table .c-age { grid-column: 3; grid-row: 3; }
  .unallocated-table .c-status { grid-column: 1 / 3; grid-row: 4; }
  .unallocated-table .c-action { grid-column: 3; grid-row: 4; text-align: right; }
}

/* Customer information forms (/admin/forms) */
.tabs { display: flex; flex-wrap: wrap; gap: 0 var(--s5); border-bottom: 1px solid var(--rule); margin: var(--s4) 0; }
.tabs a { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a b { font-weight: 600; font-size: var(--t-xs); color: var(--ink-2); }
.tabs a[aria-current="page"] { font-weight: 600; border-bottom-color: var(--plan-green); }
.forms-table td small { display: block; }
.forms-table tr.is-new .c-name a { font-weight: 600; }
.form-missing { color: var(--error); font-weight: 600; }
small.form-missing { font-size: var(--t-xs); }
.tag-form-new { color: var(--gold-text); }
.tag-form-contacted { color: var(--plan-green); }
.tag-form-onboarded { color: var(--whatsapp); }
.tag-form-not-proceeding { color: var(--ink-2); }
@media (max-width: 599px) {
  .forms-table thead, .forms-table .hide-s { display: none; }
  .forms-table tr { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s3); padding: var(--s3); border-bottom: 1px solid var(--rule); }
  .forms-table td { display: block; padding: 0; border: 0; }
  .forms-table .c-status { grid-column: 2; grid-row: 1; }
  .forms-table .c-plot small { display: inline; margin-left: var(--s2); }
  .forms-table .c-date { grid-column: 2; grid-row: 2; color: var(--ink-2); font-size: var(--t-xs); text-align: right; }
}
.note-line { margin: 0 0 var(--s4); padding: var(--s3) var(--s4); background: var(--paper); border-left: 3px solid var(--logo-gold); font-size: var(--t-s); max-width: 72ch; }
.form-cols { display: grid; gap: 0 var(--gutter); grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.form-cols .panel { max-width: none; }
.form-cols .facts, .panel-wide .facts { border: 0; padding: 0; margin: 0; }
.doc-tiles { list-style: none; margin: var(--s3) 0; padding: 0; display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.doc-tile { display: grid; gap: 2px; text-decoration: none; font-size: var(--t-s); }
.doc-tile small { font-size: var(--t-xs); }
.doc-prev { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--rule); background: var(--ivory); margin-bottom: var(--s1); }
.doc-pdf { display: grid; place-items: center; }
.doc-pdf::after { content: "PDF"; font-weight: 600; color: var(--ink-2); }
.doc-tile:hover .doc-prev { border-color: var(--plan-green); }
.status-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); margin-bottom: var(--s4); }
.status-form .field:nth-child(2) { flex: 1; min-width: 220px; }
.status-form .form-error { flex-basis: 100%; }
.plain-list { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s1); }
.btn .count { margin-left: var(--s2); padding: 0 var(--s2); background: var(--gold-light); color: var(--plan-green); border-radius: 2px; }
@media print { .doc-tiles { grid-template-columns: repeat(3, 1fr); } }
.strip .is-new strong { color: var(--gold-text); }
