/* Pensum stylesheet. One file, no build step.
   Design: "Insomnia Light" palette with a ledger layout (see docs/DESIGN.md).
   Sections: tokens, base, layout, controls, ledger tables, dialogs, views, mobile. */

/* ---- Tokens ------------------------------------------------------------------------------ */
:root {
  --paper: #f5f3ec;      /* page background */
  --surface: #ffffff;    /* cards, tables */
  --inset: #efece2;      /* group rows, segmented backgrounds */
  --tint: #faf8f2;       /* table headers, subtle panels */
  --current: #fcf9f2;    /* the current month's column */
  --line: #ece9df;       /* hairlines between rows */
  --border: #d9d4c4;     /* control borders */
  --rule: #bcb6a2;       /* strong rules, card borders, ledger double rules */
  --ink: #1a1c20;
  --ink-strong: #0a0c10;
  --muted: #5a5e66;
  --dim: #7c8089;
  --amber: #a05f00;      /* brand: primary buttons, active tab, selection */
  --amber-dark: #7a4800;
  --amber-tint: #f6ead3;
  --green: #3b6d11;      /* positive money, success */
  --green-tint: #eaf0df;
  --red: #a32d2d;        /* negative money, destructive */
  --red-border: #e3b8b0;
  --orange: #b4470a;     /* needs action (uncategorized) */
  --orange-tint: #fdf3ea;
  --blue: #2f6f8f;       /* settled information (splits, matched rows) */
  --blue-tint: #f4f8fa;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 6px;
  --shadow: 0 10px 28px rgba(26, 28, 32, 0.14);
}

