/* Quill for the web. The "Ledger" design from the mobile app (docs/design/REVAMP-2026-10.md):
   flat surfaces, hairlines, one accent, Roboto Regular and Medium. Nothing animates. */

/* Roboto is not fetched here: the app adds it from the copy inside the PDF engine (quill.page.addFont).
   The plain pages (privacy, terms) load the font files themselves in pages.css. */

:root {
  color-scheme: light;
  --canvas: #F5F5F3; --surface: #FFFFFF; --surface-2: #EDEDEA;
  --border: #D6D6D1; --border-strong: #84847E;
  --text: #1B1C1E; --text-2: #4A4B4F; --text-3: #646569;
  --accent: #3546C4; --accent-pressed: #2A389F; --on-accent: #FFFFFF;
  --overdue: #B42318; --paid: #1D7A3A;
  --inverse: #1B1C1E; --on-inverse: #F5F5F3;
  --scrim: rgba(0, 0, 0, .4); --shadow: 0 2px 8px rgba(0, 0, 0, .16);
  --side: 16px; --rail: 232px; --nav-h: 60px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #121314; --surface: #1B1C1E; --surface-2: #26272A;
  --border: #34363A; --border-strong: #70737A;
  --text: #ECECEA; --text-2: #BDBEC1; --text-3: #93959A;
  --accent: #8DB4F2; --accent-pressed: #A9C7F5; --on-accent: #10121A;
  --overdue: #FF8B7E; --paid: #6CCB8A;
  --inverse: #ECECEA; --on-inverse: #1B1C1E;
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #121314; --surface: #1B1C1E; --surface-2: #26272A;
    --border: #34363A; --border-strong: #70737A;
    --text: #ECECEA; --text-2: #BDBEC1; --text-3: #93959A;
    --accent: #8DB4F2; --accent-pressed: #A9C7F5; --on-accent: #10121A;
    --overdue: #FF8B7E; --paid: #6CCB8A;
    --inverse: #ECECEA; --on-inverse: #1B1C1E;
    --scrim: rgba(0, 0, 0, .6); --shadow: 0 2px 8px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font: 400 16px/24px "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--surface); color: var(--text); padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: 6px; }
.skip:focus { top: 8px; }

/* ── Type ── */
.display { font: 500 32px/40px "Roboto", sans-serif; }
.title { font: 500 22px/28px "Roboto", sans-serif; }
.heading { font: 500 18px/24px "Roboto", sans-serif; }
.label { font: 500 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.meta { font: 400 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.muted { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }
.right { text-align: right; }
.status { font: 500 13px/18px "Roboto", sans-serif; color: var(--text-2); }
.status.is-draft, .status.is-void { color: var(--text-3); }
.status.is-overdue { color: var(--overdue); }
.status.is-paid { color: var(--paid); }
.is-overdue-amount { color: var(--overdue); }
.is-void-amount { text-decoration: line-through; color: var(--text-3); }

/* ── Boot and whole-page states ── */
.boot, .state-page { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px var(--side); text-align: center; }
.boot img, .state-page img { width: 56px; height: 56px; border-radius: 12px; }
.state-page { max-width: 480px; margin: 0 auto; }
.state-page .actions { justify-content: center; }

/* ── Shell ── */
.shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
.shell.no-nav { padding-bottom: 0; }
.rail { display: none; }
.brand { display: flex; align-items: center; min-height: 44px; gap: 12px; font: 500 20px/26px "Roboto", sans-serif; color: var(--text); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 7px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px var(--side); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs a { flex: 1; min-height: var(--nav-h); display: grid; place-content: center; text-align: center; color: var(--text-2); text-decoration: none; font: 400 15px/20px "Roboto", sans-serif; border-top: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 500; border-top-color: var(--accent); }
.shell.no-nav .tabs { display: none; }
.main { padding: 8px var(--side) 32px; max-width: 1120px; margin: 0 auto; }
.main:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 16px; }
.page-head .actions { margin: 0; }
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: none; font-weight: 500; }

@media (min-width: 900px) {
  :root { --side: 32px; }
  .shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); padding-bottom: 0; }
  .topbar, .tabs { display: none; }
  .rail { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; align-self: start; height: 100vh; padding: 24px 16px; border-right: 1px solid var(--border); }
  .rail nav { display: flex; flex-direction: column; gap: 4px; }
  .rail nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; color: var(--text-2); text-decoration: none; }
  .rail nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 500; }
  .rail .foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
  .rail .foot a { color: var(--text-2); font-size: 14px; line-height: 20px; min-height: 44px; display: flex; align-items: center; padding: 0 12px; text-decoration: none; }
  .main { padding-top: 24px; }
  .shell.no-nav { grid-template-columns: var(--rail) minmax(0, 1fr); }
}

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none; cursor: pointer; text-align: center; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:active { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.btn-text { border-color: transparent; background: transparent; color: var(--accent); padding: 0 12px; }
.btn-danger { border-color: transparent; background: transparent; color: var(--overdue); padding: 0 12px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-2); border-color: var(--surface-2); color: var(--text-3); cursor: default; }
.btn-text:disabled, .btn-danger:disabled { background: transparent; border-color: transparent; }
.btn-small { min-height: 44px; padding: 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.actions.end { justify-content: flex-end; }
.actions.tight { margin-top: 8px; }
.spacer { flex: 1; }

/* ── Fields ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font: 500 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.input, .field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="url"], .field input[type="date"], .field input[type="search"], .field input[type="number"], .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--overdue); }
.error { font: 400 13px/18px "Roboto", sans-serif; color: var(--overdue); }
.hint { font: 400 13px/18px "Roboto", sans-serif; color: var(--text-3); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font: 500 14px/20px "Roboto", sans-serif; color: var(--text-2); margin-bottom: 6px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* ── Sections, cards, lists ── */
.section { margin-top: 32px; }
.section > h2 { font: 500 14px/20px "Roboto", sans-serif; color: var(--text-2); margin-bottom: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.card + .card { margin-top: 8px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--border); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center; min-height: 64px; padding: 10px 16px; color: var(--text); text-decoration: none; }
.row .primary { font-weight: 400; }
.row .amount { text-align: right; font-weight: 500; }
.row .meta { grid-column: 1; }
.row .meta .when { margin-left: 8px; }
.row .status { grid-column: 2; text-align: right; }
.row .status.link { color: var(--accent); }
.row .amount .stack { display: block; }
.lead { max-width: 640px; margin: -8px 0 16px; }
.row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 -12px -4px; }
.row .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1 / -1; }
.send-steps .hint { margin-top: 4px; }
progress { display: block; width: 100%; height: 8px; margin-top: 12px; accent-color: var(--accent); }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 16px; min-height: 64px; }
.file-row .row-actions { grid-column: 2; grid-row: 1 / span 2; margin: 0 -12px 0 0; }
.file-row .meta { grid-column: 1; }
dialog.modal { width: min(560px, calc(100vw - 32px)); }
fieldset.extra { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 8px; }
fieldset + .hint, fieldset .hint { margin-top: 4px; }
a.row:active, button.row:active { background: var(--surface-2); }
.empty { padding: 40px 16px; text-align: center; color: var(--text-2); display: grid; gap: 16px; justify-items: center; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
.kv dt { color: var(--text-2); }
.kv dd { text-align: right; }
.kv .total { font-weight: 500; border-top: 1px solid var(--border); padding-top: 8px; }

/* ── Statement block (home) ── */
.statement { display: grid; gap: 16px; }
.statement .figures { display: flex; flex-wrap: wrap; gap: 16px 48px; }
.statement .figure { display: grid; gap: 2px; }
.statement .also { color: var(--text-3); font-size: 13px; line-height: 18px; }

/* ── Filters ── */
.toolbar { display: grid; gap: 12px; margin: 24px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 500 15px/20px "Roboto", sans-serif; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--canvas); }
@media (min-width: 700px) { .toolbar { grid-template-columns: minmax(200px, 320px) 1fr; align-items: end; } }

