/* CarLog design system. Tokens come from THEMES in design/CarLogApp.dc.html; classes are the
   design's inline styles, one class per repeated style. Linked by the client as
   _content/CarLog.Components/carlog.css. */

/* ---------- Tokens ---------- */
:root {
  --bg: #f2f2ef;
  --surface: #ffffff;
  --surface2: #f8f8f6;
  --line: #e2e2dd;
  --fg: #1a1b19;
  --muted: #6d6f6a;
  --accent: #2f5d8a;
  --accent-soft: #e8eff6;
  --danger: #b3402e;
  --danger-soft: #fbeeeb;
  --warn: #8a6116;
  --warn-soft: #fbf3e3;
  --good: #3f7a4f;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  --scrim: rgba(12, 14, 16, 0.42);
  --scrim-strong: rgba(12, 14, 16, 0.5);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #16181a;
  --surface: #1d2023;
  --surface2: #23262a;
  --line: #2f3337;
  --fg: #e8e9e6;
  --muted: #9a9d98;
  --accent: #7aa7d4;
  --accent-soft: #223243;
  --danger: #d97c68;
  --danger-soft: #33231f;
  --warn: #d9a84f;
  --warn-soft: #33291a;
  --good: #79b48c;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
input, button, select, textarea { font-family: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2 { margin: 0; font-size: inherit; font-weight: inherit; }
h1:focus { outline: none; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.good { color: var(--good); }
.danger { color: var(--danger); }
.accent { color: var(--accent); }
.spacer { flex: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes sheetUp { from { transform: translateY(14px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ---------- Boot splash (before Blazor starts) ---------- */
.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--bg); color: var(--fg);
}
.boot-brand { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.boot-bar { width: 160px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.boot-fill { height: 100%; width: var(--blazor-load-percentage, 0%); background: var(--accent); transition: width 0.05s ease-in-out; }
.boot-text { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.boot-text:empty:after { content: var(--blazor-load-percentage-text, "Loading"); }

#blazor-error-ui {
  color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
  display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem; position: fixed; width: 100%; z-index: 1000; color: #1a1b19;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Auth layout ---------- */
.auth { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); color: var(--fg); overflow: auto; }
.auth-box { width: 100%; max-width: 330px; display: flex; flex-direction: column; gap: 18px; }
.auth-brand { display: flex; flex-direction: column; gap: 4px; }
.auth-title { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.auth-sub { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.auth-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.auth-card .btn { margin-top: 4px; padding: 10px; font-size: 14px; }
.auth-foot { font-size: 12px; color: var(--muted); }
.auth .field { font-size: 12px; }

/* ---------- App shell ---------- */
.app {
  position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--fg);
}
.shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.sidebar {
  display: none; width: 218px; flex: none; flex-direction: column; gap: 2px; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { padding: 2px 8px 14px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.veh-btn {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; width: 100%;
  padding: 9px 10px; margin-bottom: 10px; background: var(--surface2); border: 1px solid var(--line); border-radius: 5px; color: inherit;
}
.veh-btn:hover { border-color: var(--accent); }
.veh-name { font-size: 13.5px; font-weight: 500; }
.veh-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.veh-btn.bare { background: none; border: none; padding: 0; margin: 0; width: auto; gap: 1px; }
.veh-btn.bare .veh-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.nav-btn {
  display: block; width: 100%; padding: 8px 10px; text-align: left; font-size: 13.5px; border-radius: 5px; text-decoration: none;
  border: 1px solid transparent; background: none; color: var(--fg); font-weight: 400; line-height: 1.5;
}
.nav-btn:hover { background: var(--surface2); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.header {
  display: none; flex: none; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 26px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.header-titles { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.page-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.page-sub { font-size: 12.5px; color: var(--muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line); background: var(--surface);
  padding-top: calc(14px + env(safe-area-inset-top));
}

/* The bottom padding clears the floating add button (52px, 12px above the tab bar) so the last row can scroll out from under it. */
.content { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 80px; -webkit-overflow-scrolling: touch; }

.tabbar {
  flex: none; position: relative; display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line); background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  padding: 11px 0 14px; font-size: 11.5px; text-align: center; text-decoration: none; background: none; border: none;
  color: var(--muted); font-weight: 400; border-top: 2px solid transparent; margin-top: -1px; line-height: 1.5;
}
.tab.active { color: var(--accent); font-weight: 500; border-top-color: var(--accent); }
.fab {
  position: absolute; right: 16px; top: -64px; width: 52px; height: 52px; font-size: 24px; font-weight: 400; line-height: 1;
  color: #fff; background: var(--accent); border: none; border-radius: 50%; box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}

@media (min-width: 768px) {
  .shell { flex-direction: row; }
  .sidebar { display: flex; }
  .header { display: flex; }
  .topbar, .tabbar { display: none; }
  .content { padding: 22px 26px 30px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font-size: 13px; font-weight: 500; line-height: 1.5; border-radius: 4px; border: 1px solid transparent;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { background: var(--muted); border-color: var(--muted); opacity: 0.55; filter: none; }
.btn-secondary { padding: 7px 12px; font-size: 12.5px; font-weight: 400; color: inherit; background: var(--surface2); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { padding: 10px 14px; font-size: 13.5px; font-weight: 400; color: inherit; background: none; border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.btn-danger-text { padding: 10px 12px; color: var(--danger); }
.btn-ghost.btn-danger-text:hover { border-color: var(--danger); }
.btn-danger { padding: 10px 14px; font-size: 13.5px; color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger:disabled { opacity: 0.55; }
.btn-soft { padding: 9px 12px; font-size: 12.5px; font-weight: 400; color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.btn-soft:hover { filter: brightness(0.97); }
.btn-soft:disabled { opacity: 0.55; filter: none; }
.btn-link { padding: 4px 8px; font-size: 13px; font-weight: 400; color: var(--muted); background: none; border: none; }
.btn-link:hover { color: var(--fg); }
.btn-lg { padding: 10px 16px; font-size: 13.5px; }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-dashed {
  width: 100%; padding: 14px; font-size: 13px; font-weight: 400; color: var(--muted); background: none;
  border: 1px dashed var(--line); border-radius: 6px;
}
.btn-dashed:hover { color: var(--fg); }

/* ---------- Cards, stacks, grids ---------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-tight { display: flex; flex-direction: column; gap: 0; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 768px) {
  .stack, .hero-grid, .tile-grid { gap: 14px; }
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .tile-grid { grid-template-columns: repeat(4, 1fr); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.card.pad { padding: 16px 18px; }
.card.list { overflow: hidden; }

.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.big-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.big { font-size: 34px; font-weight: 500; font-family: var(--mono); letter-spacing: -0.02em; line-height: 1.2; }
.unit { font-size: 13px; color: var(--muted); }
.trend { margin-top: 6px; font-size: 12.5px; }

.tile { padding: 13px 14px; }
.tile-label { font-size: 11.5px; color: var(--muted); }
.tile-value { margin-top: 5px; font-size: 18px; font-weight: 500; font-family: var(--mono); }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head.tall { margin-bottom: 14px; }
.card-head.taller { margin-bottom: 16px; }
.card-title { font-size: 13px; font-weight: 500; }
.card-note { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

.list-title { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 500; }
.list-empty { padding: 22px 16px; font-size: 13px; color: var(--muted); }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 30px 18px; }
.empty-text { font-size: 13.5px; color: var(--muted); }
.empty-inline { padding: 16px 0; font-size: 13px; color: var(--muted); }

.footnote { font-size: 12px; color: var(--muted); }
.loading { padding: 30px 0; font-size: 13px; color: var(--muted); font-family: var(--mono); }

/* ---------- Rows ---------- */
.row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; text-align: left;
  background: none; color: inherit; border: none; border-top: 1px solid var(--line); font-size: inherit; line-height: 1.5;
}
.row:hover { background: var(--surface2); }
.card.list > .row:first-child, .list-title + .row, .table-head + .row { border-top: none; }
.row-date { width: 74px; flex: none; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.row-cost { font-size: 13.5px; font-weight: 500; font-family: var(--mono); }

/* Fuel table */
.table-head {
  display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.col-date { width: 80px; flex: none; text-align: left; }
.col { flex: 1; text-align: right; }
.row .col-date { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.row .col { font-size: 13.5px; font-family: var(--mono); }
.row .col.dim { color: var(--muted); }
.row .col.cons { color: var(--muted); font-weight: 400; }
.row .col.cons.has { color: var(--fg); font-weight: 500; }

/* Expense rows */
.row.exp { justify-content: space-between; align-items: flex-start; padding: 13px 16px; }
.exp-l { display: flex; flex-direction: column; gap: 3px; min-width: 0; text-align: left; }
.exp-r { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; flex: none; }
.exp-cat { font-size: 13.5px; font-weight: 500; }
.exp-notes { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-cost { font-size: 13.5px; font-weight: 500; font-family: var(--mono); }
.exp-meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* More / link rows */
.link-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 15px 16px; font-size: 14px; text-align: left;
  color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; text-decoration: none; line-height: 1.5;
}
.link-row:hover { border-color: var(--accent); }
.link-row .chev { color: var(--muted); }

/* Data page rows */
.data-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 16px; }
.data-row-text { min-width: 0; }
.data-title { font-size: 13.5px; font-weight: 500; }
.data-desc { margin-top: 3px; font-size: 12px; color: var(--muted); }
.data-row .btn { flex: none; }
.data-result { margin-top: 8px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.data-result ul { margin: 4px 0 0; padding-left: 18px; }
.data-row-text .error { margin-top: 8px; }
.data-options { margin-top: 8px; }
label.btn { cursor: pointer; }

/* Settings groups */
.group { display: flex; flex-direction: column; gap: 9px; padding: 15px 16px; }
.group-label { font-size: 12px; color: var(--muted); }
.version { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.self-start { align-self: flex-start; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips.gap6 { gap: 6px; }
.chips.fill > .chip { flex: 1; }
.chip {
  padding: 7px 11px; font-size: 12.5px; line-height: 1.5; border-radius: 4px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--fg); font-weight: 400;
}
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chip.pill { padding: 6px 10px; font-size: 12px; border-radius: 12px; }
.chip.pill:hover { border-color: var(--accent); }

/* ---------- Toggle ---------- */
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 34px; height: 20px; border-radius: 10px; background: var(--line); position: relative; transition: background 120ms; flex: none; }
.toggle-track:after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 120ms; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track:after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Forms ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.field-label { font-size: 11.5px; color: var(--muted); }
.input {
  width: 100%; padding: 9px 10px; font-size: 14px; background: var(--surface2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 4px; outline: none; line-height: 1.5;
}
.input.mono { font-family: var(--mono); }
.input:focus { border-color: var(--accent); }
.input.bad { color: var(--danger); border-color: var(--danger); }
.input::placeholder { color: var(--muted); opacity: 0.8; }
textarea.input { resize: none; }
.input-row { display: flex; gap: 6px; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; }
.error { padding: 9px 11px; font-size: 12.5px; color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger); border-radius: 4px; }
.warning { padding: 9px 11px; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 4px; }
.derived { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.hint { font-size: 11.5px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form.tight { gap: 10px; }
.stack-place { display: flex; flex-direction: column; gap: 7px; }

/* Searchable option list under an input (OpenStreetMap stations and repair shops in the record sheet). */
.option-list { display: flex; flex-direction: column; max-height: 232px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.option {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; text-align: left; cursor: pointer;
  color: inherit; background: none; border: none; border-top: 1px solid var(--line); font: inherit; line-height: 1.5;
}
.option:first-child { border-top: none; }
.option:hover, .option:focus-visible { background: var(--surface2); outline-offset: -2px; }
.option-title { font-size: 13px; }
.option-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.option-empty { padding: 10px; font-size: 12.5px; color: var(--muted); }
.option-foot { padding: 5px 10px; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface2); }

/* Station map in the record sheet (Leaflet; its own stylesheet is loaded on first use, so these need the extra
   specificity to win). The canvas isolates Leaflet's z-indexed panes from the sheet's overlays. */
.map-panel { display: flex; flex-direction: column; gap: 6px; }
.map-canvas { position: relative; z-index: 0; isolation: isolate; height: 240px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--surface2); }
.map-status { min-height: 17px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.map-canvas.leaflet-container { font-family: var(--sans); font-size: 11px; background: var(--surface2); }
.map-canvas .leaflet-bar { border: 1px solid var(--line); box-shadow: none; }
.map-canvas .leaflet-bar a { color: var(--fg); background: var(--surface); border-bottom-color: var(--line); }
.map-canvas .leaflet-bar a:hover { background: var(--surface2); }
.map-canvas .leaflet-control-attribution { color: var(--muted); background: color-mix(in srgb, var(--surface) 85%, transparent); }
.map-canvas .leaflet-control-attribution a { color: var(--accent); }
.map-canvas .leaflet-tooltip { padding: 3px 7px; font-family: var(--sans); font-size: 12px; color: var(--fg); background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.map-canvas .leaflet-tooltip-top::before { border-top-color: var(--line); }
[data-theme="dark"] .map-canvas .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(0.9) saturate(0.6); }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; padding: 0;
  background: var(--scrim); animation: fadeIn 120ms ease-out;
}
.sheet {
  width: 100%; max-width: 100%; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom)); outline: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px 10px 0 0; animation: sheetUp 160ms ease-out;
}
@media (min-width: 768px) {
  .overlay { align-items: center; padding: 26px; }
  .sheet { max-width: 460px; border-radius: 8px; padding-bottom: 18px; }
}
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sheet-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.overlay.confirm { align-items: center; padding: 24px; z-index: 50; background: var(--scrim-strong); }
.dialog {
  width: 100%; max-width: 330px; display: flex; flex-direction: column; gap: 12px; padding: 18px; outline: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
.dialog-title { font-size: 14.5px; font-weight: 600; }
.dialog-text { font-size: 13px; color: var(--muted); }
.dialog-actions { display: flex; gap: 8px; margin-top: 2px; }

.popover-wrap { position: relative; }
.popover-backdrop { position: fixed; inset: 0; z-index: 30; background: transparent; border: none; padding: 0; margin: 0; cursor: default; }
.popover {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 31; min-width: 220px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  animation: fadeIn 100ms ease-out;
}
.popover.right { left: auto; right: 0; }
.menu-item {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; width: 100%;
  padding: 9px 10px; background: none; border: 1px solid transparent; border-radius: 5px; color: inherit; font-size: 13.5px; line-height: 1.5;
}
.menu-item:hover { background: var(--surface2); }
.menu-item.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: 13px;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  animation: sheetUp 160ms ease-out; pointer-events: auto;
}
.toast.danger { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.toast.good { border-color: var(--good); color: var(--good); }
.toast .btn-link { padding: 2px 6px; color: inherit; }
@media (max-width: 767px) { .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---------- Data viz ---------- */
.chart { width: 100%; height: 112px; display: block; overflow: visible; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-avg { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted); font-family: var(--mono); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 100%; }
.bar { min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.bar-labels { display: flex; gap: 6px; margin-top: 8px; }
.bar-label { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.breakdown { display: flex; flex-direction: column; gap: 11px; }
.bd-item { display: flex; flex-direction: column; gap: 5px; }
.bd-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.bd-amount { font-family: var(--mono); color: var(--muted); }
.bd-track { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.bd-fill { height: 100%; background: var(--accent); }
.tone-accent { background: var(--accent); }
.tone-good { background: var(--good); }
.tone-danger { background: var(--danger); }
.tone-muted { background: var(--muted); }
.tone-line { background: var(--line); }

/* Timeline */
.tl-item { display: flex; gap: 14px; align-items: stretch; width: 100%; padding: 0; text-align: left; background: none; border: none; color: inherit; font-size: inherit; line-height: 1.5; border-radius: 6px; }
button.tl-item:hover .tl-cat { color: var(--accent); }
.tl-date { width: 78px; flex: none; padding-top: 14px; text-align: right; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.tl-rail { flex: none; width: 11px; display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 9px; height: 9px; margin-top: 18px; border-radius: 50%; background: var(--muted); flex: none; }
.tl-line { flex: 1; width: 1px; background: var(--line); }
.tl-body { flex: 1; min-width: 0; padding: 12px 0 18px; }
.tl-head { display: flex; justify-content: space-between; gap: 12px; }
.tl-cat { font-size: 13.5px; font-weight: 500; }
.tl-cost { font-size: 13.5px; font-family: var(--mono); }
.tl-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); }

/* ---------- Garage ---------- */
.vcard {
  display: flex; flex-direction: column; padding: 16px 18px; text-align: left; color: inherit; width: 100%;
  background: var(--surface); cursor: pointer; border-radius: 6px; border: 1px solid var(--line); font-size: inherit; line-height: 1.5;
}
.vcard:hover { border-color: var(--accent); }
.vcard.active { border-color: var(--accent); }
.vcard.archived { opacity: 0.7; }
.vcard-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.vcard-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.vcard-badge { font-size: 12px; color: var(--muted); font-family: var(--mono); display: flex; gap: 10px; align-items: baseline; }
.vcard-badge .btn-link { padding: 0 2px; font-size: 12px; font-family: var(--sans); }
.vcard-stats { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.vstat { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.vstat-label { font-size: 11.5px; color: var(--muted); }
.vstat-value { font-size: 15px; font-weight: 500; font-family: var(--mono); }
.section-label { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Misc pages ---------- */
.notfound { padding: 30px 0; color: var(--muted); font-size: 13.5px; }
.env-badge { position: fixed; right: 8px; top: 8px; z-index: 70; padding: 2px 6px; font-size: 10.5px; font-family: var(--mono); color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 3px; pointer-events: none; }