/* ---- Base -------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
h1, h2, h3 { margin: 0; font-weight: 400; }
a { color: var(--amber); }
a:hover { color: var(--amber-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.serif { font-family: var(--serif); font-weight: 400; color: var(--ink-strong); }
.money { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.zero { color: var(--dim); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { margin-left: auto; }
.stack > * + * { margin-top: 12px; }

/* ---- App layout -------------------------------------------------------------------------- */
.app-header { position: relative; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; padding: 12px 32px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 28px/1 var(--serif); color: var(--ink-strong); text-decoration: none; }
.brand:hover { color: var(--ink-strong); }
.tabs { display: flex; gap: 4px; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.tabs a[aria-current='page'] { background: var(--amber-tint); color: var(--amber); font-weight: 600; }
.tabs a svg { display: none; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; position: relative; }
.avatar { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%; background: var(--inset); font-weight: 600; cursor: pointer; }
.page { max-width: 1440px; margin: 0 auto; padding: 24px 32px 64px; }
.page.narrow { max-width: 900px; }
.page-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 18px; }
.page-title h1 { font: 36px/1.1 var(--serif); color: var(--ink-strong); }
.page-title .sub { color: var(--muted); font-size: 17px; }
.viewer-banner { display: flex; align-items: center; gap: 8px; padding: 10px 32px; background: #eef4f7; border-bottom: 1px solid #d3e2ea; color: var(--blue); font-size: 14px; }
.loading { padding: 64px; text-align: center; color: var(--muted); }

/* ---- Controls ---------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--rule); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { border-color: var(--amber); background: var(--amber); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--amber-dark); border-color: var(--amber-dark); color: #fff; }
.btn-primary:disabled { background: var(--line); border-color: var(--line); color: var(--muted); opacity: 1; }
.btn-danger { border-color: var(--red-border); color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-danger-solid { border-color: var(--red); background: var(--red); color: #fff; font-weight: 600; }
.btn-danger-solid:disabled { background: var(--line); border-color: var(--line); color: var(--muted); opacity: 1; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-link { padding: 0; border: 0; background: none; color: var(--amber); text-decoration: underline; cursor: pointer; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--inset); color: var(--ink); }
.input, .select { height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.input.money { text-align: right; }
.input:focus, .select:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 2px var(--amber-tint); }
.field { display: block; }
.field > span { display: block; margin-bottom: 6px; font-weight: 600; }
.field .input, .field .select { width: 100%; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segmented button { min-height: 38px; padding: 0 12px; border: 0; border-right: 1px solid var(--line); background: transparent; font-size: 13px; cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed='true'] { background: var(--amber-tint); color: var(--amber-dark); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 22px 24px; }
.card + .card { margin-top: 24px; }
.card h2 { font: 24px/1.15 var(--serif); color: var(--ink-strong); margin-bottom: 6px; }
.notice { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
.notice.warn { background: var(--orange-tint); color: #8f3a08; }
.notice.info { background: var(--blue-tint); color: var(--blue); }
.notice.ok { background: var(--green-tint); color: var(--green); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; background: var(--inset); color: var(--muted); }
.tag.owner { background: var(--amber-tint); color: var(--amber-dark); }
.tag.current { background: var(--green-tint); color: var(--green); }
/* Goals and notes */
.goal { margin-top: 4px; font-size: 12.5px; line-height: 1.3; font-weight: 400; }
.goal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.goal-bar { flex: none; width: 110px; height: 5px; margin-right: 2px; border-radius: 3px; background: var(--line); overflow: hidden; }
.goal-bar > span { display: block; height: 5px; border-radius: 3px; }
.goal.compact { font-size: 11.5px; } .goal.compact .goal-bar { width: 84px; }
.goal-pct { font-weight: 600; color: var(--ink); }
.goal-sep { color: var(--dim); }
.goal-status { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.goal-msg { margin-top: 2px; color: var(--muted); }
.goal-help { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--rule); border-radius: 50%; background: var(--surface); color: var(--muted); font: 600 13px/1 var(--sans); cursor: help; }
.note-mark { display: inline-flex; align-items: center; margin-left: 6px; color: #9a7a3d; vertical-align: middle; }
/* Tooltips (see Tip in js/components/ui.js): warm paper with an amber edge, positioned against the window */
.tip { display: inline-flex; align-items: center; cursor: help; }
.tip-box { position: fixed; z-index: 60; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--rule); border-top: 3px solid var(--amber);
  border-radius: 8px; background: #fffbf3; color: var(--ink); font: 400 13.5px/1.5 var(--sans); text-align: left; white-space: normal;
  box-shadow: 0 12px 28px rgba(26, 28, 32, 0.16); pointer-events: none; }
.tip-box strong { color: var(--ink-strong); }
.tip-box .tip-table { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 16px; margin-top: 6px; }
.tip-box .tip-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.tip-box .tip-total { padding-top: 4px; border-top: 1px solid var(--rule); font-weight: 600; }
.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; }
.announce-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
.announce-banner p { display: inline; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; padding: 8px 16px; background: #f6ead3; border-bottom: 1px solid #e6cfa2; color: #5c3700; font-size: 14px; text-align: center; }
.demo-bar .btn { min-height: 32px; }
.carry-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 4px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--dim); cursor: pointer; vertical-align: middle; }
.carry-btn:hover:not(:disabled) { background: var(--inset); color: var(--ink); }
.carry-btn:disabled { cursor: help; }
.carry-mark { display: inline-flex; margin-left: 4px; color: var(--dim); vertical-align: middle; }
.link-amount { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.link-amount:hover { color: var(--amber); text-decoration-color: currentColor; }
.this-month { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 10px; background: var(--green-tint); color: var(--green); font: 600 11.5px/1.6 var(--sans); vertical-align: middle; }
.needs { display: inline-flex; align-items: center; gap: 5px; color: var(--orange); font-weight: 600; }
.suggested-label { color: #8f3a08; font-style: italic; }
.suggested-label::after { content: ' (suggested)'; font-style: normal; font-size: 12px; color: var(--orange); }
.approve-btn { grid-column: 5; grid-row: 1; justify-self: end; position: relative; z-index: 1; margin-right: 4px; height: 28px; padding: 0 10px; border: 1px solid var(--green); border-radius: 14px; background: var(--surface); color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer; }
.approve-btn:hover { background: var(--green); color: #fff; }
.brow.review { background: var(--orange-tint); border-top-color: #efc9a8; }
.brow.total { background: var(--tint); border-top: 2px solid var(--rule); font-weight: 600; }
.split-label { color: var(--blue); }
.transfer-label { color: var(--dim); font-style: italic; }
.income-label { color: var(--green); font-weight: 500; }
.check-ok { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 13px; }

/* ---- Ledger tables ---------------------------------------------------------------------- */
.ledger { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); }
.ledger-head { font: italic 14px var(--serif); color: var(--muted); background: var(--tint); border-bottom: 2px solid var(--rule); }
.cell { padding: 10px 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Budget grid: category column + one 3-column block per month, separated by double rules. */
.bgrid { display: grid; grid-template-columns: minmax(210px, 1.2fr) repeat(var(--months), minmax(300px, 2fr)); }
.bmonth { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-left: 3px double var(--rule); }
/* The current month is marked by a label in its header, not a tinted column. */
.bmonth > .cell + .cell { border-left: 1px solid var(--line); }
.brow { border-top: 1px solid var(--line); }
.brow.group { background: var(--inset); border-top-color: var(--border); font-weight: 600; }
.brow.group .num { font-weight: 600; }
.brow .name { display: flex; align-items: center; gap: 6px; padding: 6px 10px; min-width: 0; }
.brow.cat .name { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }
.brow.cat .name { padding-left: 40px; }
.cat-name-btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; padding: 4px 0; cursor: pointer; text-align: left; }
.cat-name-btn:hover { color: var(--amber); }
.assign-input { width: 100%; height: 30px; padding: 0 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; text-align: right; font: 13px var(--mono); }
.assign-input:hover { border-color: var(--border); background: var(--surface); }
.assign-input:focus { border-color: var(--amber); background: var(--surface); outline: none; }
.spent-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.spent-btn:hover { color: var(--amber); text-decoration: underline; }
.mhead { position: relative; padding: 12px 12px 16px 18px; border-left: 3px double var(--rule); }
.mhead.current { background: var(--current); }
.mhead-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mhead-title h2 { font: 24px/1.1 var(--serif); color: var(--ink-strong); }
.mhead-title h2 span { font: 14px var(--sans); color: var(--dim); }
.ledger-sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 3px; column-gap: 16px; font-size: 13px; }
.ledger-sum > :nth-child(odd) { color: var(--muted); }
.ledger-sum > :nth-child(even) { text-align: right; font-family: var(--mono); }
.ledger-sum .total { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--ink); font-weight: 600; color: inherit; }
.ledger-sum .total.amount { font-size: 18px; padding-top: 4px; }
.month-btn { width: 34px; height: 34px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.month-btn:hover, .month-btn[aria-expanded='true'] { background: var(--amber-tint); border-color: #e8d3ad; }

/* Menus and popovers */
.menu { position: absolute; z-index: 20; min-width: 260px; padding: 6px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); font: 14px/1.35 var(--sans); color: var(--ink); text-align: left; }
.menu button.item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius); background: transparent; text-align: left; cursor: pointer; }
.menu button.item:hover { background: var(--paper); }
.menu .item-sub { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
.menu .sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu .item.danger { color: var(--red); }

/* Transactions table */
.tx-layout { display: flex; flex-wrap: wrap; align-items: stretch; min-height: calc(100vh - 66px); }
.tx-side { flex: 1 1 240px; max-width: 280px; padding: 24px 16px; background: var(--tint); border-right: 1px solid var(--border); }
.tx-side h2 { font: 22px var(--serif); color: var(--ink-strong); }
.tx-acct { display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--radius); background: transparent; text-align: left; cursor: pointer; }
.tx-acct[aria-pressed='true'] { background: var(--amber-tint); font-weight: 600; }
.tx-main { flex: 999 1 640px; min-width: 0; padding: 24px 32px 64px; }
.txgrid { display: grid; grid-template-columns: 44px 92px 116px minmax(150px, 1.3fr) minmax(170px, 1.3fr) minmax(110px, 1fr) 104px 104px 56px var(--runcol, 0px); align-items: center; }
.txrow { border-top: 1px solid var(--line); background: var(--surface); }
.txrow.selected { background: var(--amber-tint); }
.txrow.uncat, .txrow.pending { background: #fdf3ea; }
.txrow.selected.uncat { background: var(--amber-tint); }
.rowbtn { grid-column: 2 / 9; grid-row: 1; display: grid; grid-template-columns: subgrid; align-items: center; min-height: 44px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.rowbtn:hover { background: rgba(160, 95, 0, 0.07); }
.rowbtn > span { padding: 10px 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-toggle { grid-column: 5; grid-row: 1; justify-self: start; position: relative; z-index: 1; margin-left: 4px; color: var(--blue); }
.split-line { background: var(--blue-tint); border-top: 1px dashed #d3e2ea; font-size: 13px; }
.cleared-btn { width: 24px; height: 24px; padding: 0; border: 1px solid var(--rule); border-radius: 50%; background: var(--surface); color: var(--dim); font-size: 11px; font-weight: 600; cursor: pointer; }
.cleared-btn[aria-pressed='true'] { background: var(--green); border-color: var(--green); color: #fff; }
.selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; min-height: 52px; padding: 6px 16px; border-bottom: 1px solid var(--border); background: var(--tint); font-size: 13px; }
.editor-row { padding: 8px 0 4px; background: var(--current); border-top: 1px solid var(--rule); }
.editor-row .input, .editor-row .select { height: 36px; width: 100%; font-size: 13px; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 12px 10px; background: var(--current); }

/* Dialogs: centered modal on desktop, bottom sheet on phones */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(26, 28, 32, 0.42); }
.dialog { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 24px 26px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 18px 48px rgba(26, 28, 32, 0.22); }
.dialog.wide { max-width: 900px; }
.dialog h2 { font: 28px/1.1 var(--serif); color: var(--ink-strong); margin-bottom: 6px; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 14px; max-width: calc(100vw - 32px); }
.toast button { min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius); background: var(--amber-tint); color: var(--amber-dark); font-weight: 600; cursor: pointer; }
.steps { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 20px; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 14px; }
.steps li span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 50%; font-size: 12px; }
.steps li[aria-current='step'] { color: var(--amber-dark); font-weight: 600; }
.steps li[aria-current='step'] span { border-color: var(--amber); background: var(--amber-tint); }
.steps li.done { color: var(--green); }
.steps li.done span { border-color: var(--green); background: var(--green-tint); }
.dropzone { padding: 34px 24px; border: 2px dashed var(--rule); border-radius: 8px; background: var(--tint); text-align: center; }
.dropzone.over { border-color: var(--amber); background: var(--amber-tint); }

/* Reports */
.pie { position: relative; width: 280px; height: 280px; border-radius: 50%; }
.pie-center { position: absolute; inset: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface); text-align: center; }
.chart { position: relative; height: 200px; margin-left: 44px; }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.gridline span { position: absolute; left: -44px; top: -8px; width: 36px; text-align: right; font: 11px var(--mono); color: var(--dim); }
.tiles { display: flex; gap: 4px; }
.tiles span { width: 18px; height: 18px; border-radius: 3px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 24px; margin-bottom: 24px; }

