/* RV app styles. Colors are tokens on :root; dark mode redefines them. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #eceff4;
  --fg: #1a1f2a;
  --muted: #566070;
  --line: #d9dee7;
  --accent: #1d59d6;
  --accent-fg: #ffffff;
  --accent-soft: #e3ecff;
  --danger: #bf2a2a;
  --danger-soft: #fde7e5;
  --warn: #8a5a00;
  --warn-soft: #fff1cf;
  --ok: #19794a;
  --ok-soft: #dff4e8;
  --info-soft: #e3ecff;
  --shadow: 0 1px 2px rgba(20, 30, 50, .08), 0 4px 14px rgba(20, 30, 50, .06);
  --st0-bg: #e9ecf1; --st0-fg: #3b4453;
  --st1-bg: #e1ecff; --st1-fg: #1c4ba6;
  --st2-bg: #e4f3ea; --st2-fg: #19673f;
  --st3-bg: #fff0d1; --st3-fg: #7a5200;
  --st4-bg: #efe3fb; --st4-fg: #5b2a92;
  --st5-bg: #fde3ea; --st5-fg: #9a2147;
  --scale: 1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --surface: #171b23; --surface2: #212733; --fg: #e8ebf2; --muted: #9ba5b6; --line: #2b3240;
    --accent: #7ba6ff; --accent-fg: #0a1020; --accent-soft: #1b2744;
    --danger: #ff8f86; --danger-soft: #3a1f1f; --warn: #ffd079; --warn-soft: #3a2f14;
    --ok: #6fdba3; --ok-soft: #14301f; --info-soft: #1b2744; --shadow: 0 1px 2px rgba(0, 0, 0, .5);
    --st0-bg: #272d3a; --st0-fg: #b7c0d0;
    --st1-bg: #1b2a4d; --st1-fg: #a9c5ff;
    --st2-bg: #163326; --st2-fg: #9be3bd;
    --st3-bg: #3a2f14; --st3-fg: #ffd584;
    --st4-bg: #2d2142; --st4-fg: #d4b8f7;
    --st5-bg: #3f1d29; --st5-fg: #ffb3c7;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --surface: #171b23; --surface2: #212733; --fg: #e8ebf2; --muted: #9ba5b6; --line: #2b3240;
  --accent: #7ba6ff; --accent-fg: #0a1020; --accent-soft: #1b2744;
  --danger: #ff8f86; --danger-soft: #3a1f1f; --warn: #ffd079; --warn-soft: #3a2f14;
  --ok: #6fdba3; --ok-soft: #14301f; --info-soft: #1b2744; --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --st0-bg: #272d3a; --st0-fg: #b7c0d0;
  --st1-bg: #1b2a4d; --st1-fg: #a9c5ff;
  --st2-bg: #163326; --st2-fg: #9be3bd;
  --st3-bg: #3a2f14; --st3-fg: #ffd584;
  --st4-bg: #2d2142; --st4-fg: #d4b8f7;
  --st5-bg: #3f1d29; --st5-fg: #ffb3c7;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(16px * var(--scale)); }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.icon { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 8px; min-height: 54px;
}
.topbar h1 { font-size: 1.25rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { color: var(--muted); font-size: .8rem; font-weight: 400; display: block; }
.view { width: 100%; max-width: 640px; margin: 0 auto; padding: 14px 16px 120px; flex: 1; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { display: flex; width: 100%; max-width: 640px; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 7px;
  background: none; border: 0; color: var(--muted); font-size: .72rem; min-height: 56px; cursor: pointer; position: relative;
}
.tab[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tab .dot {
  position: absolute; top: 5px; left: calc(50% + 6px); background: var(--danger); color: #fff; border-radius: 9px;
  font-size: .62rem; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 4px; font-weight: 700;
}

.fab {
  position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 25; width: 56px; height: 56px; border-radius: 28px;
  background: var(--accent); color: var(--accent-fg); border: 0; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; cursor: pointer;
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card > h2, .card-head h2 { font-size: 1rem; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.stack > * + * { margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--fg); cursor: pointer; font-weight: 600; text-decoration: none;
}
.btn:active { filter: brightness(.95); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: .9rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.big { min-height: 64px; font-size: 1.05rem; border-radius: 16px; flex-direction: column; gap: 4px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; min-width: 0; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:active { background: var(--surface2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; min-height: 38px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: .9rem; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.chip .n { font-size: .75rem; opacity: .8; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--st0-bg); color: var(--st0-fg); white-space: nowrap; }
.badge[data-s="1"] { background: var(--st1-bg); color: var(--st1-fg); }
.badge[data-s="2"] { background: var(--st2-bg); color: var(--st2-fg); }
.badge[data-s="3"] { background: var(--st3-bg); color: var(--st3-fg); }
.badge[data-s="4"] { background: var(--st4-bg); color: var(--st4-fg); }
.badge[data-s="5"] { background: var(--st5-bg); color: var(--st5-fg); }
.badge.flag-overdue { background: var(--danger-soft); color: var(--danger); }
.badge.flag-soon { background: var(--warn-soft); color: var(--warn); }
.badge.flag-snoozed { background: var(--surface2); color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 8px; }
.group-head { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 2px 2px; }
.row {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 10px 10px 14px; min-height: 60px; cursor: pointer; text-decoration: none; color: inherit;
}
.row:active { background: var(--surface2); }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .line2 { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .line3 { font-size: .78rem; margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row.plain { cursor: default; }
.row.plain:active { background: var(--surface); }
.nhbtn { flex: none; min-width: 52px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--fg); font-weight: 700; font-size: .8rem; cursor: pointer; }
.nhbtn:active { background: var(--accent-soft); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label, .field > .lbl { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .78rem; color: var(--muted); }
input[type=text], input[type=search], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.searchbox { position: relative; }
.searchbox input { padding-left: 38px; }
.searchbox .icon { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.switchrow { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.switchrow .grow { flex: 1; min-width: 0; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 15px; transition: background .15s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .15s; }
.switch input:checked ~ .track { background: var(--accent); }
.switch input:checked ~ .thumb { transform: translateX(20px); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; margin-bottom: 12px; font-size: .92rem; }
.banner .icon { margin-top: 2px; }
.banner .body { flex: 1; min-width: 0; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--info-soft); color: var(--accent); }
.banner button.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: .85rem; margin-top: 4px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; white-space: pre-wrap; }

.tl { list-style: none; margin: 0; padding: 0 0 0 4px; }
.tl li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.tl li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 6px; background: var(--accent); border: 2px solid var(--surface); }
.tl li.nh::before { background: var(--muted); }
.tl li.stage::before { background: var(--ok); }
.tl li.note::before { background: var(--warn); }
.tl .when { font-size: .78rem; color: var(--muted); }
.tl .what { font-weight: 600; font-size: .9rem; }
.tl .txt { white-space: pre-wrap; word-break: break-word; font-size: .92rem; }
.tl .acts { margin-top: 2px; }

.empty { text-align: center; color: var(--muted); padding: 26px 12px; }
.empty .icon { opacity: .6; margin-bottom: 6px; }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 20, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; background: var(--surface); color: var(--fg);
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; font-size: 1.1rem; }
.sheet .actions { display: flex; gap: 10px; margin-top: 8px; position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--surface); padding: 10px 0 2px; }
.sheet .actions .btn { flex: 1; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; min-height: 50px; border-radius: 12px; background: var(--surface2); border: 1px solid transparent; margin-bottom: 8px; cursor: pointer; }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt .sub { color: var(--muted); font-size: .8rem; }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.has-fab .toasts { bottom: calc(136px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; background: #202634; color: #f2f5fa; padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); display: flex; align-items: center; gap: 8px; max-width: 560px; width: 100%; }
.toast .msg { flex: 1; font-size: .92rem; }
.toast button { background: none; border: 0; color: #9fc0ff; font-weight: 700; padding: 8px 8px; min-height: 40px; cursor: pointer; }

.lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 16px; }
.pindots { display: flex; gap: 12px; height: 18px; }
.pindots i { width: 14px; height: 14px; border-radius: 7px; border: 2px solid var(--muted); display: block; }
.pindots i.on { background: var(--fg); border-color: var(--fg); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.keypad button { height: 64px; border-radius: 32px; border: 1px solid var(--line); background: var(--surface); font-size: 1.4rem; cursor: pointer; }
.keypad button:active { background: var(--surface2); }

.setrow { display: flex; align-items: center; gap: 10px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; min-height: 52px; width: 100%; text-align: left; }
.setrow .main { flex: 1; min-width: 0; }
.setrow .sub { color: var(--muted); font-size: .8rem; }
.seg { display: flex; background: var(--surface2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.dayrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.dayrow .chip { padding: 6px 10px; min-height: 36px; }
.window { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; background: var(--surface2); }
.sticky-filters { position: sticky; top: 54px; z-index: 10; background: var(--bg); padding: 10px 0 8px; margin: -14px 0 4px; }
.tag { display: inline-block; background: var(--surface2); border-radius: 8px; padding: 2px 8px; font-size: .78rem; margin: 0 4px 4px 0; color: var(--muted); }
.progress-note { font-size: .8rem; color: var(--muted); }
details.more { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface2); }
details.more summary { padding: 12px 0; cursor: pointer; font-weight: 600; min-height: 44px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
@media (min-width: 700px) { .view { padding-top: 22px; } .sticky-filters { margin-top: -22px; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .switch .track, .switch .thumb { transition: none; } }

/* ---------- version 2: calmer, flatter layout ---------- */
.card { box-shadow: none; }
.tab { font-size: .68rem; }

