/* MAT Invoicer: app shell + the printed sheet.
   Two worlds on purpose. The shell is a quiet system-font tool; the sheet is the
   Mat Solutions house document (framed A4, Georgia, ink and gold) and never changes theme. */

:root {
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #ECEBE6;
  --ink: #0E1422;
  --ink-soft: #2A3142;
  --muted: #5B6275;
  --line: #E1E4EA;
  --line-strong: #C9CDD6;
  --gold: #B58B3C;
  --gold-ink: #6E5A2A;
  --gold-soft: #F4EDDD;
  --danger: #A32D2D;
  --danger-soft: #F8E7E7;
  --paid: #1F6B45;
  --paid-soft: #E3F1E9;
  --focus: #2F5BAA;
  --radius: 10px;
  --bar-h: 56px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", "Liberation Serif", serif;
  --display: "DM Serif Display", Georgia, serif;
  --c-family: #B5563C; --c-transfers: #5B6C9F; --c-cash: #8A6D2E; --c-shopping: #8A5C9E; --c-dining: #C48A3C;
  --c-software: #2F5BAA; --c-hosting: #2E7D5B; --c-groceries: #7A8C3A; --c-telecom: #3A8C8C; --c-fees: #7A7A7A; --c-other: #9AA1B3; --c-in: #1F6B45;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1422;
    --surface: #171D2B;
    --surface-2: #1F2636;
    --ink: #F2F3F6;
    --ink-soft: #D6DAE3;
    --muted: #9AA1B3;
    --line: #2A3142;
    --line-strong: #3B4358;
    --gold: #D1A555;
    --gold-ink: #E5C27A;
    --gold-soft: #2A2618;
    --danger: #E07A7A;
    --danger-soft: #3A1E1E;
    --paid: #6FCB98;
    --paid-soft: #17301F;
    --focus: #7FA4EA;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  touch-action: manipulation;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  max-width: 100%;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.bar > :first-child { justify-self: start; }
.bar > :last-child { justify-self: end; }
.wordmark {
  font: 400 21px/1 var(--display); letter-spacing: 0.01em; color: var(--ink);
  background: none; border: 0; padding: 8px 4px;
}
.wordmark small { color: var(--gold); font-style: italic; font-weight: 400; }
.wordmark .logo { height: 34px; width: auto; display: block; }
@media (prefers-color-scheme: dark) { .wordmark .logo, .login .logo-big { filter: invert(1); } }
.login .logo-big { height: 64px; width: auto; }
.bar-title { font-weight: 600; font-size: 15px; text-align: center; }
.bar .seg button { min-height: 34px; padding: 0 12px; font-size: 13px; }
@media (max-width: 480px) {
  .bar { grid-template-columns: auto 1fr auto; padding: env(safe-area-inset-top) 8px 0; }
  .bar .back-label { display: none; }
  .bar .btn-text { padding: 0 6px; }
  .bar-title { font-size: 14px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  border: 1px solid transparent; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform 120ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease), opacity 160ms;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink-soft); }
