/* Splitty app — native-style look (design direction E), light and dark. */
:root {
  --bg: #f2f2f7; --card: #ffffff; --sep: #d8d8dc; --fill: #e9e9ee;
  --label: #000000; --label-2: #6e6e73; --label-3: #c7c7cc;
  --tint: #0b63ce; --on-tint: #ffffff; --tint-soft: rgba(11, 99, 206, 0.12);
  --pos: #1b7f36; --neg: #d70015; --warn-bg: #fff4d6; --warn-fg: #6b4a00;
  --p1: #0b63ce; --p2: #c93400; --p3: #1b7f36; --p4: #a35b00; --p5: #b4306f; --p6: #5e5ce6;
  /* Chart series: a categorical pair, validated (dataviz, categorical) on the card in both modes. */
  --chart-1: var(--tint); --chart-2: #eb6834;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --card: #1c1c1e; --sep: #38383a; --fill: #2c2c2e;
    --label: #ffffff; --label-2: #98989f; --label-3: #48484a;
    --tint: #3d9bff; --on-tint: #000000; --tint-soft: rgba(61, 155, 255, 0.18);
    --pos: #32d74b; --neg: #ff6961; --warn-bg: #3a2e00; --warn-fg: #ffd66b;
    --p1: #3d9bff; --p2: #ff8a4c; --p3: #32d74b; --p4: #ffb340; --p5: #ff6ba8; --p6: #9d9bff;
    --chart-1: #3987e5; --chart-2: #d95926;
  }
}

* { box-sizing: border-box; }
/* The app does not zoom, like a native app: no double-tap zoom here, no pinch
   zoom (index.html viewport, and ui.js for Safari, which ignores the viewport
   rule), and no text field under 16px (iOS zooms into those when tapped). */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* Never sideways: nothing may make the page wider than the screen (the
   native-behaviour test checks every screen and sheet in Chromium and WebKit). */
