/* Layout: single centred column (phone first), fixed bottom tab bar, bottom-sheet forms.
   Look: calm Rubik type, deep green-black ground, mint for "good / primary", amber for fuel, coral for overdue. */
:root {
  --bg: #F1F5FA; --surface: #FFFFFF; --sunk: #E5ECF5; --raise: #F7FAFD; --ink: #0A1A33; --muted: #5A6B84; --line: #D8E1ED;
  --mint: #06808F; --mint-ink: #FFFFFF; --mint-soft: rgba(6,128,143,.12);
  --amber: #E08A00; --amber-ink: #2A1B00; --amber-soft: rgba(224,138,0,.13);
  --coral: #E0503F; --coral-soft: rgba(224,80,63,.12);
  --blue: #2F7FE0; --blue-soft: rgba(47,127,224,.12);
  --hero-a: #12305E; --hero-b: #0A1F42; --hero-c: #041129; --hero-ink: #EAF4FA; --hero-muted: #9FC3D6;
  --scrim: rgba(2, 10, 28, .5);
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --radius: 18px;
  --tabbar-h: 78px;
  /* legacy names used across views */
  --accent: var(--mint); --on-accent: var(--mint-ink); --accent-soft: var(--mint-soft);
  --ok: var(--mint); --warn: var(--amber); --crit: var(--coral); --info: var(--blue);
  --ok-soft: var(--mint-soft); --warn-soft: var(--amber-soft); --crit-soft: var(--coral-soft); --info-soft: var(--blue-soft);
  --brass: var(--amber); --brass-soft: var(--amber-soft);
  color-scheme: light;
}
/* Dark: follows the phone unless the account menu forces a mode (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #031029; --surface: #0B1A38; --sunk: #102244; --raise: #0E1E3F; --ink: #EAF4FA; --muted: #8EA3BF; --line: #1C2E52;
    --mint: #19E6E0; --mint-ink: #00202A; --mint-soft: rgba(25,230,224,.14);
    --amber: #FFB547; --amber-soft: rgba(255,181,71,.14);
    --coral: #FF6B5E; --coral-soft: rgba(255,107,94,.14);
    --blue: #5AA9FF; --blue-soft: rgba(90,169,255,.14);
    --scrim: rgba(0, 4, 14, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #031029; --surface: #0B1A38; --sunk: #102244; --raise: #0E1E3F; --ink: #EAF4FA; --muted: #8EA3BF; --line: #1C2E52;
  --mint: #19E6E0; --mint-ink: #00202A; --mint-soft: rgba(25,230,224,.14);
  --amber: #FFB547; --amber-soft: rgba(255,181,71,.14);
  --coral: #FF6B5E; --coral-soft: rgba(255,107,94,.14);
  --blue: #5AA9FF; --blue-soft: rgba(90,169,255,.14);
  --scrim: rgba(0, 4, 14, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body.sheet-open { overflow: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; text-wrap: balance; }
p { margin: 0; }
a { color: var(--mint); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }

.boot { display: grid; place-items: center; min-height: 100vh; font-size: 26px; font-weight: 700; color: var(--mint); }

.shell {
  max-width: 620px; margin-inline: auto; display: flex; flex-direction: column; gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) max(16px, env(safe-area-inset-right, 0px)) calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px) max(16px, env(safe-area-inset-left, 0px));
}
.page { display: flex; flex-direction: column; gap: 14px; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top h1 { font-size: 24px; font-weight: 700; }
.sub { font-size: 13px; color: var(--muted); }
.label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.section-title h2 { font-size: 16px; font-weight: 600; }
.demo-banner { background: var(--amber-soft); color: var(--amber); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; font-weight: 500; }

/* buttons & chips */
.btn { border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 600; cursor: pointer; background: var(--mint); color: var(--mint-ink);
  display: inline-flex; justify-content: center; align-items: center; gap: 6px; transition: transform .12s; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--sunk); color: var(--ink); }
.btn.small { padding: 7px 13px; font-size: 13.5px; border-radius: 11px; }
.btn.danger { background: var(--coral-soft); color: var(--coral); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.linkbtn { background: none; border: 0; color: var(--mint); font-weight: 600; cursor: pointer; padding: 4px; font-size: 13.5px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; }
.chip.on { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); font-weight: 600; }

