[x-cloak] { display: none !important; }
:root {
  /* #472: shared tokens. Use these, not new hex values or radii. */
  --navy: #00263B; --gold: #AA9251; --cream: #FAFFE4; --text: #1e293b; --muted: #475569;
  --field-h: 48px; --field-pad: 0.75rem;
  --radius-sm: 0.5rem; --radius: 0.75rem; --radius-lg: 0.9rem; --radius-pill: 999px;
  /* #530: spacing and text-size steps. Snap new values to these. */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem; --sp-5: 1.5rem;
  --fs-xs: 0.75rem; --fs-sm: 0.85rem; --fs-md: 0.95rem; --fs-lg: 1.15rem; --fs-xl: 1.6rem;
}
html { background-color: var(--navy); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background-color: #f6f6f1; margin: 0; padding-bottom: 6.5rem; color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; }
.shell { max-width: 28rem; margin: 0 auto; min-height: 100vh; flex-direction: column; display: flex; background-color: #f6f6f1; box-shadow: 0 16px 28px -8px rgb(0 38 59 / 0.14); }
header { background-color: var(--navy); color: var(--cream); padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem 1rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.75rem; position: sticky; top: 0; z-index: 50; border-bottom: 3px solid var(--gold); }
.wait-label { flex: 1 0 100%; margin: 0; font-size: var(--fs-xs); font-weight: 700; color: var(--cream); font-family: inherit; line-height: 1.4; overflow-wrap: anywhere; }
header h1 { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
header p { margin: 0; font-size: var(--fs-xs); color: var(--cream); font-family: monospace; font-weight: bold; letter-spacing: 0.05em; }
.status-box { display: flex; align-items: center; gap: 0.35rem; }
header .icon-btn { width: auto; background: transparent; color: var(--cream); border: 0; padding: 0.35rem; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
header a.icon-btn { text-decoration: none; }
header .help-chip { display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--cream); color: var(--cream); background: transparent; border-radius: var(--radius-sm); padding: 0.4rem 0.85rem; font-size: var(--fs-md); font-weight: 600; line-height: 1; text-decoration: none; }
header .icon-btn.cog-ring { width: 2.15rem; height: 2.15rem; padding: 0; border: 1.5px solid var(--cream); border-radius: var(--radius-pill); }
header .icon-btn.cog-ring svg { width: 18px; height: 18px; }
.help-page { display: flex; flex-direction: column; }
.help-page .page-title { margin-bottom: 0.35rem; }
.help-page > .page-lead { margin-bottom: 1.05rem; }
.help-steps { list-style: none; margin: 0 0 1.05rem; padding: 0; display: flex; flex-direction: column; gap: 0.85rem; }
.help-step { background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 1rem 1.05rem 1.05rem; box-shadow: 0 1px 2px rgb(0 38 59 / 0.045); }
.help-step-head { display: flex; align-items: center; gap: 0.7rem; }
.help-num { width: 1.75rem; height: 1.75rem; flex: 0 0 1.75rem; display: flex; align-items: center; justify-content: center; background: var(--navy); color: var(--cream); border-radius: 0.35rem; font-size: var(--fs-md); font-weight: 700; line-height: 1; }
.help-step h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.help-step p { margin: 0.55rem 0 0; color: var(--muted); font-size: var(--fs-md); font-weight: 500; line-height: 1.5; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; background-color: #34d399; }
.dot.syncing { background-color: var(--cream); animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.banner { background-color: var(--navy); border-bottom: 1px solid #01344f; padding: 0.5rem 0.75rem; text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--cream); line-height: 1.4; overflow-wrap: anywhere; }
/* #339: non-prod hosts only (html.ew-staging from supabase-config.js) */
.staging-banner { display: none; }
html.ew-staging .staging-banner { display: block; background: #fef3c7; border-bottom: 2px solid #d97706; color: #78350f; padding: 0.45rem 0.75rem; text-align: center; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1.35; }
main { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 1rem; background-color: #f6f6f1; }
.home-board { display: flex; flex-direction: column; gap: var(--sp-3); }
.home-heading { margin: var(--sp-1) 0 0; font-size: var(--fs-lg); font-weight: 700; color: #0f172a; }
button.pile { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; text-align: left; background: #ffffff; color: #0f172a; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 0.95rem 1rem; font-weight: 700; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.pile-copy { display: flex; flex-direction: column; min-width: 0; }
button.pile .metric-value { font-size: 1.55rem; margin-top: 0.3rem; }
.pile-hint { display: block; margin-top: 0.2rem; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.pile-empty { display: block; margin-top: 0.35rem; font-size: var(--fs-md); font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.pile-chevron { flex-shrink: 0; color: var(--navy); }
.sheet-page > * + * { margin-top: 0.85rem; }
.sheet-page:where(.ew-scale) > * + * { margin-top: var(--sp-3); }
.sheet-page > .page-lead { margin-top: 0.3rem; }
.sheet-page:where(.ew-scale) > .page-lead { margin-top: var(--sp-1); }
.page-title { margin: 0; font-size: 1.7rem; font-weight: 700; color: var(--navy); letter-spacing: -0.025em; line-height: 1.15; }
.page-lead { margin: 0; color: var(--muted); font-size: var(--fs-md); font-weight: 500; line-height: 1.5; }
.pay-row { display: flex; align-items: center; gap: 0.55rem; margin: 0.15rem 0 0.85rem; }
a.pay-open { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--navy); font-weight: 700; font-size: 0.92rem; }
button.pay-copy { width: 2.5rem; height: 2.5rem; flex: 0 0 2.5rem; padding: 0; background: #ffffff; color: var(--navy); border: 1px solid #e2e8f0; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
button.pay-copy:disabled { background: #ffffff; color: #94a3b8; }
.note-row:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.inv-actions { display: flex; gap: 0.65rem; align-items: center; }
.inv-actions button { flex: 0 1 auto; width: auto; }
button.btn-line, a.btn-line { background: #ffffff; color: var(--navy); border: 1.5px solid var(--navy); }
/* #472: every sheet ends with the same full-width Cancel. */
/* #595: a sheet's Cancel is the secondary beside its primary, sized to its label. */
button.sheet-cancel { width: auto; min-height: 48px; margin: 0; }
a.btn-line { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; padding: 0.9rem 1rem; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; line-height: 1.3; text-decoration: none; }
button.btn-quiet { width: auto; align-self: center; background: transparent; color: var(--muted); padding: 0.35rem 0.7rem; font-size: 0.8rem; font-weight: 700; min-height: 44px; min-width: 44px; }
button.btn-quiet:disabled { background: transparent; color: #94a3b8; }
.send-dock .pay-row { margin: 0; }
.send-dock .share-whatsapp { flex: 1 1 100%; }
.send-bar { background: var(--navy); color: var(--cream); border-radius: var(--radius); padding: 0.85rem 1rem; font-weight: 700; overflow-wrap: anywhere; }
.send-heading { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--navy); }
label.to-label { text-transform: none; letter-spacing: 0; font-size: var(--fs-md); font-weight: 600; color: #334155; }
textarea.email-preview { min-height: 4.25rem; line-height: 1.4; white-space: pre-wrap; background: #ffffff; }
.invoice-sheet { background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-4) var(--sp-3); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); scroll-margin-top: 5.25rem; }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.invoice-head > div:first-child { min-width: 0; }
.invoice-sheet .page-title { overflow-wrap: anywhere; }
.invoice-meta > div { min-width: 0; }
.inv-actions { flex-wrap: wrap; }
.invoice-kicker { margin: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #3d5166; }
.invoice-client { margin: 0.15rem 0 0; font-size: 1.05rem; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.invoice-job { margin: 0.25rem 0 0; color: #334155; font-size: 0.92rem; font-weight: 600; overflow-wrap: anywhere; }
.invoice-long { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.84rem; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.invoice-line-title:empty { display: none; }
.invoice-total-block { flex: 0 0 auto; text-align: right; }
.invoice-total { display: block; margin-top: 0.15rem; font-size: 1.45rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem 0.75rem; margin: 0.9rem 0 0; }
.invoice-meta dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #3d5166; }
.invoice-meta dd { margin: 0.12rem 0 0; font-size: 0.92rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.invoice-lines { margin-top: 0.85rem; border-top: 1px solid #e6eaee; }
.related-invoices { margin-top: var(--sp-3); }
.related-invoices .page-lead { margin-bottom: var(--sp-2); }
.related-invoices .inv-row + .inv-row { margin-top: var(--sp-2); }
.invoice-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; padding: 0.7rem 0; border-bottom: 1px solid #f1f5f9; }
.invoice-line-main { flex: 1 1 auto; min-width: 0; }
.invoice-line-title { display: block; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; white-space: pre-wrap; }
.invoice-line-meta { display: block; margin-top: 0.15rem; color: #3d5166; font-size: 0.8rem; font-weight: 600; overflow-wrap: anywhere; }
.invoice-line-amt { flex: 0 0 4.75rem; font-weight: 700; color: var(--navy); text-align: right; font-variant-numeric: tabular-nums; }
/* #381: keep ✎/✕ lined up across rows */
.invoice-line-actions { display: flex; flex: 0 0 auto; gap: 0.25rem; align-items: flex-start; min-height: 44px; }
.invoice-line-actions .line-remove { margin-left: 0; }
.invoice-totals { margin-top: 0.35rem; }
.invoice-payments { margin-top: 0.8rem; border-top: 1px solid #e6eaee; padding-top: 0.6rem; }
.invoice-payments > * + * { margin-top: 0.4rem; }
.payment-line { margin: 0; font-size: var(--fs-md); }
.vat-note { margin: 0 0 0.85rem; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.85rem; }
.switch-label { font-size: var(--fs-md); font-weight: 700; color: var(--navy); text-transform: none; letter-spacing: 0; }
button.switch { width: 3.15rem; height: 1.85rem; flex: 0 0 3.15rem; padding: 0.18rem; border-radius: var(--radius-pill); background: #e2e8f0; position: relative; }
button.switch.switch-on { background: var(--navy); }
.switch-knob { display: block; width: 1.45rem; height: 1.45rem; border-radius: var(--radius-pill); background: #ffffff; transform: translateX(0); }
button.switch.switch-on .switch-knob { transform: translateX(1.3rem); }
.invoice-total-row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-1) 0; font-size: 0.92rem; font-weight: 600; color: #334155; }
.invoice-grand { margin-top: 0.15rem; padding-top: 0.45rem; border-top: 2px solid var(--gold); font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.margin-block { margin: 0.7rem 0 0.2rem; padding: 0.7rem 0.8rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--radius); }
.margin-head { width: 100%; background: none; color: inherit; text-align: left; padding: 0.55rem 1.4rem 0.55rem 0; position: relative; min-height: 44px; }
/* #472: one disclosure glyph, ›, turned down when open. */
.margin-head::after, .sec-head::after { content: "\203A"; font-size: 1.35rem; line-height: 1; font-weight: 400; transition: transform 0.15s; }
.margin-head::after { position: absolute; right: 0; top: 0; color: var(--muted); }
.margin-head.margin-open::after, .sec.sec-open > .sec-head::after { transform: rotate(90deg); }
.margin-title { display: block; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.margin-summary { display: block; margin-top: 0.2rem; font-size: var(--fs-md); font-weight: 600; color: var(--navy); }
.margin-body { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.28rem; }
.margin-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.45rem; align-items: baseline; font-size: 0.9rem; font-weight: 500; color: #334155; }
.margin-note { color: var(--muted); font-weight: 400; min-width: 0; overflow-wrap: anywhere; }
.margin-amt { font-weight: 600; color: var(--navy); }
.margin-row.margin-total { margin-top: 0.2rem; padding-top: 0.4rem; border-top: 1px solid #e2e8f0; font-weight: 700; color: var(--navy); }
.form-row > .cost-amt { flex: 0 0 7.2rem; }
.cost-live { margin: 0; align-self: flex-end; padding-bottom: 0.85rem; color: var(--muted); font-size: 0.88rem; font-weight: 500; line-height: 1.35; min-width: 0; }
.field-hint { margin: 0.15rem 0 0.55rem; font-size: 0.8rem; color: var(--muted); line-height: 1.4; font-weight: 500; }
.field-error { margin: 0.15rem 0 0; font-size: var(--fs-sm); font-weight: 650; color: #9f1239; line-height: 1.4; }
.field-error[hidden] { display: none !important; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #9f1239; }
.email-sheet { background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 0.7rem; }
.email-sheet > * + * { margin-top: 0.55rem; }
.email-sheet button { padding: 0.7rem; }
.send-dock { position: sticky; bottom: 4.4rem; z-index: 30; background: #f6f6f1; padding-top: 0.35rem; max-height: calc(100dvh - 9.5rem); overflow-y: auto; }
/* #384 / #375 / #595: detail actions side by side, each sized to its words */
.send-dock-inner { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
/* #642: one main button plus Options, side by side and equal; Options alone fills the row. */
.send-dock-inner > button { width: auto; flex: 1 1 0; min-width: 0; margin: 0; min-height: 48px; padding-inline: 0.7rem; }
.options-send > * + * { margin-top: 0.55rem; }
#detail-options-sheet .field-label { margin-bottom: 0; }
/* #350: leave room above the Send dock so Add discount / line editors stay reachable */
.sb-ux .sheet-page .invoice-sheet { padding-bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px)); }
.sb-ux .quote-read-actions { margin: 0.65rem 0 0.35rem; }
/* #642: sheet choices sit in the shared .btn-row, two equal buttons a row. */
.detail-sheet-actions > .send-pay-btn { flex-direction: column; }
.detail-sheet-actions .send-pay-sub { display: block; margin-top: 0.25rem; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; line-height: 1.35; }
.detail-sheet-actions .send-pay-title { display: block; }
.email-compose-sheet { display: flex; flex-direction: column; max-height: min(92dvh, calc(100dvh - 0.5rem - env(safe-area-inset-bottom, 0px))); height: min(88dvh, calc(100dvh - 1rem - env(safe-area-inset-bottom, 0px))); overflow: auto; }
.email-compose-sheet .sheet-head { flex: 0 0 auto; }
.email-subject-preview { margin: 0; padding: 0.65rem 0.75rem; border: 1px solid #e6eaee; border-radius: var(--radius); background: #f8fafc; color: #0f172a; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.email-compose-sheet .email-preview { min-height: 6.5rem; resize: vertical; }
.history-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 0.55rem; }
.history-chips .chip { margin: 0; }
.metric-title.gold { color: var(--gold); }
.metric-box.alt .metric-title.gold { color: var(--gold); }
section { background: #ffffff; border: 1px solid #e8ebeb; border-radius: var(--radius-lg); padding: 1.15rem; display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 1px 2px 0 rgb(0 38 59 / 0.045); }
/* #530: .ew-scale marks the five main screens (Home, Log a job, Jobs, invoice detail, Money). :where() keeps each rule's weight; Settings, Admin and sheets keep their old spacing. */
:where(.ew-scale) section:not(:where(.bottom-sheet *)) { padding: var(--sp-4); gap: var(--sp-4); }
section + section { margin-top: 1rem; }
:where(.ew-scale) section + section:not(:where(.bottom-sheet *)) { margin-top: var(--sp-4); }
.card-title { font-size: 1rem; font-weight: 700; color: #0f172a; margin: 0; padding-bottom: 0.5rem; border-bottom: 1px solid #f1f5f9; }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
:where(.ew-scale) .form-group:not(:where(.bottom-sheet *)) { gap: var(--sp-2); }
[x-show^="authView ==="] > * + * { margin-top: 0.85rem; }
.privacy-consent { display: flex; align-items: flex-start; gap: 0.7rem; margin: 1rem 0; padding: 0.9rem; border: 1px solid #d8e0e5; border-radius: var(--radius); line-height: 1.5; font-size: 0.9rem; font-weight: 500; color: #334155; text-transform: none; letter-spacing: 0; }
.privacy-consent span { min-width: 0; }
.privacy-consent input { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; margin: 0.1rem 0 0; }
.legal-links { display: flex; flex-wrap: wrap; gap: 0.55rem 1.1rem; margin: 1rem 0 0; font-size: 0.9rem; line-height: 1.5; }
.legal-links a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.legal-links a, .page-lead a, .help-page a { color: var(--navy); font-weight: 600; text-decoration-color: var(--gold); text-underline-offset: 0.16em; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.legal-links a:focus-visible, .page-lead a:focus-visible, .help-page a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
.account-delete-link { display: inline-block; margin: 0.5rem 0 1rem; text-decoration: none; }
/* #683: deletion sits well apart from Sign out. */
#settings-account > .account-delete-link { margin-top: var(--sp-5); }
/* #206: Sign out and Sign out of all devices stack with the shared gap. */
#settings-account > .btn-line + .btn-line { margin-top: var(--sp-3); }
label, .field-label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.045em; line-height: 1.35; }
/* 16px: iPhone Safari zooms the page into any field smaller than that on focus. */
select, input, textarea { width: 100%; min-width: 0; background-color: #fbfbf8; border: 1px solid #d8e0e5; border-radius: var(--radius); padding: var(--field-pad); font-size: 16px; color: var(--navy); font-weight: 500; box-sizing: border-box; font-family: inherit; line-height: 1.35; }
select::placeholder, input::placeholder, textarea::placeholder { color: #5f6368; font-style: italic; font-weight: 400; opacity: 1; }
select.is-empty, select:invalid, select:has(> option[value=""]:checked) { color: #5f6368; font-style: italic; font-weight: 400; }
select option { color: var(--navy); font-style: normal; font-weight: 500; }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgb(170 146 81 / 0.42); outline-offset: 1px; border-color: var(--gold); }
input:disabled, textarea:disabled, select:disabled { background-color: #f1f5f9; color: var(--muted); font-style: normal; font-weight: 400; }
/* No Save IBAN prompt: the IBAN is an editable box, not an input (Chrome can't offer to save it), styled like a one-line input. */
.textbox { position: relative; display: block; width: 100%; min-width: 0; height: var(--field-h); padding: 0 var(--field-pad); line-height: calc(var(--field-h) - 2px); background-color: #fbfbf8; border: 1px solid #d8e0e5; border-radius: var(--radius); font-size: 16px; color: var(--navy); font-weight: 500; font-family: inherit; box-sizing: border-box; white-space: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; cursor: text; }
.textbox::-webkit-scrollbar { display: none; }
.textbox:empty::before { content: attr(data-placeholder); position: absolute; left: var(--field-pad); right: var(--field-pad); overflow: hidden; text-overflow: ellipsis; color: #5f6368; font-style: italic; font-weight: 400; pointer-events: none; }
.textbox:focus { outline: 3px solid rgb(170 146 81 / 0.42); outline-offset: 1px; border-color: var(--gold); }
.textbox[aria-invalid="true"] { border-color: #9f1239; }
.textbox[aria-disabled="true"] { background-color: #f1f5f9; color: var(--muted); font-style: normal; font-weight: 400; cursor: default; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
/* #472: one height for every one-line field, so a row of inputs and selects lines up. */
select, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) { height: var(--field-h); padding-top: 0; padding-bottom: 0; }
textarea { min-height: var(--field-h); }
input[type="file"] { min-height: var(--field-h); }
input[type="time"]::-webkit-calendar-picker-indicator, input[type="date"]::-webkit-calendar-picker-indicator { margin-left: 0.25rem; padding: 0; }
/* #673: a date field types dd/mm/yyyy whatever the phone's language; the calendar button on the right
   is a see-through native picker that only fills the box in (its own text is never shown). */
.date-field { position: relative; }
.date-field > input[data-date] { padding-right: 2.5rem; }
.date-field > .date-pick { position: absolute; top: 0; right: 0; width: 2.5rem; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.date-field > .date-pick::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; cursor: pointer; }
.date-field::after { content: ""; position: absolute; top: 50%; right: 0.75rem; width: 1.1rem; height: 1.1rem; transform: translateY(-50%); pointer-events: none; background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat; }
.date-field:has(input:disabled)::after { opacity: 0.5; }
.logo-frame { display: block; background: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 0.75rem; }
.logo-frame img { display: block; max-width: 100%; max-height: 12rem; margin: 0 auto; object-fit: contain; }
.shift-note { margin: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--cream); background: var(--navy); border-radius: var(--radius); padding: 0.5rem 0.75rem; }
/* #595: action buttons size to their words. Full-width list rows (.pile, .inv-row, .todo-row,
   .unbilled-row, .menu-item, .sum2-row, .sec-head, .price-card, .seg tabs and the like) set width: 100% themselves.
   Primary + secondary pairs go in .fit-actions (on a page) or .sheet-actions (in a sheet). */
button { width: auto; background-color: var(--navy); color: var(--cream); font-family: inherit; font-weight: 600; padding: 0.9rem 1rem; border-radius: var(--radius); border: none; font-size: 0.9rem; line-height: 1.3; cursor: pointer; }
/* #595: in a column of fields or cards, a plain button keeps its own width instead of stretching. Rows with width: 100% still fill. */
:is(section, .home-board, .setup-extra, .exp-form, .trial-pay, .home-sync, .form-group, .unbilled-dock, .unbilled-draft, .visit-form) > button { align-self: flex-start; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button:disabled { background-color: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
button.btn-alt { background-color: var(--navy); color: var(--cream); }
button.btn-paid { background-color: #047857; }
button.btn-unpaid { background-color: #b45309; }
button.btn-bad { background-color: #be123c; }
nav { background-color: var(--navy); color: var(--cream); display: flex; justify-content: center; padding: 0.45rem 0.35rem calc(0.7rem + env(safe-area-inset-bottom, 0px)); position: fixed; bottom: 0; left: 0; right: 0; max-width: 28rem; margin: 0 auto; z-index: 50; border-top: 1px solid #01344f; box-sizing: border-box; gap: 0.35rem; }
nav button, nav a { background: none; color: var(--cream); font-size: var(--fs-sm); display: flex; align-items: center; justify-content: center; padding: 0.45rem 0.15rem 0.15rem; width: auto; min-width: 0; flex: 1 1 0; font-weight: 500; line-height: 1.2; text-align: center; text-decoration: none; position: relative; }
button.see-more { width: auto; align-self: flex-start; background: transparent; color: var(--navy); font-size: 0.8rem; font-weight: 700; padding: 0; text-align: left; }
.alert { padding: 0.875rem; border-radius: var(--radius); text-align: center; font-size: 0.875rem; font-weight: 600; border: 1px solid transparent; }
.job-logged-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem; margin: 0; }
button.text-btn { width: auto; background: transparent; color: inherit; padding: 0; border-radius: 0; font-weight: 700; text-decoration: underline; text-underline-offset: 0.18em; }
button.text-btn:disabled { background: transparent; color: inherit; opacity: 0.55; }
.alert-success { background-color: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background-color: #fff1f2; color: #9f1239; border-color: #fecdd3; }
.alert.alert-warn { background-color: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.metric-box { background-color: #f8fafc; border: 1px solid #f1f5f9; padding: 0.75rem; border-radius: var(--radius); }
.metric-box.alt { background-color: var(--navy); border-color: var(--navy); color: var(--cream); }
.metric-box.warn { background-color: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.metric-box.bad { background-color: #fff1f2; border-color: #fecdd3; color: #9f1239; }
button.metric-box { text-align: left; color: #0f172a; font-weight: 700; padding: 0.75rem; }
button.metric-box.alt { background-color: var(--navy); color: var(--cream); }
button.metric-box.warn { background-color: #fff7ed; color: #9a3412; }
button.metric-box.bad { background-color: #fff1f2; color: #9f1239; }
.metric-title { font-size: var(--fs-xs); font-weight: 700; color: #94a3b8; text-transform: uppercase; display: block; }
.metric-value { display: block; margin-top: 0.25rem; font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; }
.metric-value-sm { font-size: var(--fs-md); }
button.seg { background: #f8fafc; color: var(--muted); padding: 0.65rem 0.4rem; border: 1px solid #e2e8f0; }
button.seg.seg-on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
button.btn-ghost { background: #e2e8f0; color: #0f172a; }
button.inv-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; width: 100%; background: #fff; color: #0f172a; border: 1px solid #e2e8f0; text-align: left; padding: var(--sp-3); }
.inv-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.inv-title { font-weight: 700; font-size: var(--fs-sm); }
.inv-meta { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.inv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex-shrink: 0; }
/* #520: the › is a third flex item, so without this the spare space splits and .inv-side floats mid-row. */
.inv-row.card-chev .inv-side { margin-left: auto; }
.inv-amt { font-weight: 700; font-size: var(--fs-sm); }
.pill { display: inline-block; border-radius: var(--radius-pill); padding: 0.15rem 0.45rem; font-size: var(--fs-xs); font-weight: 700; background: #e2e8f0; color: #334155; }
.pill-bad, .pill-writtenoff { background: #ffe4e6; color: #9f1239; }
/* #522: the Demo label in the top bar. */
.pill-demo { background: var(--gold); color: var(--navy); flex: 0 0 auto; margin-left: 0.4rem; }
.line { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 0.15rem 0.5rem; padding: 0.55rem 0; border-bottom: 1px solid #f1f5f9; font-size: var(--fs-xs); }
.line-amt { font-weight: 700; text-align: right; }
button.btn-line:disabled,
button.btn-alt:disabled,
button.btn-paid:disabled,
button.btn-bad:disabled,
button.btn-ghost:disabled,
button.btn-unpaid:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}
nav button.nav-on { color: var(--cream); font-weight: 700; }
nav button.nav-on::before { content: ""; position: absolute; top: 0; left: 50%; width: 1.5rem; height: 3px; transform: translateX(-50%); background: var(--gold); border-radius: 2px; }
.metric-box.alt .metric-title,
button.metric-box.alt .metric-title { color: var(--cream); }
.banner.sample { background: #fff8e8; border-bottom-color: #e2d9c3; color: #59491e; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.todo-list { display: flex; flex-direction: column; gap: var(--sp-3); }
button.todo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "kicker amount" "client amount" "meta amount" "link amount";
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.12rem;
  width: 100%;
  text-align: left;
  background: #ffffff;
  color: var(--navy);
  border: 1px solid #e6eaee;
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  font-weight: 700;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}
/* #782: a booking that wasn't logged: the same card as the rows above, with its two buttons under the words. */
.todo-booked { display: flex; flex-direction: column; gap: 0.2rem; background: #ffffff; color: var(--navy); border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: var(--sp-4); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.todo-booked .todo-booked-actions { margin: var(--sp-2) 0 0; }
/* #472: overdue is the one Needs you card with a gold edge, on purpose: it is the one with money late. */
button.todo-row.todo-late { border-left: 4px solid var(--gold); }
.todo-kicker { grid-area: kicker; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
button.todo-late .todo-kicker { color: var(--gold); }
.todo-client { grid-area: client; font-size: 1.05rem; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.todo-meta { grid-area: meta; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.todo-amount { grid-area: amount; font-size: 1.2rem; font-weight: 700; color: var(--navy); white-space: normal; overflow-wrap: anywhere; text-align: right; }
.setup-card { background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 0.7rem 0.85rem 0.85rem; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
/* #500: first-run card: heading, Log a job, then the + line, spaced like Needs you. */
.home-first-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
.home-first-card .home-heading { margin: 0; }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.setup-head .home-heading { margin: 0; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.setup-head .icon-btn { flex: 0 0 auto; align-self: center; width: 44px; min-width: 44px; min-height: 44px; margin-right: -0.6rem; padding: 0; background: transparent; border: 0; color: var(--navy); font-size: var(--fs-lg); }
.auth-after-send { margin-top: 0.65rem; font-size: 0.88rem; color: var(--muted); }
.setup-progress { margin: 0.2rem 0 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.setup-bar { display: flex; gap: 0.2rem; height: 0.35rem; margin-bottom: 0.55rem; }
.setup-seg { flex: 1; border-radius: var(--radius-pill); background: #e6eaee; }
.setup-seg.is-on { background: var(--navy); }
.setup-next, .setup-row { display: flex; align-items: center; gap: 0.65rem; width: 100%; min-height: 44px; text-align: left; background: #f6f6f1; color: #0f172a; border: 0; border-radius: var(--radius); padding: 0.45rem 0.75rem; font-weight: 650; }
.setup-next { font-weight: 700; }
.setup-row.is-done { color: var(--muted); }
.setup-list { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.45rem; }
.setup-mark { flex-shrink: 0; width: 1.4rem; text-align: center; }
.setup-extra { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.55rem; }
.setup-actions { margin-top: 0.45rem; }
.setup-extra .vat-note { margin: 0; }
#setup-restore { min-height: 44px; }
.adm-import { margin: 0 0 1.25rem; padding: 0.85rem 0.9rem; background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); }
.adm-import .quiet-actions { margin: 0.4rem 0 0.75rem; }
.adm-imp-preview { max-height: 16rem; overflow: auto; margin: 0.5rem 0; border: 1px solid #e6eaee; border-radius: var(--radius-sm); }
.adm-imp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.adm-imp-table th, .adm-imp-table td { padding: 0.35rem 0.5rem; text-align: left; border-bottom: 1px solid #eef2f5; vertical-align: top; }
.adm-imp-table tr.adm-imp-error td { color: #9b1c1c; background: #fff5f5; }
.adm-imp-table tr.adm-imp-skip td { color: var(--muted); background: #f8fafc; }
.adm-imp-pill { white-space: nowrap; }
.adm-imp-pill-create { background: #d1fae5; color: #065f46; }
.adm-imp-pill-match { background: #e0f2fe; color: #075985; }
.adm-imp-pill-skip { background: #e2e8f0; color: var(--muted); }
.adm-imp-pill-error { background: #ffe4e6; color: #9f1239; }
.adm-imp-skip { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0; font-size: 0.9rem; font-weight: 500; color: #334155; }
.adm-imp-skip input { width: 1.15rem; height: 1.15rem; margin: 0; }
.adm-imp-batch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0; border-bottom: 1px solid #eef2f5; }
.adm-imp-batch .btn-line { min-height: 44px; }
.adm-imp-batch-id { display: block; font-size: 0.78rem; color: var(--muted); }
.quiet-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.quiet-actions > button { flex: 1 1 0; width: auto; padding: 0.75rem 0.4rem; }
.remind-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; margin-top: 0.55rem; }
.send-choices { display: flex; flex-wrap: wrap; gap: 0.55rem; }

/* Phase 10 (#133): All invoices, unbilled work, editing a draft's lines */
.is-hidden { display: none !important; }
.seg-tabs { display: flex; gap: 0.4rem; margin: 0.4rem 0 0.6rem; }
.seg-tabs button { flex: 1; background: #ffffff; color: var(--navy); border: 1px solid #c9d3db; }
.seg-tabs button.seg-on { background: var(--navy); color: var(--cream); }
/* #241: one segmented switch; the chosen side is filled and ticked, not just coloured */
/* #472: the one segmented control: Job/Quote, Invoices/Quotes, the pricing chips and the Money periods. */
.seg-switch { gap: 2px; padding: 3px; background: #ffffff; border: 1.5px solid var(--navy); border-radius: var(--radius); }
.seg-switch button { min-width: 0; min-height: 44px; margin: 0; background: transparent; color: var(--navy); border: 0; border-radius: var(--radius-sm); font-weight: 700; white-space: nowrap; box-shadow: none; }
.seg-switch button.seg-on, .seg-switch button.pp-on { background: var(--navy); color: var(--cream); box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); }
.seg-switch button:not(.seg-on):not(.pp-on):hover { background: #eef2f5; }
.history-select-count { margin: 0; font-weight: 700; color: var(--navy); }
.history-bulk-dock { position: sticky; bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); z-index: 20; background: #ffffff; border: 1px solid #e2d9c3; border-top: 3px solid var(--gold); border-radius: var(--radius-lg); padding: 0.7rem; box-shadow: 0 6px 18px rgba(0, 38, 59, 0.18); display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.history-bulk-dock button { min-height: 48px; }
.bulk-pay-row { padding: 0.55rem 0; border-bottom: 1px solid #eef2f5; }
.bulk-pay-row:last-of-type { border-bottom: 0; }
.bulk-pay-head { display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: baseline; }
.bulk-pay-code { font-weight: 700; color: var(--navy); }
.bulk-pay-client { color: var(--muted); font-weight: 500; }
.sb-ux .hist-table.hist-selecting .lt-head,
.sb-ux .hist-table.hist-selecting .lt-row { grid-template-columns: 1.6rem 2.3rem minmax(0, 1fr) 3.1rem 4.6rem 4.3rem; }
.sb-ux .hist-table .lt-pick { width: 1.15rem; margin: 0; }
.sb-ux .hist-table .lt-row.hist-picked { background: #FFF8E6; }
.form-row { display: flex; gap: 0.6rem; }
:where(.ew-scale) .form-row:not(:where(.bottom-sheet *)) { gap: var(--sp-2); }
.form-row > .form-group { flex: 1; min-width: 0; }
.btn-inline { display: inline; padding: 0; width: auto; }
.history-total { grid-column: 2; grid-row: 1; font-weight: 600; }
.history-meta, .history-owed { font-size: 0.9rem; color: var(--muted); }
.history-owed { grid-column: 2; text-align: right; }
.history-late .history-meta { color: #b42318; }
.unbilled-row { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 0.5rem; align-items: center; width: 100%; text-align: left; background: #ffffff; color: #0f172a; border: 1px solid #e6eaee; }
.price-row { display: flex; flex-direction: column; gap: 0.35rem; width: 100%; box-sizing: border-box; text-align: left; background: #ffffff; color: #0f172a; border: 1px solid #e6eaee; border-radius: var(--radius-sm); padding: 0.7rem 0.75rem; margin: 0 0 0.5rem; }
.price-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.price-row-name { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.price-row-price { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-row-meta { margin: 0; font-size: 0.8rem; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.price-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.price-row-actions .btn-line { width: auto; flex: 0 0 auto; min-height: 44px; min-width: 44px; margin: 0; padding: 0 0.65rem; box-sizing: border-box; }
button.price-move { width: 44px; height: 44px; min-width: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; background: #ffffff; color: var(--navy); border: 1.5px solid var(--navy); border-radius: var(--radius); font-size: var(--fs-lg); line-height: 1; }
button.price-card { display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; width: 100%; box-sizing: border-box; margin: 0 0 0.45rem; padding: 0.7rem 0.75rem; text-align: left; background: #ffffff; color: #0f172a; border: 1px solid #e6eaee; border-radius: var(--radius-sm); font-weight: 600; }
button.price-card.price-card-on { background: #FFF8E6; border-color: var(--gold); }
.price-card-line { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; width: 100%; min-width: 0; }
.price-card-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.price-card-price { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-card-desc { font-size: 0.8rem; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.price-picked-note { color: #334155; font-size: var(--fs-sm); font-weight: 600; }
#price-form { scroll-margin-top: 5.25rem; }
.unbilled-head { font-weight: 600; background: #f4f7f9; }
/* #472: one drawn checkbox for Remind / pay, Unbilled, Add items and the price list (no ☐/☑ text). The glyph stays for screen readers. */
.pick-box { position: relative; display: inline-block; flex: 0 0 auto; width: 1.15rem; height: 1.15rem; box-sizing: border-box; margin-right: 0.45rem; vertical-align: -0.2em; border: 2px solid var(--navy); border-radius: 4px; background: #ffffff; font-size: 0; color: transparent; overflow: hidden; }
.pick-box.is-on, .unbilled-on .pick-box, .hist-picked .pick-box, .price-card-on .pick-box { background: var(--navy); }
.pick-box.is-on::after, .unbilled-on .pick-box::after, .hist-picked .pick-box::after, .price-card-on .pick-box::after { content: ""; position: absolute; left: 0.3rem; top: 0.08rem; width: 0.28rem; height: 0.55rem; border: solid var(--cream); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.unbilled-some .pick-box::after { content: ""; position: absolute; left: 0.17rem; right: 0.17rem; top: calc(50% - 1px); height: 2px; background: var(--navy); }
.unbilled-mark { margin-right: 0; }
.invoice-line { position: relative; }
.line-remove { width: auto; padding: 0.25rem 0.55rem; margin-left: 0.4rem; background: transparent; color: #b42318; border: 1px solid #f1c4bf; }
/* #375: draft description fields use the full card width */
.detail-desc-edit { margin-top: 0.75rem; width: 100%; max-width: 100%; }
.detail-desc-edit .form-group,
.detail-desc-edit input,
.detail-desc-edit textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
.btn-danger { color: #b42318; border-color: #f1c4bf; }
/* #669: destructive sheet actions sit apart, on their own row above Cancel. */
.sheet-danger-row { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #e2d9c3; }

/* Phase 11: cash sale, receipt, discount */
.sale-total { font-size: 1.3rem; font-weight: 700; margin: 0.6rem 0; }
/* #170 PR 1: Log a job */
.sb-ux .log-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.sb-ux .log-title-row .card-title { margin-bottom: 0.5rem; }
.sb-ux #job-day-1 { box-sizing: border-box; max-width: 100%; margin-top: 0.35rem; }
.sb-ux #job-day-1 .card-title { margin: 0 0 0.25rem; }
.sb-ux #job-day-desc-1,
.sb-ux .job-day textarea { width: 100%; max-width: 100%; min-height: 4.5rem; }
.sb-ux .job-day { box-sizing: border-box; max-width: 100%; border: 1px solid #d5dee8; border-radius: var(--radius-lg); padding: 0.75rem 0.75rem 0.15rem; margin-top: 0.75rem; }
.sb-ux .job-day-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sb-ux .job-day-head .card-title { margin: 0; }
.sb-ux .job-day-head .btn-line { width: auto; flex: 0 0 auto; min-height: 44px; margin: 0; padding: 0 0.9rem; }
.sb-ux #add-next-day { margin-top: 0.75rem; }
.sb-ux #job-days-total { font-weight: 700; }
.sb-ux #job-date { min-height: 44px; width: 100%; }
.sb-ux .mat-photo-frame { margin: 0.25rem 0 0.5rem; }
.sb-ux .mat-photo { display: block; max-width: 100%; max-height: 14rem; border-radius: var(--radius-sm); border: 1px solid #e2e8f0; object-fit: contain; background: #f8fafc; }
.sb-ux .field-hint { margin: 0.3rem 0 0; font-size: 0.8rem; color: var(--muted); }
/* #170 PR 2: search + filter sheet, compact sortable lists */
.sb-ux .search-wrap { position: relative; }
.sb-ux .search-wrap input[type="search"] { padding-right: 3rem; }
.sb-ux .search-filter-btn { position: absolute; top: 50%; right: 0.25rem; transform: translateY(-50%); width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; background: transparent; color: var(--navy); border: 0; border-radius: var(--radius-sm); }
.sb-ux .search-filter-btn.filter-on { background: var(--navy); color: var(--cream); }
.sb-ux .filter-badge { position: absolute; top: 3px; right: 3px; min-width: 1.05rem; height: 1.05rem; border-radius: var(--radius-pill); background: var(--gold); color: var(--navy); font-size: var(--fs-xs); font-weight: 800; line-height: 1.05rem; text-align: center; }
.sb-ux .filter-sheet { border-top: 4px solid var(--gold); background: #FFFDF5; }
.sb-ux .sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -0.25rem 0 0.5rem; }
.sb-ux .sheet-head h2 { margin: 0; font-size: 1.1rem; color: var(--navy); }
.sb-ux .sheet-close { width: 44px; height: 44px; min-height: 44px; padding: 0; background: none; border: 0; color: var(--navy); font-size: 1.1rem; }
.sb-ux .sheet-actions { position: sticky; bottom: calc(-1rem - env(safe-area-inset-bottom, 0px)); background: inherit; padding: 0.5rem 0 0.25rem; }
.sb-ux .list-table { box-sizing: border-box; max-width: 100%; background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); overflow-x: auto; overflow-y: hidden; margin: 0.25rem 0 0.75rem; }
.sb-ux .lt-head, .sb-ux .lt-row { display: grid; align-items: center; column-gap: 0.4rem; padding: 0 0.6rem; }
.sb-ux .hist-table .lt-head, .sb-ux .hist-table .lt-row { grid-template-columns: 2.3rem minmax(0, 1fr) 3.1rem 4.6rem 4.3rem; }
.sb-ux .lt-num-full { display: none; }
.sb-ux .client-table .lt-head, .sb-ux .client-table .lt-row { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 4.6rem 3.4rem; }
.sb-ux .lt-head { background: #f1f5f9; border-bottom: 1px solid #e2e8f0; }
.sb-ux .lt-col { min-height: 44px; padding: 0; margin: 0; background: none; border: 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; text-align: left; width: auto; white-space: nowrap; overflow: hidden; }
.sb-ux .lt-col.lt-sorted { color: var(--navy); }
.sb-ux .lt-row { width: 100%; min-height: 48px; margin: 0; background: #fff; color: #0f172a; border: 0; border-bottom: 1px solid #f1f5f9; border-radius: 0; text-align: left; font-size: var(--fs-sm); font-weight: 500; }
.sb-ux .lt-row:last-child { border-bottom: 0; }
.sb-ux .lt-row:active, .sb-ux .lt-row:hover { background: #f8fafc; }
.sb-ux .lt-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-ux .lt-num { font-weight: 700; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.sb-ux .lt-client { font-weight: 600; }
.sb-ux .lt-date, .sb-ux .lt-contact { color: var(--muted); font-size: 0.8rem; }
.sb-ux .lt-amt, .sb-ux .lt-c-amount, .sb-ux .lt-c-owed { text-align: right; font-variant-numeric: tabular-nums; }
.sb-ux .lt-amt { font-weight: 700; }
.sb-ux .lt-status { text-align: right; }
.sb-ux .lt-c-status { text-align: right; }
.sb-ux .lt-bal { display: none; }
.sb-ux .hist-table .lt-c-bal { display: none; }
.sb-ux .status-chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 0.12rem 0.45rem; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; background: #e2e8f0; color: #334155; }
.sb-ux .hist-table .lt-status { overflow: visible; white-space: normal; }
.sb-ux .chip-imported { margin-left: 0.25rem; background: #eef2ff; color: #3730a3; }
.sb-ux .chip-imported:empty { display: none; margin-left: 0; }
/* #679: "Invoiced as INV-…" under the green chip on a converted quote. */
.sb-ux .lt-invoiced-as { display: block; margin-top: 0.15rem; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.sb-ux .lt-invoiced-as:empty { display: none; }
.sb-ux .chip-paid, .sb-ux .chip-converted, .sb-ux .chip-invoiced, .sb-ux .chip-accepted { background: #dcfce7; color: #166534; }
.sb-ux .chip-sent, .sb-ux .chip-part-paid { background: #dbeafe; color: #1e40af; }
.sb-ux .chip-overdue, .sb-ux .chip-expired { background: #fee2e2; color: #991b1b; }
.sb-ux .chip-draft { background: #fef3c7; color: #92400e; }
.sb-ux .chip-written-off, .sb-ux .chip-declined { background: #f1f5f9; color: var(--muted); }
.sb-ux .lt-row.history-late .lt-date { color: #b42318; }
.sb-ux .lt-row.lt-archived { color: #94a3b8; }
.sb-ux .lt-row.lt-owes .lt-amt { color: #b42318; }
.sb-ux .client-table .lt-amt { font-weight: 600; }
.entry-row-wrap { display: flex; align-items: stretch; gap: 0.4rem; }
.entry-row-wrap .entry-row { flex: 1 1 auto; min-width: 0; }
button.entry-photo-button { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; align-self: center; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--navy); border: 1px solid #e2e8f0; border-radius: var(--radius); font-size: 1.1rem; }
button.entry-photo-button.entry-photo-slot { visibility: hidden; }
.materials-photo-backdrop { z-index: 89; }
.materials-photo-viewer { position: fixed; inset: 0; z-index: 90; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); background: #f4f6f8; }
.materials-photo-viewer img { display: block; max-width: calc(100vw - 2rem); max-height: calc(100dvh - 6rem); object-fit: contain; }
.pdf-preview-frame { width: 100%; max-width: 720px; height: min(70dvh, 900px); border: 0; background: #fff; }
.pdf-preview-fallback { margin: 1rem 0 0.5rem; }
.pdf-preview-pages { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 720px; overflow-y: auto; }
.pdf-preview-page { display: block; width: 100%; height: auto; margin-bottom: 0.5rem; background: #fff; }
.pdf-preview-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.55rem; width: 100%; max-width: 420px; }
.pdf-preview-actions > button, .pdf-preview-actions > a.btn-line { width: auto; flex: 0 1 auto; min-height: 48px; }
button.materials-photo-close { width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; align-self: flex-end; padding: 0; background: transparent; color: var(--navy); border: 1px solid #c9d3db; font-size: 1.1rem; }
.materials-photo-option { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0; color: #334155; font-size: 0.9rem; font-weight: 600; line-height: 1.4; text-transform: none; letter-spacing: 0; }
.materials-photo-option input[type="checkbox"] { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; margin: 0.1rem 0 0; padding: 0; }
@media (min-width: 48rem) {
  /* Tablet canvas: preserve the familiar shell while giving list columns room to breathe. */
  .sb-ux .shell, .sb-ux nav { max-width: 68rem; }
  .sb-ux .shell { width: 100%; min-height: 100dvh; }
  .sb-ux main { padding: 1.5rem 1.75rem; }
  .sb-ux header { padding-right: 1.25rem; }
  .sb-ux .list-table { width: 100%; }
  .sb-ux .hist-table .lt-head, .sb-ux .hist-table .lt-row {
    grid-template-columns: minmax(4.4rem, 0.9fr) minmax(8rem, 2fr) minmax(5rem, 1fr) minmax(5rem, 1fr) minmax(6.1rem, 1.1fr) minmax(5.2rem, 1fr);
    column-gap: 0.55rem;
    padding: 0 0.85rem;
  }
  .sb-ux .hist-table.hist-selecting .lt-head, .sb-ux .hist-table.hist-selecting .lt-row {
    grid-template-columns: 1.6rem minmax(4.4rem, 0.9fr) minmax(8rem, 2fr) minmax(5rem, 1fr) minmax(5rem, 1fr) minmax(6.1rem, 1.1fr) minmax(5.2rem, 1fr);
  }
  .sb-ux .client-table .lt-head, .sb-ux .client-table .lt-row {
    grid-template-columns: minmax(8rem, 1.4fr) minmax(8rem, 1.2fr) minmax(6rem, 0.9fr) minmax(5.2rem, 0.8fr);
    column-gap: 0.7rem;
    padding: 0 0.85rem;
  }
  .sb-ux .lt-row { min-height: 52px; font-size: 0.92rem; }
  .sb-ux .lt-col { min-height: 48px; }
  .sb-ux .seg-tabs button, .sb-ux .period-pick .pp { min-height: 48px; }
  .sb-ux .home-board .todo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .sb-ux main .sheet-page { box-sizing: border-box; width: 100%; max-width: 72rem; margin-left: auto; margin-right: auto; }
  .sb-ux .exp-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
  .sb-ux .exp-row { min-width: 0; }
  .sb-ux main > div[x-show="currentTab === 'auth'"] > section { box-sizing: border-box; width: 100%; max-width: 44rem; margin-left: auto; margin-right: auto; }
  .sb-ux main > div[x-show="currentTab === 'tracker'"] > section { box-sizing: border-box; width: 100%; max-width: 56rem; margin-left: auto; margin-right: auto; }
  .sb-ux main > div[x-show="currentTab === 'clients'"] section { box-sizing: border-box; width: 100%; max-width: 72rem; margin-left: auto; margin-right: auto; }
  .sb-ux main > div[x-show="currentTab === 'settings'"] > section { box-sizing: border-box; width: 100%; max-width: 64rem; margin-left: auto; margin-right: auto; }
  .sb-ux main > div[x-show="currentTab === 'summary'"] section { box-sizing: border-box; width: 100%; max-width: 72rem; margin-left: auto; margin-right: auto; }
  .sb-ux main > div[x-show="currentTab === 'clients'"] > div[x-show="clientView === 'form'"] > section { max-width: 56rem; }
  .sb-ux .bottom-sheet { width: calc(100% - 2rem); max-width: 44rem; max-height: calc(100dvh - 2rem - env(safe-area-inset-bottom, 0px)); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); border-radius: 1.1rem; }
  .sb-ux .new-sheet { max-width: 30rem; }
  .sb-ux #history-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; }
  .sb-ux #history-filters .sheet-head, .sb-ux #history-filters .sheet-actions,
  .sb-ux #history-filters .form-row { grid-column: 1 / -1; }
  .sb-ux .lt-bal { display: block; text-align: right; color: var(--muted); }
  .sb-ux .lt-num-full { display: inline; }
  .sb-ux .lt-num-short { display: none; }
  .sb-ux .hist-table .lt-c-bal { display: block; text-align: right; }
  /* #375: Quotes list has no Balance column */
  .sb-ux .hist-table.hist-quotes .lt-head, .sb-ux .hist-table.hist-quotes .lt-row {
    grid-template-columns: minmax(4.4rem, 0.9fr) minmax(8rem, 2fr) minmax(5rem, 1fr) minmax(5rem, 1fr) minmax(6.1rem, 1.1fr);
  }
  .sb-ux .hist-table.hist-quotes .lt-bal, .sb-ux .hist-table.hist-quotes .lt-c-bal { display: none; }
}
/* #170 PR 3: menu section dividers, Summary first pass */
.sb-ux .app-menu .menu-group { margin: 0; font-size: var(--fs-xs); letter-spacing: 0.08em; }
.sb-ux .app-menu .menu-item { box-sizing: border-box; margin: 0; border-radius: 0; border-bottom: 1px solid #e2e8f0; }
.sb-ux .sum2 { background: transparent; box-shadow: none; padding: 0; border: 0; }
.sb-ux .period-pick { display: grid; grid-template-columns: repeat(4, 1fr); }
.sb-ux .pp { padding: 0; font-size: 0.9rem; width: auto; }
.sb-ux .sum2-range { margin: var(--sp-2) 0 var(--sp-3); color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.sb-ux .kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.sb-ux .kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; min-height: 5.2rem; margin: 0; padding: var(--sp-3); box-sizing: border-box; background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-left: 5px solid var(--navy); border-radius: var(--radius-lg); text-align: left; width: auto; box-shadow: 0 1px 2px rgba(0, 38, 59, 0.06); }
.sb-ux .kpi-paid { border-left-color: #16a34a; }
.sb-ux .kpi-owed { border-left-color: #dc2626; cursor: pointer; }
.sb-ux .kpi-profit { border-left-color: var(--gold); }
.sb-ux .kpi-k { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sb-ux .kpi-v { font-size: 1.35rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2; }
.sb-ux .kpi-s { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.sb-ux .sum2-list { margin-top: var(--sp-4); background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius-lg); overflow: hidden; }
.sb-ux .sum2-list-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-4); background: #f1f5f9; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--navy); }
.sb-ux .sum2-list-head .text-btn { min-height: 44px; min-width: 44px; padding: 0 0.35rem; text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); width: auto; background: none; border: 0; color: var(--navy); text-decoration: underline; }
.sb-ux .sum2-hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.sb-ux .sum2-row { box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 0.6rem; width: 100%; min-height: 52px; margin: 0; padding: var(--sp-2) var(--sp-4); background: #fff; color: #0f172a; border: 0; border-top: 1px solid #f1f5f9; border-radius: 0; text-align: left; }
.sb-ux .sum2-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-ux .sum2-meta { grid-row: 2; font-size: 0.78rem; color: var(--muted); }
.sb-ux .sum2-amt { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-ux .sum2-late { color: #b42318; }
.sb-ux .sum2-empty { margin: 0; padding: 0.8rem 0.9rem; color: var(--muted); font-size: 0.9rem; }
.sb-ux .sum2-more { margin: 1rem 0 0.25rem; min-height: 48px; background: #fff; color: var(--navy); border: 1px dashed #94a3b8; border-radius: var(--radius-lg); font-weight: 600; }
/* SUM-4: 12-month chart and Records & exports. */
.sb-ux .sum-chart-head { margin: -0.6rem -0.6rem 0.5rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.sb-ux #sum-chart .sum-bar { cursor: pointer; }
.sb-ux .rec-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid #f1f5f9; }
.sb-ux .rec-main { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; }
.sb-ux .rec-name { font-weight: 600; color: #0f172a; }
.sb-ux .rec-what { font-size: 0.8rem; color: var(--muted); }
.sb-ux .rec-go { width: auto; margin: 0; }
.sb-ux .rec-actions { margin: 0; flex: 1 1 100%; }
.sb-ux .rec-actions > button { flex: 0 1 auto; padding: 0.6rem 0.9rem; white-space: nowrap; margin: 0; }
.sb-ux .rec-panel { padding: 0 0.9rem 0.7rem; }
/* SUM-3: Spending on Money. */
.sb-ux .sum2-row-static { cursor: default; }
.sb-ux .spend-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.9rem 0.7rem; border-top: 1px solid #f1f5f9; }
.sb-ux .spend-actions #spend-add { width: auto; margin: 0; padding: 0.7rem 1.1rem; }
.sb-ux .spend-actions .card-link { white-space: nowrap; }
/* #579: Set aside card on Money; SUM-2: the VAT card. */
.sb-ux .set-aside { display: block; box-sizing: border-box; width: 100%; padding: 0 0 0.7rem; color: #0f172a; text-align: left; font-weight: 400; cursor: pointer; }
.sb-ux .set-aside:disabled { cursor: default; opacity: 1; }
.sb-ux .set-aside > span, .sb-ux .vat-guide > span { display: block; }
.sb-ux .vat-guide { padding: 0 0 0.7rem; }
.sb-ux .set-aside > .sa-line, .sb-ux .vat-guide > .sa-line { display: flex; align-items: baseline; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4) 0; }
.sb-ux .sa-k { flex: 1; min-width: 0; font-weight: 600; }
.sb-ux .sa-v { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb-ux .sa-period { font-weight: 500; color: var(--muted); }
.sb-ux .sa-go { color: var(--gold); font-weight: 700; }
.sb-ux .sa-note { padding: 0.15rem 0.9rem 0; font-size: 0.82rem; color: var(--muted); }
.sb-ux .sa-foot { padding: 0.6rem 0.9rem 0; font-size: 0.78rem; color: var(--muted); }
/* #168 cash-sale client picker */
.sale-pick-wrap { position: relative; }
.sale-pick-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 20; background: #fff; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); box-shadow: 0 10px 24px rgba(0, 38, 59, 0.18); overflow: hidden; max-height: 18rem; overflow-y: auto; }
.sale-pick { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 48px; padding: 0.55rem 0.8rem; background: #fff; color: #0f172a; border: 0; border-bottom: 1px solid #f1f5f9; border-radius: 0; text-align: left; }
.sale-pick:last-child { border-bottom: 0; }
.sale-pick-on, .sale-pick:hover { background: #eef4f8; }
.sale-pick-name { font-weight: 600; font-size: 1rem; }
.sale-pick-meta { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
#sale-client-note { margin: 0.3rem 0 0.6rem; padding: 0; background: none; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; border-radius: 0; }
.receipt-banner { background: #e7f6ec; color: #14532d; border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; font-weight: 600; }
#home-cash-sale, #log-cash-sale { width: auto; margin: 0.5rem 0; }

/* #149: popups (toasts) and the notification list. */
.toast { position: fixed; left: 1rem; right: 1rem; bottom: 5.25rem; z-index: 60; max-width: 30rem; margin: 0 auto; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); cursor: pointer; display: flex; align-items: center; gap: 0.6rem; }
.toast #toast-text { flex: 1; }
/* #862: an error shows above any open sheet or panel (sheets go up to 71, admin 80, confirm 95), so a failed Save never looks dead.
   Other toasts (saved, update ready) stay under sheets. */
.toast.alert-error { z-index: 96; }
button.toast-undo { width: auto; flex: 0 0 auto; min-height: 44px; margin: 0; }
.seg-col { display: flex; flex-direction: column; gap: 0.4rem; margin: 0 0 0.7rem; }
.seg-col button.seg { width: 100%; min-height: 44px; text-align: left; }
.bell-btn { position: relative; }
.bell-count { position: absolute; top: -0.1rem; right: -0.2rem; min-width: 1.05rem; height: 1.05rem; padding: 0 0.2rem; border-radius: var(--radius-sm); background: #e11d48; color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 1.05rem; text-align: center; }
.notes-panel { position: fixed; top: 4.25rem; left: 0.75rem; right: 0.75rem; max-width: 30rem; margin: 0 auto; max-height: 70vh; overflow-y: auto; z-index: 55; background: #fff; border-radius: var(--radius-lg); padding: 0.9rem; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22); }
.notes-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.notes-head .card-title { flex: 1; margin: 0; }
.notes-head button { width: auto; }
.note-row { border-top: 1px solid #e5e7eb; padding: 0.6rem 0 0.6rem 0.6rem; border-left: 3px solid transparent; min-height: 44px; box-sizing: border-box; }
.note-row.note-unread { border-left-color: #0ea5e9; background: #f0f9ff; }
.note-row.note-error .note-text { color: #9f1239; }
.note-text { font-size: 0.875rem; font-weight: 600; }
.note-when { font-size: var(--fs-xs); color: #6b7280; margin-top: 0.15rem; }
.note-actions { display: flex; gap: 0.5rem; margin-top: 0.35rem; }
.note-actions button { width: auto; padding: 0.35rem 0.7rem; font-size: 0.8rem; min-height: 44px; min-width: 44px; }

.exp-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.exp-row { border-top: 1px solid #e5e7eb; padding: 0.55rem 0; min-height: 44px; box-sizing: border-box; }
.form-lock { border: 0; margin: 0; padding: 0; min-width: 0; }
.exp-main { display: flex; justify-content: space-between; gap: 0.75rem; font-weight: 600; font-size: 0.9rem; }


/* #160 mobile UX: Summary panes, collapsible sections, sticky actions */
.sec { border: 1px solid #e2e8f0; border-radius: var(--radius-lg); background: #ffffff; margin: 0 0 0.6rem; }
:where(.ew-scale) .sec:not(:where(.bottom-sheet *)) { margin: 0 0 var(--sp-2); }
.sec-head { width: 100%; min-height: 48px; text-align: left; background: none; color: var(--navy); font-weight: 700; padding: 0.7rem 2.2rem 0.7rem 0.9rem; position: relative; border: 0; }
:where(.ew-scale) .sec-head:not(:where(.bottom-sheet *)) { padding: var(--sp-3) 2.2rem var(--sp-3) var(--sp-4); }
.sec-head::after { position: absolute; right: 0.9rem; top: calc(50% - 0.7rem); color: var(--muted); }
.sec-body { padding: 0 0.9rem 0.6rem; }
:where(.ew-scale) .sec-body:not(:where(.bottom-sheet *)) { padding: 0 var(--sp-4) var(--sp-2); }
/* #472: room between a group's lead line ("Setup 2 of 6 done") and the first field; between a label and its buttons. */
.sec-body > .page-lead { margin: 0 0 0.75rem; }
.pay-choice { margin-top: 0.4rem; }
.sec:not(.sec-open) > .sec-body { display: none; }
.sec-flat .sec { border: 0; margin: 0; background: none; }
.sec-flat .sec-head { display: none; }
.sec-flat .sec-body, .sec-flat .sec:not(.sec-open) > .sec-body { display: block; padding: 0; }
/* #321: Settings groups + search */
.settings-search { margin: 0 0 0.75rem; }
.settings-search input[type="search"] { width: 100%; }
.sec-head-title { display: block; }
.sec-head-sum { display: block; font-weight: 500; font-size: var(--fs-sm); color: var(--muted); margin-top: 0.15rem; padding-right: 1.2rem; }
mark.settings-hit { background: var(--cream); color: var(--navy); padding: 0 0.1em; border-radius: 0.15rem; }
#settings-no-match { margin: 0.4rem 0 0.8rem; }
.settings-pricelist { margin-top: 0.6rem; padding-top: 0.4rem; border-top: 1px solid #e2e8f0; }
/* #326: nested costs inside Log Advanced */
#sec-log-advanced .sec-body > .secs { margin-top: 0.4rem; }
.sticky-action, .save-bar { position: sticky; bottom: calc(4.2rem + env(safe-area-inset-bottom, 0px)); z-index: 20; box-shadow: 0 6px 18px rgba(0, 38, 59, 0.25); }
/* #636 follow-up: room above the floating Log a job button (its height + a gap + the safe area),
   so the last hint under the pricing row always scrolls clear of it. */
.sb-ux #log-submit.sticky-action { margin-top: calc(var(--field-h) + 0.75rem + env(safe-area-inset-bottom, 0px)); }
.save-bar { box-shadow: none; padding: 0.5rem 0 0; background: linear-gradient(rgba(255,255,255,0), #ffffff 35%); }
.save-bar button { box-shadow: 0 6px 18px rgba(0, 38, 59, 0.25); }

/* #160 PR B: filters chip, add-line link, payment bottom sheet */
button.chip { width: auto; min-height: 44px; padding: 0.5rem 1rem; border-radius: var(--radius-pill); background: #f8fafc; color: var(--navy); border: 1px solid #cbd5e1; font-weight: 600; margin: 0 0 0.6rem; }
button.chip.chip-on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.exp-groups { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
/* #472: Expenses sits on the page like the other list screens; the form is one card with even gaps. */
#exp-pane, #mileage { display: flex; flex-direction: column; gap: 0.85rem; }
.exp-form { display: flex; flex-direction: column; gap: 0.85rem; background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 1rem; }
.exp-form .form-lock { display: flex; flex-direction: column; gap: 0.85rem; }
.exp-form .form-group { margin: 0; }
.exp-list:has(.exp-row) { background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 0 1rem; }
.exp-list .exp-row:first-child { border-top: 0; }
.page-empty { margin: 0.5rem 0; }
.exp-groups button.chip { margin: 0; }
.exp-row-static { cursor: default; }
#history-filters { margin-bottom: 0.4rem; }
.history-count { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
button.add-line { min-height: 44px; margin: -0.3rem 0 0.6rem; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 38, 59, 0.45); z-index: 60; }
.bottom-sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 28rem; margin: 0 auto; z-index: 61; max-height: 88vh; overflow-y: auto; border-radius: 1.1rem 1.1rem 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); background: #ffffff; box-shadow: 0 -8px 28px rgba(0, 38, 59, 0.3); }
.bottom-sheet #save-payment { min-height: 52px; font-size: 1.05rem; }
.bottom-sheet .btn-quiet { min-height: 44px; }
#line-remove button, #doc-delete button { min-height: 48px; }
#line-remove #line-delete, #delete-invoice, #delete-empty-draft { color: #b42318; border-color: #f1c4bf; }
#delete-invoice { min-height: 44px; }
#empty-draft { margin-top: 0.6rem; }
#empty-draft > * + * { margin-top: 0.5rem; }
.doc-delete-jobs > * + * { margin-top: 0.45rem; }
.pick-row { width: 100%; text-align: left; background: #ffffff; color: var(--navy); border: 1px solid #cbd5e1; border-radius: var(--radius); }
.pick-row::before { content: "\25CB  "; }
.pick-row.is-picked { border: 2px solid var(--navy); background: #f1f5f9; font-weight: 700; }
.pick-row.is-picked::before { content: "\25CF  "; }
.btn-danger-solid { background: #b42318; color: #ffffff; border: 1px solid #b42318; }
#feedback-backdrop { touch-action: none; overscroll-behavior: none; }
html:has(#feedback-sheet:not([x-cloak]):not([style*="display: none"])),
html:has(#feedback-sheet:not([x-cloak]):not([style*="display: none"])) body,
html.sheet-lock, html.sheet-lock body { overflow: hidden; overscroll-behavior: none; }
.sb-ux #feedback-sheet { max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 0.5rem)); overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scroll-padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }
#feedback-sheet #fb-message { min-height: 8rem; max-height: min(18rem, 40dvh); resize: none; overflow-y: auto; overscroll-behavior-y: contain; line-height: 1.45; field-sizing: content; flex-shrink: 0; }
#feedback-sheet .sheet-actions { background: #ffffff; position: sticky; z-index: 1; box-shadow: 0 -12px 12px -12px rgba(0, 38, 59, 0.35); }
#feedback-sheet .sheet-actions .sheet-cancel, #feedback-sheet .sheet-actions .sheet-cancel:disabled { width: auto; min-height: 48px; padding: 0.65rem 0.8rem; background: #ffffff; color: var(--navy); border: 1.5px solid var(--navy); border-radius: var(--radius); font-size: var(--fs-md); opacity: 1; }
#feedback-sheet .fb-shot-pair { margin-top: 0.25rem; }
#feedback-sheet .fb-shot-pair .fb-shot-btn { box-sizing: border-box; width: 100%; min-width: 0; min-height: 48px; margin: 0; padding: 0.5rem; font-size: 0.875rem; font-weight: 600; line-height: 1.2; }
#feedback-sheet #fb-photo-remove { margin-top: 0.5rem; }
.send-dock.dock-hidden { display: none; }

/* #160 PR C: 44px tap targets and a slim test banner, Supabase mode only (html.sb-ux) */
.sb-ux header { padding: calc(0.35rem + env(safe-area-inset-top, 0px)) 0.5rem 0.35rem 1rem; z-index: 72; }
.sb-ux header .status-box { gap: 0; flex: 0 0 auto; }
.sb-ux header .icon-btn { min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 0; }
.sb-ux nav { padding: 0.25rem 0.35rem calc(0.25rem + env(safe-area-inset-bottom, 0px)); }
.sb-ux nav button, .sb-ux nav a { min-height: 48px; padding: 0.25rem 0.15rem; }
.sb-ux .banner.sample { padding: 0.15rem 0.75rem; font-size: var(--fs-xs); text-align: center; letter-spacing: 0.04em; text-transform: uppercase; }
.sb-ux .see-more, .sb-ux .btn-inline, .sb-ux .text-btn, .sb-ux #change-valid, .sb-ux #clients-archived { min-height: 44px; display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }
.sb-ux .line-remove { min-width: 44px; min-height: 44px; padding: 0 0.6rem; display: inline-flex; align-items: center; justify-content: center; }
.sb-ux .note-row { cursor: pointer; }
.sb-ux .note-actions button, .sb-ux .notes-head button { min-height: 44px; min-width: 44px; padding: 0 0.9rem; }
.sb-ux .bell-count { top: 4px; right: 4px; }

/* #165 Option A: header back, menu, + New sheet, Invoices tab (Supabase) */
/* #332: brand shrinks so bell + Settings cog + Menu fit one row at 360px */
.sb-ux header .brand { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
.sb-ux header .brand h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Menu and notifications: one panel system. Both slide in from the right below the header, same width and backdrop; the header stays visible. */
.sb-ux .app-menu, .sb-ux .notes-panel { position: fixed; top: var(--hdr-bottom, var(--hdr, 56px)); right: 0; bottom: 0; left: auto; width: min(20rem, 88vw); max-width: none; max-height: none; margin: 0; border-radius: 0; z-index: 70; background: #ffffff; box-shadow: -8px 0 28px rgba(0, 38, 59, 0.25); overflow-y: auto; padding: 0 0 calc(1rem + env(safe-area-inset-bottom, 0px)); animation: sb-panel-in 0.18s ease-out; }
.sb-ux .menu-backdrop { top: var(--hdr-bottom, var(--hdr, 56px)); z-index: 69; }
.sb-ux .panel-head { display: flex; align-items: center; gap: 0.25rem; min-height: 52px; margin: 0; padding: 0.25rem 0.25rem 0.25rem 1rem; background: #ffffff; color: #0f172a; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 1; }
.sb-ux .panel-head .panel-title { flex: 1; margin: 0; padding: 0; border: 0; font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.sb-ux .panel-head .panel-close { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; background: none; border: 0; color: #0f172a; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.sb-ux .notes-panel .page-lead, .sb-ux .notes-panel .note-row { margin-left: 1rem; margin-right: 1rem; }
.sb-ux .notes-panel .page-lead { margin-top: 1rem; }
.sb-ux header .icon-btn.hdr-on { background: #01344f; }
@keyframes sb-panel-in { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sb-ux .app-menu, .sb-ux .notes-panel { animation: none; } }
.sb-ux .menu-group { margin: 0.9rem 1rem 0.2rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sb-ux .menu-item { display: block; width: 100%; text-align: left; background: none; color: #0f172a; border: 0; border-bottom: 1px solid #f1f5f9; padding: 0.9rem 1rem; font-size: 1rem; font-weight: 600; text-decoration: none; min-height: 48px; }
.sb-ux .menu-item.menu-danger { color: #b42318; }
.sb-ux .new-sheet { z-index: 71; }
.sb-ux .new-sheet .menu-item { border: 1px solid #e2e8f0; border-radius: var(--radius); margin: 0.4rem 0; background: #f8fafc; }
/* #640: two equal tiles per row; one column only below 360px. */
.new-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); margin: var(--sp-2) 0; grid-auto-rows: 1fr; }
.sb-ux .new-sheet .new-grid > .menu-item { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 72px; margin: 0; padding: 0.6rem 0.5rem; text-align: center; }
/* #780: the + sheet leads with Log a job; each choice has a name on one line and a short hint under it. */
.sb-ux .new-sheet .new-main { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 64px; margin: var(--sp-2) 0 0; padding: 0.6rem 0.75rem; }
.new-label { display: block; white-space: nowrap; }
.sb-ux .new-sheet .new-hint { display: block; margin: 0.15rem 0 0; font-weight: 500; line-height: 1.3; }
.sb-ux .new-sheet .new-main .new-hint { font-size: 0.8rem; color: inherit; opacity: 0.85; }
@media (max-width: 359px) { .new-grid { grid-template-columns: 1fr; } }
/* Room under every screen for the bottom menu + the round + (56px) + the phone's safe area, so nothing hides under them. */
html.sb-ux body { padding-bottom: calc(4.25rem + 56px + 2.75rem + env(safe-area-inset-bottom, 0px)); }
/* #430: the bottom bar's height (48px buttons + padding + the phone's home-bar inset).
   Sticky bars and the toast sit on it, so on an iPhone the bar can't cover them; and a
   field you move to scrolls clear of the header, the bar and a sticky action button.
   #656: plus a hint line, so the hint or price line under the field clears the floating Save too
   (--nav-h already carries env(safe-area-inset-bottom)). */
html.sb-ux { --nav-h: calc(56px + env(safe-area-inset-bottom, 0px)); scroll-padding-top: calc(var(--hdr, 56px) + 0.5rem); scroll-padding-bottom: calc(var(--nav-h) + var(--field-h) + 3rem); }
/* #669: the invoice bar is fixed directly on the tab bar (0.25rem + 48px + 0.25rem + 1px border + inset), so it never floats
   mid-screen at the end of the page; the detail page leaves room for it so the last line (Balance due) shows. */
html.sb-ux .send-dock { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 1px); max-width: 28rem; margin: 0 auto; padding: 0.5rem 1rem; box-sizing: border-box; max-height: none; overflow: visible; border-top: 1px solid #e2d9c3; }
html.sb-ux .detail-page { padding-bottom: calc(48px + 2rem); }
/* #678: floating Save (Log a job / quote), Save settings and the Invoices / Unbilled docks clear the tab bar
   (--nav-h + its 1px border) by a full 1rem, so their shadow doesn't run into it and they stay easy to tap. */
html.sb-ux .sticky-action, html.sb-ux .save-bar,
html.sb-ux .history-bulk-dock, html.sb-ux .unbilled-dock { bottom: calc(var(--nav-h) + 1px + 1rem); }
/* #678: while the select dock is up on Invoices, the last rows can still scroll clear of it. */
html.sb-ux body:has(#history-bulk-dock:not([style*="none"])) { padding-bottom: calc(var(--nav-h) + 1rem + 12rem); }
@media (min-width: 48rem) { html.sb-ux .send-dock { max-width: 68rem; padding-inline: 1.75rem; } }
@media (min-width: 68.75rem) { html.sb-ux .send-dock { max-width: 78rem; padding-inline: 2.25rem; } }
html.sb-ux .toast { bottom: calc(var(--nav-h) + 1.75rem); }
/* #675: on a quote or invoice, clear the action bar too (1px + 0.5rem + 48px button + 0.5rem + 1px border), so
   Turn into invoice, Record payment and Options stay visible and tappable while the toast shows. */
html.sb-ux .toast.toast-over-dock { bottom: calc(var(--nav-h) + 2px + 48px + 1rem + 0.75rem); }
/* help.html (#167 docs) */
.help-sub { margin: 1.25rem 0 0.4rem; font-size: 1rem; font-weight: 700; color: var(--navy); }
.help-list { margin: 0; padding: 0; list-style: none; }
.help-list li { padding: 0.55rem 0; border-bottom: 1px solid #f1f5f9; font-size: var(--fs-md); line-height: 1.4; }

/* Round 3: Summary KPI strip + Invoiced vs Paid chart */
.sb-ux .kpi-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; background: #fff; border: 1px solid #e2d9c3; border-radius: var(--radius-lg); overflow: hidden; }
.sb-ux .kpi-strip .kpi { min-height: 0; padding: 0.55rem 0.4rem; border: 0; border-left: 1px solid #efe8d6; border-top: 3px solid var(--navy); border-radius: 0; box-shadow: none; align-items: flex-start; text-align: left; padding-left: 0.75rem; }
.sb-ux .kpi-strip .kpi:nth-child(odd) { border-left: 0; }
.sb-ux .kpi-strip .kpi:nth-child(n+3) { border-bottom: 0; }
.sb-ux .kpi-strip button.kpi { width: auto; color: inherit; font: inherit; cursor: pointer; }
.sb-ux .kpi-strip button.kpi:disabled { cursor: default; opacity: 1; background: #fff; }
.sb-ux .kpi-strip .kpi-paid { border-top-color: #16a34a; }
.sb-ux .kpi-strip .kpi-spent { border-top-color: var(--muted); }
.sb-ux .kpi-strip .kpi-profit { border-top-color: var(--gold); }
.sb-ux .kpi-strip .kpi-k { font-size: var(--fs-xs); letter-spacing: 0.03em; }
.sb-ux .kpi-strip .kpi-v { font-size: var(--fs-lg); }
.sb-ux .kpi-strip .kpi-s { min-height: 1.1em; }
/* #472: "See … ›" links sit left and at the bottom of the tile, as on Home. */
.sb-ux .kpi-strip .kpi .card-link { margin-top: auto; padding-top: 0.35rem; }
.sb-ux .kpi-strip .kpi-loss .kpi-v { color: #b42318; }
.sb-ux .kpi-basis { margin-top: -0.3rem; }
.sb-ux .owed-card { margin-bottom: 0.8rem; }
.sb-ux .owed-bar { display: flex; height: 0.5rem; margin: 0.6rem 0.9rem 0; border-radius: var(--radius-pill); overflow: hidden; background: #efe8d6; }
.sb-ux .owed-due { background: var(--navy); }
.sb-ux .owed-late { background: #b42318; }
.sb-ux .owed-split { margin: var(--sp-2) var(--sp-4) var(--sp-1); font-size: var(--fs-sm); color: #334155; }
.sb-ux .owed-card > .card-link { margin: 0 0.9rem 0.3rem; }
.sb-ux .kpi-note { margin: 0.35rem 0 0.6rem; font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.sb-ux .sum-chart-card { background: #fffdf7; border: 1px solid #e2d9c3; border-radius: var(--radius-lg); padding: 0.6rem 0.6rem 0.3rem; margin-top: var(--sp-4); margin-bottom: 0.8rem; }
.sb-ux .sum-chart-legend { display: flex; gap: 0.9rem; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); margin-bottom: 0.2rem; }
.sb-ux .sum-chart-legend .lg::before { content: ""; display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 2px; margin-right: 0.3rem; vertical-align: -1px; }
.sb-ux .lg-inv::before { background: var(--navy); }
.sb-ux .lg-paid::before { background: var(--gold); }
.sb-ux .sum-chart-svg { width: 100%; max-height: 7.5rem; height: auto; display: block; }
.sb-ux .sum-chart-svg .bar-inv { fill: var(--navy); }
.sb-ux .sum-chart-svg .bar-paid { fill: var(--gold); }
.sb-ux .sum-chart-svg text { font-size: 9px; fill: var(--muted); font-family: inherit; }
.sb-ux .sum2-row { cursor: pointer; }
.sb-ux .sum2-row:hover, .sb-ux .sum2-row:focus-visible { background: #f8fafc; }
.sb-ux .client-ov .page-title { margin-bottom: 0.2rem; }
.sb-ux .client-ov-actions { margin: 0.75rem 0 0.25rem; }
/* #472: the client page sits on the page like other screens; Owed full width; Edit a full-width outline button. */
.sb-ux .client-ov-actions > button { flex: 1 1 0; min-height: 44px; }
.sb-ux .client-ov-owed { margin-top: 0.6rem; grid-template-columns: 1fr; }
.sb-ux .client-ov > .sum2-list { margin-top: 0.85rem; }

/* Installable app: iOS Add to Home Screen hint in the menu */
.sb-ux .install-hint { margin: 0; padding: 0.7rem 1rem 0.9rem; font-size: 0.88rem; color: #334155; background: var(--cream); border-bottom: 1px solid #e2d9c3; }

/* Install banners (Android prompt and iOS Share hint) */
.install-banner { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 0.8rem; padding: 0.7rem 0.8rem; border: 1px solid #e2d9c3; border-radius: var(--radius-lg); background: var(--cream); color: var(--navy); }
.install-banner .install-banner-text { flex: 1 1 12rem; margin: 0; font-size: 0.9rem; line-height: 1.35; }
.install-banner .install-banner-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; width: 100%; }
.install-banner .install-banner-actions button { flex: 0 1 auto; width: auto; margin: 0; padding: 0.55rem 0.8rem; min-height: 0; }
.install-banner-ios { flex-wrap: nowrap; }
.install-banner .share-badge { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: var(--radius-sm); background: #fff; border: 1px solid #e2d9c3; color: #007AFF; }
.install-banner .share-inline { width: 1em; height: 1em; vertical-align: -0.15em; color: #007AFF; }
.install-banner .panel-close { flex: 0 0 auto; width: auto; margin: 0; padding: 0.3rem 0.5rem; }

/* Offline saving: status strip under the header */
.offline-strip { display: block; width: 100%; margin: 0; padding: 0.45rem 1rem; min-height: 0; border: 0; border-radius: 0; font-size: var(--fs-sm); font-weight: 700; text-align: center; color: #fff; background: var(--muted); }
.offline-strip.offline-sync { background: var(--gold); color: var(--navy); }

/* Settings → Payments (Stripe Connect) */
.sb-ux #settings-payments .stripe-status { margin: 0.4rem 0 0.8rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); background: #f1f5f9; color: #334155; font-weight: 600; font-size: 0.92rem; }
.sb-ux #settings-payments .stripe-status.stripe-on { background: #ecfdf5; color: #166534; }
.sb-ux #settings-payments .btn-line { margin-top: 0.5rem; }
/* Round 4 (Jane's snag list), Supabase mode only */
/* 1. Hints are plain muted text; only real buttons are navy. */
.sb-ux .shift-note { background: none; color: #334155; padding: 0; border-radius: 0; font-size: var(--fs-sm); font-weight: 500; line-height: 1.4; }
.sb-ux .shift-note.history-late { color: #9f1239; }
/* 2. Menu: cream highlight bands with a gold rule as section separators. */
.sb-ux .app-menu .menu-group { background: #FFF8E6; color: #7a6526; border-top: 3px solid var(--gold); border-bottom: 1px solid #efe3c4; padding: 0.55rem 1rem 0.4rem; }
.sb-ux .app-menu .menu-group:first-of-type { border-top: 0; }
.sb-ux .app-menu .menu-item.menu-danger { border-top: 3px solid var(--gold); }
.sb-ux .app-menu .menu-item:active, .sb-ux .app-menu .menu-item:hover { background: #fffdf5; }
/* 3. Unbilled work: groups per client, light highlight, sticky footer. */
.sb-ux .unbilled-list { display: flex; flex-direction: column; gap: 0.35rem; }
.sb-ux .unbilled-row { min-height: 48px; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); font-weight: 500; }
.sb-ux .unbilled-head { background: #f1f5f9; color: var(--navy); font-weight: 700; border-color: #e2e8f0; }
.sb-ux .unbilled-list > .unbilled-head ~ .unbilled-head { margin-top: 0.75rem; }
.sb-ux .unbilled-job { margin-left: 0.75rem; width: calc(100% - 0.75rem); }
.sb-ux .unbilled-row.unbilled-on { background: #FFF8E6; border-color: var(--gold); }
.sb-ux .unbilled-head.unbilled-some { border-color: var(--gold); }
.sb-ux .unbilled-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-ux .unbilled-dock { position: sticky; bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); z-index: 20; background: #ffffff; border: 1px solid #e2d9c3; border-top: 3px solid var(--gold); border-radius: var(--radius-lg); padding: 0.7rem; box-shadow: 0 6px 18px rgba(0, 38, 59, 0.18); display: flex; flex-direction: column; gap: 0.5rem; }
.sb-ux .unbilled-sum { margin: 0; font-size: 1rem; font-weight: 700; color: var(--navy); }
.sb-ux .unbilled-switch { margin: 0; font-size: 0.82rem; color: #7a6526; }
.sb-ux .unbilled-dock button { min-height: 48px; padding: 0.75rem; }
.sb-ux .unbilled-draft { display: flex; flex-direction: column; gap: 0.4rem; }
/* 6. Logged jobs: badge per job; invoiced ones are locked. */
.sb-ux .entry-badge { font-size: var(--fs-xs); font-weight: 700; border-radius: var(--radius-pill); padding: 0.12rem 0.45rem; background: #f1f5f9; color: var(--muted); white-space: nowrap; }
.sb-ux .entry-locked { background: #f8fafc; }
.sb-ux .entry-locked .entry-badge { background: #dcfce7; color: #166534; }
.sb-ux .entry-locked .entry-badge::before { content: "🔒 "; }
.sb-ux .entry-draft .entry-badge { background: #fef3c7; color: #92400e; }
.sb-ux .app-sheet { z-index: 71; }
.sb-ux .app-sheet > * + * { margin-top: 0.7rem; }
/* #700: a tall sheet stops below the header (z-index 72), so its × is never covered. Beats the wide-screen .bottom-sheet rules. */
.sb-ux .bottom-sheet.app-sheet { max-height: calc(100dvh - var(--hdr-bottom, var(--hdr, 56px)) - 2rem - env(safe-area-inset-bottom, 0px)); }
.sb-ux .entry-lock { margin: 0; color: var(--muted); font-size: 0.9rem; }
.sb-ux .entry-facts { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.4rem 0.75rem; margin: 0.6rem 0 0; }
.sb-ux .entry-facts dt { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; padding-top: 0.15rem; }
.sb-ux .entry-facts dd { margin: 0; font-weight: 600; color: #0f172a; overflow-wrap: anywhere; }
/* 8. Inline two-way choice (materials, merge picker). */
.sb-ux .choice-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
/* #454: materials have three choices; the third goes full width below. */
.sb-ux .choice-pair.choice-three > :last-child { grid-column: 1 / -1; }
.sb-ux button.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; min-height: 48px; padding: 0.65rem 0.75rem; background: #ffffff; color: #0f172a; border: 1.5px solid #e2e8f0; border-radius: var(--radius); font-weight: 500; }
.sb-ux button.choice b { font-weight: 700; color: var(--navy); font-size: 0.9rem; }
.sb-ux button.choice span { font-size: var(--fs-xs); color: var(--muted); }
.sb-ux button.choice.choice-on { background: #FFF8E6; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
/* 9. Materials photo: camera or gallery. */
.sb-ux .photo-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.sb-ux label.photo-btn { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1.5px solid var(--navy); border-radius: var(--radius); background: #ffffff; color: var(--navy); font-size: 0.875rem; font-weight: 600; text-transform: none; letter-spacing: 0; cursor: pointer; text-align: center; }
.sb-ux .photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
/* 11. Jobs by profit: chart + compact grid. */
.sb-ux .profit-svg .pc-label { font-size: var(--fs-xs); fill: #334155; }
.sb-ux .profit-svg .pc-val { font-size: var(--fs-xs); fill: var(--navy); font-weight: 700; }
.sb-ux .sum-chart-svg .bar-loss { fill: #dc2626; }
.sb-ux .profit-table .lt-head, .sb-ux .profit-table .lt-row { grid-template-columns: minmax(0, 1fr) 4.1rem 4.1rem 4.4rem; }
.sb-ux .profit-table .lt-head .lt-col { display: flex; align-items: center; }
.sb-ux .profit-table .lt-r { justify-content: flex-end; }
.sb-ux .profit-table .lt-row { padding-top: 0.35rem; padding-bottom: 0.35rem; }
.sb-ux .pt-job { display: flex; flex-direction: column; min-width: 0; white-space: normal !important; }
.sb-ux .pt-job > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-ux .pt-meta { font-size: var(--fs-xs); color: var(--muted); }
.sb-ux .pt-cost { color: var(--muted); font-weight: 500 !important; }
.sb-ux .pt-loss .pt-profit { color: #b42318; }
/* 12. One info style. */
.sb-ux .info-box { margin: 0; background: #FFFDF5; border: 1px solid #e2d9c3; border-left: 4px solid var(--gold); border-radius: var(--radius-sm); padding: 0.65rem 0.8rem; color: var(--navy); font-size: 0.875rem; font-weight: 500; text-align: left; line-height: 1.45; }
/* 16. Merge picker */
.sb-ux #client-merge-open { color: var(--navy); text-decoration: underline; text-underline-offset: 0.18em; min-height: 44px; }
.sb-ux .merge-explain { margin: 0; color: #334155; font-size: 0.92rem; line-height: 1.45; }
.sb-ux .merge-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 40vh; overflow-y: auto; }
.sb-ux .merge-list button.choice { width: 100%; font-weight: 700; color: var(--navy); }
/* 14. Help page in app styling */
.sb-ux .help-sub { margin: 0.4rem 0 0.5rem; font-size: 1.05rem; }
.sb-ux .help-list { background: #ffffff; border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: 0.15rem 1rem; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); margin-bottom: 1.05rem; }
.sb-ux .help-list li { color: var(--muted); }
.sb-ux .help-list li:last-child { border-bottom: 0; }
.sb-ux .help-list li b { color: var(--navy); }
.sb-ux .photo-pick + .photo-input + .photo-input + .btn-line, .sb-ux #materials-choice { margin-top: 0.5rem; }
.pay-sub { margin: 0.75rem 0 0.25rem; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.pay-choice { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pay-choice button { flex: 1 1 0; width: auto; min-width: 0; padding-left: 0.4rem; padding-right: 0.4rem; margin: 0; }
.pay-choice button.pay-on { background: var(--navy); color: var(--cream); }
/* Phase 21: Request access (sign-in) and access.html */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.access-page { max-width: 32rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.access-details { margin: 0 0 1.25rem; display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.9rem; font-size: var(--fs-md); }
.access-details dt { color: var(--muted); }
.access-details dd { margin: 0; color: var(--text); font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
/* #194: nothing in the panel is wider than the panel. Flex/grid children may shrink, long text wraps, wide tables scroll inside themselves. */
main, main > *, .card { min-width: 0; max-width: 100%; box-sizing: border-box; }
main .card, main p, main h2, main h3, main td, main .lt-col { overflow-wrap: anywhere; }
main table { display: block; max-width: 100%; overflow-x: auto; }
/* #196: free test banner */
.trial-banner { margin: 0 0 0.8rem; padding: 0.65rem 0.8rem; border-radius: var(--radius-lg); background: var(--cream); border: 1px solid #e2d9c3; color: var(--navy); font-size: 0.88rem; font-weight: 600; }
.trial-banner.trial-over { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
/* Paying by Revolut: banner text, Pay button and copy-email line stack at phone width. */
.trial-banner-text { margin: 0; }
.trial-pay { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.trial-pay-note { margin: 0.5rem 0 0; font-weight: 500; overflow-wrap: anywhere; }
.trial-pay .trial-pay-note { margin: 0; }
.trial-pay-note a { color: inherit; font-weight: 700; }
/* #197 feedback */
.sb-ux .fb-kinds { grid-template-columns: 1fr 1fr 1fr; margin: 0.5rem 0 0.75rem; }
#feedback-sheet textarea { width: 100%; box-sizing: border-box; }
.fb-kinds button.pay-on { background: var(--navy); color: var(--cream); }
/* #198 Admin */
.admin-page { position: fixed; inset: 0; z-index: 80; background: #f6f6f1; overflow-y: auto; padding: 0 1rem calc(2rem + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; }
.admin-page .panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 0.5rem; background: var(--navy); color: var(--cream); margin: 0 -1rem 0.75rem; padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 1rem 0.6rem; }
.admin-page .panel-title { flex: 1; margin: 0; color: var(--cream); font-size: 1.1rem; }
.admin-page .panel-head .icon-btn, .admin-page .adm-refresh { width: auto; background: transparent; color: var(--cream); border: 1.5px solid var(--cream); padding: 0.4rem 0.8rem; }
.admin-page > * { max-width: 60rem; margin-left: auto; margin-right: auto; }
.adm-sec { border: 1px solid #e2e8f0; border-radius: var(--radius); background: #fff; margin: 0 0 0.6rem; overflow: hidden; }
.adm-sec-bar { display: flex; align-items: stretch; gap: 0.35rem; }
button.adm-sec-head { flex: 1; min-height: 48px; margin: 0; text-align: left; background: #fff; color: var(--navy); border: 0; border-radius: 0; font-weight: 700; padding: 0.7rem 0.9rem; }
button.adm-sec-head::before { content: "\203A"; display: inline-block; width: 1em; font-size: 1.2rem; line-height: 1; font-weight: 400; transition: transform 0.15s; }
.adm-sec.is-open button.adm-sec-head::before { transform: rotate(90deg); }
.adm-sec-body { display: none; padding: 0 0.9rem 0.8rem; }
.adm-sec.is-open .adm-sec-body { display: block; }
button.adm-older { width: auto; flex: 0 0 auto; min-height: 44px; margin: 0.25rem 0.4rem 0.25rem 0; padding: 0.4rem 0.7rem; font-size: 0.82rem; }
.adm-search { display: flex; gap: 0.4rem; align-items: center; margin: 0 0 0.5rem; }
.adm-search input { flex: 1; min-width: 0; }
.adm-search .btn-line { flex: 0 0 auto; width: auto; }
.adm-kpis { margin-bottom: 0.8rem; }
.adm-kpis .metric-box { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.7rem; background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); }
.adm-kpis .metric-label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.adm-kpis .metric-val { font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.adm-biz-list { background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); overflow: hidden; }
.adm-biz { border-top: 1px solid #f1f5f9; }
.adm-biz:first-child { border-top: 0; }
button.adm-biz-row { display: flex; gap: 0.15rem; width: 100%; background: #fff; color: #0f172a; border-radius: 0; text-align: left; }
.adm-biz-name { font-weight: 700; }
.adm-biz-meta { font-size: 0.78rem; color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.adm-tl { padding: 0 0.9rem; }
.adm-timeline { margin: 0 0 0.7rem; padding-left: 1.1rem; font-size: 0.8rem; color: #334155; }
.adm-list { list-style: none; margin: 0 0 1rem; padding: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius); }
.adm-list li { padding: 0.6rem 0.9rem; border-top: 1px solid #f1f5f9; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.adm-list li:first-child { border-top: 0; }
.adm-msg { color: #0f172a; }
/* #533: one row per Admin item: the text on the left, its action on the right. */
.adm-row { display: flex; align-items: center; gap: var(--sp-3); }
.adm-row-main { flex: 1; min-width: 0; }
.adm-row .adm-row-btn { flex: 0 0 auto; width: auto; min-height: 44px; margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.adm-list li.adm-biz { padding: 0; }
button.adm-biz-row { flex-direction: row; align-items: center; min-height: 48px; padding: var(--sp-3) var(--sp-4); }
.adm-biz-row .adm-biz-name, .adm-biz-row .adm-biz-meta { display: block; }
.adm-row-act { flex: 0 0 auto; font-size: var(--fs-sm); font-weight: 700; color: var(--navy); }
.adm-row-act::after { content: " \203A"; }
.adm-biz.is-open .adm-row-act::after { content: ""; }
.adm-biz-panel { padding: var(--sp-2) 0; border-top: 1px solid #f1f5f9; }
.adm-biz-panel > .vat-note { margin: 0 var(--sp-4) var(--sp-2); }
.adm-more { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.admin-page .sum-chart-svg .bar-inv { fill: var(--navy); }
.admin-page .sum-chart-svg text { font-size: 9px; fill: var(--muted); }
@media (min-width: 48rem) { .sb-ux .adm-kpis { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 48rem) {
  .sb-ux .kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sb-ux .kpi-strip .kpi:nth-child(odd) { border-left: 1px solid #efe8d6; }
  .sb-ux .kpi-strip .kpi:first-child { border-left: 0; }
}
#admin-page .panel-title { color: var(--cream); }
.admin-page > .panel-head { max-width: none; }
.admin-page .sum-chart-card { max-width: 34rem; margin-left: 0; }
/* #199 View as */
.view-as-banner { position: sticky; top: var(--hdr, 56px); z-index: 45; display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.8rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-lg); background: #fef3c7; border: 2px solid #d97706; color: #78350f; font-weight: 700; font-size: 0.9rem; }
.view-as-banner span { flex: 1; overflow-wrap: anywhere; }
button.view-as-exit { width: auto; padding: 0.45rem 0.9rem; background: #92400e; color: #fff; border-radius: var(--radius-sm); }
html.view-as header { border-bottom-color: #d97706; }
.adm-biz-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0.9rem 0.6rem; }
button.adm-view-as, button.adm-edit-settings, button.adm-trial-save { width: auto; margin: 0; padding: 0.45rem 0.8rem; font-size: 0.82rem; }
/* #196 follow-up: per-business free test end date on the Admin business row. */
.adm-trial-edit { align-items: flex-end; }
.adm-trial-edit .form-group { flex: 1 1 10rem; margin: 0; }
.admin-settings-banner { position: sticky; top: var(--hdr, 56px); z-index: 44; display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.8rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-lg); background: #e0f2fe; border: 2px solid #0369a1; color: #0c4a6e; font-weight: 700; font-size: 0.9rem; }
.admin-settings-banner span { flex: 1; overflow-wrap: anywhere; }
button.admin-settings-back { width: auto; padding: 0.45rem 0.9rem; background: #0369a1; color: #fff; border-radius: var(--radius-sm); }

@media (min-width: 68.75rem) {
  .sb-ux .shell, .sb-ux nav { max-width: 78rem; }
  .sb-ux main { padding: 2rem 2.25rem; }
  .sb-ux header { padding-right: 1.5rem; }
  .sb-ux .hist-table .lt-head, .sb-ux .hist-table .lt-row {
    grid-template-columns: minmax(4.5rem, 0.9fr) minmax(10rem, 2.2fr) minmax(6rem, 1fr) minmax(6rem, 1fr) minmax(7rem, 1.2fr) minmax(6rem, 1fr);
    column-gap: 0.8rem;
    padding: 0 1.1rem;
  }
  .sb-ux .hist-table.hist-quotes .lt-head, .sb-ux .hist-table.hist-quotes .lt-row {
    grid-template-columns: minmax(4.5rem, 0.9fr) minmax(10rem, 2.2fr) minmax(6rem, 1fr) minmax(6rem, 1fr) minmax(7rem, 1.2fr);
  }
  .sb-ux .hist-table.hist-selecting .lt-head, .sb-ux .hist-table.hist-selecting .lt-row {
    grid-template-columns: 1.6rem minmax(4.5rem, 0.9fr) minmax(10rem, 2.2fr) minmax(6rem, 1fr) minmax(6rem, 1fr) minmax(7rem, 1.2fr) minmax(6rem, 1fr);
  }
  .sb-ux .client-table .lt-head, .sb-ux .client-table .lt-row {
    grid-template-columns: minmax(11rem, 1.5fr) minmax(10rem, 1.25fr) minmax(7rem, 0.9fr) minmax(6rem, 0.8fr);
    column-gap: 1rem;
    padding: 0 1.1rem;
  }
  .sb-ux .lt-row { min-height: 56px; font-size: var(--fs-md); }
  .sb-ux .lt-col { min-height: 52px; }
  .sb-ux .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
  .sb-ux .kpi-strip .kpi { padding: 0.75rem 0.65rem; }
  .sb-ux .kpi-strip .kpi-v { font-size: 1.1rem; }
  .sb-ux .bottom-sheet { max-width: 50rem; max-height: calc(100dvh - 2rem - env(safe-area-inset-bottom, 0px)); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
  .sb-ux .new-sheet { max-width: 32rem; }
  .sb-ux #history-filters { max-width: 50rem; }
  .sb-ux .period-pick .pp { min-height: 52px; }
}

@media (min-width: 48rem) {
}

/* Responsive overrides follow the application panel rules so their placement wins at tablet widths. */
@media (min-width: 48rem) {
  .sb-ux .app-menu, .sb-ux .notes-panel { right: max(0px, calc((100vw - 68rem) / 2)); width: min(24rem, 45vw); }
  .sb-ux main .sheet-page#sale-view { max-width: 56rem; }
  .sb-ux main > div[x-show="currentTab === 'settings'"] .sec.sec-open > .sec-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 0.8rem 1rem;
  }
  .sb-ux main > div[x-show="currentTab === 'settings'"] .sec-body > .form-group { min-width: 0; }
  .sb-ux main > div[x-show="currentTab === 'settings'"] #sec-basic .sec-body > .form-group[data-settings-field="logo"],
  .sb-ux main > div[x-show="currentTab === 'settings'"] #sec-basic .sec-body > .settings-pricelist,
  .sb-ux main > div[x-show="currentTab === 'settings'"] #sec-basic .sec-body > div[data-settings-field="vatApplied"],
  .sb-ux main > div[x-show="currentTab === 'settings'"] #sec-onetime .sec-body > #settings-payments,
}

@media (min-width: 68.75rem) {
  .sb-ux .app-menu, .sb-ux .notes-panel { right: max(0px, calc((100vw - 78rem) / 2)); width: min(26rem, 40vw); }
}

/* #324: confirm sits above every other sheet, including Admin. */
#confirm-backdrop { z-index: 94; }
#confirm-sheet { z-index: 95; }

/* #324: a 360px phone still has 44px targets and no sideways scroll. */
@media (max-width: 360px) {
  .shell { max-width: 100%; }
  .seg-tabs button, .seg-switch button { min-height: 44px; padding-left: 0.4rem; padding-right: 0.4rem; }
  .price-row-actions { gap: 0.35rem; }
  .price-row-actions .btn-line, button.price-move { min-width: 44px; min-height: 44px; }
  main { padding-left: 0.75rem; padding-right: 0.75rem; }
}

/* #205 #221 #211: quote link list, review preview, Home overdue groups */
.quote-pick { display: flex; width: 100%; text-align: left; background: #ffffff; color: var(--navy); border: 1px solid #cbd5e1; border-radius: var(--radius); }
.quote-pick + .quote-pick { margin-top: 0.45rem; }
.review-preview { white-space: pre-line; overflow-wrap: anywhere; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 0.7rem 0.8rem; margin: 0.5rem 0; color: var(--text); }
.home-remind { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.home-remind .shift-note { margin: 0; }
/* Home: work strip, Needs you, two highlights, quiet lines. */
.home-week { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "stats" "value" "last" "link"; align-items: center; column-gap: 0.75rem; row-gap: 0.2rem; margin: 0; background: var(--navy); color: var(--cream); border: 0; border-radius: var(--radius-lg); padding: var(--sp-3) var(--sp-4); box-shadow: none; }
/* #455: the date sits beside the switch, right-aligned and centred on it, in
   both modes; it never drops under the switch, so the panel doesn't jump. */
.home-week-head { grid-area: head; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; min-height: 2.6rem; margin-bottom: var(--sp-1); gap: var(--sp-2); }
.home-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: rgb(250 255 228 / 0.12); }
.home-seg button { min-height: 36px; padding: 0.3rem 0.8rem; border: 0; border-radius: var(--radius-sm); background: none; color: #c9d3dc; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.home-seg button.home-seg-on { background: var(--cream); color: var(--navy); }
.home-week-range { justify-self: end; text-align: right; line-height: 1.2; text-wrap: balance; overflow-wrap: normal; font-size: 0.8rem; font-weight: 600; color: #c9d3dc; }
.home-week-stats { grid-area: stats; display: flex; flex-wrap: nowrap; min-height: 1.95rem; gap: 0.25rem 1.1rem; }
/* #455: an empty row keeps its space (so This week and This month are the same
   height); visibility also takes it out of the tab order and screen readers. */
.home-slot-off { visibility: hidden; }
/* #500: each figure is a button that opens Jobs; it looks the same, with a taller tap area. */
.home-stat { display: flex; align-items: baseline; gap: 0.3rem; }
button.home-stat, button.home-week-value { width: auto; margin: -0.45rem 0; padding: 0.45rem 0; border: 0; border-radius: 0; background: none; color: inherit; text-align: left; }
.home-stat-n { font-size: var(--fs-xl); font-weight: 700; line-height: 1.1; }
.home-stat-l { font-size: var(--fs-sm); font-weight: 600; color: #c9d3dc; }
.home-week-value { grid-area: value; justify-self: start; margin: 0; font-size: 0.92rem; font-weight: 600; }
.home-needs { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.home-needs .page-lead { margin: 0; }
/* #634: Log a job under the to-do rows, or beside the line when that's all there is. */
.home-needs-foot { display: flex; flex-direction: column; gap: 0.6rem; }
.home-needs-foot.is-beside { flex-direction: row; align-items: center; }
.home-needs-foot.is-beside > .page-lead { flex: 1 1 auto; min-width: 0; }
.home-needs-foot.is-beside > #home-log-job { flex: 0 0 auto; width: auto; min-height: var(--field-h); margin: 0; padding: 0 var(--sp-4); white-space: nowrap; }
.home-week-link { grid-area: link; justify-self: start; }
/* #455 Option B: a tappable card says where it goes ("See … ›"); a row in a
   dense list gets a trailing › only. Cards you can't tap get neither. The ›
   isn't read out. #7a6630 is 5.1:1 or better on every card background. */
.card-link { display: block; margin-top: 0.35rem; font-size: var(--fs-sm); font-weight: 700; line-height: 1.2; color: #7a6630; }
.card-link::after { content: " ›"; content: " ›" / ""; }
.card-link-dark { color: #e6cf8f; }
button.card-link { width: auto; min-height: 44px; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; text-align: left; }
.card-chev::after { content: "›"; content: "›" / ""; margin-left: 0.4rem; font-size: 1.45rem; font-weight: 500; line-height: 1; color: #7a6630; align-self: center; }
.setup-next.card-chev::after, .setup-row.card-chev::after { margin-left: auto; }
.sb-ux .sum2-row.card-chev { grid-template-columns: minmax(0, 1fr) auto auto; }
.sb-ux .sum2-row.card-chev::after { grid-column: 3; grid-row: 1 / span 2; }
.todo-row .card-link { grid-area: link; }
button:disabled .card-link, button:disabled.card-chev::after { display: none; }
.home-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
button.home-hi { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; text-align: left; background: #ffffff; color: var(--navy); border: 1px solid #e6eaee; border-radius: var(--radius-lg); padding: var(--sp-3) var(--sp-4); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.home-hi-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.home-hi-n { font-size: var(--fs-xl); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.home-hi-sub { font-size: 0.82rem; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
/* #500: Owed's overdue split and Paid in's comparison; the quiet lines under the highlights. */
.home-hi-sub.home-hi-late { color: #b42318; }
.home-hi-sub.home-hi-up { color: #166534; }
.sb-ux .home-lines { margin-top: 0; }
.home-week-last { grid-area: last; margin: 0; font-size: var(--fs-sm); font-weight: 600; color: #c9d3dc; }
/* #500: grey placeholders while Home loads. */
.skel { display: block; border-radius: var(--radius-sm); background: #e6eaee; }
.skel-dark { background: rgb(250 255 228 / 0.14); }
.skel-line { width: 60%; height: 1.2rem; }
.skel-row { height: 4.5rem; border-radius: var(--radius-lg); }
.skel-tile { height: 8rem; border-radius: var(--radius-lg); }
@media (prefers-reduced-motion: no-preference) { .skel { animation: skel-pulse 1.4s ease-in-out infinite; } }
@keyframes skel-pulse { 50% { opacity: 0.55; } }
#doc-po .form-group { margin-top: 0.5rem; }

/* #157 #159: receipts on an expense, Expenses / Mileage switch */
.exp-subs { margin: 0 0 0.75rem; }
.exp-receipt-thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.35rem 0 0.5rem; }
.exp-receipt-card { display: flex; flex-direction: column; align-items: stretch; gap: 0.25rem; width: 5.5rem; }
.exp-receipt-thumb { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 5rem; padding: 0.25rem; overflow: hidden; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); background: #f8fafc; color: var(--navy); font-weight: 700; font-size: var(--fs-xs); }
.exp-receipt-img-el { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.exp-receipt-img-el:not([src]), .exp-receipt-img-el[src=""], .exp-receipt-pdf .exp-receipt-img-el { display: none; }
.exp-receipt-label { position: relative; background: rgba(255, 255, 255, 0.9); border-radius: 0.35rem; padding: 0 0.3rem; }
.exp-receipt-delete { font-size: var(--fs-xs); min-height: 36px; }
#receipt-viewer img { max-width: 100%; max-height: 80vh; object-fit: contain; }

/* #216: waiting-to-sync chip and Home card */
.sync-chip { min-height: 32px; padding: 0.15rem 0.6rem; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; border: 1px solid #cbd5e1; background: #fff7ed; color: #9a3412; white-space: nowrap; }
.sync-chip.sync-failed { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.sync-chip.sync-done { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.home-sync { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; padding: 0.75rem; border: 1px solid #fed7aa; border-radius: var(--radius-lg); background: #fffbf5; }
.home-sync .shift-note { margin: 0; }
.sync-list { display: flex; flex-direction: column; gap: 0.45rem; }
.sync-item { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; border-radius: var(--radius-sm); background: #ffffff; border: 1px solid #e2e8f0; }
.sync-item-main { display: flex; flex-direction: column; min-width: 0; }
.sync-item-label { font-weight: 700; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.sync-item-meta { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.sync-item-actions { display: flex; gap: 0.35rem; flex: 0 0 auto; }
.sync-item .sync-retry { display: none; }
.sync-item.sync-item-failed { border-color: #fecaca; background: #fef2f2; }
.sync-item.sync-item-failed .sync-item-meta { color: #b91c1c; }
.sync-item.sync-item-failed .sync-retry { display: inline-flex; }

/* #396: invoice editing fields full width under the header; inline Save */
.doc-fields { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.6rem; }
.doc-fields .form-group { margin: 0; }
.doc-fields .field-hint { margin: 0.25rem 0 0.35rem; }
.doc-quote-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.doc-quote-actions > button.btn-line { width: auto; padding: 0.6rem 1rem; min-height: 44px; }
/* #472 / #595: the add buttons wrap side by side, each sized to its words. */
.line-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.line-tools > button { width: auto; flex: 0 1 auto; min-height: 44px; padding: 0.6rem 0.95rem; margin: 0; }
#detail-desc-save, #quote-short-save { width: auto; padding: 0.6rem 1rem; min-height: 44px; }

/* #396: Invoices list on phones: two lines per invoice so the client name has room. */
@media (max-width: 47.99rem) {
  .sb-ux .hist-table .lt-row,
  .sb-ux .hist-table.hist-selecting .lt-row {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "client client client amt" "num date . status";
    row-gap: 0.15rem; column-gap: 0.6rem; padding: 0.55rem 0.7rem;
  }
  .sb-ux .hist-table.hist-selecting .lt-row {
    grid-template-columns: 1.6rem auto auto minmax(0, 1fr) auto;
    grid-template-areas: "pick client client client amt" "pick num date . status";
  }
  .sb-ux .hist-table .lt-row > .lt-pick { grid-area: pick; align-self: center; }
  .sb-ux .hist-table .lt-row > .lt-client { grid-area: client; font-size: var(--fs-md); }
  .sb-ux .hist-table .lt-row > .lt-amt { grid-area: amt; justify-self: end; font-weight: 700; }
  .sb-ux .hist-table .lt-row > .lt-num { grid-area: num; color: var(--muted); font-size: 0.8rem; }
  .sb-ux .hist-table .lt-row > .lt-date { grid-area: date; color: var(--muted); font-size: 0.8rem; }
  .sb-ux .hist-table .lt-row > .lt-status { grid-area: status; justify-self: end; }
  /* #472: Clients use the same two lines (name and owed, then contact and last invoice). */
  .sb-ux .client-table .lt-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "client amt" "contact date";
    row-gap: 0.15rem; column-gap: 0.6rem; padding: 0.55rem 0.7rem;
  }
  .sb-ux .client-table .lt-row > .lt-client { grid-area: client; font-size: var(--fs-md); font-weight: 600; }
  .sb-ux .client-table .lt-row > .lt-amt { grid-area: amt; justify-self: end; }
  .sb-ux .client-table .lt-row > .lt-contact { grid-area: contact; white-space: nowrap; text-overflow: ellipsis; }
  .sb-ux .client-table .lt-row > .lt-date { grid-area: date; justify-self: end; }
  /* #472: on a phone the header row is a row of sort chips, not columns that can't line up with two-line rows. */
  .sb-ux .hist-table .lt-head, .sb-ux .client-table .lt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.45rem 0.7rem; }
  .sb-ux .hist-table .lt-head::before, .sb-ux .client-table .lt-head::before { content: "Sort"; content: "Sort" / ""; margin-right: 0.15rem; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
  .sb-ux .hist-table .lt-head .lt-col, .sb-ux .client-table .lt-head .lt-col { width: auto; min-height: 36px; padding: 0 0.6rem; border: 1px solid #d8e0e5; border-radius: var(--radius-pill); background: #ffffff; font-size: var(--fs-xs); }
  .sb-ux .lt-head .lt-col.lt-sorted { border-color: var(--navy); }
}

/* One look for every screen: a page title named like its tab, then (where it
   has one) a switch, then small secondary actions. Lists sit on the page;
   forms sit in one white card with the same shape everywhere. */
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 0.75rem; min-height: 44px; }
.screen-head .page-title { margin: 0; }
/* Same title position with or without Back; a long title wraps, Back never shrinks. */
.screen-head > .page-title, .screen-head > .card-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sb-ux .sum2-title { margin: 0; }
.screen-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.65rem 0 0.75rem; }
.screen-actions > button { width: auto; flex: 0 0 auto; min-height: 44px; padding: 0.55rem 1rem; margin: 0; }
.sb-ux section.screen-flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.sb-ux section.screen-card { border-radius: var(--radius-lg); }
.sb-ux #log-kind-switch { margin-bottom: 0.25rem; }

/* Loading screen on first load / refresh. Navy like the phone's launch screen
   (manifest background_color), so the two run on without a white flash. */
.boot-splash { position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; background: var(--navy); color: var(--cream); padding: env(safe-area-inset-top, 0px) 1rem env(safe-area-inset-bottom, 0px); text-align: center; }
html.ew-booted .boot-splash { display: none; }
.boot-logo { width: 72px; height: 72px; border-radius: var(--radius-lg); }
.boot-name { margin: 0.35rem 0 0.4rem; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
.boot-text { margin: 0.35rem 0 0; font-size: var(--fs-md); color: #d9e2e8; }
.boot-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(250, 255, 228, 0.25); border-top-color: var(--gold); animation: boot-spin 0.9s linear infinite; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .boot-spinner { animation-duration: 2.4s; } }

/* Invoices: Remind or pay several. Checkboxes on every row while choosing,
   and one slim, solid bar above the bottom menu instead of a floating panel. */
.history-select-hint { margin: 0; flex: 1 1 100%; font-size: var(--fs-sm); color: var(--muted); }
.history-bulk-dock { position: fixed; left: 0; right: 0; bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); z-index: 40; margin: 0; padding: 0.5rem 0.75rem; background: #ffffff; border: 0; border-top: 2px solid var(--gold); border-radius: 0; box-shadow: 0 -6px 16px rgb(0 38 59 / 0.12); }
/* Phones: count and ✕ on top, the two actions side by side below. Wider: one row. */
.bulk-dock-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; max-width: 68rem; margin: 0 auto; }
.bulk-dock-count { order: 0; flex: 1 1 calc(100% - 3.5rem); min-width: 0; font-weight: 700; font-size: 0.9rem; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-bulk-dock .bulk-dock-close { order: 1; flex: 0 0 44px; width: 44px; height: 36px; min-height: 36px; padding: 0; background: transparent; color: var(--navy); border: 0; font-size: 1.1rem; }
.history-bulk-dock .bulk-dock-row > #history-bulk-remind { order: 2; }
.history-bulk-dock .bulk-dock-row > #history-bulk-pay { order: 3; }
.history-bulk-dock .bulk-dock-row > #history-bulk-remind,
.history-bulk-dock .bulk-dock-row > #history-bulk-pay { flex: 1 1 0; width: auto; min-height: 44px; padding: 0.5rem 0.6rem; font-size: var(--fs-sm); margin: 0; }
.history-bulk-dock .bulk-dock-row > button:disabled { opacity: 0.45; }
@media (min-width: 48rem) {
  .bulk-dock-count { flex: 1 1 auto; }
  .history-bulk-dock .bulk-dock-row > #history-bulk-remind,
  .history-bulk-dock .bulk-dock-row > #history-bulk-pay { flex: 0 0 auto; padding: 0.5rem 1rem; }
  .bulk-dock-close { order: 4; }
}
.bulk-dock-note { max-width: 68rem; margin: 0.3rem auto 0; font-size: 0.8rem; color: var(--muted); }
.sheet-page.hist-dock-pad { padding-bottom: 6.5rem; }

/* Invoices: fewer rows above the list (switch, search + Remind/pay, chips + count). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sb-ux .hist-switch { margin-bottom: 0.6rem; }
.sb-ux .hist-switch button { min-height: 40px; padding-top: 0.4rem; padding-bottom: 0.4rem; }
.form-group.hist-search-row, .sb-ux .form-group.hist-search-row { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: stretch; gap: 0.5rem; margin: 0 0 0.5rem; }
.hist-search-row .search-wrap { flex: 1 1 auto; min-width: 0; }
.hist-search-row > .hist-tool { flex: 0 0 auto; width: auto; min-height: var(--field-h); padding: 0.45rem 0.6rem; font-size: var(--fs-sm); margin: 0; white-space: nowrap; }
.hist-search-row > .hist-tool .pick-box { margin-right: 0.35rem; }
/* #472: "Search invoices" / "Search quotes" in full at 360px. */
.hist-search-row input[type="search"]::placeholder { font-size: 0.9rem; }
.hist-filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.55rem; }
.hist-filter-row .history-chips { margin: 0; }
.hist-filter-row button.chip { min-height: 38px; padding: 0.35rem 0.85rem; margin: 0; }
.hist-filter-row .history-select-hint { flex: 0 1 auto; margin: 0; }
.hist-count { margin-left: auto; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

/* Header: the name starts at the left (no reserved Back slot); Help beside Settings. */
.sb-ux header .brand { gap: 0; padding-left: 0.25rem; }
.sb-ux header .brand h1 { max-width: 11rem; }
header .help-btn { text-decoration: none; }
/* The ring is on the glyph, so the 44px tap target doesn't stretch it. */
header .help-btn > span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 2px solid currentColor; border-radius: 50%; box-sizing: border-box; font-weight: 800; font-size: var(--fs-md); line-height: 1; }
/* Back is a link at the top of a flow page (invoice, quote, client), not in the header. */
/* #457: "‹ Back" at the right of the header row on every click-through screen. */
.head-back { display: inline-flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; width: auto; min-height: 44px; min-width: 44px; margin: 0; padding: 0 0.85rem 0 0.65rem; border-radius: var(--radius); background: #fff; color: var(--navy); border: 1.5px solid var(--navy); font-size: 0.9rem; font-weight: 700; line-height: 1; }
.head-back > span[aria-hidden="true"] { font-size: 1.35rem; font-weight: 400; color: var(--gold); margin-top: -2px; }
.head-back:active { background: var(--navy); color: var(--cream); }
.head-back:active > span[aria-hidden="true"] { color: var(--cream); }
/* Menu: Sign out sits apart at the bottom. */
.app-menu .menu-signout { margin-top: 0.75rem; border-top: 1px solid #e2e8f0; }

/* Bottom bar: Home · Jobs · + · Invoices · Money. The + is part of the bar,
   so it never sits over a list or a form's button. */
nav .nav-new { flex: 0 0 auto; align-self: center; width: 48px; height: 48px; min-height: 48px; margin: 0 0.35rem; padding: 0; border-radius: 50%; background: var(--gold); color: var(--navy); font-size: 1.9rem; font-weight: 400; line-height: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
nav .nav-new > span { margin-top: -0.12rem; }
.sb-ux nav .nav-new { min-height: 48px; padding: 0; }
/* Jobs: Log a job and Unbilled work above the list. Money: its sections under the title. */
.jobs-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: 0 0 var(--sp-2); }
.jobs-actions > button { width: auto; flex: 0 1 auto; min-height: 44px; margin: 0; }
.clients-actions > .chip { flex: 0 0 auto; }

/* #414: one-off client on Log a job. */
.one-off-start { display: inline-block; margin: 0.4rem 0 0; min-height: 44px; }
.one-off-box { margin: 0 0 0.9rem; padding: 0.75rem; border: 1px solid #d9dee5; border-radius: var(--radius-sm); background: #fbfcf6; min-width: 0; }
.one-off-box legend { padding: 0 0.3rem; font-weight: 700; font-size: 0.9rem; color: var(--navy); }
.one-off-box .form-row { gap: 0.5rem; }
#clients-one-off { width: auto; min-height: 40px; margin: 0; }

/* #456: where the work goes. No drafts: one gold line. Drafts: Add to | New invoice. */
.where-note { margin: 0; padding: 0.55rem 0.75rem; border-left: 3px solid var(--gold); border-radius: var(--radius-sm); background: #fbf6e8; color: var(--navy); font-size: 0.9rem; }
.where-switch { margin: 0; }
.where-switch button { flex: 1 1 0; white-space: normal; line-height: 1.15; padding: 0.3rem 0.5rem; }
.where-switch #log-where-draft { flex-grow: 1.5; }
.where-switch .where-code { white-space: nowrap; }
.where-pick-wrap { margin: 0.5rem 0 0; }
/* To | PO / job no. on one row; the To hint is a full-width line under it. */
.to-po-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 0.6rem; margin: 0 0 0.9rem; }
.to-po-row > .form-group { flex: 1 1 8.5rem; min-width: 0; margin: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.to-po-row > .to-hint { flex: 1 1 100%; margin: 0.3rem 0 0; }
/* Pricing: five short chips in one row (Hour, Day, Week, Fixed, List). */
.price-chips { display: flex; }
.price-chips .seg { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0.4rem 0.2rem; font-size: var(--fs-sm); }
/* Log a job, Phase 1: the review card. */
.log-review .rv-who { margin: 0; font-weight: 700; }
.log-review .rv-where, .log-review .rv-po, .log-review .rv-heading { margin: 0.15rem 0 0; color: #334155; font-size: 0.9rem; }
.log-review .rv-lines { margin: 0.6rem 0 0; border-top: 1px solid #e2e8f0; padding-top: 0.4rem; }
.log-review .rv-line { display: flex; justify-content: space-between; gap: 0.75rem; margin: 0.25rem 0; font-size: 0.9rem; }
.log-review .rv-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-review .rv-total { border-top: 1px solid #e2e8f0; padding-top: 0.4rem; font-weight: 700; }
.log-review .rv-note { margin: 0.3rem 0 0; font-size: var(--fs-sm); color: var(--muted); }
.log-review #log-review-go { margin-top: 0.75rem; }

/* Log a job: small values share a row; full width only for the client, the
   descriptions, To and other long text. */
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr)); gap: 0.6rem; margin: 0 0 0.5rem; }
:where(.ew-scale) .field-grid:not(:where(.bottom-sheet *)) { gap: var(--sp-2); margin: 0 0 var(--sp-2); }
.field-grid > .form-group { min-width: 0; margin: 0; }
.field-grid input, .field-grid select { width: 100%; min-width: 0; }
.field-grid.field-grid-dates { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); } /* #673: Valid until never clipped */
.seg-wrap { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.7rem; }
.seg-wrap button.seg { width: auto; flex: 1 1 auto; min-height: 40px; padding: 0.4rem 0.7rem; font-size: var(--fs-sm); }
/* #456: Date | Details, then each panel's fields three (or two) across. */
.date-details-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 0.6rem; }
.date-details-row > .log-date { flex: 0 0 9.5rem; min-width: 0; margin: 0; } /* #673: room for dd/mm/yyyy and the calendar */
.date-details-row > .log-details { flex: 1 1 9rem; min-width: 0; margin: 0; }
.grow-field { min-height: var(--field-h); field-sizing: content; max-height: calc(6 * 1.35em + 1.5rem); overflow-y: auto; resize: none; }
.field-row3, .field-row2 { display: grid; gap: 0.5rem; align-items: end; margin: 0 0 0.5rem; }
.field-row3 { grid-template-columns: repeat(auto-fit, minmax(5.4rem, 1fr)); }
.field-row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row3 > .form-group, .field-row2 > .form-group { min-width: 0; margin: 0; }
.field-row3 input, .field-row3 select, .field-row2 input { width: 100%; min-width: 0; }
/* #636: each pricing mode's small values on one row (hidden boxes take no column);
   Day is Days | Day rate | Total. Two across only below 360px. */
.field-row4 { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.5rem; align-items: end; margin: 0 0 0.5rem; }
.field-row4 > .form-group { min-width: 0; margin: 0; }
.field-row4 input, .field-row4 select { width: 100%; min-width: 0; }
.field-row3.field-row3-fixed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Start | Finish | Break | Hours: Break gets room for "30 mins"; on a phone the
   desktop clock icon goes (phones have none; tapping still opens the picker). */
/* #636 follow-up: Start/Finish need ~86px for "08:00 AM" at 16px (no smaller: iOS zooms on focus),
   so they get the most room; below 380px the row goes two across (Start | Finish, Break | Hours). */
.field-row4.field-times { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.6fr); gap: 0.4rem; }
@media (max-width: 379px) { .field-row4.field-times { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-times input, .field-times select { padding-left: 0.4rem; padding-right: 0.3rem; }
@media (max-width: 26.25rem) { .field-times input[type="time"]::-webkit-calendar-picker-indicator { display: none; } }
.row-hint, .sb-ux .row-hint { margin: 0 0 0.6rem; }
@media (max-width: 359px) { .field-row4 { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-with-hint { display: flex; align-items: flex-end; gap: 0.6rem; margin: 0 0 0.5rem; }
.field-with-hint > .form-group { flex: 0 0 8rem; margin: 0; }
.field-with-hint > .field-hint { flex: 1 1 auto; margin: 0 0 0.5rem; }
.calc-line { margin: 0.1rem 0 0.6rem; font-weight: 600; color: var(--navy); }
.calc-line strong { font-weight: 800; }
.price-picked-note { margin: 0.35rem 0 0; }

/* Log a job: "The work" groups the billing option, date, that entry's fields and details. */
.log-work, .sb-ux section.log-work { margin: 0.9rem 0 0.6rem; padding: 0.75rem 0 0; border: 0; border-top: 1px solid #e2e8f0; border-radius: 0; background: transparent; box-shadow: none; }
.log-work-title { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 700; color: var(--navy); }
/* Log a job, List: tick several price-list items; Misc charges for extras. */
.log-list { margin: 0.2rem 0 0.6rem; }
.list-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.4rem; margin: 0 0 0.5rem; }
.list-cards .list-card { width: 100%; margin: 0; }
.list-picked { border-top: 1px solid #e2e8f0; margin: 0.3rem 0 0.4rem; }
.list-row { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }
.list-row-name { flex: 1 1 auto; min-width: 0; }
.list-qty { display: inline-flex; align-items: center; gap: 0.15rem; }
.list-qty-n { min-width: 3.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.list-step, .list-remove { width: 36px; height: 36px; min-height: 36px; padding: 0; }
.list-row-amt { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 4.5rem; text-align: right; }
/* Misc | € | + on one row; Total · Edit price list on one line. */
.list-misc { display: flex; align-items: flex-end; gap: 0.5rem; }
.list-misc > .form-group { flex: 1 1 auto; min-width: 0; margin: 0; }
.list-misc > .cost-amt { flex: 0 0 5.2rem; }
/* #636: the + is as tall as the boxes beside it. */
.list-misc-add { flex: 0 0 var(--field-h); width: var(--field-h); height: var(--field-h); min-height: var(--field-h); margin: 0; padding: 0; font-size: 1.3rem; }
.list-total { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin: 0.4rem 0; font-weight: 700; }
.list-total > .text-btn { margin-left: auto; }

.list-card .price-card-line { flex-wrap: wrap; gap: 0.1rem 0.5rem; }
.list-card .price-card-name { white-space: normal; overflow: visible; text-overflow: clip; }
.list-row .list-step, .list-row .list-remove { background: #ffffff; color: var(--navy); border: 1px solid #cbd5e1; box-shadow: none; font-size: 1rem; }
/* Log a job: the saved message floats over the page (top, under the header). */
.log-review #log-review-warning { background: #FFF7E6; border: 1px solid #E8C98A; color: #5C4200; text-align: left; }

/* #455 PR 2: rows in the Clients, Invoices & Quotes and Jobs by profit tables
   get a trailing › on their right edge, outside their grid, so each table's
   phone and desktop columns stay as they are. The header gets the same right
   padding so the columns still line up. No › while selecting invoices. */
.sb-ux .lt-chev .lt-head, .sb-ux .lt-chev .lt-row { padding-right: 1.7rem; }
.sb-ux .lt-chev .lt-row { position: relative; }
.sb-ux .lt-chev .lt-row.card-chev::after { position: absolute; right: 0.6rem; top: 50%; margin: 0; transform: translateY(-50%); }
.sb-ux .hist-table.hist-selecting .lt-row.card-chev::after { content: none; }

/* #577: plan card and "Available on Standard" prompts. */
.upgrade-card { margin: var(--sp-4) 0; padding: var(--sp-4); background: #fff; border: 1px solid #e2e8f0; border-radius: var(--radius-lg); }
.upgrade-head { margin: 0 0 var(--sp-2); font-weight: 700; color: var(--navy); }
.upgrade-card .btn-line { width: auto; margin-top: var(--sp-2); }
/* #204: Schedule, a job's screen and a visit's actions. */
#schedule-view, #job-view { display: flex; flex-direction: column; gap: var(--sp-3); }
.visit-week-nav { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: var(--sp-2); }
.visit-week-nav button.btn-line { padding: 0; min-height: 48px; }
.visit-week-nav button.btn-quiet { width: 100%; color: var(--navy); }
.visit-slot { display: contents; }
.visit-day { margin: var(--sp-2) 0 0; font-size: var(--fs-lg); font-weight: 700; color: #0f172a; }
.visit-day.visit-day-today { color: var(--navy); }
.visit-none { margin: 0; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.visit-row .entry-badge:empty { display: none; }
/* #783: a day off is a grey row, so a free day and a day off don't look alike. */
.sb-ux .visit-row.visit-off { background: #eef1f4; border-color: #dfe4e9; color: var(--muted); box-shadow: none; }
.sb-ux .visit-row.visit-off .inv-title { color: var(--muted); }
div.visit-row.visit-off { width: 100%; }
/* #784: the month grid, Home's week strip, free times and working hours. */
.cal-month { margin: var(--sp-2) 0; }
.cal-grid, .home-week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { margin-bottom: 4px; text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.home-week-strip { margin: var(--sp-2) 0; }
.sb-ux button.cal-cell, button.cal-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; width: 100%; min-width: 0; min-height: 48px; margin: 0; padding: 4px 0 2px; background: #ffffff; color: var(--navy); border: 1px solid #e6eaee; border-radius: var(--radius-sm); box-shadow: none; font-weight: 700; line-height: 1.1; }
button.cal-cell .cal-num { font-size: var(--fs-md); }
button.cal-cell .cal-dow { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
button.cal-cell .cal-dots { min-height: 0.9rem; font-size: 0.9rem; line-height: 0.9rem; letter-spacing: 1px; color: var(--navy); }
button.cal-cell.cal-rest { background: #f6f8fa; color: #5b6770; font-weight: 600; }
button.cal-cell.cal-off { background: #e3e7eb; color: #5b6770; }
button.cal-cell.cal-today { border: 2px solid var(--navy); }
button.cal-cell.cal-on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
button.cal-cell.cal-on .cal-dots, button.cal-cell.cal-on .cal-dow { color: var(--cream); }
.sb-ux button.visit-free, button.visit-free { display: block; width: 100%; min-height: 44px; margin: 0; padding: 0.5rem 0.75rem; text-align: left; background: transparent; color: var(--navy); border: 1px dashed #b9c4cd; border-radius: var(--radius); font-weight: 600; }
.visit-free-plain { padding: 0.25rem 0; }
button.visit-many-link { display: block; margin: 0 0 var(--sp-2); padding-left: 0; text-align: left; }
button.work-hours-row { width: 100%; margin-top: var(--sp-3); text-align: left; }
button.work-hours-row + button.work-hours-row { margin-top: 0; }
.phone-cal-steps { margin: 0 0 var(--sp-2); padding-left: 1.25rem; color: var(--navy); font-size: var(--fs-md); line-height: 1.45; }
.phone-cal-steps li { margin-bottom: 0.25rem; }
.work-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: var(--sp-2) 0 var(--sp-3); }
.sb-ux button.work-day, button.work-day { min-width: 0; min-height: 44px; margin: 0; padding: 0; background: #ffffff; color: var(--navy); border: 1px solid #c9d3db; border-radius: var(--radius-sm); box-shadow: none; font-size: var(--fs-sm); font-weight: 700; }
.sb-ux button.work-day.seg-on, button.work-day.seg-on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.visit-time { display: block; font-size: 0.8rem; font-weight: 700; color: var(--navy); }
.visit-row .inv-title, .visit-row .inv-meta { display: block; overflow-wrap: anywhere; }
button.inv-row.visit-done, button.inv-row.visit-cancelled { background: #f8fafc; }
.visit-cancelled .inv-title { text-decoration: line-through; }
.visit-form { display: flex; flex-direction: column; gap: var(--sp-3); }
/* #595: a visit's actions wrap side by side, each sized to its words. */
.visit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.visit-actions > button { width: auto; flex: 0 1 auto; min-height: 48px; margin: 0; }
/* #594: buttons sized to their words, side by side when there are two. The job screen's hub. */
.fit-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 0; }
.fit-actions > button, .fit-actions > a.btn-line { width: auto; flex: 0 0 auto; min-height: 48px; margin: 0; padding: 0.7rem 1.2rem; }
/* #595: a sheet's buttons sit side by side at its end: secondary (Cancel) first, then the primary. */
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.sheet-actions > button { width: auto; flex: 0 1 auto; min-height: 48px; margin: 0; }
.job-hub { display: flex; flex-direction: column; gap: var(--sp-2); }
.job-hub .page-lead { margin: 0; }
.job-work-row { display: flex; justify-content: space-between; gap: var(--sp-2); }
.job-work-row .inv-side { font-weight: 700; color: var(--navy); white-space: nowrap; }
.visit-omw { display: flex; flex-wrap: wrap; gap: var(--sp-2); flex: 1 1 100%; }
.visit-omw > button { width: auto; flex: 0 1 auto; min-height: 48px; margin: 0; }

/* #633 #635 #639: buttons that share a row are the same width, two to a row;
   a lone last one takes the row. .exp-actions fits three. */
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.btn-row > button, .btn-row > a, .btn-row > label { flex: 1 1 calc(50% - var(--sp-2)); box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 0; min-height: var(--field-h); margin: 0; padding: 0.5rem 0.6rem; text-align: center; text-decoration: none; }
.btn-row.exp-actions > button, .btn-row.exp-actions > label { flex: 1 1 5.5rem; }
/* #638: room under a field for its focus ring (3px + 1px offset), so the ring never covers the hint or error below. */
:is(input, select, textarea) ~ :is(.field-hint, .field-error),
.sb-ux :is(input, select, textarea) ~ :is(.field-hint, .field-error),
.form-group + .field-hint, .sb-ux .form-group + .field-hint,
.form-row + .field-hint, .sb-ux .form-row + .field-hint { margin-top: 0.5rem; }
.date-field ~ :is(.field-hint, .field-error) { margin-top: 0.5rem; } /* #673: same gap under a date field */
/* #685: the app version, small, at the bottom of Settings and Help. */
.app-version { margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-xs); color: var(--muted); text-align: center; }
