/* keel — design tokens (light first; dark redefines the same names) */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f3f0;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #cde2fb;
  --accent-track: #e3eefb;
  --spark: #86b6ef;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: #e3f6e3;
  --warning: #fab219;
  --warning-text: #7a5200;
  --warning-soft: #fff1cf;
  --serious: #ec835a;
  --serious-text: #8a3a1a;
  --serious-soft: #fde5da;
  --critical: #d03b3b;
  --critical-text: #a12525;
  --critical-soft: #fbe0e0;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px -12px rgba(11, 11, 11, .18);
  --radius: 16px;
  --tabs-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #184f95;
    --accent-track: #22344d;
    --spark: #1c5cab;
    --good-text: #0ca30c;
    --good-soft: #163d16;
    --warning-text: #fab219;
    --warning-soft: #3d3010;
    --serious-text: #ec835a;
    --serious-soft: #3f2418;
    --critical-text: #e66767;
    --critical-soft: #3d1a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322; --ink: #ffffff; --ink-2: #c3c2b7; --hairline: #2c2c2a;
  --border: rgba(255,255,255,0.10); --accent: #3987e5; --accent-soft: #184f95; --accent-track: #22344d; --spark: #1c5cab;
  --good-text: #0ca30c; --good-soft: #163d16; --warning-text: #fab219; --warning-soft: #3d3010; --serious-text: #ec835a; --serious-soft: #3f2418;
  --critical-text: #e66767; --critical-soft: #3d1a1a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.45 var(--font); font-feature-settings: "cv11", "ss01"; }
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
button { font: inherit; color: inherit; }
.ic { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.15em; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.neg { color: var(--critical-text); }
.pos { color: var(--good-text); }
.r { text-align: right; }

/* ---- header / nav ---- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: color-mix(in srgb, var(--page) 80%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--hairline); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand.big { font-size: 22px; margin-bottom: 18px; }
.mark { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), #6da7ec); box-shadow: 0 0 0 3px var(--accent-soft); flex: none; }
.nav { display: none; gap: 4px; }
.nav a { color: var(--ink-2); padding: 8px 12px; border-radius: 999px; font-weight: 500; transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.nav a.settings { margin-left: 10px; }
.nav a.settings span { display: none; }

/* ---- page ---- */
.page { max-width: 1040px; margin: 0 auto; padding: 20px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 24px); }
.h { margin: 6px 0 16px; }
.h h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.h .sub { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
h2 { font-size: 15px; margin: 0 0 12px; letter-spacing: -0.005em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.auth { max-width: 440px; margin: 28px auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 26px 24px; box-shadow: var(--shadow); }
.auth h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 8px; }

/* ---- flash ---- */
.flash { display: flex; align-items: center; gap: 8px; background: var(--good-soft); color: var(--good-text); padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; animation: slide-in .35s cubic-bezier(.2,.8,.2,1) both; }
.flash.err { background: var(--critical-soft); color: var(--critical-text); }
.flash.hide { animation: fade-out .3s ease-in both; }

/* ---- reveal ---- */
.reveal { animation: reveal .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes fade-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* ---- tiles ---- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tile { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 12px; box-shadow: var(--shadow); transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s; overflow: hidden; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(11,11,11,.05), 0 16px 32px -14px rgba(11,11,11,.28); }
.tile .label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.tile .chev { color: var(--muted); opacity: 0; transition: opacity .15s, transform .15s; }
.tile:hover .chev { opacity: 1; transform: translateX(2px); }
.tile .num { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 4px 0 6px; }
.tile .num.neg { color: var(--critical-text); }
.tile .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 5px; border-radius: 999px; font-weight: 600; font-size: 12px; background: var(--surface-2); color: var(--ink-2); }
.delta.good { background: var(--good-soft); color: var(--good-text); }
.delta.bad { background: var(--critical-soft); color: var(--critical-text); }
.spark { display: none; position: absolute; right: 16px; top: 38px; width: 96px; height: 28px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--spark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 1s .3s ease-out forwards; }
.spark .end { fill: var(--accent); stroke: var(--surface); stroke-width: 2; opacity: 0; animation: pop .35s 1.1s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- attention ---- */
.attention { display: grid; gap: 8px; }
.att { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--muted); transition: transform .15s, background .15s; }
.att:hover { transform: translateX(2px); }
.att-ic { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; flex: none; font-size: 16px; }
.att.info { border-color: var(--accent); } .att.info .att-ic { background: var(--accent-soft); color: var(--accent); }
.att.warning { border-color: var(--warning); } .att.warning .att-ic { background: var(--warning-soft); color: var(--warning-text); }
.att.serious { border-color: var(--serious); } .att.serious .att-ic { background: var(--serious-soft); color: var(--serious-text); }
.att.critical { border-color: var(--critical); } .att.critical .att-ic { background: var(--critical-soft); color: var(--critical-text); }
.att-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.att-msg { font-weight: 500; line-height: 1.4; }
.att-detail { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 2px; }
.calm { display: flex; align-items: center; gap: 12px; color: var(--ink-2); padding: 6px 0; }
.calm-ic { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; background: var(--good-soft); color: var(--good-text); animation: pop .4s .2s both; }

/* ---- chart ---- */
.chart-card { display: none; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--hairline); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .tick, .chart .xlabel { font-size: 11px; fill: var(--muted); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .xlabel.current { fill: var(--ink-2); font-weight: 600; }
.chart .bar { fill: var(--accent); transform-box: fill-box; transform-origin: bottom; animation: grow .6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--k, 0) * 60ms); transition: fill .15s; outline: none; cursor: default; }
.chart .bar.current { fill: url(#hatch); }
.chart .hatch-bg { fill: var(--accent-soft); }
.chart .hatch-fg { fill: var(--accent); opacity: .7; }
.chart .bar:hover, .chart .bar:focus-visible { fill: #5598e7; }
.chart .bar.current:hover, .chart .bar.current:focus-visible { fill: url(#hatch); filter: brightness(1.08); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart-note { margin: 6px 0 0; }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--page); padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.3; box-shadow: var(--shadow); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.tip strong { display: block; font-size: 15px; }
.datatable { width: 100%; border-collapse: collapse; font-size: 14px; }
.datatable th, .datatable td { padding: 8px 6px; border-bottom: 1px solid var(--hairline); text-align: left; }
.datatable th { color: var(--ink-2); font-weight: 500; font-size: 12px; }
.datatable td.r { font-variant-numeric: tabular-nums; }

/* ---- buttons / forms ---- */
.primary, a.button.primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; transition: transform .12s, filter .15s; }
.primary:hover { filter: brightness(1.06); }
.primary:active { transform: scale(.98); }
a.button.wide, button.wide { width: 100%; }
.ghost, button:not(.primary):not(.row-button):not(.close) { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 500; transition: background .15s; }
.ghost:hover, button:not(.primary):not(.row-button):not(.close):hover { background: var(--hairline); }
.ghost[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.stack { display: grid; gap: 10px; }
.stack input, .stack select, .inline input, .inline select { font: inherit; color: inherit; padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px; width: 100%; background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.stack input:focus, .inline input:focus, .stack select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stack label { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.row-button { display: flex; justify-content: space-between; width: 100%; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; text-align: left; transition: background .15s; }
.row-button:hover { background: var(--hairline); }
.devbox { margin-top: 18px; }
.devbox summary { cursor: pointer; }
.devbox form { margin-top: 10px; }
.inline { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.inline label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.inline input { width: 120px; font-variant-numeric: tabular-nums; }
.inline select { width: auto; min-width: 220px; }
.inline .prefix { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---- stepper / counts ---- */
.stepper { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: step; }
.stepper li { flex: 1; font-size: 11px; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--hairline); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.done { border-color: var(--good); color: var(--ink-2); }
.stepper li.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.counts { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
.counts strong { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-right: 8px; }

/* ---- money filters: range nav, search, day strip ---- */
.filters { display: grid; gap: 10px; margin-bottom: 14px; }
.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-title { font-weight: 600; min-width: 150px; }
.nav-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); transition: background .15s; }
.nav-btn:hover { background: var(--surface-2); }
.nav-btn.off { opacity: .35; pointer-events: none; }
.nav-btn .ic.flip { transform: rotate(180deg); }
.presets { display: inline-flex; gap: 4px; margin-left: auto; }
.presets a { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); }
.presets a.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.search { position: relative; display: flex; align-items: center; }
.search .ic:first-of-type { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; font: inherit; color: inherit; padding: 11px 40px 11px 38px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: box-shadow .15s, border-color .15s; -webkit-appearance: none; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search .clear { position: absolute; right: 8px; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip-day { flex: none; scroll-snap-align: start; display: grid; justify-items: center; gap: 1px; min-width: 64px; padding: 8px 6px 7px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); transition: background .15s, transform .15s; }
.chip-day:hover { background: var(--surface-2); transform: translateY(-1px); }
.chip-day .dl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.chip-day .dn { font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.chip-day .dt { font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.chip-day .dt.pos { color: var(--good-text); }
.chip-day .dt.neg { color: var(--ink-2); }
.chip-day.today { border-color: var(--accent); }
.chip-day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-day.on .dn, .chip-day.on .dt, .chip-day.on .dl { color: var(--accent-ink); }
.chip-day.future { opacity: .4; pointer-events: none; }
.chip-day.all { background: var(--surface-2); }
.chip-day.all.on { background: var(--ink); border-color: var(--ink); color: var(--page); }
.chip-day.all.on .dn, .chip-day.all.on .dt, .chip-day.all.on .dl { color: var(--page); }
.strip.month .chip-day { min-width: 56px; padding: 7px 4px 6px; }
.strip.month .chip-day .dt { display: none; }
.strip.month .chip-day.all .dt { display: block; }

/* ---- rows (money, settings, report) ---- */
.row { border-top: 1px solid var(--hairline); }
.row:first-of-type, .day-head + .row { border-top: 0; }
.row summary, .row.static { list-style: none; display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.row summary { cursor: pointer; }
.row summary::-webkit-details-marker { display: none; }
.row.link:hover { background: var(--surface-2); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); flex: none; font-size: 16px; }
.avatar.in { background: var(--good-soft); color: var(--good-text); }
.avatar.out { background: var(--surface-2); color: var(--ink-2); }
.avatar.look { background: var(--warning-soft); color: var(--warning-text); }
.avatar.done { background: var(--good-soft); color: var(--good-text); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.row-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .muted { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.amt.pos { color: var(--good-text); }
.amt.neg { color: var(--ink); }
.row .chev { color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.pill.cat { background: var(--accent-soft); color: var(--accent); }
.pill.you { background: var(--good-soft); color: var(--good-text); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.day-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 2px 0 8px; }
.inset { margin: 0 0 10px 46px; }

/* ---- picker (inline on desktop, bottom sheet on phone) ---- */
.picker { padding: 4px 0 14px 46px; display: grid; gap: 12px; }
.sheet-head { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span { display: inline-block; padding: 8px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-weight: 500; transition: background .12s, color .12s, transform .12s; cursor: pointer; }
.chip:hover span { background: var(--hairline); }
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: scale(1.03); }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }
.close { display: none; }

/* ---- budget ---- */
.brow { border-top: 1px solid var(--hairline); padding: 12px 0; }
.brow:first-of-type { border-top: 0; }
.brow summary { list-style: none; cursor: pointer; }
.brow summary::-webkit-details-marker { display: none; }
.brow-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.brow-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.tick { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px; background: var(--good-soft); color: var(--good-text); font-size: 12px; animation: pop .4s .3s both; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.status.good { background: var(--good-soft); color: var(--good-text); }
.status.accent { background: var(--accent-soft); color: var(--accent); }
.status.warning { background: var(--warning-soft); color: var(--warning-text); }
.status.serious { background: var(--serious-soft); color: var(--serious-text); }
.status.muted { background: var(--surface-2); color: var(--muted); }
.track { position: relative; height: 10px; background: var(--accent-track); border-radius: 999px; }
.fill { height: 100%; border-radius: 999px; width: 0; background: var(--accent); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.fill.good { background: var(--good); }
.fill.warning { background: var(--warning); }
.fill.serious { background: var(--serious); }
.fill.muted { background: var(--spark); }
.pace-mark { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink); opacity: .55; border-radius: 1px; }
.pace-mark span { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.brow-nums { display: flex; justify-content: space-between; font-size: 13px; margin-top: 16px; color: var(--ink-2); }
.brow-nums strong { color: var(--ink); }

/* ---- report ---- */
.email .email-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.subject { font-weight: 600; flex: 1; }
.email-frame { width: 100%; height: 880px; border: 0; border-radius: 12px; background: #f4f4f1; margin-bottom: 12px; }
.report { white-space: pre-wrap; font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0 0 12px; overflow-x: auto; background: var(--surface-2); padding: 14px 16px; border-radius: 12px; }

/* ---- pager / tabs ---- */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px 12px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-top: 1px solid var(--hairline); display: flex; z-index: 5; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: var(--muted); gap: 3px; transition: color .15s; }
.tabs a .ic { font-size: 22px; }
.tabs a.on { color: var(--accent); }

/* ---- phone: bottom sheet picker ---- */
@media (max-width: 799px) {
  .row.review[open] .picker, .row[open] .picker { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-radius: 20px 20px 0 0; padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -12px 40px rgba(0,0,0,.25); animation: sheet .3s cubic-bezier(.2,.8,.2,1) both; max-height: 80vh; overflow: auto; }
  .row[open] .sheet-head { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
  .row[open] .sheet-head strong { grid-column: 1; }
  .row[open] .sheet-head .muted { grid-column: 1; font-size: 13px; }
  .row[open] .sheet-head .close { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; border: 0; background: var(--surface-2); cursor: pointer; }
  body.sheet-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; animation: fade-in .25s both; }
  .chip span { padding: 10px 15px; }
  @keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
}

/* ---- desktop ---- */
@media (min-width: 800px) {
  .nav { display: flex; }
  .nav a.settings span { display: inline; }
  .tabs { display: none; }
  .page { padding-bottom: 40px; padding-top: 26px; }
  .h h1 { font-size: 30px; }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .tile .num { font-size: 30px; }
  .chart-card { display: block; }
  .spark { display: block; }
  .tile .num { padding-right: 104px; }
  .tile:nth-child(n+2) .num { padding-right: 0; }
  .card { padding: 18px 20px; }
  .top { padding: 12px 28px; }
}

/* ---- motion off ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .flash, .chart .bar, .spark polyline, .spark .end, .tick, .calm-ic { animation: none !important; opacity: 1; stroke-dashoffset: 0; }
  .fill, .tile, .att, .chip span { transition: none; }
}
