/* Nabzo: calm, warm, high-contrast. No gradients, no purple. */
:root {
  --bg: #F5F4EF;
  --bg-outer: #ECEAE3;
  --card: #FFFFFF;
  --line: #E4E2DA;
  --line2: #ECEAE3;
  --text: #17191C;
  --muted: #5A6068;
  --accent: #0B6B63;
  --accent-h: #08524C;
  --accent-soft: #E3F1EE;
  --on-accent: #FFFFFF;
  --good: #1C7A4A;
  --good-soft: #E4F3EA;
  --warn: #A24E00;
  --warn-soft: #FCEFE1;
  --bad: #B3261E;
  --bad-soft: #FBE9E7;
  --info: #22577A;
  --info-soft: #E5EEF5;
  --chip: #EDEBE4;
  --dash: #CFCBBF;
  --shadow: 0 1px 2px rgba(23, 25, 28, .05);
  --r-lg: 20px;
  --r-md: 16px;
  --r-sm: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-d: "Space Grotesk", Inter, system-ui, sans-serif;
  --nav-h: 66px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315;
    --bg-outer: #0B0C0D;
    --card: #1A1D20;
    --line: #2A2E33;
    --line2: #24282C;
    --text: #ECEDEE;
    --muted: #A1A7AE;
    --accent: #3FB5A8;
    --accent-h: #5CC7BB;
    --accent-soft: #15332F;
    --on-accent: #062B27;
    --good: #4CC38A;
    --good-soft: #15301F;
    --warn: #F0A24B;
    --warn-soft: #3A2A14;
    --bad: #FF8A80;
    --bad-soft: #3D1A17;
    --info: #8CC3E8;
    --info-soft: #17283A;
    --chip: #262A2F;
    --dash: #3A3F45;
    --shadow: none;
    color-scheme: dark;
  }
}