html, body { overflow-x: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font-family: var(--font); font-size: 17px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
body.has-sheet { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Form fields shrink with their column instead of pushing it wider: Safari
   gives date fields and selects a built-in minimum width otherwise. */
input, select, textarea { min-width: 0; max-width: 100%; }
input[type=date] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; min-width: 0; }
input[type=date]::-webkit-datetime-edit { min-width: 0; overflow: hidden; }
/* Like a native app: buttons, tabs and bars are not text to select or to
   long-press for a callout. Text fields stay selectable. */
button, [role=tab], [role=switch], .nav, .tab-bar, .seg-item { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; }

#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; }
.screen { display: flex; flex-direction: column; gap: 12px; padding-bottom: 32px; }
.screen.with-bottom { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.screen.with-bottom.with-readonly { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
.pad { padding: 0 16px; }

/* svg icons */
.ico { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico-sm { width: 16px; height: 16px; }
.chev { width: 18px; height: 18px; stroke: var(--label-3); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* navigation bar */
.nav {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(88px, auto) 1fr minmax(88px, auto);
  align-items: center; min-height: 52px; padding: env(safe-area-inset-top) 4px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--sep);
}
.nav-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px 0 4px; border: 0; background: none; color: var(--tint); }
.nav-back .ico { stroke-width: 2.6; width: 22px; }
.nav-title { text-align: center; min-width: 0; padding: 4px 0; }
.nav-title-main { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-title-sub { display: block; max-width: 100%; font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-title-sub > span { margin: 0 2px; vertical-align: middle; }
.nav-actions { display: flex; justify-content: flex-end; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: none; border-radius: 10px; }
.icon-btn.tint { color: var(--tint); }

.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); display: inline-block; }
/* Connection states are prefixed (st-) so they never collide with layout classes. */
.state-dot.st-synced, .state-dot.st-direct, .state-dot.st-relayed { background: var(--pos); }
.state-dot.st-connecting { background: #e8a000; }
.state-dot.st-error { background: var(--neg); }

.large-head { padding: calc(20px + env(safe-area-inset-top)) 16px 4px; }
.large-title { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.37px; }

/* cards and lists */
.card { background: var(--card); border-radius: var(--radius); margin: 0 16px; }
.pad .card { margin: 0; }
.list { overflow: hidden; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px;
  padding: 8px 12px 8px 16px; border: 0; background: none; text-align: left; color: inherit;
}
.row + .row::before { content: ""; position: absolute; left: 64px; right: 0; top: 0; height: 1px; background: var(--sep); }
.row-link:active { background: var(--fill); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; white-space: nowrap; }
.row-amt { font-weight: 500; }
.row-net { font-size: 13px; font-weight: 500; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .zero { color: var(--label-2); }
.you-tag { color: var(--label-2); }
.sec-h { margin: 12px 16px 6px; font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--label-2); letter-spacing: 0; }
.pad .sec-h { margin-left: 16px; }
.sec-label { font-size: 13px; text-transform: uppercase; color: var(--label-2); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
  color: #fff; font-size: 14px; font-weight: 600; flex-shrink: 0;
}
@media (prefers-color-scheme: dark) { .avatar { color: #000; } }
.avatar.p1 { background: var(--p1); } .avatar.p2 { background: var(--p2); } .avatar.p3 { background: var(--p3); }
.avatar.p4 { background: var(--p4); } .avatar.p5 { background: var(--p5); } .avatar.p6 { background: var(--p6); }
.avatar.pay { background: var(--fill); color: var(--pos); }

/* balance card */
.balance { padding: 16px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.bal-amt { font-size: 30px; line-height: 36px; font-weight: 700; }
.bal-line { margin: 0 0 8px; font-size: 15px; color: var(--label-2); }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 4px; }
.bar-fill { display: block; height: 100%; border-radius: 3px; }
.bar-fill.pos { background: var(--pos); } .bar-fill.neg { background: var(--neg); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px;
  border: 0; border-radius: var(--radius); font-weight: 600; text-decoration: none;
}
.btn-fill { background: var(--tint); color: var(--on-tint); }
.btn-tinted { background: var(--tint-soft); color: var(--tint); }
.btn-plain { background: transparent; color: var(--tint); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn-wide { width: 100%; }
.danger { color: var(--neg); }
.stack { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; }
/* Bottom dock of a group: the tab bar, and above it the read-only notice. */
.bottom-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; max-width: 640px; margin: 0 auto; }
.bottom-dock .readonly-bar { margin: 0 16px 10px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18); }
.tab-bar {
  position: relative; padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--sep);
}
.tab-row { display: grid; grid-template-columns: repeat(5, 1fr); }
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 56px;
  padding: 6px 2px 4px; border: 0; background: none; color: var(--label-2); font-size: 11px; font-weight: 500; line-height: 1.2;
}
.tab-item.on { color: var(--tint); }
.tab-ico { width: 26px; height: 26px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-add {
  position: absolute; left: 50%; top: -16px; transform: translateX(-50%); display: grid; place-items: center;
  width: 60px; height: 60px; border: 0; border-radius: 50%; background: var(--tint); color: var(--on-tint);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.tab-add-ico { width: 30px; height: 30px; stroke-width: 2.4; }

/* segmented control */
.segmented { display: flex; padding: 2px; border-radius: 9px; background: var(--fill); gap: 2px; }
.seg-item { flex: 1; min-height: 44px; border: 0; border-radius: 7px; background: transparent; font-size: 15px; font-weight: 500; color: var(--label); }
.seg-item.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
@media (prefers-color-scheme: dark) { .seg-item.on { background: #636366; } }
.seg-4 .seg-item { font-size: 14px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* A column's content never reaches past it: WebKit counts a select's long
   option text (and a date field's own display) as wider than the box. Fields
   with buttons (the language switch) are not clipped, so focus rings stay whole;
   inputs and selects show focus as a border, not a ring. */
.two-col > *, .field:has(select) { overflow: hidden; overflow: clip; }
select.input { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.label { font-size: 13px; text-transform: uppercase; color: var(--label-2); }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--sep); border-radius: 10px;
  background: var(--card); font-size: 17px;
}
.input:focus { border-color: var(--tint); outline: none; }
.input.small { min-height: 40px; width: 96px; text-align: right; padding: 6px 10px; }
.input.mono { font-family: var(--mono); font-size: 16px; }
.inline-input { border-color: transparent; background: transparent; padding: 4px 0; min-height: 36px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; }
.affixed { position: relative; display: flex; align-items: center; gap: 6px; }
.affix { color: var(--label-2); font-size: 15px; }
.amount-input { font-size: 34px; font-weight: 700; min-height: 64px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.hint { margin: 0; font-size: 13px; color: var(--label-2); line-height: 1.4; }
.hint.center { text-align: center; }
.form-error { margin: 0; min-height: 0; color: var(--neg); font-size: 15px; }
.form-error:empty { display: none; }
.remainder { margin: 0; color: var(--neg); font-size: 15px; }
.remainder:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--tint-soft); color: var(--tint); font-size: 15px; }
.chip-x { display: inline-flex; border: 0; background: none; color: inherit; padding: 4px; min-width: 28px; min-height: 28px; align-items: center; justify-content: center; }
.split-row input[type=checkbox], .choice input[type=radio] { width: 22px; height: 22px; accent-color: var(--tint); flex-shrink: 0; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill); color: var(--tint); font-size: 20px; }
.stepper-value { min-width: 24px; text-align: center; }

/* misc */
.welcome { padding: 0 16px; }
.welcome-title { font-size: 22px; font-weight: 600; margin: 8px 0; }
.welcome-text { margin: 0; color: var(--label-2); }
.waiting { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.waiting p { margin: 0; }
.empty { color: var(--label-2); text-align: center; padding: 24px 8px; margin: 0; }
.banner { margin: 0 16px; padding: 12px 14px; border-radius: 10px; background: var(--card); font-size: 15px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.explain summary { color: var(--tint); cursor: pointer; padding: 8px 0; }
.danger-zone { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--sep); padding-top: 10px; align-items: flex-start; }
/* QR scanner: the viewfinder shows the centred square of the camera image, the part that is decoded */
.scan-area { display: flex; flex-direction: column; gap: 10px; }
.scan-or { margin-top: 2px; }
.scanner { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 0 auto; border-radius: var(--radius); overflow: hidden; background: #000; }
.scan-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 12%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.3); pointer-events: none; }
.qr { width: min(240px, 70vw); height: auto; margin: 0 auto; display: block; border-radius: 8px; }
.share-box { display: flex; flex-direction: column; gap: 12px; }

/* bottom sheet */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow-x: hidden; overflow-y: auto; background: var(--bg);
  overscroll-behavior: contain; /* scrolling the sheet never moves the page behind it */
  border-radius: 14px 14px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  .scrim { align-items: center; }
  .sheet { max-width: 520px; border-radius: 14px; }
}
/* A sheet takes focus itself when it opens (see ui.js): no ring around the whole sheet. */
.sheet:focus { outline: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
.sheet-title { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-body { padding-bottom: 8px; min-width: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 16px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--label); color: var(--bg); font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.toast-action { border: 0; background: none; color: #3d9bff; font-weight: 600; min-height: 44px; padding: 0 4px; }
@media (prefers-color-scheme: dark) { .toast-action { color: #0b63ce; } }

.banner.update { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.install-hint { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.install-hint p { margin: 0; }

/* review fixes */
.nav-title-main { margin: 0; font-size: 17px; }
.nav-title-main:focus, .large-title:focus { outline: none; }
.row-title.wrap, .transfer .row-title { white-space: normal; }
.person-row { align-items: flex-start; }
.person-row .avatar { margin-top: 6px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.btn-danger { background: var(--neg); color: #fff; }
.dup { padding: 14px 16px; margin: 8px 0; border: 1px solid #e8a000; }
.dup-title { margin: 0 0 4px; font-weight: 600; }
.dup-actions { margin-top: 10px; flex-wrap: wrap; }
.payment-line { margin: 0; font-size: 17px; }
.sec-h { font-size: 13px; }

/* relays */
.relay-row { min-height: 56px; gap: 12px; }
.relay-row + .relay-row::before { left: 36px; }
.relay-row .row-title { font-size: 16px; }
.banner.flush { margin: 0; }
.cross-hint { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cross-hint .btn { padding-left: 0; }
.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; width: 51px; height: 31px; margin: 0;
  border-radius: 16px; background: var(--fill); cursor: pointer; transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.switch:checked { background: var(--pos); }
.switch:checked::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
/* offline mailbox */
.mailbox-line { display: flex; align-items: center; gap: 8px; }
.mailbox-line .state-dot { flex-shrink: 0; }
.explain .hint + .hint { margin-top: 8px; }

/* ── Notes, categories, statistics, search and activity (docs/notes-charts-activity.md §15) ── */

/* utility: visually hidden text for screen readers (what a row's icons show) */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* In a row, pin it inside the row: after a long, cut-off title it would sit past the screen edge. */
.row .sr-only { top: 0; left: 0; }
.ico-xs { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
/* Four tabs at 390 px, German included: never wider than their quarter. */
.seg-4 .seg-item { min-width: 0; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A long option text in a select must not widen its column past the screen. */
.two-col > * { min-width: 0; }

/* search and filter (Expenses tab) */
.search-row { display: flex; align-items: center; gap: 8px; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: flex; color: var(--label-2); pointer-events: none; }
.search-ico, .search-ico .ico { width: 20px; height: 20px; }
.search-field input { width: 100%; padding-left: 40px; font-size: 17px; -webkit-appearance: none; appearance: none; }
.search-field input::-webkit-search-decoration { -webkit-appearance: none; }
.filter-btn { position: relative; flex-shrink: 0; color: var(--tint); }
.filter-btn.on, .filter-btn[aria-pressed="true"] { background: var(--tint-soft); color: var(--tint); }
.filter-dot {
  position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--tint); box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
/* Filter selects (Expenses filter row, Stats period and view) hold long option
   text: "Gesamter Zeitraum", month names, "Anteil von …", category names. Two
   selects side by side leave about 124 px of text at 390 px and cut them, so
   each select gets its own row with the label on the left. */
.filter-row, .filter-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.filter-row > .field, .filter-stack > .field { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 12px; }
.results-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--label-2); }
/* The group tab's content (role=tabpanel) keeps the screen's spacing. */
.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.results-line .btn { min-height: 44px; flex-shrink: 0; }

/* list rows: category tile, note marker, entries from a newer version */
.cat-tile {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px; background: var(--fill); color: var(--label-2);
}
.cat-tile .ico { width: 20px; height: 20px; }
.row-note { display: inline-block; width: 14px; height: 14px; margin: 0 2px 0 4px; vertical-align: -2px; color: var(--label-2); }
.row-note .ico { display: block; width: 14px; height: 14px; }
.row.newer .row-title { color: var(--label-2); font-style: italic; }

/* expense and payment sheets */
.note-input {
  display: block; width: 100%; min-height: 72px; padding: 10px 14px; border: 1px solid var(--sep); border-radius: 10px;
  background: var(--card); font-size: 17px; line-height: 1.35; resize: vertical;
}
.note-input:focus { border-color: var(--tint); outline: none; }
.cat-field { display: flex; align-items: center; gap: 10px; }
.cat-field .input, .cat-field select { flex: 1; min-width: 0; }
.cat-field > .ico { color: var(--label-2); }
.cat-hint { margin: 0; font-size: 13px; color: var(--tint); }

/* per-record history in the sheets */
details.history summary { color: var(--tint); cursor: pointer; padding: 12px 0; }
.history-now {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--card); font-size: 15px; overflow-wrap: anywhere;
}
.history-now .sec-label { margin-bottom: 2px; }
.history-list { margin-top: 10px; border-radius: var(--radius); background: var(--card); overflow: hidden; }

/* activity feed */
.feed-row { align-items: flex-start; }
.feed-row > .avatar { margin-top: 2px; }
.feed-text { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
.feed-change { font-size: 13px; color: var(--label-2); white-space: normal; overflow-wrap: anywhere; }
.feed-note { font-size: 13px; color: var(--label-2); }
.feed-note.overwritten { align-self: flex-start; padding: 2px 6px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-fg); }
.feed-time { flex-shrink: 0; font-size: 13px; color: var(--label-2); white-space: nowrap; }
.avatar.device { background: var(--fill); color: var(--label-2); }
.feed-more { margin-top: 4px; }

/* statistics: tiles and chart cards */
.stats { display: flex; flex-direction: column; gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--card); container-type: inline-size; }
.tile-label { font-size: 13px; color: var(--label-2); }
/* A money value never breaks inside the number: it stays on one line and its
   font shrinks with its length (--chars, set by charts.js) to fit the tile;
   values too long even then put the tiles in one column (.tiles.one-col). */
.tile-value { font-size: 22px; line-height: 28px; font-weight: 600; font-variant-numeric: proportional-nums; white-space: nowrap; }
.tile-value { font-size: clamp(14px, calc(100cqi / (var(--chars, 8) * 0.62)), 22px); }
.tiles.one-col { grid-template-columns: minmax(0, 1fr); }
@supports not (container-type: inline-size) { .tile-value { white-space: normal; overflow-wrap: anywhere; } }
.chart { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px 16px; border-radius: var(--radius); background: var(--card); }
.chart-title { margin: 0; font-size: 17px; font-weight: 600; }
.chart-sub { margin: 0; font-size: 13px; color: var(--label-2); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--label-2); }
.legend > * { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.swatch.s1 { background: var(--chart-1); }
.swatch.s2 { background: var(--chart-2); }

/* horizontal bars (Balances keeps .bar/.bar-fill): 8 px, rounded data end, square baseline */
.hb-list { display: flex; flex-direction: column; }
.hb-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; min-height: 48px; margin: 0; padding: 6px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left;
}
button.hb-row:active { opacity: 0.6; }
.hb-row .row-main { gap: 4px; }
/* A long amount narrows the label column: the label wraps instead of being cut. */
.hb-row .row-title { white-space: normal; overflow-wrap: break-word; }
.hb-track { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--fill); overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--chart-1); }
.hb-fill.s2 { background: var(--chart-2); }
.hb-amt { font-size: 15px; font-weight: 500; }
.hb-pct { font-size: 13px; color: var(--label-2); }

/* column chart (SVG): geometry in the markup, colour from here */
.col-chart { display: block; width: 100%; max-width: 480px; height: auto; overflow: visible; }
.ch-grid { fill: none; stroke: var(--sep); stroke-width: 1; shape-rendering: crispEdges; vector-effect: non-scaling-stroke; }
.ch-tick { fill: var(--label-2); font-size: 11px; }
.ch-col { fill: var(--chart-1); }
.ch-col.on { fill: color-mix(in srgb, var(--chart-1) 75%, var(--label)); }
.ch-hit { fill: transparent; cursor: pointer; pointer-events: all; }
.chart-readout { margin: 0; min-height: 20px; font-size: 15px; }

/* "Show as table" under every chart */
.chart-table summary { min-height: 44px; padding: 12px 0; color: var(--tint); font-size: 15px; cursor: pointer; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.chart-table caption { caption-side: top; padding: 0 0 4px; text-align: left; font-size: 13px; color: var(--label-2); }
.chart-table th, .chart-table td { padding: 6px 0; border-bottom: 1px solid var(--sep); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.chart-table :is(th, td) + :is(th, td) { padding-left: 8px; }
.chart-table thead th { font-size: 13px; font-weight: 400; color: var(--label-2); }
.chart-table tbody th { font-weight: 400; }
.chart-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* read-only and update experience */
.readonly-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 12px 16px; border-radius: var(--radius); background: var(--card); font-size: 15px;
}
.readonly-bar .btn { flex-shrink: 0; }
/* The update banner (.banner.update) keeps its own row layout. */
.banner:not(.update) .btn { margin-top: 8px; }
/* New tap targets are at least 44 px, also where a small button (.btn-sm) is used. */
.readonly-bar .btn, .banner:not(.update) .btn, .feed-row .row-actions .btn { min-height: 44px; }
[hidden] { display: none !important; }