/* sections without boxes: a small label, then content */
.sec { margin-bottom: 26px; }
.sec-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 10px; }
.sec-head h2 { flex: 1; font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sec-head .count { font-size: .78rem; color: var(--muted); font-weight: 600; }
.sec-actions { display: inline-flex; align-items: center; gap: 4px; }
.iconbtn.sm { width: 32px; height: 32px; border-radius: 10px; color: var(--muted); }
.link-quiet { color: var(--muted); font-size: .82rem; text-decoration: none; padding: 6px 4px; display: inline-block; }
.subhead { font-size: .8rem; font-weight: 600; color: var(--fg); margin: 2px 2px 8px; }
.daygroup { margin-bottom: 14px; }

/* campaign banner: one plain accent bar */
.home { padding-top: 2px; }
.campaign-bar {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); border-radius: 16px; padding: 16px 16px 16px 18px; margin-bottom: 26px;
}
.campaign-bar .cb-text { flex: 1; min-width: 0; }
.cb-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.cb-title { font-size: 1.25rem; font-weight: 700; line-height: 1.2; margin: 2px 0; }
.cb-sub { font-size: .85rem; opacity: .9; }
.campaign-soon {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; color: var(--muted);
  font-size: .88rem; padding: 4px 2px 18px; cursor: pointer;
}

