:root {
  --app-safe-area-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --ink: #0b2344;
  --muted: #5c6976;
  --line: #d7e0e7;
  --surface: #ffffff;
  --subtle: #f2f6f8;
  --canvas: #edf3f6;
  --navy: #062a5e;
  --navy-dark: #041c42;
  --green: #008f57;
  --green-dark: #006e43;
  --red: #a43131;
  --amber: #8a5a00;
  --focus: #1177aa;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent); outline-offset: 2px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 22px; font-size: 28px; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 16px; font-size: 18px; letter-spacing: 0; }

.auth-layout, .state-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-panel, .state-panel { width: min(100%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 18px 50px rgba(23, 32, 25, .08); }
.state-panel { text-align: center; }
.state-panel > img { border-radius: 8px; margin-bottom: 18px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-lockup img { border-radius: 8px; }
.brand-lockup div { min-width: 0; display: grid; gap: 2px; }
.brand-lockup strong { font-size: 19px; }
.brand-lockup span { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.brand-lockup.compact { margin: 0; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 28px; padding: 3px; background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; }
.segment { min-height: 38px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-weight: 600; }
.segment.active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(23, 32, 25, .14); }

.form-stack { display: grid; gap: 16px; }
.form-stack h1, .form-stack h2 { margin-bottom: 2px; }
.account-choice-actions { margin-top: 22px; }
.auth-link { justify-self: center; padding-block: 6px; }
label { display: grid; gap: 7px; color: #455048; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #bfc8c1; border-radius: 5px; padding: 9px 11px; color: var(--ink); background: var(--surface); }
textarea { resize: vertical; }
input[readonly] { background: var(--subtle); }
.button { min-height: 40px; border: 1px solid transparent; border-radius: 5px; padding: 9px 15px; font-weight: 650; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: #bfc8c1; color: var(--ink); background: var(--surface); }
.button.secondary:hover { background: var(--subtle); }
.button.text { color: var(--green-dark); background: transparent; }
.button.small { min-height: 32px; padding: 5px 9px; font-size: 13px; }
.button:disabled { cursor: wait; opacity: .55; }
.button-row, .form-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.eyebrow { margin-bottom: 7px; color: var(--green-dark); font-size: 12px; font-weight: 750; text-transform: uppercase; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; overflow-y: auto; overscroll-behavior: contain; padding: 20px 16px; color: white; background: var(--navy-dark); }
.sidebar .brand-lockup span { color: #b9c8d9; }
.org-picker { color: #d3ddea; }
.org-picker select { border-color: #31527a; color: white; background: #0b3265; }
nav { display: grid; gap: 4px; }
.nav-item { min-height: 42px; border: 0; border-radius: 5px; padding: 9px 12px; color: #d3ddea; background: transparent; text-align: left; font-weight: 650; }
.nav-item:hover, .nav-item.active { color: white; background: #123b70; }
.sidebar-signout { margin-top: auto; border-color: #31527a !important; color: white !important; background: transparent !important; }
.workspace { min-width: 0; padding: 34px clamp(20px, 4vw, 54px) 64px; }
.workspace-section { width: min(1120px, 100%); min-width: 0; margin: 0 auto; }
.page-header { min-height: 70px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.page-header h1 { margin-bottom: 20px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.status-pill { border: 1px solid #9acaaa; border-radius: 999px; padding: 5px 9px; color: var(--green-dark); background: #e7f5eb; font-size: 12px; font-weight: 750; text-transform: capitalize; }
.metric-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 34px; border-block: 1px solid var(--line); background: var(--surface); }
.metric-strip > div { min-height: 100px; display: grid; align-content: center; gap: 8px; padding: 18px 22px; border-right: 1px solid var(--line); }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip span { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; }
.metric-strip strong { font-size: 22px; text-transform: capitalize; }
.content-band { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.details-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; background: var(--surface); border: 1px solid var(--line); }
.details-list div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.details-list div:last-child { border-right: 0; }
.details-list dt { margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; }
.details-list dd { overflow-wrap: anywhere; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.framed-tool { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.subscription-lock-panel { width: min(620px, 100%); margin: 9vh auto 0; padding: 30px; border: 1px solid var(--line); border-top: 4px solid var(--amber); border-radius: 8px; background: var(--surface); }
.subscription-lock-panel h1 { margin-bottom: 12px; }
.subscription-lock-panel .muted { margin-bottom: 24px; line-height: 1.65; }
.subscription-lock-panel .button + .button { margin-left: 8px; }

.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { height: 44px; color: var(--muted); background: var(--subtle); font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.actions-column { width: 110px; text-align: right; }
.table-select { min-width: 125px; min-height: 34px; padding: 5px 8px; text-transform: capitalize; }
.capitalize { text-transform: capitalize; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; text-transform: capitalize; }
.status-dot::before { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); content: ""; }
.status-dot.active::before { background: var(--green); }
.status-dot.disabled::before { background: var(--red); }
.list { border: 1px solid var(--line); background: var(--surface); }
.list > .muted { margin: 0; padding: 18px; }
.list-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row div { min-width: 0; display: grid; gap: 3px; }
.list-row strong { overflow: hidden; text-overflow: ellipsis; }
.list-row span { color: var(--muted); font-size: 13px; text-transform: capitalize; }
.plan-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.plan-heading h2 { margin-bottom: 5px; }
.plan-heading p { margin-bottom: 0; }
.billing-cycle { width: 230px; margin: 0; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan-card { min-height: 260px; display: flex; flex-direction: column; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.plan-card h3 { margin: 0; font-size: 18px; letter-spacing: 0; }
.portal-plan-price { margin: 10px 0 0; color: var(--green-dark); font-size: 21px; font-weight: 750; }
.plan-card ul { display: grid; gap: 9px; margin: 0; padding-left: 20px; color: #455048; }
.plan-card .button, .plan-contact { margin-top: auto; align-self: flex-start; }
.plan-contact { display: inline-flex; align-items: center; text-decoration: none; }

dialog { width: min(460px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; color: var(--ink); box-shadow: 0 24px 80px rgba(23, 32, 25, .25); }
dialog::backdrop { background: rgba(23, 32, 25, .55); }
dialog form { padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 16px; }
.icon-button { min-width: 42px; min-height: 38px; border: 1px solid #bfc8c1; border-radius: 5px; padding: 7px 10px; color: var(--ink); background: var(--surface); font-weight: 650; }
.invite-result { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.venue-actions { width: 270px; text-align: right; }
.table-actions { display: flex; justify-content: flex-end; gap: 7px; }
.compact-grid { gap: 12px; }
.clock-tool { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px; border: 1px solid #9acaaa; border-radius: 8px; background: #e7f5eb; }
.clock-tool h2 { margin-bottom: 7px; }
.clock-tool p:last-child { margin-bottom: 0; }
.qr-dialog { width: min(520px, calc(100% - 28px)); }
.qr-panel { display: grid; justify-items: center; gap: 15px; padding: 22px; }
.qr-panel .dialog-heading { width: 100%; }
.qr-panel img { width: min(360px, 100%); height: auto; aspect-ratio: 1; image-rendering: crisp-edges; }
.qr-panel a.button { display: inline-flex; align-items: center; text-decoration: none; }
.document-upload { display: grid; grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 1fr) auto; align-items: end; gap: 14px; margin-bottom: 20px; padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.document-upload.contextual-upload { grid-template-columns: 1fr 1fr; align-items: start; }
.document-file-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.document-upload-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: -6px 0 20px; padding: 12px 14px; border: 1px solid #aeb8b0; background: #f8faf8; }
.document-upload-status > div { min-width: 0; display: grid; gap: 3px; }
.document-upload-status span { color: var(--muted); overflow-wrap: anywhere; }
.document-upload-status[data-state="ready"] { border-color: #77a989; background: #f1f8f3; }
.document-upload-status[data-state="error"] { border-color: #c88787; background: #fff6f6; }
.context-note { margin: 0; border-left: 3px solid var(--amber); padding: 10px 12px; color: #6a4700; background: #fff8e8; font-size: 13px; }
.document-table-wrap { max-height: calc(100vh - 270px); }
.document-actions { min-width: 190px; text-align: right; }
.confidence { font-variant-numeric: tabular-nums; }
.confidence.high { color: var(--green-dark); }
.confidence.medium { color: var(--amber); }
.confidence.low { color: var(--red); }
.document-dialog { width: min(620px, calc(100% - 28px)); }
.batch-ocr-form { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); align-items: end; gap: 14px; margin-bottom: 20px; }
.batch-mode-control { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; min-width: 0; margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--subtle); }
.batch-mode-control legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.batch-mode-control label { min-width: 0; }
.batch-mode-control input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.batch-mode-control span { display: grid; min-height: 38px; place-items: center; padding: 7px 10px; border-radius: 4px; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; cursor: pointer; }
.batch-mode-control input:checked + span { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(18, 35, 24, .12); }
.batch-mode-control input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 1px; }
.batch-file-field { grid-column: 1 / 3; }
.batch-selection { min-height: 46px; display: grid; align-content: center; gap: 3px; }
.batch-selection span { color: var(--muted); font-size: 12px; }
.batch-metrics { grid-template-columns: repeat(4, 1fr); }
.batch-progress-band { display: grid; gap: 12px; padding: 18px 0 22px; }
.batch-progress-band > div { display: flex; justify-content: space-between; gap: 16px; }
.batch-progress-band span { color: var(--muted); }
.batch-progress-band progress { width: 100%; height: 12px; accent-color: var(--green); }
.batch-progress-band p { margin: 0; }
.batch-table-wrap table { min-width: 1180px; font-variant-numeric: tabular-nums; }
.takings-filters { display: grid; grid-template-columns: minmax(180px, 240px) minmax(220px, 320px); gap: 14px; margin-bottom: 20px; }
.price-viewbar { display: grid; grid-template-columns: minmax(460px, 520px) minmax(260px, 1fr); align-items: end; gap: 14px; margin-bottom: 14px; }
.price-tabs { grid-template-columns: repeat(4, 1fr); margin: 0; }
.price-search { justify-self: end; width: min(420px, 100%); }
.price-filters { display: grid; grid-template-columns: repeat(3, minmax(170px, 220px)) minmax(260px, 1fr); align-items: end; gap: 14px; margin-bottom: 20px; }
#prices-section .metric-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#prices-section table { min-width: 1420px; font-variant-numeric: tabular-nums; }
#prices-section th:first-child { position: sticky; z-index: 2; left: 0; background: var(--subtle); }
#prices-section td:first-child { position: sticky; z-index: 1; left: 0; background: var(--surface); }
#prices-section td.negative { color: var(--red); font-weight: 750; }
#prices-section td.positive { color: var(--green-dark); font-weight: 750; }
.price-product-row td { background: var(--surface); }
.price-product-row:hover td { background: #f8faf8; }
.price-history-row td { height: 50px; color: #455048; background: var(--subtle); }
.price-history-row td:first-child { border-left: 3px solid #aeb8b0; }
.price-history-row td:first-child { background: var(--subtle); }
.price-history-label { font-size: 13px; font-weight: 700; }
.price-expand-cell { width: 58px; text-align: center; }
.price-history-toggle { min-width: 34px; min-height: 34px; padding: 4px 8px; }
.ordering-history-toggle { min-width: 34px; min-height: 34px; padding: 4px 8px; }
.order-status { display: inline-flex; align-items: center; min-height: 28px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; background: var(--subtle); font-size: 12px; font-weight: 750; white-space: nowrap; }
.order-status.overdue { border-color: #ddb1b1; color: #782323; background: #fbecec; }
.order-status.due_soon { border-color: #e3c27c; color: #6a4700; background: #fff8e8; }
.order-status.on_schedule { border-color: #9acaaa; color: var(--green-dark); background: #e7f5eb; }
.takings-form { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.takings-scan-tools { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.takings-scan-tools > div { display: grid; gap: 2px; margin-right: auto; }
.takings-scan-tools span { font-size: 12px; }
.takings-form-actions { grid-column: 1 / -1; display: flex; gap: 9px; }
.takings-table-wrap { max-height: calc(100vh - 320px); }
.takings-table-wrap table { min-width: 1650px; font-variant-numeric: tabular-nums; }
.takings-table-wrap tfoot td { border-top: 2px solid #aeb8b0; background: var(--subtle); font-weight: 750; }
.bank-import-form { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.bank-saved-account-field { grid-column: span 3; }
.bank-file-field { grid-column: span 2; }
.bank-column-mapping { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.bank-column-mapping[hidden] { display: none; }
.bank-import-actions { grid-column: 1 / -1; display: flex; gap: 9px; }
.bank-preview-status { grid-column: 1 / -1; margin: 0; }
.bank-preview-wrap { margin-bottom: 22px; }
.bank-preview-wrap table, .bank-transactions-wrap table { min-width: 980px; font-variant-numeric: tabular-nums; }
.bank-amount { text-align: right; white-space: nowrap; }
.bank-transactions-wrap tbody tr[data-bank-review] { cursor: pointer; }
.bank-transactions-wrap tbody tr[data-bank-review]:hover td { background: #f7faf7; }
.bank-transactions-wrap th:last-child, .bank-transactions-wrap td:last-child { position: sticky; right: 0; z-index: 1; background: var(--surface); box-shadow: -8px 0 12px rgba(23, 32, 25, .06); }
.bank-transactions-wrap thead th:last-child { z-index: 2; }
.bank-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bank-filter-grid { display: grid; grid-template-columns: minmax(210px, 1.5fr) repeat(5, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 22px; padding: 16px; }
.bank-filter-grid .button { white-space: nowrap; }
.banking-page-nav { display: flex; gap: 4px; overflow-x: auto; margin: -8px 0 28px; padding: 4px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.banking-page-tab { flex: 0 0 auto; min-height: 42px; border: 0; border-bottom: 3px solid transparent; padding: 9px 13px 7px; color: var(--muted); background: transparent; font-weight: 650; white-space: nowrap; }
.banking-page-tab:hover { color: var(--ink); background: var(--subtle); }
.banking-page-tab.active { border-bottom-color: var(--green); color: var(--green-dark); }
.banking-page { min-width: 0; }
.banking-page-heading { margin-bottom: 22px; }
.banking-page-heading > h2 { margin-bottom: 5px; }
.banking-page-heading > p { margin-bottom: 0; }
.banking-page .bank-import-form { margin-bottom: 24px; }
.bank-rule-suggestion { display: block; margin-top: 4px; color: var(--green-dark); }
.bank-review-dialog { width: min(780px, calc(100% - 28px)); }
.bank-treatment-panel { display: grid; gap: 12px; }
.bank-suggestions { display: grid; gap: 8px; }
.bank-suggestion { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; color: var(--ink); background: var(--surface); text-align: left; }
.bank-match-option { display: grid; grid-template-columns: auto minmax(180px, 1fr) minmax(120px, .45fr) auto; }
.bank-match-option > input[type="checkbox"] { width: 18px; min-height: 18px; }
.bank-match-option > label { min-width: 110px; }
.bank-suggestion:hover, .bank-suggestion.selected { border-color: var(--green); background: #e7f5eb; }
.bank-suggestion span { display: grid; gap: 3px; }
.bank-suggestion span:last-child { text-align: right; }
.bank-suggestion small { color: var(--muted); }
.bank-split-lines { display: grid; gap: 10px; }
.bank-split-line { display: grid; grid-template-columns: minmax(150px, 1.5fr) minmax(105px, .7fr) minmax(145px, 1fr) minmax(105px, .7fr) 40px; gap: 9px; align-items: end; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.bank-split-line .bank-line-memo { grid-column: 1 / -2; }
.bank-split-line .remove-bank-split-line { grid-column: -2; grid-row: 2; }
.bank-split-balance.balanced { color: var(--green-dark); font-weight: 750; }
#bank-match-balance.balanced { color: var(--green-dark); font-weight: 750; }
.ledger-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ledger-table-wrap table { min-width: 820px; font-variant-numeric: tabular-nums; }
.ledger-table-wrap tbody tr[data-ledger-draft] { cursor: pointer; }
.ledger-table-wrap tbody tr[data-ledger-draft]:hover td { background: #f7faf7; }
.ledger-table-wrap th:last-child, .ledger-table-wrap td:last-child { position: sticky; right: 0; z-index: 1; background: var(--surface); }
.ledger-draft-dialog { width: min(820px, calc(100% - 28px)); }
.ledger-lines-wrap table { min-width: 680px; font-variant-numeric: tabular-nums; }
.ledger-lines-wrap tfoot td { border-top: 2px solid #aeb8b0; font-weight: 750; }
.ledger-account-assignment { min-width: 220px; }
.fixed-asset-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fixed-assets-table-wrap table { min-width: 1160px; font-variant-numeric: tabular-nums; }
.fixed-asset-dialog { width: min(920px, calc(100% - 28px)); }
.asset-account-links { border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.asset-account-links legend { padding: 0 6px; font-weight: 750; }
.asset-action-section { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.asset-action-section h3 { margin: 0; }
.asset-action-section > .button { justify-self: start; }
.pos-scan-review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); }
.pos-scan-field { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.pos-scan-field:nth-child(odd) { border-right: 1px solid var(--line); }
.pos-scan-field span { color: var(--muted); font-size: 12px; }
.pos-scan-field strong { text-align: right; }
.pos-scan-field small { grid-column: 1 / -1; color: var(--muted); text-align: right; }
.cash-form { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.span-3 { grid-column: 1 / -1; }
.cash-metrics strong.negative { color: var(--red); }
.cash-metrics strong.positive { color: var(--green-dark); }
.denomination-tool { border-block: 1px solid var(--line); padding: 14px 0; }
.denomination-tool summary { cursor: pointer; font-weight: 750; }
.denomination-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; margin-top: 14px; }
.denomination-total { display: flex; justify-content: flex-end; gap: 10px; margin: 14px 0 0; }
.cash-balance-check { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; border-left: 3px solid var(--amber); padding: 11px 13px; background: #fff8e8; }
.cash-balance-check.balanced { border-left-color: var(--green); background: #e7f5eb; }
.cash-balance-check span { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; }
.cash-balance-check small { color: var(--muted); }
.cash-form-actions { display: flex; gap: 9px; }
.cash-table-wrap table { min-width: 1050px; font-variant-numeric: tabular-nums; }
.cash-variance-negative { color: var(--red); font-weight: 750; }
.cash-variance-positive { color: var(--green-dark); font-weight: 750; }
.review-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.review-summary span { border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; color: var(--muted); background: var(--subtle); font-size: 12px; }
.review-warnings { border-left: 3px solid #c37b00; padding: 10px 12px; color: #6a4700; background: #fff8e8; font-size: 13px; }
.review-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 8px; }
.checkbox-label { display: flex; align-items: center; grid-template-columns: 20px 1fr; }
.checkbox-label input { width: 18px; min-height: 18px; }
.optional-agreement-field { display: grid; gap: 8px; align-content: start; }
.optional-agreement-field:has(.checkbox-label input:not(:checked)) > label:not(.checkbox-label),
.optional-agreement-field:has(.checkbox-label input:not(:checked)) > canvas,
.optional-agreement-field:has(.checkbox-label input:not(:checked)) > .signature-actions { opacity: .45; }
.agreement-form-section { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); background: #fbfcfa; display: grid; gap: 12px; }
.agreement-form-section legend { padding: 0 6px; font-weight: 700; }
.agreement-form-section summary { cursor: pointer; font-weight: 700; }
.award-guide > .muted { margin: 0; line-height: 1.55; }
.award-guide .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 4px; }
.award-guide .form-grid > * { min-width: 0; }
.award-guide select { width: 100%; }
.award-guide .agreement-rate-guide { grid-column: 1 / -1; }
.agreement-rate-guide { min-height: 94px; display: grid; align-content: center; justify-items: start; gap: 7px; border-left: 3px solid var(--green); padding: 12px 14px; background: #eef7f0; }
.agreement-rate-guide strong { font-size: 18px; }
.agreement-rate-guide span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.agreement-rate-guide.warning { border-left-color: var(--amber); background: #fff8e8; }
.agreement-checklist { display: grid; gap: 10px; padding-top: 12px; }
.part-time-pattern { min-width: 650px; }
.part-time-pattern input { min-width: 100px; }
.part-time-pattern td:last-child { display: flex; align-items: center; gap: 6px; }
.agreement-clause-list { display: grid; gap: 16px; }
.agreement-clause-list article { border-top: 1px solid var(--line); padding-top: 12px; }
.agreement-clause-list h4 { margin: 0 0 7px; font-size: 14px; }
.agreement-clause-list p { margin: 0 0 7px; }
.agreement-acknowledgements { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); background: #f7f9f6; }
.agreement-acknowledgements span::before { content: 'Not confirmed: '; font-weight: 700; color: #8b3a2d; }
.agreement-acknowledgements span.confirmed::before { content: 'Confirmed: '; color: #27613d; }
.forms-tabs { grid-template-columns: repeat(5, 1fr); margin-bottom: 22px; }
.staff-record-form { min-width: 0; display: grid; gap: 24px; }
.form-band { padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.form-band h2 { margin-bottom: 18px; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.field-help[data-verified="true"] { color: var(--green-dark); font-weight: 700; }
.address-search-field { position: relative; }
.address-suggestions { position: absolute; z-index: 8; top: calc(100% - 18px); right: 0; left: 0; overflow: hidden; border: 1px solid #9fa9a1; border-radius: 6px; background: var(--surface); box-shadow: 0 12px 32px rgba(23, 32, 25, .18); }
.address-suggestion { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 11px 12px; color: var(--ink); background: var(--surface); text-align: left; }
.address-suggestion:hover, .address-suggestion:focus { background: #edf6ef; }
.address-attribution { display: block; padding: 7px 12px; color: var(--muted); background: var(--subtle); text-align: right; }
.signature-field { display: grid; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.signature-field canvas { width: 100%; height: 150px; border: 1px solid #9fa9a1; border-radius: 4px; background: #fff; cursor: crosshair; touch-action: none; }
.signature-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.signature-actions small { color: var(--muted); font-weight: 500; }
.signature-review { border: 1px solid var(--line); padding: 14px; }
.signature-review h3 { margin: 0 0 10px; }
.signature-review img { display: block; width: min(100%, 520px); max-height: 150px; object-fit: contain; object-position: left center; border: 1px solid var(--line); background: #fff; }
.staff-form-panel, .staff-form-panel > *, .staff-form-panel .table-wrap { min-width: 0; max-width: 100%; }
.staff-form-panel { display: grid; gap: 24px; }
.forms-table { margin-top: 22px; }
.availability-grid { display: grid; margin-bottom: 18px; border: 1px solid var(--line); }
.availability-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 180px) minmax(130px, 180px); align-items: end; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.availability-row:last-child { border-bottom: 0; }
.availability-row > .checkbox-label { align-self: center; text-transform: capitalize; }
.review-details { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--line); }
.review-details div { min-width: 0; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.review-details dt { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; }
.review-details dd { overflow-wrap: anywhere; margin: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin-bottom: 5px; }
.section-heading p { margin-bottom: 0; }
.section-heading label { width: min(220px, 100%); }
.payroll-toolbar, .payroll-downloads { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.payroll-settings-form { margin-top: 18px; }
.payroll-warning-list { display: grid; gap: 4px; margin-top: 8px; min-width: 180px; }
.payroll-warning { border-left: 3px solid #c18416; color: #7a5208; display: block; font-size: 12px; line-height: 1.35; padding-left: 7px; }
.payroll-mapping-table { min-width: 980px; }
.payroll-mapping-table input, .payroll-mapping-table select { min-width: 90px; padding: 8px; }
.payroll-mapping-table td:first-child { min-width: 170px; }
.agreement-settings-form { margin-top: 18px; }
.agreement-dialog { width: min(920px, calc(100% - 28px)); }
.agreement-document { display: grid; gap: 22px; max-height: 58vh; overflow: auto; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.agreement-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.agreement-heading strong { font-size: 18px; }
.agreement-heading span { color: var(--muted); font-size: 12px; }
.agreement-copy { margin: 0; line-height: 1.6; }
.agreement-signing-block { display: grid; gap: 7px; border-left: 3px solid var(--green); padding: 15px; background: var(--subtle); }
.agreement-signing-block h3 { margin: 0; }
.agreement-signature-image { display: block; width: min(420px, 100%); max-height: 120px; object-fit: contain; object-position: left center; border: 1px solid var(--line); background: #fff; }
.agreement-messages { display: grid; gap: 10px; }
.agreement-messages > h3 { margin-bottom: 0; }
.agreement-messages article { border-left: 3px solid var(--amber); padding: 10px 12px; background: #fff8e8; }
.agreement-messages article p { margin: 5px 0; }
.agreement-messages article small { color: var(--muted); }
.agreement-action-panel { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.payroll-lock-status { margin-top: 14px; font-size: 13px; }
.staff-selection { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 16px; border: 1px solid var(--line); background: var(--line); }
.staff-selection > .muted { grid-column: 1 / -1; margin: 0; padding: 18px; background: var(--surface); }
.staff-choice { min-width: 0; padding: 12px; background: var(--surface); }
.staff-choice span { min-width: 0; display: grid; gap: 3px; }
.staff-choice strong, .staff-choice small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-choice small { color: var(--muted); font-weight: 400; }
#payroll-hours-foot td { border-top: 2px solid #aeb8b0; background: var(--subtle); font-weight: 750; }
.toast { position: fixed; z-index: 20; top: 18px; right: 18px; max-width: min(420px, calc(100% - 36px)); border: 1px solid #9acaaa; border-radius: 6px; padding: 12px 15px; color: #0f4624; background: #e7f5eb; box-shadow: 0 10px 35px rgba(23, 32, 25, .18); }
.toast[data-type="error"] { border-color: #ddb1b1; color: #782323; background: #fbecec; }
.mobile-header { display: none; }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .mobile-header { height: calc(66px + var(--app-safe-area-top)); display: flex; align-items: center; justify-content: space-between; padding: calc(10px + var(--app-safe-area-top)) 14px 10px; color: white; background: var(--navy-dark); }
  .mobile-header .brand-lockup span { color: #aeb8b0; }
  .mobile-header .icon-button { border-color: #475248; color: white; background: transparent; }
  .sidebar { position: fixed; z-index: 10; inset: calc(66px + var(--app-safe-area-top)) auto 0 0; width: min(300px, 88vw); height: calc(100dvh - 66px - var(--app-safe-area-top)); transform: translateX(-105%); transition: transform .18s ease; box-shadow: 18px 0 50px rgba(23, 32, 25, .24); }
  .sidebar > .brand-lockup { display: none; }
  .menu-open .sidebar { transform: translateX(0); }
  .workspace { padding: 24px 14px 48px; }
  .metric-strip, .details-list { grid-template-columns: 1fr; }
  .metric-strip > div, .details-list div { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-strip > div:last-child, .details-list div:last-child { border-bottom: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .award-guide .form-grid { grid-template-columns: 1fr; }
  .plan-heading { align-items: stretch; flex-direction: column; }
  .billing-cycle { width: min(100%, 280px); }
  .plan-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-header { min-height: 0; align-items: center; }
  .page-actions { align-items: stretch; flex-direction: column; }
  .page-header h1 { font-size: 24px; }
  .clock-tool { align-items: stretch; flex-direction: column; }
  .document-upload, .document-upload.contextual-upload { grid-template-columns: 1fr; align-items: stretch; }
  .document-file-options { grid-template-columns: 1fr; }
  .document-upload-status { align-items: stretch; flex-direction: column; }
  .batch-ocr-form { grid-template-columns: 1fr; }
  .batch-file-field { grid-column: auto; }
  .batch-metrics { grid-template-columns: 1fr 1fr; }
  .document-table-wrap { max-height: none; }
  .takings-filters, .takings-form { grid-template-columns: 1fr; }
  .bank-import-form, .bank-column-mapping, .bank-filter-grid { grid-template-columns: 1fr; }
  .bank-saved-account-field { grid-column: auto; }
  .bank-file-field { grid-column: auto; }
  .bank-import-actions { align-items: stretch; flex-direction: column; }
  .bank-import-actions .button { width: 100%; }
  .bank-metrics { grid-template-columns: 1fr 1fr; }
  .banking-page-nav { margin-inline: -4px; }
  .banking-page-heading .page-actions { width: 100%; justify-content: stretch; }
  .banking-page-heading .page-actions > * { flex: none; width: 100%; }
  .ledger-metrics { grid-template-columns: 1fr 1fr; }
  .bank-split-line { grid-template-columns: 1fr 1fr; }
  .bank-split-line .bank-line-memo { grid-column: 1 / -1; }
  .bank-split-line .remove-bank-split-line { grid-column: auto; grid-row: auto; }
  .bank-match-option { grid-template-columns: auto 1fr; }
  .bank-match-option > label, .bank-match-option > span:last-child { grid-column: 2; }
  .price-viewbar, .price-filters, #prices-section .metric-strip { grid-template-columns: 1fr; }
  .price-tabs { grid-template-columns: 1fr 1fr; }
  .price-search { justify-self: stretch; width: 100%; }
  .takings-form-actions { grid-column: auto; }
  .takings-scan-tools { grid-column: auto; align-items: stretch; flex-wrap: wrap; }
  .takings-scan-tools > div { flex-basis: 100%; }
  .pos-scan-review { grid-template-columns: 1fr; }
  .pos-scan-field:nth-child(odd) { border-right: 0; }
  .takings-table-wrap { max-height: none; }
  .cash-form, .denomination-grid { grid-template-columns: 1fr 1fr; }
  .span-3 { grid-column: 1 / -1; }
  .cash-balance-check { grid-template-columns: auto 1fr; }
  .cash-balance-check small { grid-column: 1 / -1; }
  .review-actions { align-items: stretch; flex-direction: column; }
  .forms-tabs { grid-template-columns: 1fr 1fr; }
  .agreement-heading { align-items: flex-start; flex-direction: column; }
  .agreement-document { max-height: none; padding: 14px; }
  .availability-row { grid-template-columns: 1fr 1fr; }
  .availability-row > .checkbox-label { grid-column: 1 / -1; }
  .review-details { grid-template-columns: 1fr; }
  .signature-actions { align-items: stretch; flex-direction: column; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .staff-selection { grid-template-columns: 1fr; }
  .payroll-downloads { align-items: stretch; flex-direction: column; }
  .auth-layout, .state-layout { padding: 14px; }
  .auth-panel, .state-panel { padding: 22px 18px; }
}

@media (max-width: 480px) {
  .cash-form, .denomination-grid { grid-template-columns: 1fr; }
  .span-3 { grid-column: auto; }
  .cash-form-actions { align-items: stretch; flex-direction: column; }
}

@media print {
  body > *:not(#qr-dialog) { display: none !important; }
  #qr-dialog[open] { position: static; display: block; width: 100%; border: 0; box-shadow: none; }
  #qr-dialog .icon-button, #qr-dialog .button-row, #qr-expiry { display: none; }
  .qr-panel img { width: 110mm; }
}

@media (display-mode: standalone) {
  .web-only { display: none !important; }
}

.auth-legal { margin: 18px 0 0; text-align: center; font-size: .82rem; }
.form-error { margin: 0; color: var(--danger); font-size: .88rem; }
.auth-legal a, .policy-content a { color: var(--accent); }
.policy-page { min-height: 100vh; background: var(--surface); }
.policy-header { min-height: 72px; padding: 14px clamp(18px, 5vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--panel); }
.policy-header .brand-lockup { color: inherit; text-decoration: none; }
.policy-header small { display: block; color: var(--muted); }
.policy-content { width: min(760px, calc(100% - 36px)); margin: 0 auto; padding: 54px 0 80px; }
.policy-content h1 { margin: 4px 0 24px; font-size: clamp(2rem, 6vw, 3.6rem); }
.policy-content h2 { margin: 32px 0 8px; font-size: 1.2rem; }
.policy-content p { line-height: 1.7; }
.policy-links { width: min(760px, calc(100% - 36px)); display: flex; flex-wrap: wrap; gap: 10px 22px; margin: -46px auto 0; padding: 0 0 60px; }
.policy-links a { color: var(--accent); font-weight: 700; }