/* Setup and splash */
.wizard { max-width: 860px; margin: 0 auto; padding: 32px 32px 64px; }
.choice { display: flex; gap: 12px; padding: 16px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.choice.on { border-color: var(--amber); background: #fdf8ee; }
.fab { display: none; }
.mobile-only { display: none; }

/* ---- Phones ------------------------------------------------------------------------------ */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .app-header { padding: 10px 16px; gap: 8px; }
  .brand { font-size: 24px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; justify-content: space-around; gap: 0; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
  .tabs a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 0; font-size: 12px; border-radius: 0; }
  .tabs a[aria-current='page'] { background: transparent; }
  .tabs a svg { display: block; }
  .page, .tx-main { padding: 14px 12px 110px; }
  .page-title h1 { font-size: 28px; }
  .tx-side { display: none; }
  .desktop-only { display: none !important; }
  .mobile-only { display: block; }
  .fab { display: inline-flex; position: fixed; right: 18px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 11; width: 58px; height: 58px; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--amber); color: #fff; box-shadow: 0 6px 16px rgba(122, 72, 0, 0.35); cursor: pointer; }
  .overlay { align-items: flex-end; padding: 0; }
  .dialog, .dialog.wide { max-width: none; max-height: calc(100vh - 40px); border-radius: 14px 14px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .card { padding: 18px 16px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .viewer-banner { padding: 8px 16px; }
}