/* topics on Home: plain rows with hairlines */
.plainlist { display: flex; flex-direction: column; }
.prow { text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 2px; cursor: pointer; width: 100%; }
.prow:first-child { border-top: 0; padding-top: 2px; }
.prow:active { background: var(--surface2); }
.prow .pt { font-weight: 600; font-size: 1.02rem; }
.prow .pd { color: var(--muted); font-size: .88rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.readtext { white-space: pre-wrap; word-break: break-word; }
.kvline { margin-bottom: 14px; }
.kvline .k { font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.plainul { margin: 0; padding-left: 18px; }

/* RV detail: who they are and what to bring up, above the buttons */
.household { margin-top: 8px; white-space: pre-wrap; word-break: break-word; font-size: .95rem; }
.snap { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.snap-row { text-align: left; border: 0; width: 100%; border-radius: 12px; padding: 10px 12px; background: var(--surface2); color: inherit; }
button.snap-row { cursor: pointer; }
.snap-row.next { background: var(--accent-soft); }
.snap-k { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.snap-row.next .snap-k { color: var(--accent); }
.snap-v { white-space: pre-wrap; word-break: break-word; }
.snap-v.empty { color: var(--muted); }
.snap-v.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Insights */
.funnel { display: flex; flex-direction: column; gap: 2px; }
.frow { display: grid; grid-template-columns: minmax(96px, 38%) 1fr 34px; gap: 10px; align-items: center; width: 100%; background: none; border: 0; padding: 9px 2px; cursor: pointer; text-align: left; border-radius: 10px; }
.frow:active { background: var(--surface2); }
.fname { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbar { height: 10px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.fbar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.fbar i.f1 { background: var(--st1-fg); } .fbar i.f2 { background: var(--st2-fg); } .fbar i.f3 { background: var(--st3-fg); } .fbar i.f4 { background: var(--st4-fg); } .fbar i.f5 { background: var(--st5-fg); }
.fcount { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.effort .big .num { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.effort .big .unit { color: var(--muted); font-size: .95rem; }
.level { margin-top: 14px; }
.lvl-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.bar { height: 10px; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center; }
.tile .tn { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .tl { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.line3.hint-line { color: var(--accent); }

/* ---------- version 2.1: Nothing-style (monochrome, dot-matrix, one red accent) ---------- */
@font-face { font-family: "Doto"; font-weight: 700; font-display: swap; src: url("../fonts/doto-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url("../fonts/space-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("../fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("../fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }

:root {
  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-dot: "Doto", "Space Mono", ui-monospace, monospace;
  --red: #d71921;
  --bg: #f2f2ef; --surface: #ffffff; --surface2: #e9e9e5; --fg: #0b0b0b; --muted: #6a6a66; --line: #d6d6d1;
  --accent: #0b0b0b; --accent-fg: #ffffff; --accent-soft: #e3e3de;
  --danger: #d71921; --danger-soft: #fbe6e7; --warn: #0b0b0b; --warn-soft: #e9e9e5; --ok: #0b0b0b; --ok-soft: #e9e9e5; --info-soft: #e9e9e5;
  --st0-bg: #e9e9e5; --st0-fg: #3a3a38; --st1-bg: #e9e9e5; --st1-fg: #0b0b0b; --st2-bg: #e9e9e5; --st2-fg: #0b0b0b;
  --st3-bg: #e9e9e5; --st3-fg: #0b0b0b; --st4-bg: #e9e9e5; --st4-fg: #0b0b0b; --st5-bg: #e9e9e5; --st5-fg: #0b0b0b;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #ff2d37;
    --bg: #000000; --surface: #111111; --surface2: #1b1b1b; --fg: #f4f4f1; --muted: #8d8d89; --line: #2a2a28;
    --accent: #f4f4f1; --accent-fg: #000000; --accent-soft: #222220;
    --danger: #ff4d55; --danger-soft: #2a1011; --warn: #f4f4f1; --warn-soft: #1b1b1b; --ok: #f4f4f1; --ok-soft: #1b1b1b; --info-soft: #1b1b1b;
    --st0-bg: #1b1b1b; --st0-fg: #b8b8b4; --st1-bg: #1b1b1b; --st1-fg: #f4f4f1; --st2-bg: #1b1b1b; --st2-fg: #f4f4f1;
    --st3-bg: #1b1b1b; --st3-fg: #f4f4f1; --st4-bg: #1b1b1b; --st4-fg: #f4f4f1; --st5-bg: #1b1b1b; --st5-fg: #f4f4f1;
  }
}
:root[data-theme="dark"] {
  --red: #ff2d37;
  --bg: #000000; --surface: #111111; --surface2: #1b1b1b; --fg: #f4f4f1; --muted: #8d8d89; --line: #2a2a28;
  --accent: #f4f4f1; --accent-fg: #000000; --accent-soft: #222220;
  --danger: #ff4d55; --danger-soft: #2a1011; --warn: #f4f4f1; --warn-soft: #1b1b1b; --ok: #f4f4f1; --ok-soft: #1b1b1b; --info-soft: #1b1b1b;
  --st0-bg: #1b1b1b; --st0-fg: #b8b8b4; --st1-bg: #1b1b1b; --st1-fg: #f4f4f1; --st2-bg: #1b1b1b; --st2-fg: #f4f4f1;
  --st3-bg: #1b1b1b; --st3-fg: #f4f4f1; --st4-bg: #1b1b1b; --st4-fg: #f4f4f1; --st5-bg: #1b1b1b; --st5-fg: #f4f4f1;
}

body { font-family: var(--font-ui); letter-spacing: .005em; }
.icon { stroke-width: 1.5; }
a { color: var(--fg); text-decoration-color: var(--red); text-underline-offset: 3px; }

/* mono labels */
.group-head, .sec-head h2, .snap-k, .kvline .k, .cb-label, .tab, .badge, .tl .when, .tile .tl, .field > label, .field > .lbl, .chip .n, .fname + *, .seg button, .nhbtn {
  font-family: var(--font-mono);
}
.group-head, .sec-head h2, .snap-k, .kvline .k, .cb-label { text-transform: uppercase; letter-spacing: .09em; font-weight: 400; font-size: .7rem; }
.field > label, .field > .lbl { font-weight: 400; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }

/* dot-matrix display type */
.topbar h1 { font-family: var(--font-dot); font-weight: 700; font-size: 1.6rem; letter-spacing: .01em; }
.topbar .sub { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.cb-title, .effort .big .num, .tile .tn, .fcount, .lvl-row strong { font-family: var(--font-dot); font-weight: 700; }
.cb-title { font-size: 1.55rem; }
.effort .big .num { font-size: 3.2rem; }
.tile .tn { font-size: 2rem; }
.fcount { font-size: 1.15rem; }

/* surfaces */
.topbar { border-bottom: 0; background: var(--bg); }
.card, .row, .setrow, .tile { border-radius: 22px; box-shadow: none; }
.row { padding: 12px 12px 12px 18px; }
.setrow { padding: 14px 16px; }
input[type=text], input[type=search], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], input[type=url], select, textarea { border-radius: 16px; background: var(--surface); }
.sheet { border-radius: 28px 28px 0 0; }
.overlay { background: rgba(0, 0, 0, .6); }
details.more, .window, .snap-row, .opt { border-radius: 18px; }

/* buttons: pills, black on white */
.btn { border-radius: 999px; font-weight: 500; background: var(--surface); border: 1px solid var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn.ghost { color: var(--fg); }
.btn.sm { border-radius: 999px; }
.btn.big { border-radius: 24px; }
.iconbtn { border-radius: 999px; }
.nhbtn { border-radius: 999px; font-size: .72rem; }
.chip { border-radius: 999px; color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 500; }
.badge { background: transparent; color: var(--fg); border: 1px solid var(--line); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; padding: 2px 9px; }
.badge[data-s] { background: transparent; color: var(--fg); }
.badge.flag-overdue { color: var(--red); border-color: var(--red); background: transparent; }
.badge.flag-soon { color: var(--fg); border-color: var(--fg); background: transparent; }
.badge.flag-snoozed { color: var(--muted); background: transparent; }
.tag { border-radius: 999px; font-family: var(--font-mono); font-size: .7rem; }
.seg { border-radius: 999px; background: var(--surface2); }
.seg button { border-radius: 999px; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.opt[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.opt[aria-pressed="true"] .sub { color: inherit; opacity: .7; }
input:focus, select:focus, textarea:focus, button:focus-visible, .row:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* switch */
.switch .track { background: var(--surface2); border: 1px solid var(--line); }
.switch .thumb { background: var(--muted); box-shadow: none; }
.switch input:checked ~ .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked ~ .thumb { background: var(--red); }
.check input { accent-color: var(--fg); }

/* banners: outlined, no tinted fills */
.banner { border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.banner.warn, .banner.info { background: var(--surface); color: var(--fg); }
.banner.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* nav */
.tabbar { background: var(--bg); border-top: 1px solid var(--line); }
.tab { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; }
.tab[aria-current="page"] { color: var(--fg); font-weight: 400; }
.tab[aria-current="page"]::after { content: ""; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.tab .dot { background: var(--red); font-family: var(--font-mono); }
.fab { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.fab::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* campaign bar: solid black (or white in dark) with a live red dot */
.campaign-bar { border-radius: 26px; background: var(--accent); color: var(--accent-fg); position: relative; }
.cb-label::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: 1px; }
.cb-label { opacity: .75; }
.campaign-soon { color: var(--muted); font-family: var(--font-mono); font-size: .78rem; }

/* snapshots on RV detail */
.snap-row.next { background: var(--surface); border: 1px solid var(--fg); }
.snap-row.next .snap-k { color: var(--red); }
.line3.hint-line { color: var(--red); }

/* dot-row funnel and level bar */
.fbar, .bar { height: 8px; background: radial-gradient(circle, var(--line) 38%, transparent 42%) 0 0 / 8px 8px repeat-x; border-radius: 0; overflow: hidden; }
.fbar i, .bar i { height: 8px; border-radius: 0; background: radial-gradient(circle, var(--fg) 38%, transparent 42%) 0 0 / 8px 8px repeat-x; }
.fbar i.f1, .fbar i.f2, .fbar i.f3, .fbar i.f4 { background: radial-gradient(circle, var(--fg) 38%, transparent 42%) 0 0 / 8px 8px repeat-x; }
.fbar i.f5 { background: radial-gradient(circle, var(--red) 38%, transparent 42%) 0 0 / 8px 8px repeat-x; }
.bar i { background: radial-gradient(circle, var(--red) 38%, transparent 42%) 0 0 / 8px 8px repeat-x; }
.effort .big .unit { font-family: var(--font-mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }

/* timeline dots */
.tl li::before { background: var(--fg); border-color: var(--bg); }
.tl li.nh::before { background: transparent; border: 2px solid var(--muted); }
.tl li.stage::before { background: var(--red); }
.tl li.note::before { background: var(--muted); }
.tl .what { font-weight: 500; }

/* lock */
.pindots i { border-color: var(--fg); }
.pindots i.on { background: var(--red); border-color: var(--red); }
.keypad button { font-family: var(--font-dot); font-weight: 700; font-size: 1.6rem; background: transparent; }
.lock h2 { font-family: var(--font-dot); font-size: 1.8rem; }
.toast { background: var(--fg); color: var(--bg); border-radius: 999px; padding-left: 20px; }
.toast button { color: var(--bg); text-decoration: underline; text-decoration-color: var(--red); }
.prow .pt { font-weight: 500; }
.empty { font-family: var(--font-mono); font-size: .8rem; }
.btn-row > .btn.sm { padding: 4px 6px; gap: 5px; font-size: .84rem; white-space: nowrap; }
.btn-row > .btn.sm .icon { width: 16px; height: 16px; }
a.setrow, a.row, a.btn, .tab, .campaign-bar, a.prow { text-decoration: none; }

/* study stage */
.snap-row.study { background: var(--surface); border: 1px solid var(--fg); }
.snap-row.study .snap-k { color: var(--fg); }
.snap-v.study-pub { font-weight: 700; font-size: 1.1rem; }

/* ---------- version 2.3: comfort pass ----------
   Fewer outlines, one grouped surface per list, sentence-case labels, readable names.
   The dot-matrix face is kept only for tab titles and big numbers. */
:root {
  --bg: #efefed; --surface: #ffffff; --surface2: #f1f1ef; --fg: #161616; --muted: #62625f;
  --line: #e4e4e1; --line-strong: #cfcfcb; --accent-soft: #ebebe8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0b0b0b; --surface: #161616; --surface2: #202020; --fg: #f2f2ef; --muted: #9a9a96; --line: #262626; --line-strong: #3b3b3b; --accent-soft: #262626; }
}
:root[data-theme="dark"] { --bg: #0b0b0b; --surface: #161616; --surface2: #202020; --fg: #f2f2ef; --muted: #9a9a96; --line: #262626; --line-strong: #3b3b3b; --accent-soft: #262626; }

body { font-size: 1rem; line-height: 1.45; letter-spacing: 0; -webkit-font-smoothing: antialiased; }
.view { padding-top: 8px; }
.muted { font-size: .9rem; }
.small { font-size: .875rem; }

/* every small label: sentence case, readable size, no mono */
.group-head, .sec-head h2, .snap-k, .kvline .k, .cb-label, .tab, .badge, .tl .when, .tile .tl, .field > label, .field > .lbl, .chip .n, .seg button, .nhbtn, .topbar .sub, .empty {
  font-family: var(--font-ui); text-transform: none; letter-spacing: 0;
}
.group-head { font-size: .9rem; font-weight: 500; color: var(--muted); margin: 22px 4px 8px; }
.sec { margin-bottom: 30px; }
.sec-head { margin: 0 4px 12px; }
.sec-head h2 { font-size: 1.05rem; font-weight: 600; color: var(--fg); }
.field > label, .field > .lbl { font-size: .875rem; font-weight: 500; color: var(--muted); }
.snap-k, .kvline .k { font-size: .85rem; font-weight: 500; color: var(--muted); }
.topbar .sub { font-size: .85rem; color: var(--muted); }

/* header */
.topbar { padding: 14px 20px 6px; min-height: 64px; background: var(--bg); }
.topbar h1 { font-family: var(--font-dot); font-size: 1.9rem; }
.topbar.sub-page h1 { font-family: var(--font-ui); font-weight: 600; font-size: 1.3rem; }
.topbar .sub { font-size: .85rem; margin-top: 2px; }

/* surfaces: no outlines, one radius family */
.card, .banner, .tile, .setrow, details.more { border: 0; border-radius: 20px; background: var(--surface); }
.card { padding: 18px; margin-bottom: 14px; }
details.more { background: var(--surface2); border-radius: 16px; }
details.more[open] summary { border-bottom-color: var(--line-strong); }
.card details.more, .sheet details.more { background: var(--surface2); }
.setrow { padding: 15px 18px; margin-bottom: 8px; }
.setrow:active, .row:active { background: var(--surface2); }

/* lists: one grouped surface, hairline dividers */
.list { gap: 0; background: var(--surface); border-radius: 20px; overflow: hidden; }
.list > .row, .list > button.row { border: 0; border-radius: 0; background: transparent; border-top: 1px solid var(--line); }
.list > .row:first-child { border-top: 0; }
.row { padding: 14px 12px 14px 18px; min-height: 68px; border: 0; border-radius: 20px; background: var(--surface); }
.row .name { font-size: 1.05rem; font-weight: 600; }
.row .line2 { font-size: .9rem; margin-top: 1px; }
.row .line3 { margin-top: 6px; gap: 10px; font-size: .85rem; }
.nhbtn { min-width: 52px; height: 48px; border: 0; background: var(--surface2); font-size: .85rem; font-weight: 600; }
.nhbtn:active { background: var(--line); }
.list .nhbtn { background: var(--surface2); }

/* stage: five pips show where someone is in the funnel */
.badge, .badge[data-s] { border: 0; background: transparent; padding: 0; color: var(--fg); font-size: .85rem; font-weight: 500; display: inline-flex; align-items: center; }
.pips { position: relative; display: inline-block; width: calc(var(--t) * 9px); height: 9px; margin-right: 8px; background: radial-gradient(circle, var(--line-strong) 38%, transparent 44%) 0 0 / 9px 9px repeat-x; }
.pips::after { content: ""; position: absolute; left: 0; top: 0; height: 9px; width: calc(var(--n) * 9px); background: radial-gradient(circle, var(--fg) 38%, transparent 44%) 0 0 / 9px 9px repeat-x; }
.badge.flag-overdue { background: var(--danger-soft); color: var(--danger); padding: 2px 10px; border-radius: 999px; font-weight: 500; }
.badge.flag-soon { background: var(--surface2); color: var(--fg); padding: 2px 10px; border-radius: 999px; }
.badge.flag-snoozed { background: transparent; color: var(--muted); padding: 0; }
.list .badge.flag-soon { background: var(--surface2); }

/* buttons: filled, no outlines. Black is for the one main action */
.btn { border: 0; background: var(--surface2); font-weight: 500; min-height: 48px; padding: 8px 20px; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--fg); }
.btn.sm { min-height: 40px; padding: 4px 14px; font-weight: 500; }
.btn.big { min-height: 64px; border-radius: 22px; font-size: 1rem; }
.btn-row { gap: 10px; }
.btn-row > .btn.sm { padding: 4px 8px; gap: 6px; font-size: .875rem; }
.page-actions .btn, .sheet .actions .btn { min-height: 52px; }
.card .btn:not(.primary):not(.danger):not(.ghost), .sheet .btn:not(.primary):not(.danger):not(.ghost) { background: var(--surface2); }
.iconbtn { width: 48px; height: 48px; }

/* chips and inputs: filled, soft */
.chip { border: 0; background: var(--surface); color: var(--fg); min-height: 40px; padding: 8px 16px; font-size: .95rem; }
.card .chip, .sheet .chip { background: var(--surface2); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 500; }
input[type=text], input[type=search], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], input[type=url], input[type=datetime-local], select, textarea {
  border: 0; border-radius: 14px; background: var(--surface); min-height: 48px; padding: 11px 14px;
}
.card input, .card select, .card textarea, .sheet input[type=text], .sheet input[type=search], .sheet input[type=tel], .sheet input[type=date], .sheet input[type=time], .sheet input[type=number], .sheet input[type=password], .sheet input[type=datetime-local], .sheet select, .sheet textarea { background: var(--surface2); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--fg); outline-offset: 0; }
.field { gap: 6px; margin-bottom: 14px; }
.seg { background: var(--surface2); }
.seg button { font-size: .9rem; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.opt { background: var(--surface2); border: 0; border-radius: 16px; }
.opt[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

/* sheets and toasts */
.sheet { border-radius: 28px 28px 0 0; padding-top: 12px; }
.sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet-head h2 { font-size: 1.2rem; font-weight: 600; }
.toast { border-radius: 18px; padding: 12px 12px 12px 18px; }

/* banners */
.banner { background: var(--surface); padding: 14px 16px; }
.banner.warn, .banner.info { background: var(--surface); }
.banner.danger { background: var(--danger-soft); }

/* navigation: sentence-case labels, a soft pill behind the active icon */
.tabbar { background: var(--surface); border-top: 0; box-shadow: 0 -1px 0 var(--line); }
.tab { font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; min-height: 60px; padding-top: 10px; color: var(--muted); }
.tab::before { content: ""; position: absolute; top: 8px; left: 50%; width: 58px; height: 32px; margin-left: -29px; border-radius: 16px; background: transparent; }
.tab .icon { position: relative; }
.tab[aria-current="page"] { color: var(--fg); font-weight: 600; }
.tab[aria-current="page"]::before { background: var(--surface2); }
.tab[aria-current="page"]::after { content: none; }
.tab .dot { z-index: 2; left: calc(50% + 8px); top: 6px; font-family: var(--font-ui); }
.fab::after { content: none; }

/* Home: the campaign bar is the one bold element */
.campaign-bar { padding: 20px 20px 20px 22px; border-radius: 28px; margin-bottom: 28px; }
.cb-label { font-size: .85rem; font-weight: 500; opacity: .8; }
.cb-title { font-size: 1.7rem; line-height: 1.15; margin: 4px 0 6px; }
.cb-sub { font-size: .95rem; opacity: .85; }
.prow { padding: 16px 4px; }
.prow .pt { font-size: 1.05rem; font-weight: 600; }
.prow .pd { font-size: .95rem; margin-top: 3px; }
.plainlist { background: var(--surface); border-radius: 20px; padding: 4px 16px; }
.prow:first-child { padding-top: 14px; }
.prow:last-child { padding-bottom: 14px; }

/* record detail */
.snap { gap: 10px; margin-top: 14px; }
.snap-row { background: var(--surface2); border: 0; border-radius: 16px; padding: 14px 16px; }
.snap-row.next { background: var(--surface2); border: 0; }
.snap-row.next .snap-k { color: var(--muted); }
.snap-row.next .snap-k::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: 1px; }
.snap-v { font-size: 1rem; line-height: 1.45; }
.snap-row.study { background: var(--fg); color: var(--bg); border: 0; }
.snap-row.study .snap-k { color: var(--bg); opacity: .7; }
.snap-v.study-pub { font-size: 1.3rem; font-weight: 600; line-height: 1.25; margin: 2px 0 4px; }
.snap-row.study .snap-v.empty { color: var(--bg); opacity: .7; }
.household { font-size: 1rem; color: var(--fg); margin-top: 10px; }
.kv { grid-template-columns: 112px 1fr; gap: 12px 12px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.card-head h2 { font-size: 1.1rem; font-weight: 600; }
.tl li { padding-bottom: 18px; }
.tl .what { font-size: 1rem; font-weight: 600; }
.tl .when { font-size: .85rem; }
.tl .txt { margin-top: 2px; }
.tl .acts { margin-top: 4px; display: flex; gap: 4px; }
.tl .acts .btn.ghost.sm { min-height: 36px; padding: 0 12px 0 0; color: var(--muted); font-size: .875rem; }
.tl li::before { background: var(--fg); border-color: var(--surface); }
.tl li.nh::before { background: var(--surface); border: 2px solid var(--muted); }

/* insights */
.tile { padding: 16px 10px; }
.tile .tn { font-size: 2.2rem; }
.tile .tl { font-size: .85rem; margin-top: 4px; }
.effort .big .unit { font-size: .95rem; text-transform: none; letter-spacing: 0; font-family: var(--font-ui); }
.effort .big .num { font-size: 3.4rem; }
.frow { padding: 12px 4px; }
.fname { font-size: 1rem; }
.fcount { font-size: 1.2rem; }

/* lock and misc */
.empty { font-size: .95rem; padding: 32px 16px; }
.keypad button { background: var(--surface); border: 0; }
.link-quiet { font-size: .9rem; }
a.setrow, a.row, a.btn, .tab, .campaign-bar, a.prow { text-decoration: none; }
.btn { background: var(--surface); }
.tab { isolation: isolate; }
.tab::before { z-index: -1; }
.btn-row > .btn.sm { gap: 4px; padding: 4px 4px; font-size: .84rem; }
.btn-row > .btn.sm .icon { width: 15px; height: 15px; }

/* v2.4: compact header, menu drawer */
.topbar { padding: 6px 8px 2px 18px; min-height: 48px; gap: 4px; }
.topbar.sub-page { padding-left: 4px; }
.topbar h1 { font-size: 1.5rem; display: flex; align-items: baseline; gap: 10px; }
.topbar.sub-page h1 { font-size: 1.15rem; }
.topbar .sub { display: inline; margin: 0; font-size: .8rem; }
.topbar .iconbtn { width: 44px; height: 44px; }
.view { padding-top: 4px; }
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.4); display: flex; justify-content: flex-end; }
.drawer-panel { width: min(320px, 86vw); height: 100%; overflow-y: auto; background: var(--bg); padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 4px 8px; }
.drawer-head h2 { font-family: var(--font-dot); font-size: 1.5rem; }
.drawer-item { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 14px; border-radius: 14px; color: var(--fg); text-decoration: none; font-size: 1rem; font-weight: 500; }
.drawer-item:active { background: var(--surface2); }
.no-scroll { overflow: hidden; }
.sticky-filters { top: 49px; padding: 6px 0 6px; margin: -6px 0 2px; }
.sticky-filters input[type=search] { min-height: 44px; padding-left: 40px; }
.searchbox .icon { top: 50%; margin-top: -9px; }
.sticky-filters .chip { min-height: 34px; padding: 4px 13px; font-size: .88rem; }
.sticky-filters select { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.sticky-filters .nhbtn, .sticky-filters .iconbtn { min-height: 40px; height: 40px; }
.row { padding: 10px 10px 10px 16px; min-height: 0; }
.row .name { font-size: 1rem; }
.row .line2 { font-size: .86rem; margin-top: 0; }
.row .line3 { margin-top: 4px; gap: 2px 10px; font-size: .8rem; flex-wrap: wrap; align-items: center; }
.row .badge { font-size: .8rem; }
.row .badge.flag-overdue, .row .badge.flag-soon { padding: 1px 8px; }
.nhbtn { min-width: 46px; height: 42px; }
.list .group-head, .list > .group-head { padding: 10px 16px 4px; }
.group-head { margin: 12px 4px 4px; font-size: .8rem; }
.list .group-head { margin: 0; padding: 10px 16px 4px; }

/* v2.5: row actions, quick log, folded details */
.row-acts { display: flex; gap: 6px; flex: none; align-items: center; }
.navbtn { width: 44px; height: 44px; border: 0; border-radius: 999px; background: var(--surface2); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.navbtn:active { background: var(--line); }
.stagebtn { display: inline-flex; padding: 6px 0; cursor: pointer; }
.quicklog { gap: 8px; }
.quicklog .chip { min-height: 38px; font-size: .9rem; }
details.fold { padding: 14px 18px; }
details.fold summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; min-height: 28px; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary h2 { font-size: 1.1rem; font-weight: 600; }
details.fold[open] summary .icon { transform: rotate(180deg); }
.btn-row > .btn.sm { padding: 4px 10px; flex: 1 1 auto; justify-content: center; }
.btn-row:has(.btn.sm) { flex-wrap: wrap; gap: 8px; }

/* v2.7: more room, best day on rows, Today split, full-screen note */
.view { padding-left: 12px; padding-right: 12px; }
.card { padding: 14px; }
.topbar { padding-left: 14px; }
input[type=text], input[type=search], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], input[type=url], input[type=datetime-local], select { min-height: 44px; }
.field { margin-bottom: 12px; }
.sheet { padding-left: 14px; padding-right: 14px; }

/* record detail: note blocks sit on the card with dividers, not in boxes inside it */
.card .snap { gap: 0; margin-top: 10px; }
.card .snap-row, .card .snap-row.next { background: transparent; border-radius: 0; padding: 10px 0; border-top: 1px solid var(--line); }
.card .snap-row.study { background: var(--fg); border-radius: 16px; padding: 12px 14px; border-top: 0; margin-bottom: 4px; }
.card .snap-row.next:active { background: var(--surface2); }

/* list rows: smaller side buttons, best day label */
.navbtn { width: 40px; height: 40px; }
.row-acts .nhbtn { height: 40px; min-width: 44px; }
.row-acts { gap: 4px; }
.row { padding-right: 8px; }
.besttag { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 500; color: var(--fg); }
.besttag .icon { color: var(--muted); }
.besttag.none { color: var(--muted); font-weight: 400; }

/* Today */
.now-pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 600; vertical-align: 1px; }
details.fold-sec > summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; }
details.fold-sec > summary::-webkit-details-marker { display: none; }
details.fold-sec > summary h2 { flex: 0 1 auto; }
details.fold-sec > summary .icon { margin-left: auto; color: var(--muted); }
details.fold-sec[open] > summary .icon { transform: rotate(180deg); }

/* detail: one-tap log reads as buttons, with a label */
.quicklog { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ql-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.quicklog .btn.ql { min-height: 38px; padding: 4px 12px; gap: 4px; font-size: .9rem; background: var(--surface2); }

/* visit note: full-screen writing view */
.note-field .show-fields { display: none; }
.overlay:has(.sheet.writing) { align-items: flex-start; }
.sheet.writing { position: fixed; left: 0; right: 0; margin: 0 auto; top: var(--vvt, 0); height: var(--vvh, 100dvh); max-height: none; border-radius: 0; display: flex; flex-direction: column; overflow: hidden; animation: none; padding-top: 8px; }
.sheet.writing::before { display: none; }
.sheet.writing > form { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sheet.writing > form > *:not(.note-field):not(.actions) { display: none !important; }
.sheet.writing .note-field { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
.sheet.writing .note-field textarea { flex: 1; min-height: 0; height: auto; resize: none; font-size: 1.05rem; line-height: 1.5; }
.sheet.writing .note-field .show-fields { display: block; align-self: flex-start; padding: 10px 2px 4px; color: var(--muted); font-size: .9rem; }
.sheet.writing .actions { position: static; margin-top: 4px; }
.note-field .show-fields { background: none; border: 0; cursor: pointer; text-decoration: underline; font: inherit; }
.ql-label { flex-basis: 100%; margin-bottom: -2px; }
.quicklog .btn.ql { flex: 1; justify-content: center; }
/* notes show in full on the record screen, keeping line breaks */
.snap-v, .tl .txt, .household { white-space: pre-wrap; overflow-wrap: anywhere; }

/* v2.7.2: small toasts, bottom-left, clear of the + button */
.toasts, .has-fab .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); align-items: flex-start; padding: 0 84px 0 12px; }
.toast { width: auto; max-width: 100%; min-height: 0; padding: 4px 4px 4px 14px; border-radius: 999px; gap: 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.toast .msg { font-size: .84rem; cursor: pointer; }
.toast button { min-height: 32px; padding: 4px 10px; font-size: .84rem; }

/* v2.8: accent is purple (default) or blue instead of red; warnings are a muted amber.
   --red is kept as the accent token's name so older rules pick it up. */
:root[data-accent="purple"] { --red: #5b3e96; --accent-soft: #ece7f6; --danger: #8a5300; --danger-soft: #f8ecd9; }
:root[data-accent="blue"] { --red: #2f5fa8; --accent-soft: #e3ebf7; --danger: #8a5300; --danger-soft: #f8ecd9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-accent="purple"] { --red: #b9a2ee; --accent-soft: #272036; --danger: #f2bd69; --danger-soft: #30250f; }
  :root:not([data-theme="light"])[data-accent="blue"] { --red: #8db2ee; --accent-soft: #1b2535; --danger: #f2bd69; --danger-soft: #30250f; }
}
:root[data-theme="dark"][data-accent="purple"] { --red: #b9a2ee; --accent-soft: #272036; --danger: #f2bd69; --danger-soft: #30250f; }
:root[data-theme="dark"][data-accent="blue"] { --red: #8db2ee; --accent-soft: #1b2535; --danger: #f2bd69; --danger-soft: #30250f; }
.badge.flag-overdue { background: var(--accent-soft); color: var(--red); }
.tab .dot { background: var(--red); color: var(--bg); }

/* row buttons: Log NH over Map in one column at the right edge */
.row-acts { flex-direction: column; gap: 8px; align-items: stretch; width: 64px; }
.row-acts .nhbtn { width: 64px; min-width: 64px; height: 36px; padding: 0 6px; font-size: .78rem; border-radius: 999px; }
.navbtn { width: 64px; height: 36px; gap: 4px; font-size: .78rem; font-weight: 600; border-radius: 999px; }

/* best days picker */
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.daypick .chip { min-height: 40px; padding: 0; justify-content: center; font-size: .82rem; }

/* study block lines */
.study-line { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; }
.study-line .snap-k { min-width: 92px; }
.area-row { width: 100%; text-align: left; cursor: pointer; }
.area-row + .area-row { border-top: 1px solid var(--line); }
.dup-hint { color: var(--red); font-weight: 500; }
.field > .list + .btn { margin-top: 10px; }
.list + .btn.sm { margin-top: 10px; }

/* v2.9: New RV form, More details */
.more-btn { width: 100%; justify-content: center; color: var(--muted); margin: 2px 0 6px; }
.more-fields { animation: up .15s ease-out; }