/* ── Banners ── */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 10px 16px; margin-bottom: 16px; background: var(--surface-2); border-radius: 6px; color: var(--text); }
.banner p { flex: 1 1 240px; }
.banner.warn { border: 1px solid var(--overdue); }
.banner .btn-text { min-height: 44px; }

/* ── Invoice editor ── */
.editor { display: grid; gap: 24px; padding-bottom: 104px; }
.editor .section { margin-top: 0; }
.editor .section + .section { margin-top: 24px; }
.item { display: grid; gap: 12px; }
.item-fields { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.item-fields .name, .item-fields .desc { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .item-fields { grid-template-columns: minmax(0, 1fr) 96px 136px; }
  .item-fields .name { grid-column: auto; }
}
.item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.item-foot .amount { margin-left: auto; font-weight: 500; }
.readonly-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; }
.summary { display: grid; gap: 16px; }
.side { display: grid; gap: 16px; }
/* On a phone the amount due and the next step stay at the bottom of the screen. */
.paybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 12px var(--side) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.paybar .due { margin-right: auto; display: grid; }
.paybar .due .amount { font: 500 22px/28px "Roboto", sans-serif; }
.shell.no-nav .say { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { .paybar { left: var(--rail); } }
@media (min-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; padding-bottom: 0; }
  .editor .side { position: sticky; top: 24px; }
  .paybar { position: static; padding: 16px; border: 1px solid var(--border); border-radius: 8px; flex-direction: column; align-items: stretch; }
  .paybar .due { margin: 0; }
  .shell.no-nav .say { bottom: 24px; }
}
.menu { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 -12px; }
.menu.danger { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.more .label { margin-bottom: 4px; }
@media (min-width: 1100px) { .more .menu { flex-direction: column; align-items: stretch; } .more .menu .btn { justify-content: flex-start; } }
/* An item that is not being edited: one row to tap. */
ol#items:not(.list) { display: grid; gap: 8px; }
.item-closed { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
button.row { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; font: inherit; }
.item-row .status { color: var(--accent); }
.field.inline { flex: 1 1 200px; max-width: 320px; }

/* ── Segments (Invoices, Estimates, Expenses) ── */
.segments { display: flex; margin-top: 24px; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; background: var(--surface); max-width: 480px; }
.segments a { flex: 1; min-height: 44px; display: grid; place-content: center; text-align: center; padding: 0 12px; color: var(--text-2); text-decoration: none; font: 500 15px/20px "Roboto", sans-serif; }
.segments a + a { border-left: 1px solid var(--border-strong); }
.segments a[aria-current="true"] { background: var(--text); color: var(--canvas); }
.segments + .empty { margin-top: 8px; }

/* ── Quick invoices ── */
.quick { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.quick-item { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.quick-main { flex: 1; min-width: 0; min-height: 64px; display: grid; gap: 2px; align-content: center; padding: 8px 12px 8px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.quick-main:active { background: var(--surface-2); }
.quick-item .btn { border-left: 1px solid var(--border); border-radius: 0; min-height: 64px; }

/* ── Dialog ── */
dialog { border: 0; border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: var(--scrim); }
.dialog-body { padding: 24px; display: grid; gap: 16px; }
.dialog-body .actions { margin-top: 8px; justify-content: flex-end; }
.dialog-body .actions.tight { justify-content: flex-start; margin-top: 0; }
.dialog-body p { color: var(--text-2); white-space: pre-line; }

/* ── Status line ── */
.say-action { margin-left: 16px; min-height: 44px; padding: 0 12px; margin-top: -12px; margin-bottom: -12px; margin-right: -8px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.say { display: flex; align-items: center; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 40; background: var(--inverse); color: var(--on-inverse); border-radius: 6px; padding: 12px 16px; font-size: 15px; line-height: 20px; max-width: calc(100vw - 32px); }
@media (min-width: 900px) { .say { bottom: 24px; } }

/* ── Logo preview ── */
.logo-box { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.logo-box img { max-width: 160px; max-height: 80px; background: #FFFFFF; border: 1px solid var(--border); border-radius: 2px; padding: 4px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ── Welcome (a first visit; static markup in index.html, shown by boot.js) ── */
#welcome { display: none; }
.is-new #welcome { display: grid; }
.is-new #app { display: none; }
.welcome { min-height: 100vh; min-height: 100dvh; max-width: 1200px; margin: 0 auto; gap: 32px; align-content: start; padding: 32px var(--side) calc(32px + env(safe-area-inset-bottom, 0px)); }
.welcome-text { display: grid; gap: 16px; align-content: start; max-width: 560px; }
.welcome-text .actions { margin-top: 8px; }
.welcome-links { display: flex; gap: 24px; }
.welcome-links a { min-height: 44px; display: inline-flex; align-items: center; }
.welcome-shots { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.shot { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.shot img { width: 100%; height: auto; }
.shot-wide { display: none; }
.shot-phone { max-width: 300px; }
@media (min-width: 640px) {
  .welcome-shots { grid-template-columns: minmax(0, 1000fr) minmax(0, 390fr); }
  .shot-wide { display: block; }
  .shot-phone { max-width: none; }
}
@media (min-width: 1000px) {
  .welcome { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; align-content: center; gap: 48px; }
}
.setup-page { max-width: 640px; margin: 0 auto; padding-top: 32px; }
.noscript { padding: 24px; }

/* ── Small helpers (the page allows no inline styles: see the Content-Security-Policy in index.html) ── */
.mt-0 { margin-top: 0 !important; } .mt-4 { margin-top: 4px !important; } .mt-8 { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; } .mt-16 { margin-top: 16px !important; } .mt-24 { margin-top: 24px !important; }
.mt-32 { margin-top: 32px !important; }
.mb-8 { margin-bottom: 8px !important; } .mb-12 { margin-bottom: 12px !important; } .mb-24 { margin-bottom: 24px !important; }
.pre-line { white-space: pre-line; }
.head-tight { padding: 0 0 8px !important; }
.at-end { grid-row: 1 !important; grid-column: 2 !important; }
.about-head { display: flex; gap: 16px; align-items: center; }
.app-icon { border-radius: 12px; }
summary.toggle { cursor: pointer; min-height: 44px; line-height: 44px; }
a.say-action { display: inline-flex; align-items: center; }
h1[tabindex="-1"]:focus { outline: none; }

/* ── Screen edges (a phone held sideways, a folding phone's hinge side): content keeps clear of them ── */
@supports (padding: max(0px)) {
  .main, .topbar, .welcome { padding-left: max(var(--side), env(safe-area-inset-left, 0px)); padding-right: max(var(--side), env(safe-area-inset-right, 0px)); }
  @media (max-width: 1099px) { .paybar { padding-left: max(var(--side), env(safe-area-inset-left, 0px)); padding-right: max(var(--side), env(safe-area-inset-right, 0px)); } }
  .tabs { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
}
@media (min-width: 900px) { .rail { height: 100dvh; } }

/* ── Sales tax rates: the states as a compact grid that fills the width ── */
.rate-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); }
.rate { width: 100%; min-height: 48px; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.rate:active { background: var(--surface-2); }
.rate .code { font-weight: 500; color: var(--text-2); }
.rate .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dialog buttons stay in view: a long form scrolls under them (the quick invoice form on a phone) ── */
.dialog-body .dialog-actions { position: sticky; bottom: 0; z-index: 1; margin: 8px -24px -24px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); justify-content: flex-end; }

/* An estimate's or an expense's amount is not money owed: lighter than an invoice's. */
.row .amount.not-owed { font-weight: 400; color: var(--text-2); }

/* ── Touch and scrolling ── */
a, button, input, select, textarea, summary, label { touch-action: manipulation; }
html { -webkit-tap-highlight-color: transparent; }
dialog { overscroll-behavior: contain; }
h1, h2, .title, .display { text-wrap: balance; }
/* A field that takes focus under the bar fixed to the bottom of the screen is scrolled clear of it. */
@media (max-width: 1099px) { html { scroll-padding-bottom: 128px; } }

/* ── Dashboard: sections side by side where there is room for two, one under the other elsewhere ── */
.dash { display: grid; gap: 0 32px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.dash > .section { min-width: 0; }
.dash .empty { padding: 24px 16px; }
/* The chart: six months, two bars each. The bars are SVG rectangles (the page allows no inline styles). */
.legend { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-bottom: 12px; font: 400 14px/20px "Roboto", sans-serif; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.key { width: 12px; height: 12px; border-radius: 2px; flex: none; }
.key-in, .bar-in { background: var(--paid); fill: var(--paid); }
.key-out, .bar-out { background: var(--border-strong); fill: var(--border-strong); }
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 8px; border-top: 1px dashed var(--border); margin-top: 2px; }
.bar-col { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.bar-svg { display: block; width: 100%; height: 140px; border-bottom: 1px solid var(--border-strong); }