/* greeting + brand switcher */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hello h1 { font-size: 22px; font-weight: 700; }
.avatar { width: 42px; height: 42px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #3FF2EA, #00A9B8); color: #00202A;
  display: grid; place-items: center; font-weight: 700; font-size: 17px; border: 0; cursor: pointer; }
.brands { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.brands::-webkit-scrollbar { display: none; }
.brand { flex: none; width: 62px; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted);
  background: none; border: 0; padding: 0; cursor: pointer; }
.brand .lg { width: 56px; height: 56px; border-radius: 19px; background: var(--surface); border: 1.5px solid var(--line); display: grid; place-items: center; transition: all .2s; }
.brand.on .lg { border-color: var(--mint); background: var(--mint-soft); box-shadow: 0 0 0 4px var(--mint-soft); }
.brand.on { color: var(--ink); font-weight: 600; }
.brand.add .lg { border-style: dashed; font-size: 24px; color: var(--muted); }
.brand span:last-child { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 30px; height: 30px; object-fit: contain; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { filter: invert(1); } }
:root[data-theme="dark"] .logo { filter: invert(1); }
.mono { font-weight: 700; font-size: 20px; color: var(--ink); }

/* hero with real car photo */
.hero { border-radius: 26px; position: relative; overflow: hidden; color: var(--hero-ink); min-height: 250px; display: flex; flex-direction: column;
  background: radial-gradient(120% 90% at 20% 0%, var(--hero-a) 0%, var(--hero-b) 45%, var(--hero-c) 100%); }
.hero .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: drive-in .9s cubic-bezier(.2,.8,.2,1) both; }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,15,12,.65) 0%, rgba(5,15,12,.05) 38%, rgba(5,15,12,.15) 60%, rgba(5,15,12,.88) 100%); }
.hero .art { position: relative; height: 132px; margin: 6px 4px -6px; animation: drive-in .9s cubic-bezier(.2,.8,.2,1) both; }
.hero .art svg { width: 100%; height: 100%; }
.hero .glow { position: absolute; width: 60%; height: 60px; border-radius: 50%; background: rgba(25,230,224,.35); filter: blur(28px); left: 18%; top: 120px; }
@keyframes drive-in { from { transform: translateX(-14%); opacity: 0; } }
.hero .head, .hero .stats, .hero .credit { position: relative; }
.hero .head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 16px 0; gap: 10px; }
.hero h2 { font-size: 21px; font-weight: 700; }
.hero small { color: var(--hero-muted); font-size: 12.5px; }
.plate { direction: ltr; font-size: 11.5px; font-weight: 600; background: #F4F7F6; color: #0E1A17; border-radius: 7px; padding: 3px 8px; white-space: nowrap; }
.hero .grow { flex: 1; min-height: 70px; }
.hero .stats { display: flex; justify-content: space-between; padding: 0 16px 10px; gap: 8px; }
.hero .stats div { display: flex; flex-direction: column; }
.hero .stats b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero .stats span { font-size: 11.5px; color: var(--hero-muted); }
.hero .credit { font-size: 9.5px; color: rgba(255,255,255,.55); padding: 0 16px 8px; text-align: left; direction: ltr; }
.hero .edit { position: absolute; top: 52px; left: 12px; z-index: 2; background: rgba(0,0,0,.35); color: #fff; border: 0; border-radius: 99px; padding: 5px 11px; font-size: 12px; cursor: pointer; }

.acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink); transition: transform .12s; }
.act:active { transform: scale(.97); }
.act .ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; }
.act svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.nextcard { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; width: 100%; text-align: start; }
.nextcard .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nextcard b { font-size: 15px; }
.nextcard small { font-size: 12.5px; color: var(--muted); }

/* cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.flush { padding-block: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: start; width: 100%; }
.alert .stripe { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.alert .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.alert b { font-size: 14px; font-weight: 500; }
.alert small { color: var(--muted); font-size: 12px; }
.alert em { font-style: normal; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.s-crit { background: var(--coral); } .s-warn { background: var(--amber); } .s-ok { background: var(--mint); } .s-info { background: var(--blue); } .s-none { background: var(--line); }
.t-crit { color: var(--coral); } .t-warn { color: var(--amber); } .t-ok { color: var(--mint); } .t-info { color: var(--blue); } .t-none { color: var(--muted); }
.allgood { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 16px; background: var(--mint-soft); color: var(--mint); font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.p-ok { background: var(--mint-soft); color: var(--mint); } .p-warn { background: var(--amber-soft); color: var(--amber); }
.p-crit { background: var(--coral-soft); color: var(--coral); } .p-none, .p-info { background: var(--sunk); color: var(--muted); }

.item { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: start; }
.item:last-child { border-bottom: 0; }
.item .head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item .head b { font-size: 14px; font-weight: 500; }
.item .meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bar { height: 7px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }

.line { display: flex; gap: 12px; align-items: center; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: start; }
.line:last-child { border-bottom: 0; }
.line .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.line b { font-size: 14px; font-weight: 500; }
.line small { color: var(--muted); font-size: 12px; }
.line .amt { font-size: 14px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fileicon { width: 36px; height: 44px; border-radius: 8px; flex: none; border: 1px solid var(--line);
  background: repeating-linear-gradient(0deg, var(--sunk) 0 5px, var(--surface) 5px 8px); }
.fileicon.none { background: var(--sunk); opacity: .5; }
.fuelicon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); font-weight: 700; font-size: 13px; }

.ring { --p: 50; --c: var(--mint); width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--sunk) 0); }
.ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }

/* fuel chart */
.chart { display: flex; flex-direction: column; gap: 6px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 96px; border-bottom: 1px solid var(--line); position: relative; }
.bars i { flex: 1; background: var(--amber-soft); border-radius: 5px 5px 0 0; min-height: 4px; }
.bars i.hi { background: var(--coral); }
.bars i.last { background: var(--amber); }
.bars .avg { position: absolute; inset-inline: 0; border-top: 1px dashed var(--muted); }
.bars-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

/* fuel quick sheet */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--sunk); border-radius: 16px; padding: 4px; }
.seg button { border: 0; background: none; border-radius: 12px; padding: 9px 6px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 16px; display: flex; flex-direction: column; align-items: center; }
.seg button em { font-style: normal; font-size: 11.5px; font-weight: 400; opacity: .85; }
.seg button.on { background: var(--amber); color: var(--amber-ink); }
.amount { text-align: center; }
.amount .big { font-size: 54px; font-weight: 700; letter-spacing: -1px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.amount .big small { font-size: 19px; color: var(--muted); font-weight: 500; margin-inline-start: 6px; letter-spacing: 0; }
.calc { display: flex; justify-content: center; gap: 8px; margin-top: 8px; min-height: 28px; flex-wrap: wrap; }
.calc span { background: var(--mint-soft); color: var(--mint); border-radius: 99px; padding: 4px 12px; font-size: 13.5px; font-weight: 600; }
.quick { display: flex; gap: 8px; justify-content: center; }
.quick button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 7px 16px; font-size: 14.5px; font-weight: 500; cursor: pointer; }
.metabar { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--sunk); border-radius: 14px; padding: 9px 12px; flex-wrap: wrap; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; }
.keys button { background: var(--sunk); border: 0; border-radius: 14px; padding: 12px 0; font-size: 21px; font-weight: 500; cursor: pointer; }
.keys button:active { background: var(--line); }
.optional { display: flex; flex-direction: column; gap: 10px; background: var(--sunk); border-radius: 14px; padding: 12px; }