/* Drive mode is always dark: easier on the eyes at night, less glare. */
body.drive-mode {
  --bg: #0B0C0D;
  --card: #16191C;
  --line: #2A2E33;
  --text: #F2F3F4;
  --muted: #A1A7AE;
  --accent: #3FB5A8;
  --on-accent: #062B27;
  --good: #4CC38A;
  --warn: #F0A24B;
  --bad: #FF8A80;
  --chip: #262A2F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 640px) {
  body { background: var(--bg-outer); }
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
body.drive-mode { background: var(--bg); }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--bg); position: relative; }
.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}
.screen.no-nav { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

h1 { font: 700 27px/1.15 var(--font-d); letter-spacing: -0.01em; margin: 0; }
h1:focus { outline: none; }
h2 { margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
b { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.block { display: block; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.num { font-family: var(--font-d); font-variant-numeric: tabular-nums; }
.label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
h2.label { margin: 8px 2px -4px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.pad { padding: 12px 0 4px; }
svg.i { flex: none; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.tb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-name { font: 700 21px/1.2 var(--font-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sub { font-size: 13px; color: var(--muted); }
.back {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding-right: 8px;
  font-weight: 600; font-size: 15.5px; text-decoration: none; color: var(--accent);
}

/* ---------- connection pill ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 36px; padding: 0 13px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: 600 13.5px var(--font); cursor: pointer;
}
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dash); }
.pill-good { background: var(--good-soft); border-color: transparent; color: var(--good); }
.pill-good .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.pill-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pill-warn .dot { background: var(--warn); }
.pill-info { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.pill-idle { color: var(--muted); }

.spinner {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 3px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
  animation: spin .8s linear infinite; color: var(--accent);
}
.spinner.sm { width: 15px; height: 15px; border-width: 2.5px; }
.pill .spinner { color: inherit; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  min-height: 52px; padding: 0 20px; border-radius: 26px; border: 1px solid transparent;
  font: 700 16px var(--font); text-decoration: none; cursor: pointer; text-align: center;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--dash); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--accent); min-height: 46px; }
.btn-danger { background: var(--bad); color: #fff; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-mini {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 14px;
  border-radius: 20px; border: 1px solid var(--dash); background: var(--card); color: var(--text);
  font: 600 14px var(--font); cursor: pointer;
}
.btn-mini.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-mini:disabled { opacity: .45; cursor: default; }
.btn-mini.busy svg { animation: spin .8s linear infinite; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border-radius: 22px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.link-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--card);
  color: var(--text); font: 600 15px var(--font); text-decoration: none; cursor: pointer; text-align: left;
}
.link-row > span { flex: 1; }
.link-row > svg:first-child { color: var(--accent); }
.link-row > svg:last-child { color: var(--muted); }
.link-row.in { border: 0; border-radius: 0; padding: 0; border-bottom: 1px solid var(--line2); }
.link-row.in:last-child { border-bottom: 0; }
.cta { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.sticky-cta { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 2; }
.sticky-cta .btn { box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 180px; }
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.card-title { font: 700 18px/1.25 var(--font-d); margin: 0 0 6px; }
.card.list { padding: 0 16px; }
.card-warn { background: var(--warn-soft); border-color: transparent; }
.note-card { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 14.5px; }
.note-card > svg { color: var(--accent); margin-top: 1px; }
.note-card b { color: var(--text); }
.tip-card { display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
.tip-badge { align-self: flex-start; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 8px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 20px; }
.empty .btn { margin-top: 8px; }
.cc-icon { width: 56px; height: 56px; border-radius: 28px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.cc-icon.sm { width: 44px; height: 44px; }
.connect-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.connect-card .btn { margin-top: 6px; }
.connect-card.row { flex-direction: row; align-items: center; text-decoration: none; color: var(--text); }
.connect-card.row > svg:last-child { color: var(--muted); }
.install-card .grow b { display: block; }
.week-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.week-card > svg { color: var(--muted); }
.week-main { display: block; margin: 2px 0; }
.week-main .big { font-size: 28px; font-weight: 700; }
.detected { display: flex; align-items: center; gap: 12px; }
.detected > svg { color: var(--accent); }
.detected b { display: block; }
.art-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; }
.art { display: block; width: 100%; height: auto; }
.callout { background: var(--accent-soft); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.callout .art { max-width: 300px; margin: 0 auto; }
.option-card { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.option-card b { display: block; }
.option-card span { color: var(--muted); font-size: 14.5px; }
.opt-icon { width: 36px; height: 36px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------- status and banners ---------- */
.status { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); border-color: transparent; }
.status > svg:last-child { color: var(--muted); }
.status-icon { width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; flex: none; }
.status-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.status-title { font: 700 19px/1.25 var(--font-d); }
.status-sub { font-size: 14.5px; color: var(--muted); }
.status-when { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.status-good { background: var(--good-soft); }
.status-good .status-icon { background: var(--good); color: #fff; }
.status-warn { background: var(--warn-soft); }
.status-warn .status-icon { background: var(--warn); color: #fff; }
.status-bad { background: var(--bad-soft); }
.status-bad .status-icon { background: var(--bad); color: #fff; }
.status-info { background: var(--accent-soft); }
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border-radius: var(--r-md); font-size: 14.5px; }
.banner b { display: block; }
.b-icon { flex: none; margin-top: 1px; }
.banner-warn { background: var(--warn-soft); }
.banner-warn .b-icon { color: var(--warn); }
.banner-info { background: var(--accent-soft); align-items: center; }
.banner-info .b-icon { color: var(--accent); }

/* ---------- live tiles ---------- */
.live { display: flex; flex-direction: column; gap: 10px; }
.hero-grid, .tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile-grid.one { grid-template-columns: 1fr; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 104px; }
.tile-big { min-height: 124px; }
.tl { font-size: 13px; font-weight: 600; color: var(--muted); }
.tv-row { display: flex; align-items: baseline; gap: 5px; }
.tv { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tile-big .tv { font-size: 40px; }
.tu { font-size: 14px; color: var(--muted); font-weight: 600; }
.ts { font-size: 13px; font-weight: 600; min-height: 18px; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin-top: 2px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .35s ease; }
.bar.lg { height: 8px; }
.tone-good { color: var(--good); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }
.tone-info { color: var(--info); }
.tone-muted, .tone-none, .tone-unknown { color: var(--muted); }

/* ---------- this trip ---------- */
.trip-card { display: flex; flex-direction: column; gap: 10px; }
.trip-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trip-stats > div { display: flex; flex-direction: column; }
.trip-stats .big { font-size: 26px; font-weight: 700; line-height: 1.15; }
.trip-stats .u { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- step headers and lists ---------- */
.step-head { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.step { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.step-icon { width: 52px; height: 52px; border-radius: 26px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.step-icon.tone-warn { background: var(--warn-soft); }
.step-icon.tone-info { background: var(--accent-soft); color: var(--accent); }
.lead { font-size: 17px; color: var(--muted); }
.steps-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.step-item { display: flex; gap: 14px; align-items: flex-start; }
.step-num { width: 30px; height: 30px; border-radius: 15px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.step-body { display: flex; flex-direction: column; gap: 1px; padding-top: 3px; }
.step-title { font-weight: 600; font-size: 15.5px; }
.step-text { font-size: 14px; color: var(--muted); }
.bullets { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.bullets.numbered { list-style: decimal; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.checklist svg { color: var(--accent); margin-top: 1px; }

/* ---------- connect progress ---------- */
.progress { list-style: none; margin: 0; padding: 4px 0; display: flex; flex-direction: column; gap: 4px; }
.pstep { display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; }
.pmark { width: 30px; height: 30px; border-radius: 15px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--chip); color: var(--muted); font-weight: 700; font-size: 13.5px; }
.pstep.done .pmark { background: var(--good); color: #fff; }
.pstep.active .pmark { background: var(--accent-soft); color: var(--accent); }
.pstep.warn .pmark { background: var(--warn-soft); color: var(--warn); }
.ptext { display: flex; flex-direction: column; padding-top: 4px; }
.plabel { font-weight: 600; font-size: 15.5px; }
.pstep.todo .plabel { color: var(--muted); font-weight: 500; }
.psub { font-size: 13.5px; color: var(--muted); }
.success { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 16px; border-radius: var(--r-md); background: var(--good-soft); color: var(--good); font-weight: 700; }
.tech { font-size: 13px; color: var(--muted); }
.tech code { display: block; margin-top: 6px; word-break: break-word; }

/* ---------- plug choice ---------- */
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px 12px 10px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text);
  font: inherit; cursor: pointer;
}
.choice:hover { border-color: var(--dash); }
.choice > svg { color: var(--muted); }
.choice-art { width: 84px; flex: none; }
.plug-art { display: block; width: 100%; height: auto; }
.choice-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.choice-title { font: 700 17px/1.2 var(--font-d); }
.choice-sub { font-size: 14px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 4px 9px; border-radius: 8px; white-space: nowrap; margin-top: 3px; }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--accent-soft); color: var(--accent); }
.chip-muted { background: var(--chip); color: var(--muted); }

/* ---------- welcome ---------- */
.welcome { gap: 22px; padding-top: calc(22px + env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font: 700 19px var(--font-d); }
.hero h1 { font-size: 34px; line-height: 1.08; }
.hero .lead { margin-top: 10px; }
.benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.benefit { display: flex; gap: 14px; align-items: flex-start; }
.benefit-icon { width: 42px; height: 42px; border-radius: 21px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.benefit-title { display: block; font-weight: 700; font-size: 16px; }
.benefit-text { display: block; font-size: 14.5px; color: var(--muted); }
.fine { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.fine svg { margin-top: 2px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.flabel { font-weight: 600; font-size: 14.5px; padding: 0; }
.hint { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], select {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--dash);
  background: var(--card); color: var(--text); font: 500 16px var(--font);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235A6068' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.money-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--dash); border-radius: 14px; background: var(--card); padding: 0 14px; min-height: 50px; }
.money-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.money-input input { border: 0; padding: 0; min-height: 48px; box-shadow: none !important; font-family: var(--font-d); font-size: 18px; font-weight: 700; }
.money-input .cur { font: 700 18px var(--font-d); }
.money-input .unit { color: var(--muted); font-size: 14px; white-space: nowrap; }
.seg { display: flex; background: var(--chip); border-radius: 16px; padding: 4px; gap: 4px; }
.seg-opt { flex: 1; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 12px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg-opt input:checked + span { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }
.seg-sm { align-self: flex-start; }
.seg-sm button { border: 0; background: transparent; min-height: 38px; padding: 0 16px; border-radius: 12px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; }
.seg-sm button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---------- key/value rows ---------- */
.kv { display: flex; align-items: center; gap: 12px; min-height: 50px; border-bottom: 1px solid var(--line2); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); font-size: 14.5px; flex: 1; }
.kv .v { font-weight: 600; text-align: right; word-break: break-word; }
.sheet .kv { padding: 0 2px; }

/* ---------- readings ---------- */
.reading { border-bottom: 1px solid var(--line2); }
.reading:last-child { border-bottom: 0; }
.reading summary { display: flex; align-items: center; gap: 8px; min-height: 52px; cursor: pointer; list-style: none; }
.reading summary::-webkit-details-marker { display: none; }
.rl { flex: 1; font-size: 15px; }
.rv { font-weight: 700; font-size: 17px; }
.ru { color: var(--muted); font-size: 13.5px; min-width: 34px; }
.rinfo { padding: 0 0 12px; font-size: 14px; color: var(--muted); }
.sdot { width: 10px; height: 10px; border-radius: 5px; flex: none; background: var(--dash); }
.sdot-good { background: var(--good); }
.sdot-warn { background: var(--warn); }
.sdot-bad { background: var(--bad); }
.sdot-info { background: var(--info); }

/* ---------- drive mode ---------- */
.drive-screen { min-height: 100vh; min-height: 100dvh; justify-content: space-between; }
.drive-top { display: flex; align-items: center; justify-content: space-between; }
.drive-top .back { color: var(--text); }
.drive-speed { display: flex; flex-direction: column; align-items: center; margin: 4vh 0; }
.drive-speed .num { font-size: clamp(110px, 34vw, 190px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.drive-speed .u { font-size: 20px; color: var(--muted); font-weight: 600; }
.drive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.drive-grid > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.dl { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.dv { font-size: 30px; font-weight: 700; line-height: 1.15; }
.drive-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; text-align: center; }
.drive-off { display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; margin: auto 0; }

/* ---------- trips ---------- */
.spend { display: flex; flex-direction: column; gap: 4px; }
.spend-main { font-size: 40px; font-weight: 700; line-height: 1.1; }
.bars { display: grid; gap: 6px; align-items: end; height: 130px; margin-top: 14px; }
.bars.week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bars.month { grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.bar-v { width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--accent) 35%, var(--card)); display: block; }
.bars.month .bar-v { border-radius: 3px; }
.bar-v.today { background: var(--accent); }
.bar-v.zero { background: var(--chip); }
.bar-l { font-size: 11.5px; color: var(--muted); font-weight: 600; min-height: 15px; }
.idle-note { display: flex; gap: 8px; align-items: baseline; margin-top: 12px; padding: 10px 12px; background: var(--warn-soft); border-radius: var(--r-sm); font-size: 14px; }
.idle-note b { color: var(--warn); }
.trip-row { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--line2); text-decoration: none; color: var(--text); }
.trip-row:last-child { border-bottom: 0; }
.trip-row > svg { color: var(--muted); }
.tr-title { display: block; font-weight: 600; font-size: 15px; }
.tr-meta { display: block; font-size: 13px; color: var(--muted); }
.tr-right { display: flex; flex-direction: column; align-items: flex-end; }
.tr-cost { font-weight: 700; font-size: 17px; }
.tr-eco { font-size: 12.5px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; display: flex; flex-direction: column; gap: 2px; }
.sk { font-size: 12px; color: var(--muted); font-weight: 600; }
.sv { font-size: 18px; font-weight: 700; }
.chart { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1.5; }
.chart .grid { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .ax-t { fill: var(--muted); font: 600 10.5px var(--font); }
.chart .area { fill: var(--accent-soft); stroke: none; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.insight { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; }
.ins-icon { width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.insight-good .ins-icon { background: var(--good-soft); color: var(--good); }
.insight-tip .ins-icon { background: var(--warn-soft); color: var(--warn); }

/* ---------- health ---------- */
.verdict { display: flex; align-items: center; gap: 14px; border-color: transparent; }
.verdict-icon { width: 50px; height: 50px; border-radius: 25px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.verdict-title { display: block; font: 700 21px/1.2 var(--font-d); }
.verdict-good { background: var(--good-soft); }
.verdict-good .verdict-icon { background: var(--good); }
.verdict-warn { background: var(--warn-soft); }
.verdict-warn .verdict-icon { background: var(--warn); }
.verdict-bad { background: var(--bad-soft); }
.verdict-bad .verdict-icon { background: var(--bad); }
.code-row { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--line2); text-decoration: none; color: var(--text); }
.code-row:last-child { border-bottom: 0; }
.code-row > svg { color: var(--muted); }
.code-row .chip { margin-top: 0; }
.code-chip { font: 700 12.5px var(--font-d); letter-spacing: .03em; padding: 5px 8px; border-radius: 8px; background: var(--chip); color: var(--muted); flex: none; }
.code-chip.lg { align-self: flex-start; font-size: 13px; }
.cr-title { display: block; font-weight: 600; font-size: 15px; }
.cr-meta { display: block; font-size: 13px; color: var(--muted); }
.sys-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.sys-row:last-child { border-bottom: 0; }
.sr-name { display: block; font-weight: 600; font-size: 15px; }
.sr-text { display: block; font-size: 13.5px; color: var(--muted); }
.safe { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--r-lg); font-size: 15px; }
.safe-label { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.safe-title { font: 700 22px/1.2 var(--font-d); }
.safe-good { background: var(--good-soft); }
.safe-good .safe-label { color: var(--good); }
.safe-warn { background: var(--warn-soft); }
.safe-warn .safe-label { color: var(--warn); }
.safe-bad { background: var(--bad-soft); }
.safe-bad .safe-label { color: var(--bad); }
.info-row { display: flex; flex-direction: column; gap: 3px; padding: 13px 0; border-bottom: 1px solid var(--line2); font-size: 14.5px; }
.info-row:last-child { border-bottom: 0; }
.info-row.row-between { flex-direction: row; align-items: center; }
.cost-ph { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* ---------- used-car report ---------- */
.count-row { display: flex; gap: 8px; flex-wrap: wrap; }
.count-row .chip { margin: 0; font-size: 13.5px; padding: 6px 11px; }
.check-row { border-bottom: 1px solid var(--line2); }
.check-row:last-child { border-bottom: 0; }
.check-row summary { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; cursor: pointer; list-style: none; }
.check-row summary::-webkit-details-marker { display: none; }
.check-row summary > svg:last-child { color: var(--muted); margin-top: 2px; transition: transform .15s; }
.check-row[open] summary > svg:last-child { transform: rotate(180deg); }
.ck-icon { width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--chip); }
.ck-icon.tone-bad { background: var(--bad-soft); }
.ck-icon.tone-warn { background: var(--warn-soft); }
.ck-icon.tone-good { background: var(--good-soft); }
.ck-icon.tone-info { background: var(--info-soft); }
.ck-title { display: block; font-weight: 600; font-size: 15px; }
.ck-find { display: block; font-size: 14px; color: var(--muted); }
.ck-why { margin: -4px 0 13px 40px; font-size: 14px; color: var(--muted); }

/* ---------- help and log ---------- */
.faq-item { border-bottom: 1px solid var(--line2); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 0; cursor: pointer; list-style: none; font-weight: 600; font-size: 15px; }
.faq-item summary > span { flex: 1; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary > svg { color: var(--muted); transition: transform .15s; }
.faq-item[open] summary > svg { transform: rotate(180deg); }
.faq-item p { padding: 0 0 14px; font-size: 14.5px; color: var(--muted); }
.log { margin: 0; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; max-height: 65vh; overflow: auto; color: var(--muted); }

/* ---------- bottom navigation ---------- */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 20;
  width: 100%; max-width: 520px; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 0 4px env(safe-area-inset-bottom); display: flex;
  background: var(--card); border-top: 1px solid var(--line);
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.nav a[aria-current="page"] svg { stroke-width: 2.4; }

/* ---------- bottom sheet ---------- */
#sheet-root { display: none; }
#sheet-root.open { display: block; position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 14, .45); }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; background: var(--card); color: var(--text);
  border-radius: 24px 24px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; animation: sheet-up .2s ease-out;
}
.sheet:focus { outline: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.sheet-head h2 { flex: 1; font: 700 20px/1.25 var(--font-d); }
.sheet-body { display: flex; flex-direction: column; gap: 10px; font-size: 15.5px; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
@keyframes sheet-up { from { transform: translate(-50%, 24px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14.5px;
  transition: opacity .2s, transform .2s; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 360px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-big .tv { font-size: 34px; }
  .hero h1 { font-size: 30px; }
  .choice-art { width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .spinner { border-top-color: currentColor; border-right-color: currentColor; }
}

/* ---------- print: only the used-car report ---------- */
@media print {
  :root { --bg: #fff; --card: #fff; --text: #000; --muted: #333; --line: #ccc; --line2: #ddd; color-scheme: light; }
  body { background: #fff; }
  .app { max-width: none; border: 0; }
  .nav, .topbar, .no-print, #toast, #sheet-root, .banner-info { display: none !important; }
  .screen { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .check-row summary > svg:last-child { display: none; }
  details.check-row > .ck-why { display: block; }
}

/* chips inside headers keep their own width */
.step-head .chip, .card > .chip { align-self: flex-start; }
.chart .ax-t { paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
body.drive-mode { --good-soft: #15301F; --warn-soft: #3A2A14; --accent-soft: #15332F; --bad-soft: #3D1A17; --dash: #3A3F45; }
.art-plain .art { max-width: 340px; margin: 0 auto; }
