/* Homebase — a household board.
   Cool dry-erase surfaces, slate ink, and marker colors that belong to people. */
:root {
  --board: #EEF1F0;
  --panel: #FFFFFF;
  --panel-2: #F6F8F7;
  --ink: #1F2A33;
  --ink-2: #56646E;
  --ink-3: #8A969D;
  --line: #D8DEDC;
  --line-2: #E6EAE9;
  --accent: #2F6DB5;
  --accent-ink: #FFFFFF;
  --pos: #2E7D5B;
  --neg: #C2412D;
  --warn: #A86F0E;
  --warn-bg: #FBF0D9;
  --bad-bg: #F8E3DE;
  --ok-bg: #DFF0E7;
  --info-bg: #E1EBF7;
  --amber: #E0A63A;
  --shadow: 0 1px 0 rgba(31, 42, 51, .04), 0 6px 18px -10px rgba(31, 42, 51, .22);
  --radius: 10px;
  --radius-s: 6px;
  --head: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --board: #121719; --panel: #1A2125; --panel-2: #1F272C; --ink: #E7ECEE; --ink-2: #A2AEB4; --ink-3: #74828A;
    --line: #2D373D; --line-2: #252E33; --accent: #6FA3E3; --accent-ink: #0E1B2A; --pos: #5BBF8F; --neg: #EE7A63;
    --warn: #E5B154; --warn-bg: #3A2F17; --bad-bg: #3C211C; --ok-bg: #18322A; --info-bg: #1B2B3F;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --board: #121719; --panel: #1A2125; --panel-2: #1F272C; --ink: #E7ECEE; --ink-2: #A2AEB4; --ink-3: #74828A;
  --line: #2D373D; --line-2: #252E33; --accent: #6FA3E3; --accent-ink: #0E1B2A; --pos: #5BBF8F; --neg: #EE7A63;
  --warn: #E5B154; --warn-bg: #3A2F17; --bad-bg: #3C211C; --ok-bg: #18322A; --info-bg: #1B2B3F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--board); color: var(--ink);
  font: 16px/1.5 var(--body); font-variant-numeric: tabular-nums;
}
body.drawer-open { overflow: hidden; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .5rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.block { display: block; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.r { text-align: right; }
.mono-ish { letter-spacing: .02em; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; background: linear-gradient(90deg, var(--ink) 232px, transparent 232px); }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem;
  padding: 1.25rem .9rem; background: var(--ink); color: #DCE3E6;
}
:root[data-theme="dark"] .rail { background: #0C1012; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail { background: #0C1012; } }
.brand { display: flex; gap: .7rem; align-items: center; padding: 0 .35rem .5rem; }
.brand strong { display: block; font-family: var(--head); font-size: 1.05rem; color: #fff; }
.brand .muted { color: #9FB0B8; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; flex: none; position: relative; background: #2A3842; }
.brand-mark::before { content: ""; position: absolute; inset: 9px 8px 13px; border: 3px solid #F4F6F5; border-bottom: 0; transform: perspective(40px) rotateX(0); clip-path: polygon(50% 0, 100% 45%, 100% 100%, 0 100%, 0 45%); }
.brand-mark::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 8px; height: 3px; border-radius: 2px; background: var(--amber); }
.brand-mark.big { width: 52px; height: 52px; border-radius: 13px; margin-bottom: .5rem; }
.brand-mark.big::before { inset: 14px 12px 20px; }
.brand-mark.big::after { left: 13px; right: 13px; bottom: 12px; height: 4px; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 8px;
  color: #C9D3D8; text-decoration: none; font-weight: 700; font-size: .95rem;
}
.rail nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail nav a.on { background: #F4F6F5; color: var(--ink); }
.rail nav a.on svg { color: var(--accent); }
:root[data-theme="dark"] .rail nav a.on svg { color: #2F6DB5; }
.rail-foot { margin-top: auto; font-size: .82rem; }
.demo-flag { color: var(--amber); text-decoration: none; display: block; padding: .5rem; border: 1px dashed rgba(224,166,58,.5); border-radius: 8px; }
.sync { background: none; border: 0; color: #9FB0B8; display: flex; gap: .4rem; align-items: center; cursor: pointer; padding: .4rem; }

.main { min-width: 0; padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 5rem; }
.page { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; }
.page.narrow { max-width: 720px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head p { margin: .2rem 0 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.demo-bar { max-width: 1240px; margin: -0.6rem auto 1rem; font-size: .875rem; color: var(--ink-2); background: var(--warn-bg); padding: .45rem .8rem; border-radius: 8px; }
.back { display: inline-flex; gap: .3rem; align-items: center; text-decoration: none; font-weight: 700; margin-bottom: -.4rem; }

.tabbar, .more-sheet { display: none; }

/* ---------- sections ---------- */
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
  padding: .55rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; min-height: 40px;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--board); border-color: var(--ink); }
.btn.primary:hover { background: #33424D; }
:root[data-theme="dark"] .btn.primary:hover { background: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary:hover { background: #fff; } }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { padding: .35rem .7rem; font-size: .875rem; min-height: 34px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--neg); }
.btn.armed { background: var(--neg); color: #fff; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: default; }
.icon-btn { background: none; border: 0; padding: .45rem; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:disabled { opacity: .35; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.link-plain { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; text-decoration: none; }

input:not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field { display: flex; flex-direction: column; gap: .3rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-size: .85rem; font-weight: 700; color: var(--ink-2); padding: 0; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 700; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check.inline { font-weight: 400; font-size: .9rem; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding-left: .65rem; }
.money-input span { color: var(--ink-3); }
.money-input input { border: 0 !important; min-width: 0; }
.money-input:focus-within { outline: 2px solid var(--accent); }
.money-input input:focus { outline: 0; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem 1rem; }
.form > .field:has(textarea), .form > .field:first-child, .form > fieldset, .form > .form-actions, .form > .form-error, .form > .form-note, .form > p { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; justify-content: space-between; align-items: center; padding-top: .25rem; flex-wrap: wrap; }
.form-error { color: var(--neg); font-weight: 700; }
.form-note { background: var(--info-bg); padding: .6rem .8rem; border-radius: 8px; }
.inline-field { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.inline-field .money-input { width: 120px; }

/* ---------- segmented / filters ---------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--line-2); border-radius: 10px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: .45rem .8rem; border-radius: 7px; font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--ink-2); display: flex; align-items: center; gap: .4rem; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.seg-count { font-size: .75rem; background: var(--line); color: var(--ink-2); border-radius: 99px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.seg button.on .seg-count { background: var(--ink); color: var(--board); }
.filters { display: flex; gap: .75rem 1rem; align-items: center; flex-wrap: wrap; }
.filters > select { width: auto; }
.who { display: flex; gap: .35rem; flex-wrap: wrap; }
.who > button:not(.marker-pick) { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: .3rem .8rem; cursor: pointer; font-weight: 700; }
.who > button.on:not(.marker-pick) { background: var(--ink); color: var(--board); border-color: var(--ink); }
.layer-toggles { display: flex; gap: 1rem; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: .4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding-left: .6rem; flex: 1 1 260px; color: var(--ink-3); }
.search input { border: 0 !important; }
.search:focus-within { outline: 2px solid var(--accent); }
.search input:focus { outline: 0; }

/* ---------- markers: each person's color, written like a dry-erase marker ---------- */
.marker {
  --m: #5B6670; display: inline-block; font-weight: 700; white-space: nowrap; line-height: 1.2;
  background-image: linear-gradient(transparent 62%, color-mix(in srgb, var(--m) 38%, transparent) 62%, color-mix(in srgb, var(--m) 38%, transparent) 92%, transparent 92%);
  padding: 0 .15em;
}
.marker-sm { font-size: .78rem; color: var(--ink-2); }
.marker-lg { font-size: 1.35rem; font-family: var(--head); }
.marker-pick { --m: #5B6670; border: 2px solid color-mix(in srgb, var(--m) 55%, transparent); background: var(--panel); color: var(--ink); border-radius: 99px; padding: .25rem .75rem; cursor: pointer; font-weight: 700; }
.marker-pick.on { background: var(--m); border-color: var(--m); color: #fff; }
.marker-picks { display: flex; gap: .4rem; flex-wrap: wrap; }
.swatches { display: flex; gap: .45rem; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2.5px var(--ink); }

/* ---------- pills, progress ---------- */
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .55rem; border-radius: 99px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill-bad { background: var(--bad-bg); color: var(--neg); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-ok { background: var(--ok-bg); color: var(--pos); }
.pill-info { background: var(--info-bg); color: var(--accent); }
.progress { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin: .4rem 0; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line-2); }
.row:last-child { border-bottom: 0; }
.rows.tight .row { padding: .45rem 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.row-main > span:first-child { overflow-wrap: anywhere; }
.row.done .row-main > span:first-child { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-3); }
.row.hi .row-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--neg); margin-right: .45rem; vertical-align: middle; }
.tick { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: transparent; flex: none; }
.tick:hover { border-color: var(--pos); color: var(--pos); }
.tick.on { background: var(--pos); border-color: var(--pos); color: #fff; }
.rows.board .row { padding: .75rem .25rem; }
.list-total { text-align: right; color: var(--ink-2); }
.ledger .row.short .row-main > span:first-child { color: var(--neg); }
.ledger .bal { min-width: 70px; text-align: right; }
.empty { text-align: center; padding: 1.5rem 1rem; color: var(--ink-2); }
.empty-title { font-weight: 700; color: var(--ink); margin-bottom: .25rem; }
.empty .btn { margin-top: .6rem; }
.plain { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-direction: column; gap: .3rem; }
dl.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem 1.2rem; margin: 0; }
dl.kv dt { font-size: .8rem; color: var(--ink-2); font-weight: 700; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- today ---------- */
.today .page-head h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); }
.cash { border-left: 6px solid var(--pos); }
.cash.short { border-left-color: var(--neg); background: linear-gradient(90deg, color-mix(in srgb, var(--neg) 6%, var(--panel)), var(--panel) 45%); }
.cash-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 1.5rem; align-items: center; }
.cash-headline .big { font-family: var(--head); font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); font-weight: 700; line-height: 1.1; display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem 1rem; margin: .75rem 0 0; }
.mini-stats dt { font-size: .78rem; color: var(--ink-2); font-weight: 700; }
.mini-stats dd { margin: 0; font-weight: 700; }
.week { list-style: none; margin: 0; padding: 0; }
.week li { display: grid; grid-template-columns: 88px 1fr; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.week li:last-child { border-bottom: 0; }
.week li.is-today .week-day { color: var(--accent); }
.week-day { font-weight: 700; font-size: .9rem; }
.week-items { display: flex; flex-direction: column; gap: .2rem; }
.week-item { --m: var(--ink-3); border-left: 3px solid var(--m); padding-left: .5rem; font-size: .92rem; }
.week-item em { font-style: normal; color: var(--ink-2); font-size: .85rem; }
.jars { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.jar { --j: var(--amber); border: 1px solid var(--line); border-top: 5px solid var(--j); border-radius: var(--radius); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .3rem; background: var(--panel); }
.jar .progress span { background: var(--j); }
.jar-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.jar .btn { align-self: flex-start; }

/* ---------- charts ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 2.25; }
.chart-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart-area.neg { fill: color-mix(in srgb, var(--neg) 22%, transparent); }
.chart-zero { stroke: var(--ink-3); stroke-dasharray: 4 4; }
.chart-marker { fill: var(--panel); stroke: var(--ink); stroke-width: 2.5; }
.chart-marker.neg { stroke: var(--neg); fill: var(--neg); }
.chart-hover { stroke: var(--ink-3); }
.chart-foot { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-2); gap: .5rem; }
.chart-readout { font-weight: 700; color: var(--ink); }
.bars { display: flex; align-items: flex-end; gap: .6rem; height: 180px; padding-top: 1rem; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: .25rem; min-width: 0; }
.bar-fill { width: 100%; max-width: 54px; background: var(--line); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar.current .bar-fill { background: var(--accent); }
.bar-val { font-size: .75rem; color: var(--ink-2); font-weight: 700; }
.bar-label { font-size: .8rem; color: var(--ink-2); }

/* ---------- lists ---------- */
.quick { display: flex; gap: .5rem; }
.quick input { flex: 1; font-size: 1.05rem; }
.shop-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.shop-group, .project { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.shop-group h3 { font-size: .95rem; margin-bottom: .3rem; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.project header { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .4rem; }

/* ---------- calendar ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.cal-nav { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.cal-nav h2 { flex: 1; text-align: center; font-size: 1.3rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-dow { font-size: .78rem; font-weight: 700; color: var(--ink-2); text-align: center; padding-bottom: .3rem; }
.cal-cell { min-height: 96px; background: var(--panel-2); border: 1px solid transparent; border-radius: 6px; padding: .3rem; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-cell.out { opacity: .45; }
.cal-cell.is-today .cal-num { background: var(--ink); color: var(--board); }
.cal-cell.sel { border-color: var(--accent); background: var(--panel); }
.cal-num { font-weight: 700; font-size: .85rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; }
.cal-dots { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { --m: var(--ink-3); font-size: .72rem; line-height: 1.25; padding: 1px 4px; border-radius: 3px; background: color-mix(in srgb, var(--m) 16%, transparent); border-left: 2.5px solid var(--m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.k-bill { --m: var(--warn); border-left-style: dotted; }
.cal-chip.k-service { --m: var(--neg); border-left-style: dotted; }
.cal-chip.k-task { background: transparent; }
.cal-more { font-size: .72rem; color: var(--ink-2); }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; position: sticky; top: 1rem; }
.cal-day h2 { margin-bottom: .5rem; }
.cal-bar { --m: var(--ink-3); width: 4px; align-self: stretch; border-radius: 2px; background: var(--m); flex: none; }
.row.k-bill .cal-bar { background: var(--warn); }
.row.k-service .cal-bar { background: var(--neg); }

/* ---------- garage ---------- */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.vehicle-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: .6rem; transition: border-color .15s; }
.vehicle-card:hover { border-color: var(--ink-3); }
.vehicle-card.status-overdue { border-top: 5px solid var(--neg); }
.vehicle-card.status-soon { border-top: 5px solid var(--amber); }
.vc-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.vc-head h2 { font-size: 1.35rem; }
.odo { display: flex; align-items: baseline; gap: .4rem; }
.odo-num {
  font-family: var(--head); font-size: 2.3rem; font-weight: 700; letter-spacing: .04em; line-height: 1;
  padding: .2rem .5rem; background: var(--ink); color: #F4F6F5; border-radius: 6px;
}
.odo-unit { color: var(--ink-2); font-weight: 700; }
.vc-next { margin: 0; font-size: .92rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.stat-label { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.stat-val { font-family: var(--head); font-size: 1.7rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.loan { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: var(--panel-2); }
.loan header { display: flex; flex-direction: column; gap: .1rem; }
.what-if { margin-top: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.what-if label { font-weight: 700; }
.what-if .money-input { width: 110px; }
.what-if p { flex-basis: 100%; margin: .3rem 0 0; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem 1rem; margin: .75rem 0; }
.spec { display: flex; flex-direction: column; gap: .2rem; }
.spec label { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.research { margin-top: 1rem; border-top: 1px solid var(--line-2); padding-top: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.research summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.research[open] { gap: .6rem; }
.research .btn { align-self: flex-start; }
.nhtsa { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.nhtsa .rows, .nhtsa p { flex-basis: 100%; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; color: var(--ink-2); font-weight: 700; padding: .65rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .65rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th.r, .table td.r { text-align: right; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--panel-2); }
.table.compact td, .table.compact th { padding: .4rem .5rem; }
.table.compact tbody tr { cursor: default; }

/* ---------- family ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }
.person { --m: var(--ink-3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; border-top: 6px solid var(--m); }
.person header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .75rem; margin-bottom: .6rem; }
.person header h2 { flex-basis: 100%; }
.person h3 { font-size: .85rem; color: var(--ink-2); margin: .8rem 0 .3rem; }

/* ---------- documents ---------- */
.doc-list { list-style: none; padding: 0; margin: 0 0 .6rem; }
.doc-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; padding: .45rem 0; border-bottom: 1px solid var(--line-2); }
.doc-row .link { flex: 1 1 200px; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.doc-list.big { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1rem; }
.doc-link { padding: 0 0 .45rem 1.4rem; border-bottom: 1px solid var(--line-2); margin-top: -.2rem; }
.attachments { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.attachments h3 { margin-bottom: .5rem; }
.attach-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.attach-row select { width: auto; }
.attach-row input { flex: 1 1 180px; width: auto; }
.checklist { list-style: none; padding: 0; margin: .75rem 0 0; display: flex; flex-direction: column; gap: .35rem; }
.checklist li { display: flex; gap: .5rem; align-items: center; }
.checklist .ok { color: var(--pos); }
.checklist .bad { color: var(--neg); }

/* ---------- drawer ---------- */
.drawer-wrap { position: fixed; inset: 0; background: rgba(15, 22, 27, .45); z-index: 50; display: flex; justify-content: flex-end; animation: fade .15s ease-out; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--panel); display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.2); animation: slide .2s ease-out; }
.drawer.wide { width: min(720px, 100%); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 1.25rem; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: .5; } }

/* ---------- toast, splash, auth ---------- */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: var(--board); padding: .7rem 1.1rem; border-radius: 10px; font-weight: 700; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 2rem); }
.toast.error { background: var(--neg); color: #fff; }
.splash, .auth { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 1rem; }
.splash { gap: 1rem; align-content: center; }
.splash-mark { width: 48px; height: 48px; border-radius: 12px; background: var(--ink); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 2rem 1.75rem; display: flex; flex-direction: column; gap: .9rem; text-align: left; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.6rem; }
.auth-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .cal-wrap { grid-template-columns: 1fr; }
  .cal-day { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: none; }
  .rail { display: none; }
  .main { padding: 1rem 16px calc(84px + env(safe-area-inset-bottom)); }
  .grid-2, .grid-3, .cash-grid { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; font-weight: 700; color: var(--ink-2); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; }
  .tabbar .on { color: var(--accent); }
  .more-sheet { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(15,22,27,.35); }
  .more-grid { position: absolute; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--panel); border-radius: 14px; padding: 1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; box-shadow: var(--shadow); }
  .more-grid a { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem .2rem; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .85rem; border-radius: 10px; background: var(--panel-2); }
  .cal-cell { min-height: 54px; }
  .cal-chip { font-size: 0; padding: 0; height: 5px; border-left-width: 0; background: var(--m); border-radius: 3px; }
  .cal-chip.k-bill, .cal-chip.k-service { background: transparent; border-bottom: 2px dotted var(--m); height: 3px; }
  .cal-more { font-size: .65rem; }
  .table th:nth-child(3), .table td:nth-child(3), .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .drawer { animation-name: rise; }
  .page-head .btn { min-height: 42px; }
  .demo-bar { margin-top: 0; }
}
@keyframes rise { from { transform: translateY(30px); opacity: .5; } }
@media (max-width: 520px) {
  .stat-row { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat { padding: .7rem .75rem; }
  .stat-val { font-size: 1.35rem; }
  .section { padding: .9rem; }
  .week li { grid-template-columns: 70px 1fr; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
}

/* =================== Round 2: focus, routines, calendar filters, wall =================== */
.wall-link { display: flex; gap: .4rem; align-items: center; color: #C9D3D8; text-decoration: none; padding: .4rem; margin-bottom: .4rem; font-weight: 700; }
.wall-link:hover { color: #fff; }

/* quick capture */
.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 30; width: 60px; height: 60px; border-radius: 50%;
  border: 0; background: var(--amber); color: #1F2A33; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 22px -6px rgba(0,0,0,.45);
}
.fab:hover { transform: translateY(-1px); }
.capture { display: flex; flex-direction: column; gap: .8rem; }
.capture textarea { font-size: 1.1rem; }

/* today strip */
.today-strip { display: flex; gap: .8rem; flex-wrap: wrap; align-items: stretch; }
.next-up { display: flex; flex-direction: column; gap: .05rem; padding: .7rem 1rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--accent); min-width: 0; flex: 1 1 260px; }
.next-up strong { font-family: var(--head); font-size: 1.25rem; }
.next-up.soon { border-left-color: var(--neg); background: color-mix(in srgb, var(--neg) 7%, var(--panel)); }
.one-thing { display: flex; gap: .6rem; align-items: center; padding: .7rem 1.1rem; border-radius: var(--radius); background: var(--ink); color: var(--board); text-decoration: none; flex: 0 1 auto; }
.one-thing span { display: flex; flex-direction: column; line-height: 1.2; }
.one-thing .small { opacity: .75; }
.inbox-pill { align-self: center; padding: .4rem .9rem; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-weight: 700; text-decoration: none; }
.fresh-start { display: flex; gap: .5rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .8rem 1rem; border-radius: var(--radius); background: var(--info-bg); }
.fresh-start p { margin: 0; flex: 1 1 280px; }

/* routines */
.routines { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.routine-wrap { display: flex; flex-direction: column; gap: .3rem; }
.routine { --j: var(--accent); background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--j); border-radius: var(--radius); padding: .9rem 1rem; }
.routine header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; }
.routine header h3 { flex: 1 1 auto; }
.routine .progress span { background: var(--j); }
.routine.complete { background: color-mix(in srgb, var(--pos) 7%, var(--panel)); }
.routine-items { list-style: none; padding: 0; margin: .3rem 0 0; display: flex; flex-direction: column; gap: .2rem; }
.routine-item { width: 100%; display: flex; gap: .7rem; align-items: center; text-align: left; background: none; border: 0; padding: .45rem .2rem; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.routine-item:hover { background: var(--panel-2); }
.routine-item.on { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 2px; }
.routine-item.on .tick { background: var(--pos); border-color: var(--pos); color: #fff; }
.today-routines { margin-top: -.2rem; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; margin-top: .6rem; }
.template { text-align: left; background: var(--panel-2); border: 1px dashed var(--line); border-radius: var(--radius); padding: .8rem; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; color: inherit; }
.template:hover { border-style: solid; border-color: var(--ink-3); }

/* focus */
.focus-filters { display: flex; gap: 1rem 2rem; flex-wrap: wrap; }
.focus-filters > div { display: flex; flex-direction: column; gap: .3rem; }
.focus-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1.1rem, 3vw, 2rem); display: flex; flex-direction: column; gap: .7rem; box-shadow: var(--shadow); }
.focus-why { margin: 0; font-weight: 700; color: var(--accent); }
.focus-title { font-size: clamp(1.7rem, 1.2rem + 2.4vw, 2.8rem); text-wrap: balance; }
.focus-notes { background: var(--panel-2); padding: .6rem .8rem; border-radius: 8px; }
.focus-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .4rem; border-top: 1px solid var(--line-2); }
.btn.big { font-size: 1.1rem; padding: .7rem 1.4rem; min-height: 48px; }
.up-next summary { cursor: pointer; color: var(--ink-2); }
.timer { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; padding: .8rem 0; }
.timer-face { width: min(200px, 48vw); height: auto; flex: none; }
.timer-rim { fill: var(--panel-2); stroke: var(--line); stroke-width: 2; }
.timer-wedge { fill: var(--neg); transition: d .25s linear; }
.timer-hub { fill: var(--ink); }
.timer-side { display: flex; flex-direction: column; gap: .5rem; min-width: 0; flex: 1 1 200px; }
.timer-time { font-family: var(--head); font-size: 2.8rem; font-weight: 700; line-height: 1; margin: 0; }
.timer-msg { font-weight: 700; color: var(--pos); }
.timer.finished .timer-rim { stroke: var(--pos); stroke-width: 5; }
.timer-picks, .timer-btns { display: flex; gap: .4rem; flex-wrap: wrap; }

/* chips (filters) */
.chip { --c: var(--ink-3); display: inline-flex; align-items: center; gap: .4rem; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 99px; padding: .3rem .75rem; cursor: pointer; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.chip.on { border-color: var(--c); color: var(--ink); background: color-mix(in srgb, var(--c) 12%, var(--panel)); }
.chip.ghost { border-style: dashed; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); opacity: .35; }
.chip.on .chip-dot { opacity: 1; }
.chip-n { font-size: .72rem; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cal-filters { display: flex; flex-direction: column; gap: .7rem; }
.presets { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.cal-nav { margin-bottom: 0; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.wk-col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; min-width: 0; min-height: 200px; }
.wk-col h3 { font-size: .9rem; color: var(--ink-2); margin-bottom: .3rem; }
.wk-col h3 span { color: var(--ink); font-size: 1.2rem; }
.wk-col.is-today { border-color: var(--accent); border-width: 2px; }
.wk-col .row { gap: .4rem; font-size: .88rem; }
.agenda { display: flex; flex-direction: column; gap: .8rem; }
.agenda section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; }
.agenda section.is-today { border-color: var(--accent); }
.agenda h3 { font-size: .95rem; }
.row.k-issue .cal-bar { background: var(--neg); }

/* inbox */
.inbox-row { flex-wrap: wrap; }
.inbox-row .row-main { flex-basis: 240px; }
.sort-btns { display: flex; flex-wrap: wrap; gap: .3rem; }
.sort-btns .chip { font-size: .8rem; padding: .25rem .6rem; }

/* setup & sign-in */
.setup-steps { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: .7rem; }
.setup-steps li { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; }
.code-input { font-size: 1.8rem; letter-spacing: .3em; text-align: center; }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }
.secret { word-break: break-all; background: var(--panel-2); padding: .1rem .3rem; border-radius: 4px; }
.twostep { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: .5rem; }
.twostep .form-actions { justify-content: flex-start; }
details > summary { cursor: pointer; }

/* =================== wall mode =================== */
html.wall-mode, html.wall-mode body { background: #0E1316; }
.wall {
  --w-bg: #0E1316; --w-panel: #182026; --w-ink: #EEF2F3; --w-ink2: #9DAAB1; --w-line: #2A353C;
  min-height: 100vh; background: var(--w-bg); color: var(--w-ink); padding: clamp(12px, 1.6vw, 28px);
  display: flex; flex-direction: column; gap: clamp(12px, 1.4vw, 24px); font-size: clamp(16px, 1.15vw, 26px);
}
.wall.night { filter: brightness(.55); }
.wall .muted { color: var(--w-ink2); }
.wall-head { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.wall-clock { display: flex; flex-direction: column; }
.wall-time { font-family: var(--head); font-size: clamp(3rem, 6vw, 7rem); line-height: .95; font-weight: 700; }
.wall-date { font-size: 1.2em; color: var(--w-ink2); }
.wall-next { flex: 1 1 300px; display: flex; flex-direction: column; padding: .7em 1em; border-radius: 14px; background: var(--w-panel); border-left: 8px solid #6FA3E3; }
.wall-next strong { font-family: var(--head); font-size: 1.6em; }
.wall-next.soon { border-left-color: #EE7A63; background: #2A1C19; }
.wall-btns { display: flex; gap: .5rem; }
.wall-btn { display: inline-flex; align-items: center; gap: .4rem; border: 0; border-radius: 14px; padding: .7em 1.1em; background: #E0A63A; color: #1F2A33; font-weight: 700; font-size: 1em; cursor: pointer; text-decoration: none; min-height: 56px; }
.wall-btn.ghost { background: var(--w-panel); color: var(--w-ink); }
.wall-grid { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: clamp(12px, 1.4vw, 24px); flex: 1; min-height: 0; }
.wall-panel { background: var(--w-panel); border-radius: 18px; padding: 1em 1.1em; min-width: 0; overflow: auto; display: flex; flex-direction: column; gap: .6em; }
.wall-panel h2 { font-size: 1.35em; }
.wall-sub { margin-top: .6em; color: var(--w-ink2); }
.wall-events { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45em; }
.wall-events li { --m: #6FA3E3; display: grid; grid-template-columns: 5.5em 1fr; gap: .1em .7em; border-left: 5px solid var(--m); padding: .3em .6em; border-radius: 4px; background: rgba(255,255,255,.03); }
.wall-events .wall-ev-who { grid-column: 2; font-size: .8em; color: var(--w-ink2); }
.wall-ev-time { color: var(--w-ink2); font-variant-numeric: tabular-nums; }
.wall-events.small { font-size: .85em; }
.wall-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); gap: .8em; }
.wall-person { --m: #9DAAB1; border-top: 6px solid var(--m); background: rgba(255,255,255,.03); border-radius: 10px; padding: .6em .7em; }
.wall-person h3 { font-size: 1.2em; margin-bottom: .3em; }
.wall-person ul, .wall-shop { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3em; }
.wall-tick, .wall-shop button { width: 100%; display: flex; gap: .7em; align-items: center; text-align: left; background: none; border: 0; color: var(--w-ink); font-size: 1em; padding: .45em .2em; border-radius: 10px; cursor: pointer; min-height: 52px; }
.wall-tick:active, .wall-shop button:active { background: rgba(255,255,255,.08); }
.wall .tick { width: 38px; height: 38px; border-radius: 10px; border: 2.5px solid #4A5862; background: transparent; color: transparent; flex: none; display: grid; place-items: center; }
.wall-tick em, .wall-shop em { font-style: normal; color: var(--w-ink2); font-size: .85em; }
.wall-clear { font-size: 1.2em; color: #5BBF8F; }
.wall-jar { --j: #E0A63A; display: flex; flex-direction: column; gap: .2em; }
.wall-jar > div { display: flex; justify-content: space-between; gap: .5em; }
.wall .progress { background: #2A353C; height: 12px; }
.wall .routine { background: rgba(255,255,255,.03); border-color: var(--w-line); color: var(--w-ink); }
.wall .routine-item { color: var(--w-ink); font-size: 1em; min-height: 48px; }
.wall .routine-item:hover { background: rgba(255,255,255,.06); }
@media (max-width: 900px) {
  .wall-grid { grid-template-columns: 1fr; }
  .fab { bottom: calc(84px + env(safe-area-inset-bottom)); right: 16px; width: 54px; height: 54px; }
  .week-grid { grid-template-columns: 1fr; }
  .wk-col { min-height: 0; }
}
.nowrap { white-space: nowrap; }