/* car photo picker */
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.photos button { border: 2px solid transparent; border-radius: 14px; overflow: hidden; padding: 0; cursor: pointer; background: var(--sunk); aspect-ratio: 16 / 10; max-width: 100%; position: relative; }
.photos button.on { border-color: var(--mint); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos small { position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: 9.5px; padding: 10px 6px 4px; text-align: left; direction: ltr; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* family */
.famhead { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: var(--hero-ink); border-radius: 24px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.famhead p { font-size: 13px; color: var(--hero-muted); line-height: 1.7; }
.code { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(0,0,0,.25); border-radius: 14px; padding: 10px 12px; flex-wrap: wrap; }
.code b { direction: ltr; letter-spacing: 3px; font-size: 19px; }
.member { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.member .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member b { font-size: 15px; font-weight: 600; }
.member small { color: var(--muted); font-size: 12.5px; }

/* tires */
.tirecar { display: grid; grid-template-columns: 1fr 100px 1fr; align-items: center; gap: 4px; }
.tirecar .topcar { width: 100px; height: 205px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.35)); }
.tirecar .side { display: flex; flex-direction: column; justify-content: space-between; height: 205px; padding: 18px 0 16px; }
.tirecar .side:last-child { align-items: flex-end; }
.tring { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-align: start; }
.tirecar .side:last-child .tring { flex-direction: row-reverse; text-align: end; }
.tring svg { width: 46px; height: 46px; flex: none; }
.tring span { display: flex; flex-direction: column; white-space: nowrap; font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.tring small { color: var(--muted); font-size: 11px; font-weight: 400; }
.tireguide { background: var(--raise); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tireguide svg { width: 100%; max-width: 260px; height: auto; align-self: center; }
.tireguide ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.tireguide li { display: flex; align-items: center; gap: 8px; }
.tireguide li b { width: 18px; height: 18px; border-radius: 50%; color: #031029; font-size: 11px; display: grid; place-items: center; flex: none; }
.tireguide bdi { color: var(--ink); font-weight: 600; }

.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-inline-end: 5px; background: var(--k); }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty h3 { color: var(--ink); font-size: 20px; }

.menu { display: flex; flex-direction: column; }
.menu button { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: start; }
.menu button:last-child { border-bottom: 0; }
.menu button small { color: var(--muted); }
.menu button::after { content: "‹"; color: var(--muted); font-size: 18px; }

/* tab bar */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 26px);
  padding: 22px max(14px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12px) max(14px, env(safe-area-inset-left, 0px)); }
.tabbar nav { pointer-events: auto; max-width: 560px; margin-inline: auto; display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 8px 4px; box-shadow: 0 10px 30px rgba(8,18,15,.16); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; border-radius: 14px; }
.tabbar a svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--mint); font-weight: 600; }
.tabbar a.on svg { fill: var(--mint-soft); }
.tabbar .fab { border: 0; background: none; padding: 0; display: grid; place-items: center; cursor: pointer; }
.tabbar .fab span { width: 58px; height: 58px; margin-top: -32px; border-radius: 20px; display: grid; place-items: center; color: #00202A;
  background: linear-gradient(135deg, #3FF2EA, #00A9B8); border: 4px solid var(--bg); box-shadow: 0 10px 22px rgba(0,190,198,.4); transition: transform .15s; }
.tabbar .fab:active span { transform: scale(.94); }
.tabbar .fab svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }

/* sheet (forms) */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: dim .2s; }
@keyframes dim { from { opacity: 0; } }
.sheet { background: var(--surface); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; border-radius: 26px 26px 0 0;
  padding: 12px max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 22px) max(18px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; animation: up .25s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(60px); opacity: .5; } }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 26px; max-height: 88vh; } }
.sheet > * { max-width: 100%; min-width: 0; }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--muted); opacity: .5; align-self: center; position: relative; flex: none; }
.sheet .grab::before { content: ""; position: absolute; inset: -14px -60px; } /* bigger touch target for dragging down */
.sheet.dragging { transition: none; animation: none; }
.sheet h2 { font-size: 20px; font-weight: 700; }
form.fields { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { -webkit-appearance: none; appearance: none; max-width: 100%; box-sizing: border-box; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 16px; width: 100%; min-width: 0; }
.datebox { position: relative; }
.datebox .dateface { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--raise); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; font-size: 16px; min-height: 48px; font-variant-numeric: tabular-nums; pointer-events: none; }
.datebox .dateface::after { content: ""; width: 18px; height: 18px; flex: none; opacity: .6; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat; }
.field .datebox input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.datebox:focus-within .dateface { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.field textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--mint); }
.checks { display: flex; flex-direction: column; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; }
.err { color: var(--coral); font-size: 13px; }

#toast { position: fixed; z-index: 60; inset-inline: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  margin-inline: auto; max-width: 420px; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 14px; text-align: center; font-weight: 500; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login .card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login h1 { font-size: 30px; font-weight: 700; color: var(--mint); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* account menu */
.acct { display: flex; align-items: center; gap: 12px; }
.acct .sub { overflow: hidden; text-overflow: ellipsis; }
.seg.mode button.on { background: var(--mint); color: var(--mint-ink); }
.menu { display: flex; flex-direction: column; gap: 8px; }