@media (prefers-color-scheme: dark) { .btn-primary { background: var(--gold); color: #0E1422; } .btn-primary:hover { background: var(--gold-ink); } }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); }
.btn-text { background: none; border: 0; color: var(--ink); padding: 0 10px; }
.btn-text:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { color: var(--danger); }
.btn-icon { width: 44px; padding: 0; }
.btn .ic { width: 20px; height: 20px; }
.ic { display: inline-block; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Views ---------- */
.view { max-width: 860px; margin: 0 auto; padding: 16px 16px 120px; }
.view.tabs { max-width: 600px; }
@media (min-width: 720px) { .view { padding: 28px 24px 120px; } }
.view.enter { animation: rise 320ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .view.enter { animation: none; } }

/* ---------- Login ---------- */
.login {
  min-height: calc(100dvh - var(--bar-h)); display: grid; place-content: center; gap: 22px;
  width: min(360px, 100%); margin: 0 auto; padding: 24px 16px 80px;
}
.login h1 { font: 400 40px/1.1 var(--display); margin: 0; letter-spacing: -0.01em; }
.login h1 em { color: var(--gold); font-weight: 400; }
.login p { margin: 0; color: var(--muted); }

/* ---------- Form controls ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.control {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); -webkit-appearance: none; appearance: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.control:hover { border-color: var(--muted); }
.control:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); outline: none; }
.control::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
textarea.control { resize: none; line-height: 1.4; min-height: 46px; }
select.control {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6275' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
input[type="date"].control { min-width: 0; }
.control.num { text-align: right; font-variant-numeric: tabular-nums; }
.error { color: var(--danger); font-size: 14px; min-height: 1.4em; margin: 0; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.seg button {
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(14,20,34,0.10), 0 2px 8px -4px rgba(14,20,34,0.14); }
.seg.wide { display: grid; width: 100%; }

/* ---------- Home ---------- */
.summary { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 8px 4px 22px; }
.summary .amt { font: 400 36px/1.05 var(--display); letter-spacing: -0.01em; }
.summary .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.group-title { margin: 22px 4px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.group-title:first-of-type { margin-top: 0; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center;
  width: 100%; padding: 14px 16px; border: 0; border-top: 1px solid var(--line);
  background: transparent; text-align: left; color: var(--ink);
  transition: background 120ms var(--ease);
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row:active { background: var(--surface-2); }
.row .who { font-weight: 600; font-size: 15px; line-height: 1.3; }
.row .meta { color: var(--muted); font-size: 13px; grid-column: 1; }
.row .amt { font-weight: 600; font-size: 15px; text-align: right; grid-row: 1; grid-column: 2; }
.row .pill { grid-row: 2; grid-column: 2; justify-self: end; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; }
.pill.paid { background: var(--paid-soft); color: var(--paid); }
.pill.unpaid { background: var(--gold-soft); color: var(--gold-ink); }
.pill.receipt { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 64px 16px; }
.empty b { color: var(--ink); display: block; font: 400 24px/1.2 var(--display); margin-bottom: 8px; }

/* ---------- Document view ---------- */
.doc-head { display: grid; gap: 14px; margin-bottom: 20px; }
.doc-head .num { font: 400 26px/1.1 var(--display); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form { display: grid; gap: 28px; }
.form section { display: grid; gap: 12px; }
.form h2 { margin: 0; font-size: 15px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid-3 { grid-template-columns: 1fr; } }
.item { display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.item .top { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.item .nums { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; gap: 10px; align-items: end; }
.item .line-total { min-height: 46px; display: flex; align-items: center; justify-content: flex-end; font-weight: 600; padding: 0 2px; }
.paid-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
details.bank summary { cursor: pointer; list-style: none; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
details.bank summary::-webkit-details-marker { display: none; }
details.bank summary .ic { transition: transform 200ms var(--ease); }
details.bank[open] summary .ic { transform: rotate(180deg); }
details.bank .field { margin-top: 12px; }
.danger-zone { padding-top: 8px; border-top: 1px solid var(--line); }

/* Preview area */
.preview-wrap { display: flex; justify-content: center; padding: 4px 0 24px; }
.sheet-scaler { transform-origin: top center; }

/* ---------- Bottom action bar ---------- */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
}
.actions .inner { display: flex; gap: 10px; align-items: center; justify-content: space-between; width: 100%; max-width: 860px; margin: 0 auto; }
.actions .total { display: grid; line-height: 1.2; }
.actions .total small { color: var(--muted); font-size: 12px; }
.actions .total b { font-size: 17px; }
.actions .right { display: flex; gap: 8px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px -8px rgba(14,20,34,0.4);
  animation: toast 3200ms var(--ease) both;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* =====================================================================
   THE SHEET: Mat Solutions house document. Fixed A4, always light.
   ===================================================================== */
.sheet {
  --s-ink: #0E1422; --s-soft: #2A3142; --s-muted: #5B6275; --s-line: #1B2030;
  --s-gold: #6E5A2A; --s-gold-soft: #B58B3C;
  position: relative; width: 210mm; height: 297mm; overflow: hidden;
  background: #fff; color: var(--s-ink);
  font-family: var(--serif); font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 2px 14px rgba(0,0,0,0.12), 0 24px 48px -32px rgba(0,0,0,0.3);
  color-scheme: light;
}
.sheet::before, .sheet::after { content: ""; position: absolute; pointer-events: none; border: 1px solid var(--s-line); }
.sheet::before { inset: 8mm; }
.sheet::after { inset: 9.4mm; border-width: 0.5px; }
.sheet .corner { position: absolute; width: 7mm; height: 7mm; border: 0 solid var(--s-gold-soft); z-index: 1; }
.sheet .corner.tl { top: 8mm; left: 8mm; border-top-width: 1.4px; border-left-width: 1.4px; }
.sheet .corner.tr { top: 8mm; right: 8mm; border-top-width: 1.4px; border-right-width: 1.4px; }
.sheet .corner.bl { bottom: 8mm; left: 8mm; border-bottom-width: 1.4px; border-left-width: 1.4px; }
.sheet .corner.br { bottom: 8mm; right: 8mm; border-bottom-width: 1.4px; border-right-width: 1.4px; }
.sheet .letterhead { position: absolute; top: 11mm; left: 14mm; z-index: 2; line-height: 1.1; }
.sheet .letterhead .logo { height: 13mm; width: auto; display: block; margin-left: -1mm; }
.sheet .letterhead span { display: block; font-size: 9px; font-style: italic; letter-spacing: 0.16em; text-transform: uppercase; color: var(--s-muted); margin-top: 1px; }
.sheet .pageno { position: absolute; top: 13.5mm; right: 16mm; z-index: 2; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--s-muted); }
.sheet .body { position: absolute; inset: 0; padding: 30mm 20mm 18mm; transform-origin: top left; }
.sheet h1 { margin: 0; text-align: center; font-size: 25px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.sheet .sub { text-align: center; margin: 3px 0 6px; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sheet .tick { width: 46px; height: 2px; background: var(--s-gold-soft); margin: 0 auto 16px; }
.sheet .meta { display: grid; grid-template-columns: max-content 1fr; column-gap: 12px; row-gap: 3px; font-size: 12.5px; line-height: 1.5; }
.sheet .meta b { font-weight: 700; letter-spacing: 0.02em; }
.sheet .rule { height: 1px; margin: 14px 0 14px; background: linear-gradient(to right, transparent, #cfd2d8 12%, #cfd2d8 88%, transparent); }
.sheet h2 { margin: 14px 0 6px; font-size: 14.5px; font-weight: 700; }
.sheet table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 12.5px; }
.sheet th, .sheet td { padding: 8px 10px; text-align: left; vertical-align: top; }
.sheet thead th { border-top: 1px solid var(--s-line); border-bottom: 1px solid var(--s-line); font-weight: 700; }
.sheet tbody tr { border-bottom: 1px solid #DDE0E5; }
.sheet tbody tr:last-child { border-bottom: 1px solid var(--s-line); }
.sheet .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet td .d { display: block; font-size: 11px; color: var(--s-muted); margin-top: 2px; line-height: 1.4; }
.sheet tr.total td { font-weight: 700; font-size: 13.5px; border-top: 1px solid var(--s-line); border-bottom: 0; padding-top: 10px; }
.sheet .paygrid { display: grid; grid-template-columns: max-content 1fr max-content 1fr; column-gap: 14px; row-gap: 4px; padding: 9px 12px; margin: 6px 0 12px; border-top: 1px solid var(--s-line); border-bottom: 1px solid var(--s-line); font-size: 12px; }
.sheet .paygrid b { font-weight: 700; }
.sheet .mono { font-family: "Courier New", monospace; font-size: 12px; }
.sheet .paidbox { display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; padding: 10px 14px; border: 1px solid var(--s-line); background: #F7F5EE; }
.sheet .paidbox .stamp { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #fff; background: var(--s-gold); padding: 3px 10px; border-radius: 3px; }
.sheet p { margin: 0 0 6px; }
.sheet .note { color: var(--s-soft); font-size: 12px; }
.sheet .thanks { font-style: italic; color: var(--s-soft); font-size: 12px; margin-top: 10px; }
.sheet .support { position: absolute; left: 20mm; right: 20mm; bottom: 14mm; padding-top: 6px; border-top: 1px solid #DDE0E5; font-size: 10.5px; color: var(--s-muted); letter-spacing: 0.02em; }
.sheet .support b { color: var(--s-ink); font-weight: 700; margin-right: 6px; }
.sheet .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.sheet table.summary td { font-size: 13px; padding: 7px 10px; }
.sheet table.summary tr.total td { font-size: 14.5px; }
.sheet td .d { display: block; }
.sheet.stmt { font-size: 11px; }
.sheet.stmt h1 { font-size: 22px; }
.sheet.stmt .sub { font-size: 12px; }
.sheet.stmt .meta { font-size: 11px; row-gap: 1px; }
.sheet.stmt .rule { margin: 10px 0; }
.sheet.stmt h2 { font-size: 12.5px; margin: 10px 0 4px; }
.sheet.stmt table { font-size: 10.5px; margin: 2px 0 6px; }
.sheet.stmt th, .sheet.stmt td { padding: 4px 8px; }
.sheet.stmt td .d { font-size: 9.5px; margin-top: 0; }
.sheet.stmt tr.total td { font-size: 11.5px; padding-top: 6px; }
.sheet .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 6px; }
.sheet .stats div { border: 1px solid #DDE0E5; padding: 8px 10px; }
.sheet .stats small { display: block; font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-muted); }
.sheet .stats b { display: block; font-size: 14.5px; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet .stats b.pos { color: #1F6B45; }
.sheet.stmt .note { font-size: 10px; margin-top: 8px; }
.sheet.stmt .support { position: static; margin-top: 10px; }
.sheet.stmt .body { padding-bottom: 14mm; }
.presets { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets .chip { flex: 0 0 auto; }
.stmt-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }

/* ---------- Print: the sheet alone, one A4 page ---------- */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; margin: 0; padding: 0; height: 297mm; overflow: hidden; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; position: absolute; inset: 0; }
  #print-root .sheet { box-shadow: none; margin: 0; }
  #print-root .sheet-scaler { transform: none !important; }
}


@font-face { font-family: "DM Serif Display"; src: url("fonts/dm-serif-display.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* =====================================================================
   MONEY: tab bar, home, activity, account, transaction sheet
   ===================================================================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
}
.tabbar button {
  display: grid; justify-items: center; gap: 4px; padding: 6px 0 2px; border: 0; background: none;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  transition: color 160ms var(--ease), transform 120ms var(--ease);
}
.tabbar button .ic { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--ink); }
.tabbar button[aria-current="page"] .ic { color: var(--gold); stroke-width: 2.2; }
.tabbar button:active { transform: scale(0.92); }
@media (min-width: 720px) { .tabbar { max-width: 560px; margin: 0 auto; border-radius: 18px 18px 0 0; } }

.page-head { display: flex; align-items: baseline; justify-content: space-between; margin: 2px 4px 16px; }
.page-head h1 { font: 400 32px/1.05 var(--display); margin: 0; letter-spacing: -0.01em; }
.page-head .date { color: var(--muted); font-size: 14px; }

/* ---- Balance card: ink, gold thread, the real balance line ---- */
.balance {
  position: relative; overflow: hidden; padding: 20px 22px 18px; border-radius: 24px; color: #F2F3F6;
  background: #0E1422;
  background-image: radial-gradient(120% 90% at 100% -10%, rgba(181,139,60,0.26), transparent 55%);
  box-shadow: 0 18px 40px -22px rgba(14,20,34,0.7);
}
.balance .acct { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: rgba(242,243,246,0.66); letter-spacing: 0.01em; }
.balance .acct b { color: #F2F3F6; font-weight: 600; }
.balance .num { font: 400 46px/1 var(--display); margin: 22px 0 2px; letter-spacing: -0.015em; color: #FFFDF7; }
.balance .num small { font: 600 13px var(--sans); color: rgba(242,243,246,0.55); margin-left: 8px; letter-spacing: 0.08em; vertical-align: 10px; }
.balance .as-of { font-size: 13px; color: rgba(242,243,246,0.6); }
.balance .spark-head { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 12px; color: rgba(242,243,246,0.6); letter-spacing: 0.04em; text-transform: uppercase; }
.balance .seg.mini { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); padding: 2px; }
.balance .seg.mini button { min-height: 26px; padding: 0 9px; font-size: 12px; color: rgba(242,243,246,0.6); border-radius: 6px; }
.balance .seg.mini button[aria-pressed="true"] { background: rgba(255,255,255,0.14); color: #FFFDF7; box-shadow: none; }
.balance .spark-wrap { margin: 6px 0 0; min-height: 64px; touch-action: pan-y; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.balance .spark .guide { stroke: rgba(255,255,255,0.35); stroke-width: 1; stroke-dasharray: 2 3; }
.balance .spark-labels .val { color: #FFFDF7; font-weight: 600; font-size: 13px; letter-spacing: 0; }
.balance .spark-labels .up { color: #9FD8B6; } .balance .spark-labels .down { color: #E0A0A0; }
.balance .spark { display: block; overflow: visible; }
.balance .spark-labels { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11.5px; color: rgba(242,243,246,0.55); letter-spacing: 0.02em; }
.balance .spark-labels span:nth-child(2) { color: rgba(242,243,246,0.75); }
.balance .spark .line { fill: none; stroke: #D1A555; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.balance .spark .area { fill: url(#sparkfill); }
.balance .spark .dot { fill: #FFFDF7; stroke: #D1A555; stroke-width: 2; }
.balance .flow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.10); }
.balance .flow div { display: grid; gap: 2px; }
.balance .flow small { font-size: 12px; color: rgba(242,243,246,0.6); }
.balance .flow b { font: 400 22px/1.1 var(--display); letter-spacing: -0.01em; }
.balance .flow .in b { color: #9FD8B6; }
.balance .empty-hint { margin-top: 14px; font-size: 14px; color: rgba(242,243,246,0.85); }

/* ---- Clients row (tap to bill) ---- */
.people { display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 8px; margin: 0 -4px; scrollbar-width: none; }
.people::-webkit-scrollbar { display: none; }
.person { display: grid; justify-items: center; gap: 7px; width: 72px; flex: 0 0 auto; border: 0; background: none; color: var(--ink); padding: 0; }
.person .av { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font: 400 20px var(--display); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 8px 18px -12px rgba(14,20,34,0.5); transition: transform 140ms var(--ease); }
.person:active .av { transform: scale(0.94); }
.person .av.new { background: transparent; color: var(--ink); box-shadow: none; border: 1.5px dashed var(--line-strong); }
.person .av.new .ic { width: 22px; height: 22px; }
.person span { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person em { font-style: normal; font-size: 11px; color: var(--muted); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 4px 10px; }
.section-head h2 { margin: 0; font: 400 20px/1.1 var(--display); }
.section-head .btn-text, .section-head .muted { font-size: 13px; color: var(--muted); padding: 0; min-height: 0; }

/* ---- Confirm payments ---- */
.confirm { border-radius: 18px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); overflow: hidden; }
.match { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 14px 16px; border-top: 1px solid color-mix(in srgb, var(--gold) 25%, transparent); }
.match:first-child { border-top: 0; }
.match .t { font-size: 15px; font-weight: 600; }
.match .s { font-size: 13px; color: var(--gold-ink); grid-column: 1; }
.match .btn { grid-row: 1 / span 2; grid-column: 2; min-height: 38px; padding: 0 14px; font-size: 14px; }

/* ---- Transactions ---- */
.day { margin: 14px 6px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.tx {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 1px 12px; align-items: center;
  width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; color: var(--ink);
}
.tx:first-child { border-top: 0; }
.tx:hover, .tx:active { background: var(--surface-2); }
.tx .av { grid-row: 1 / span 2; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 400 15px var(--display); color: #fff; background: var(--c, var(--c-other)); }
.tx .d { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .c { font-size: 13px; color: var(--muted); grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .a { grid-row: 1; grid-column: 3; font-weight: 600; font-size: 15px; text-align: right; }
.tx .a.in { color: var(--paid); }
.tx .lnk { grid-row: 2; grid-column: 3; justify-self: end; font-size: 12px; color: var(--gold-ink); font-weight: 600; }

/* ---- Activity ---- */
:root { --chart-bar: #0E1422; }
@media (prefers-color-scheme: dark) { :root { --chart-bar: #C9CFDD; } }
.spend { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; margin: 20px 4px 10px; }
.spend .big { font: 400 40px/1 var(--display); letter-spacing: -0.015em; }
.spend .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.spend .sub b.better { color: var(--paid); } .spend .sub b.worse { color: var(--danger); }
.spend .got { text-align: right; }
.spend .got b { font: 400 22px/1.1 var(--display); color: var(--paid); }
.spend .net { margin-top: 2px; }
.chartwrap { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 10px; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.chart-title b { color: var(--ink); font-weight: 600; }
.chart-title .nav { display: inline-flex; align-items: center; gap: 4px; }
.btn-nav { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); display: grid; place-items: center; padding: 0; }
.btn-nav .ic { width: 16px; height: 16px; }
.btn-nav:disabled { opacity: 0.35; }
.chart .hit { fill: transparent; }
.chart .bucket { cursor: pointer; }
.chart .bucket.dim .cbar { opacity: 0.35; }
.chart .bucket.on .cbar { fill: var(--gold); }
.chart .callout.sel rect { fill: var(--ink); }
.chart .callout.sel text { fill: var(--bg); }
.legend .hint { margin-left: auto; opacity: 0.8; }
.empty.small { padding: 18px 0 6px; }
.chartwrap { touch-action: pan-y; }
.chart { width: 100%; height: auto; aspect-ratio: 600 / 300; display: block; overflow: visible; }
.chart .cbar { fill: var(--chart-bar); }
.chart .cbar.peak { fill: var(--gold); }
.chart .cbar-in { fill: var(--paid); opacity: 0.85; }
.chart .clabel { font: 600 16px var(--sans); fill: var(--muted); }
.chart .cgrid { stroke: var(--line); stroke-width: 1; }
.chart .cgrid.base { stroke: var(--line-strong); }
.chart .callout rect { fill: var(--gold); }
.chart .callout text { fill: #0E1422; font: 700 16px var(--sans); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 2px 0; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--chart-bar); display: inline-block; }
.legend .sw.peak { background: var(--gold); }
.legend .sw.in { background: var(--paid); height: 4px; border-radius: 2px; }
.cats { display: grid; gap: 8px; }
.cat { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: left; color: var(--ink); width: 100%; transition: border-color 160ms var(--ease), transform 120ms var(--ease); }
.cat:active { transform: scale(0.99); }
.cat.on { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); }
.cat .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.cat .n { font-weight: 600; font-size: 15px; }
.cat .a { font-weight: 600; text-align: right; }
.cat .track { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--c) 18%, transparent); overflow: hidden; }
.cat .track i { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.cat .p { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.filters .search { flex: 1 1 200px; min-height: 42px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 10px 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.chip .ic { width: 14px; height: 14px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---- Account ---- */
.kv { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); font-size: 15px; }
.kv > div:first-child { border-top: 0; }
.kv > div span:first-child { color: var(--muted); }
.kv > div span:last-child { font-weight: 600; text-align: right; }
.kv > button, .kv > label { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.kv > button:hover, .kv > label:hover { background: var(--surface-2); }
.kv .btn-danger { color: var(--danger); }
.acct-card { display: grid; gap: 4px; padding: 18px 20px; border-radius: 20px; color: #F2F3F6; background: #0E1422; background-image: radial-gradient(120% 90% at 100% 0%, rgba(181,139,60,0.28), transparent 55%); }
.acct-card small { color: rgba(242,243,246,0.6); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.acct-card b { font: 400 22px/1.1 var(--display); }
.acct-card .row2 { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: rgba(242,243,246,0.75); }

/* ---- Transaction sheet ---- */
dialog.tx-sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; border-radius: 24px 24px 0 0;
  background: var(--bg); color: var(--ink); box-shadow: 0 -12px 40px -20px rgba(0,0,0,0.5);
}
@media (min-width: 720px) { dialog.tx-sheet { margin: auto; border-radius: 24px; } }
dialog.tx-sheet::backdrop { background: rgba(14,20,34,0.45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.tx-sheet[open] { animation: sheet-up 320ms var(--ease); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.tx-sheet[open] { animation: none; } }
.sheet-body { padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.sheet-body .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto -6px; }
.sheet-body .hd { display: grid; gap: 2px; }
.sheet-body .hd .a { font: 400 34px/1.1 var(--display); }
.sheet-body .hd .a.in { color: var(--paid); }
.sheet-body .hd .d { font-size: 15px; font-weight: 600; }
.sheet-body .hd .m { font-size: 13px; color: var(--muted); }
.sheet-body .foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }

/* ---- Rails: horizontal, snap, one card mostly in view ---- */
.rail { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 4px 10px; margin: 0 -4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rail::-webkit-scrollbar { display: none; }
.card { flex: 0 0 auto; scroll-snap-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-align: left; color: var(--ink); }
.day-card { width: min(84vw, 340px); padding: 12px 0 0; }
.day-card .card-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 14px 8px; font-size: 13px; }
.day-card .card-head b { font-weight: 600; }
.day-card .card-head .in { color: var(--paid); font-weight: 600; }
.day-card .rows.flat { border: 0; border-radius: 0 0 18px 18px; background: transparent; }
.day-card .tx { padding: 10px 14px; }
.day-card .more { padding: 8px 14px 12px; font-size: 12px; color: var(--muted); }
.cat-card { width: 168px; padding: 14px 14px 12px; display: grid; gap: 6px; }
.cat-card .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.cat-card .n { font-weight: 600; font-size: 14px; line-height: 1.25; min-height: 2.5em; }
.cat-card .a { font: 400 22px/1.1 var(--display); }
.cat-card .track { height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--c) 18%, transparent); overflow: hidden; }
.cat-card .track i { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.cat-card .p { font-size: 12px; color: var(--muted); }
.cat-card.on { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); }
.person-card { width: 168px; padding: 14px; display: grid; gap: 6px; justify-items: start; }
.person-card .av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 400 15px var(--display); color: #fff; background: var(--c, var(--c-other)); }
.person-card .n { font-weight: 600; font-size: 14px; line-height: 1.25; min-height: 2.5em; }
.person-card .a { font: 400 22px/1.1 var(--display); }
.person-card .a.in { color: var(--paid); }
.person-card .p { font-size: 12px; color: var(--muted); }

/* ---- Cashflow ---- */
.page-head .seg.mini2 { padding: 2px; }
.page-head .seg.mini2 button { min-height: 30px; padding: 0 12px; font-size: 13px; }
.pl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pl > div { padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; }
.pl small { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.pl b { font: 400 24px/1.1 var(--display); }
.pl b.in { color: var(--paid); }
.pl span { font-size: 12px; color: var(--muted); }
.pl .net { grid-column: 1 / -1; background: #0E1422; color: #F2F3F6; border-color: transparent; }
.pl .net small, .pl .net span { color: rgba(242,243,246,0.62); }
.pl .net.pos b { color: #9FD8B6; } .pl .net.neg b { color: #E0A0A0; }
.months { display: grid; gap: 8px; }
.month { display: grid; grid-template-columns: 58px 1fr; gap: 4px 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-align: left; }
.month:hover { background: var(--surface-2); }
.month .m { font-weight: 600; font-size: 14px; grid-row: 1 / span 2; }
.month .bars { display: grid; gap: 3px; }
.month .bars i { display: block; height: 6px; border-radius: 3px; background: var(--paid); min-width: 2px; }
.month .bars i.out { background: var(--chart-bar); opacity: 0.85; }
.month .v { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.month .v b { font-weight: 600; color: var(--ink); }
.month .v b.in { color: var(--paid); } .month .v b.neg { color: var(--danger); }

/* Desktop workspace. The phone navigation and document sheet retain their own layout. */
.desktop-sidebar, .desktop-heading, .desktop-welcome, .desktop-metrics, .desktop-recent-empty, .person-full { display: none; }

@media screen and (min-width: 1000px) {
  :root { --desktop-sidebar-w: 244px; }
  body.has-shell { background: #F5F5F2; }
  .desktop-sidebar:not([hidden]) {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--desktop-sidebar-w);
    display: flex; flex-direction: column; padding: 30px 16px 20px;
    background: var(--surface); border-right: 1px solid var(--line);
  }
  .desktop-brand { display: flex; align-items: center; gap: 10px; margin: 0 10px 52px; min-height: 40px; }
  .desktop-brand img { width: 37px; height: 37px; object-fit: contain; }
  .desktop-brand div { display: grid; gap: 1px; }
  .desktop-brand strong { font-size: 14px; line-height: 1.2; }
  .desktop-brand span { color: var(--muted); font-size: 12px; }
  .desktop-nav-label, .desktop-eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
  .desktop-nav-label { padding: 0 12px; margin-bottom: 12px; text-transform: uppercase; }
  .desktop-nav { display: grid; gap: 4px; }
  .desktop-nav button { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 44px; border: 0; border-radius: 10px; padding: 0 13px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 600; text-align: left; }
  .desktop-nav button:hover { background: var(--surface-2); color: var(--ink); }
  .desktop-nav button[aria-current="page"] { background: var(--gold-soft); color: var(--ink); }
  .desktop-nav button[aria-current="page"] .ic { color: var(--gold); }
  .desktop-nav .ic { width: 19px; height: 19px; }
  .desktop-sidebar-bottom { margin-top: auto; display: grid; gap: 22px; }
  .desktop-new { width: 100%; min-height: 42px; }
  .desktop-bank { display: flex; align-items: flex-start; gap: 10px; padding: 14px 12px 0; border-top: 1px solid var(--line); }
  .desktop-bank-dot { width: 7px; height: 7px; flex: none; margin-top: 7px; border-radius: 50%; background: var(--paid); }
  .desktop-bank > span:last-child { display: grid; gap: 1px; }
  .desktop-bank b { font-size: 12px; }
  .desktop-bank small { color: var(--muted); font-size: 11px; }
  .tabbar { display: none; }
  body.has-shell .bar { margin-left: var(--desktop-sidebar-w); width: calc(100% - var(--desktop-sidebar-w)); height: 86px; padding: 0 38px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .bar.desktop-tab-head { grid-template-columns: 1fr auto; }
  .bar.desktop-tab-head > :nth-child(2), .bar.desktop-tab-head > :nth-child(3) { display: none; }
  .bar.desktop-tab-head > :last-child { grid-column: 2; }
  .bar .desktop-heading { display: none; }
  .bar.desktop-tab-head .desktop-heading { display: grid; gap: 1px; grid-column: 1; }
  .desktop-heading .desktop-eyebrow { font-size: 9px; }
  .desktop-heading strong { font: 400 27px/1.1 var(--display); }
  body.has-shell .view { max-width: 1080px; margin: 0 38px 0 calc(var(--desktop-sidebar-w) + 38px); padding: 32px 0 110px; }
  body.has-shell .view.tabs { width: calc(100% - var(--desktop-sidebar-w) - 76px); max-width: 1550px; }
  body.has-shell .actions { left: var(--desktop-sidebar-w); border-top: 1px solid var(--line); }
  body.has-shell .toasts { left: calc(var(--desktop-sidebar-w) + 16px); }
  .desktop-welcome { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
  .desktop-welcome h1 { margin: 8px 0 4px; font: 400 32px/1.1 var(--display); }
  .desktop-welcome p { margin: 0; color: var(--muted); font-size: 14px; }
  .desktop-welcome > span { flex: none; color: var(--muted); font-size: 13px; padding-bottom: 4px; }
  .desktop-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
  .desktop-metric { display: grid; gap: 8px; min-width: 0; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
  .desktop-metric > span { color: var(--muted); font-size: 12px; font-weight: 600; }
  .desktop-metric b { font: 400 clamp(23px, 2vw, 30px)/1 var(--display); white-space: nowrap; }
  .desktop-metric small { color: var(--muted); font-size: 11px; }
  .desktop-home-grid, .desktop-home-main, .desktop-home-rail { min-width: 0; }
  .desktop-recent-empty { display: block; }
  .desktop-home-rail { margin-top: 4px; }
  .desktop-home-rail .section-head:first-child { margin-top: 0; }
  .desktop-home-main .balance { box-shadow: none; }
  .desktop-home-main .people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; overflow: visible; margin: 0; padding: 0; }
  .desktop-home-main .person { display: flex; align-items: center; justify-items: normal; gap: 12px; width: 100%; min-width: 0; min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); text-align: left; }
  .desktop-home-main .person:hover { border-color: var(--line-strong); background: var(--surface-2); }
  .desktop-home-main .person .av { width: 40px; height: 40px; flex: none; font-size: 15px; box-shadow: none; }
  .desktop-home-main .person > span:last-child { max-width: none; min-width: 0; text-align: left; font-size: 13px; }
  .desktop-home-main .person span { max-width: none; }
  .person-short { display: none; }
  .person-full { display: inline; }
  .desktop-home-rail .rail { display: grid; gap: 10px; overflow: visible; scroll-snap-type: none; margin: 0; padding: 0; }
  .desktop-home-rail .day-card { width: 100%; padding-top: 10px; }
  .desktop-home-rail .day-card .tx { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 0 8px; padding: 9px 10px; }
  .desktop-home-rail .day-card .tx .av { width: 32px; height: 32px; font-size: 12px; }
  .desktop-home-rail .day-card .tx .d { font-size: 12px; }
  .desktop-home-rail .day-card .tx .a { font-size: 12px; }
  .desktop-home-rail .day-card .tx .c { font-size: 11px; }
  .desktop-home-rail .day-card .card-head { padding: 0 11px 7px; }
  .view.tabs > .rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; overflow: visible; scroll-snap-type: none; margin: 0; padding: 0; }
  .view.tabs > .rail > .card { width: 100%; }
  .view.tabs .pl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .view.tabs .pl .net { grid-column: auto; }
  .view.tabs .row { grid-template-columns: minmax(0, 2fr) minmax(100px, 1fr) 160px; }
  .view.tabs .row .amt { grid-column: 2; grid-row: 1 / span 2; }
  .view.tabs .row .pill { grid-column: 3; grid-row: 1 / span 2; }
  .view.tabs .summary { padding: 22px 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin-bottom: 24px; }
  .view.tabs .summary .amt { font-size: 40px; }
  .view.tabs .group-title { margin: 26px 4px 10px; }
  .view.tabs .months { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab-activity > .page-head, .tab-account > .page-head { display: none; }
  .tab-cashflow > .page-head { justify-content: end; }
  .tab-cashflow > .page-head h1 { display: none; }
  .tab-activity > .seg.wide { width: min(420px, 100%); margin-bottom: 12px; }
  .tab-activity .spend, .tab-activity .chartwrap { width: 100%; max-width: 860px; margin-left: auto; margin-right: auto; }
}

@media screen and (min-width: 1320px) {
  .desktop-home-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .82fr); align-items: start; gap: 24px; }
  .desktop-home-rail { padding: 0 0 0 24px; border-left: 1px solid var(--line); }
  .desktop-home-rail .rail { max-height: 880px; overflow-y: auto; padding-right: 2px; }
}

@media screen and (min-width: 1650px) {
  .desktop-home-main .people { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media screen and (min-width: 1000px) and (prefers-color-scheme: dark) {
  body.has-shell { background: var(--bg); }
  .desktop-brand img { filter: invert(1); }
}

/* Quotations keep the complete development breakdown on a single A4 page. */
.sheet.quotation .body { padding: 29mm 17mm 17mm; }
.sheet.quotation h1 { font-size: 21px; }
.sheet.quotation .sub { font-size: 11px; margin: 3px 0 4px; }
.sheet.quotation .tick { margin-bottom: 9px; }
.sheet.quotation .meta { font-size: 10.5px; line-height: 1.35; row-gap: 2px; }
.sheet.quotation .rule { margin: 9px 0; }
.sheet.quotation table { font-size: 10.3px; line-height: 1.3; }
.sheet.quotation th, .sheet.quotation td { padding: 5px 7px; }
.sheet.quotation .quote-section { background: #f7f5ee; font-weight: bold; }
.sheet.quotation .quote-section td { border-top: 1px solid #cfd2d8; padding: 6px 7px; }
.sheet.quotation .client-logo { display: block; width: 27mm; height: 19mm; object-fit: contain; margin-top: 2mm; }
.sheet.quotation .support { position: static; margin-top: 10px; font-size: 10.5px; line-height: 1.5; }
.sheet.quotation .thanks, .sheet.quotation .note { font-size: 10.5px; }