/* monthly report */
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.monthnav b { font-size: 17px; }
.monthnav button { min-width: 44px; font-size: 20px; line-height: 1; }
.monthnav button:disabled { opacity: .35; }
.bignum { font-size: 30px; font-weight: 700; }
.mbars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; height: 180px; padding: 12px 10px 8px; }
.bar6 { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; }
.bar6 i { flex: none; width: 70%; max-width: 34px; border-radius: 8px 8px 3px 3px; background: var(--line); }
.bar6 small { font-size: 10.5px; }
.bar6 span { font-size: 11.5px; }
.bar6.on i { background: var(--mint); }
.bar6.on { color: var(--ink); font-weight: 600; }

/* tread entry on the car figure */
.tirecar.entry .side { padding: 4px 0; }
.tin { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.tirecar .side:last-child .tin { align-items: flex-end; }
.tbox { display: flex; align-items: center; gap: 4px; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; width: 92px; }
.tbox:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.tbox input { -webkit-appearance: none; appearance: none; border: 0; background: none; width: 100%; min-width: 0; padding: 10px 0; font-size: 18px; font-weight: 700; text-align: center; color: var(--ink); outline: none; }
.tbox small { color: var(--muted); font-size: 12px; }
.acts.two { grid-template-columns: 1fr 1fr; }

/* install banner */
.installbar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,.18); animation: drop .45s cubic-bezier(.2,.8,.2,1); }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } }
.installbar img { width: 42px; height: 42px; border-radius: 11px; flex: none; }
.installbar div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.installbar b { font-size: 14px; }
.installbar small { color: var(--muted); font-size: 12px; }
.installbar .x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px; cursor: pointer; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.steps li > b { width: 26px; height: 26px; border-radius: 50%; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; flex: none; font-size: 13px; }
.steps .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.steps .ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bar i.indeterminate { width: 35%; background: var(--mint); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-inline-start: -35%; } 100% { margin-inline-start: 100%; } }

/* service history questions for cars past 150,000 km */
.hist { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hist b { font-size: 15px; font-weight: 600; }
.hist .seg button { font-size: 14px; padding: 8px 4px; }
.histx { display: flex; gap: 8px; }
.histx input { flex: 1; min-width: 0; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 16px; -webkit-appearance: none; }

/* quick fill: fits one phone screen with the odometer visible */
.fuelsheet { gap: 10px; padding-top: 8px; }
.fuelsheet h2 { font-size: 18px; }
.fuelsheet .seg button { padding: 6px; font-size: 15px; }
.fuelsheet .seg button em { font-size: 11px; }
.fuelsheet .amount .big { font-size: 42px; }
.fuelsheet .calc { margin-top: 4px; min-height: 24px; }
.fuelsheet .quick button { padding: 5px 14px; font-size: 13.5px; }
.fuelsheet .keys { gap: 6px; }
.fuelsheet .keys button { padding: 9px 0; font-size: 19px; border-radius: 12px; }
.fuelsheet .metabar { display: block; text-align: center; background: none; padding: 0; font-size: 11.5px; }
.odorow { display: flex; gap: 10px; align-items: center; }
.odorow input:not([type=checkbox]) { flex: 1; min-width: 0; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 16px; text-align: center; -webkit-appearance: none; }
.odorow .check { flex: none; white-space: nowrap; font-size: 13.5px; }

/* read-only record view */
.viewsheet { position: relative; gap: 12px; }
.viewsheet h2 { padding-inline-end: 48px; font-size: 18px; }
.editbtn { position: absolute; top: 22px; inset-inline-end: 18px; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--raise); color: var(--mint); display: grid; place-items: center; cursor: pointer; }
.editbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.facts div { background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; }
.facts dt { font-size: 11.5px; color: var(--muted); }
.facts dd { margin: 0; font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.thumb { align-self: flex-start; width: 112px; height: 144px; padding: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  background: var(--sunk); cursor: zoom-in; display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.pdf { width: 120px; height: 120px; cursor: pointer; gap: 2px; align-content: center; }
.thumb.pdf b { font-size: 22px; color: var(--coral); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.92); display: grid; place-items: center; overflow: auto; touch-action: pinch-zoom; animation: dim .2s; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lightbox .x { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); inset-inline-start: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 26px; cursor: pointer; }
