/* Shift Log — one dark, phone-first design.
   App bar on top, tab bar with a raised Log-ride button at the bottom, cards in between. */

@font-face { font-family: "Geist"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/geist-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Geist"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/geist-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  color-scheme: dark;
  /* colour */
  --bg: #07080b; --panel: #111318; --surface: #111318; --surface-2: #181b21; --surface-3: #22262e;
  --ink: #f2f3f5; --muted: #8b919e; --faint: #5b616d;
  --line: rgba(255,255,255,.07); --grid: rgba(255,255,255,.07);
  --amber: #ffc53d; --amber-ink: #1a1300; --amber-soft: rgba(255,197,61,.13);
  --cash: #3ddc97; --warn: #ff6b57; --night: #8e9dff; --day: #ffc53d; --rose: #ff8fc6;
  /* shape */
  --r: 22px; --r-sm: 14px; --r-btn: 16px;
  --border: 1px solid var(--line);
  --inset: inset 0 0 0 1px var(--line);
  --shadow: none; --shadow-lift: 0 20px 50px -20px rgba(0,0,0,.9);
  --btn-primary: var(--amber); --btn-shadow: none; --glow: none;
  /* type */
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: var(--font); --font-display: var(--font); --font-num: var(--font);
  --num-weight: 650; --display-weight: 700;
  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.3, 1.3, .5, 1);
  /* safe areas (Capacitor sets the --safe-area-* vars on Android) */
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --nav-h: 68px;
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; letter-spacing: -0.005em; font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; min-height: 100dvh; }
button, input, select, textarea { font-family: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.up { color: var(--cash); } .down { color: var(--warn); }
a { color: inherit; }
.wrap { width: 100%; max-width: 640px; margin-inline: auto; padding-left: max(16px, var(--sal)); padding-right: max(16px, var(--sar)); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: var(--sat); transition: box-shadow .25s var(--ease); }
.appbar .wrap { display: flex; align-items: center; gap: 4px; min-height: 64px; padding-block: 8px; }
.ab-text { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.ab-sub { font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-title { font-size: 24px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scrolled .appbar { box-shadow: 0 1px 0 var(--line); }
.icon-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--muted); transition: background .2s, color .2s, transform .3s var(--spring); }
.icon-btn:active { transform: scale(.88); background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[aria-pressed="true"] { color: var(--amber); }
.q-chip { all: unset; cursor: pointer; font-size: 12px; font-weight: 650; padding: 6px 11px; border-radius: 99px; background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--ink); white-space: nowrap; }

/* ---------- bottom tab bar ---------- */
.tabs { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--nav-h) + var(--sab)); padding: 0 max(6px, var(--sar)) var(--sab) max(6px, var(--sal));
  background: color-mix(in srgb, var(--panel) 94%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
.tabs > button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); transition: color .2s; }
.tabs > button svg { width: 24px; height: 24px; padding: 3px 16px; box-sizing: content-box; border-radius: 99px; transition: background .3s var(--ease), transform .3s var(--spring); }
.tabs > button[aria-selected="true"] { color: var(--ink); }
.tabs > button[aria-selected="true"] svg { background: var(--surface-3); }
.tabs > button:active svg { transform: scale(.9); }
.tabs > .fab { justify-self: center; width: 58px; height: 58px; padding: 0; border-radius: 20px; background: var(--amber); color: var(--amber-ink); display: grid; place-items: center; transform: translateY(-10px);
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--amber) 70%, transparent); transition: transform .35s var(--spring); }
.tabs > .fab svg { width: 28px; height: 28px; padding: 0; background: none !important; }
.tabs > .fab:active { transform: translateY(-10px) scale(.9); }
.tabs > .fab[disabled] { opacity: .5; }

/* ---------- views ---------- */
main .wrap { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; padding-bottom: calc(var(--nav-h) + var(--sab) + 40px); }
@media (prefers-reduced-motion: no-preference) {
  main section:not([hidden]) > * { animation: rise .45s var(--ease) both; }
  main section:not([hidden]) > :nth-child(2) { animation-delay: .03s; } main section:not([hidden]) > :nth-child(3) { animation-delay: .06s; }
  main section:not([hidden]) > :nth-child(4) { animation-delay: .09s; } main section:not([hidden]) > :nth-child(n+5) { animation-delay: .12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}
.page-h { display: none; }  /* the app bar carries the title */
.section { display: flex; flex-direction: column; gap: 8px; }
.sec-h { display: flex; align-items: center; gap: 12px; min-height: 32px; padding: 0 4px; }
.sec-h h2 { font-size: 17px; margin-right: auto; }
.sec-h .note { white-space: nowrap; }
.sec-title { font-size: 17px; padding: 8px 4px 0; }
.link { all: unset; cursor: pointer; color: var(--amber); font-weight: 650; font-size: 14px; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.banner { background: var(--amber-soft); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; }

/* ---------- cards ---------- */
.card, .panel, .live, .review-card, .fold, .bk, .next-shift, .list, .hero { background: var(--surface); border-radius: var(--r); }
.panel { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-size: 16px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 18px 18px 14px; display: flex; flex-direction: column;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--amber) 12%, transparent), transparent 60%), var(--surface); }
.hero-l { color: var(--muted); font-size: 13px; font-weight: 550; min-height: 1.4em; }
.hero-v { font-weight: 700; font-size: clamp(40px, 12.5vw, 56px); line-height: 1.05; letter-spacing: -0.035em; margin-top: 2px; white-space: nowrap; }
.hero-d { font-size: 13px; font-weight: 600; min-height: 1.5em; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: center; }
.hero-d .up, .hero-d .down { padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, currentColor 14%, transparent); }
.hero-d .note { font-weight: 500; font-size: 13px; }
.hero-chart { min-height: 130px; margin: 10px -18px 6px; touch-action: pan-y; }
.ranges { display: flex; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.ranges button { all: unset; cursor: pointer; flex: 1; text-align: center; padding: 7px 0; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--muted); transition: background .25s var(--ease), color .25s var(--ease); }
.ranges button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.hero-pulse { transform-box: fill-box; transform-origin: center; opacity: 0; }
@media (prefers-reduced-motion: no-preference) { .hero-pulse { animation: heroPulse 2.6s var(--ease) infinite 1s; } @keyframes heroPulse { 0% { transform: scale(1); opacity: .8; } 70%, 100% { transform: scale(3.4); opacity: 0; } } }

/* ---------- quick actions ---------- */
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px; scroll-snap-type: x proximity; }
.quick::-webkit-scrollbar { display: none; }
.qa { all: unset; cursor: pointer; flex: 1 0 68px; max-width: 92px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink); text-align: center; line-height: 1.2; }
.qa i { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); transition: transform .3s var(--spring), background .2s; }
.qa i svg { width: 23px; height: 23px; }
.qa.go i { background: var(--cash); color: #04140c; }
.qa:active i { transform: scale(.9); }
.qa[hidden] { display: none; }

/* ---------- live shift ---------- */
.live { padding: 16px; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(160deg, color-mix(in srgb, var(--cash) 10%, var(--surface)), var(--surface) 60%); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cash) 22%, transparent); }
.live-top { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.live-dot { grid-row: 1 / span 2; width: 10px; height: 10px; border-radius: 50%; background: var(--cash); box-shadow: 0 0 0 5px color-mix(in srgb, var(--cash) 22%, transparent); }
@media (prefers-reduced-motion: no-preference) { .live-dot { animation: pulse 2s ease-in-out infinite; } @keyframes pulse { 50% { box-shadow: 0 0 0 9px transparent; } } }
.live-top b { font-size: 15px; font-weight: 700; }
.live-top .note { grid-column: 2; grid-row: 2; font-size: 12.5px; }
.live-time { grid-column: 3; grid-row: 1 / span 2; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; color: var(--cash); white-space: nowrap; }
.live-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.live-grid div { display: flex; flex-direction: column; gap: 1px; background: color-mix(in srgb, var(--bg) 45%, transparent); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.live-grid .v { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-grid .k { font-size: 11px; color: var(--muted); font-weight: 550; order: 2; }
.live-actions { display: flex; gap: 8px; }
.live-actions .btn { flex: 1; padding: 11px 8px; }
.live.paused { background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 30%, transparent); }
.live.paused .live-dot { background: var(--warn); animation: none; box-shadow: none; }
.live.paused .live-time { color: var(--warn); }
#live-gap:empty, #live-proj:empty { display: none; }
#live-break { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; padding: 10px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--warn) 14%, transparent); }
#live-break .btn { flex: none; }

/* shift coach */
.coach { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-sm); --c: var(--night); background: color-mix(in srgb, var(--c) 10%, transparent); }
.coach.home { --c: var(--amber); } .coach.stay { --c: var(--cash); }
.coach-head { display: flex; align-items: center; gap: 8px; }
.coach-head b { font-size: 14px; }
.coach-ic { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.coach-ic svg { width: 16px; height: 16px; }
.coach > p { margin: 0; font-size: 13px; color: var(--muted); }
.coach-bars { display: flex; align-items: flex-end; gap: 3px; height: 54px; padding-top: 4px; }
.cbw { flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 3px; height: 100%; min-width: 0; }
.cbw span { font-size: 9.5px; color: var(--muted); text-align: center; height: 11px; line-height: 11px; }
.cb { position: relative; flex: 1; }
.cb i { position: absolute; bottom: 0; border-radius: 3px 3px 1px 1px; }
.cb .g { left: 0; right: 0; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.cb .m { left: 22%; right: 22%; background: var(--c); }
.cb.cur .g { box-shadow: 0 0 0 1.5px var(--c); background: color-mix(in srgb, var(--c) 25%, transparent); }
.cb.cur::after { content: ""; position: absolute; left: 50%; top: -5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--c); }
@media (prefers-reduced-motion: no-preference) { .coach-bars .cb i { animation: cbUp .6s var(--ease) both; transform-origin: bottom; } @keyframes cbUp { from { transform: scaleY(0); } } }
.coach-why summary { cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 600; list-style: none; }
.coach-why summary::-webkit-details-marker { display: none; }
.coach-why summary::after { content: " ›"; }
.coach-why[open] summary::after { content: " ‹"; }
.coach-why ul { margin: 6px 0 4px; padding-left: 16px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }

/* ---------- figure tiles ---------- */
.rows-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rows-card:empty { display: none; }
.kpi { position: relative; background: var(--surface); border-radius: var(--r); padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.kpi .v { font-weight: 700; font-size: 22px; letter-spacing: -0.03em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.kpi.accent, .kpi.wide { grid-column: 1 / -1; }
.kpi.accent .v, .kpi.wide .v { font-size: 26px; }
.kpi.tap { cursor: pointer; transition: transform .3s var(--spring); }
.kpi.tap::after { content: ""; position: absolute; top: 18px; right: 16px; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-top: 2px solid var(--faint); transform: rotate(45deg); }
.kpi.tap:active { transform: scale(.98); }
.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--amber); border-radius: 99px; transition: width .8s var(--ease); }
.bar.over > i { background: var(--warn); }
/* ring tiles: the percentage sits inside a progress ring */
.kpi.ring { display: grid; grid-template-columns: 1fr; gap: 2px; padding-top: 16px; }
.kpi.ring .v { order: -1; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; letter-spacing: -0.02em; margin-bottom: 10px;
  background: radial-gradient(closest-side, var(--surface) 80%, transparent 81% 100%), conic-gradient(var(--ring, var(--amber)) calc(var(--p, 0) * 1turn), var(--surface-3) 0); }
.kpi.ring.done { --ring: var(--cash); }
.kpi.ring .bar { display: none; }
.kpi.ring .k { color: var(--ink); font-weight: 650; font-size: 14px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; overflow: hidden; }
.list:empty { display: none; }
.row { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 3.6em 1fr auto; gap: 2px 12px; align-items: center; padding: 13px 16px; position: relative; transition: background .15s; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
.row:active { background: var(--surface-2); }
.row .t { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.row .m { min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .m small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 450; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .a { text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; }
.row .a small { display: block; color: var(--muted); font-weight: 450; font-size: 12px; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; vertical-align: 1px; margin-left: 6px; }
.tag.day { background: var(--amber-soft); color: var(--amber); }
.tag.night { background: color-mix(in srgb, var(--night) 18%, transparent); color: var(--night); }
.tag.lt { background: var(--surface-3); color: var(--muted); }
.tag.flag { background: var(--warn); color: #1a0500; }
.empty { color: var(--muted); font-size: 14px; padding: 16px; margin: 0; }
.list > .empty, .list > .note { padding: 16px; }
.next-shift { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: var(--r); font-size: 13px; color: var(--muted); }
.next-shift::before { content: ""; grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 13px; background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b919e' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center/20px no-repeat; }
.next-shift b { color: var(--ink); font-size: 15px; }

/* week review */
.review-card { position: relative; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.review-card h2 { font-size: 22px; letter-spacing: -0.03em; }
.review-card .x { position: absolute; top: 6px; right: 6px; }
.review-card p { margin: 0; font-size: 14px; }

/* booked rides */
.bk { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; padding: 14px 16px; }
.bk + .bk { margin-top: 8px; }
.bk-time { display: flex; flex-direction: column; min-width: 4.2em; }
.bk-time b { font-weight: 700; font-size: 22px; line-height: 1.1; letter-spacing: -0.02em; }
.bk-time span { font-size: 12px; color: var(--muted); font-weight: 600; }
.bk.soon { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 40%, transparent); }
.bk.soon .bk-time span { color: var(--amber); }
.bk.late { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }
.bk.late .bk-time span { color: var(--warn); }
.bk-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk-where { font-weight: 650; overflow-wrap: anywhere; }
.bk-where a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); text-underline-offset: 3px; }
.bk-act { grid-column: 1 / -1; display: flex; gap: 8px; }
.bk-act .btn.primary { flex: 1; }

/* ---------- buttons ---------- */
.btn { all: unset; box-sizing: border-box; cursor: pointer; text-align: center; font-weight: 650; font-size: 15px; border-radius: var(--r-btn); padding: 13px 16px; background: var(--surface-3); color: var(--ink); transition: transform .3s var(--spring), background .2s, opacity .2s; user-select: none; position: relative; }
.btn:active { transform: scale(.96); transition-duration: .08s; }
.btn.primary { background: var(--amber); color: var(--amber-ink); }
.btn.danger { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 8px 13px; font-size: 13px; border-radius: 11px; }
.btn.pill { border-radius: 99px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn .sub { display: block; font-size: 12px; font-weight: 500; opacity: .75; }
.btn.big { padding: 20px 14px; font-size: 20px; border-radius: var(--r); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.btn.drop { padding: 7px 12px; font-size: 13px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 { display: grid; gap: 12px; }

/* ---------- folds (Insights / Activity) ---------- */
.fold { padding: 0 16px; }
.fold > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 15px 0; gap: 1px 10px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary span { font-weight: 650; font-size: 15px; }
.fold > summary small { grid-column: 1; color: var(--muted); font-size: 12.5px; }
.fold > summary::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg) translateY(-2px); transition: transform .3s var(--ease); margin-right: 4px; }
.fold[open] > summary::after { transform: rotate(-135deg) translate(-2px, 0); }
.fold[open] { padding-bottom: 16px; }
.fold > :not(summary) + :not(summary) { margin-top: 12px; }
@media (prefers-reduced-motion: no-preference) { .fold[open] > :not(summary) { animation: rise .35s var(--ease) both; } }
.insights { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.insights li { padding-left: 16px; position: relative; font-size: 14px; }
.insights li::before { content: ""; position: absolute; left: 1px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
#view-stats > .section:first-child { background: var(--surface); border-radius: var(--r); padding: 16px 16px 16px 14px; }

/* ---------- tables & charts ---------- */
.tablebox { overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { text-align: right; color: var(--muted); font-weight: 600; font-size: 11.5px; padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.t td { text-align: right; padding: 10px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t th:first-child, table.t td:first-child { text-align: left; padding-left: 0; }
table.t th:last-child, table.t td:last-child { padding-right: 0; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:active td { background: var(--surface-2); }
.scroll { max-height: 30rem; overflow: auto; }
.chart { position: relative; min-height: 200px; }
.chart svg { display: block; overflow: visible; }
.tick { font-size: 10.5px; fill: var(--muted); font-family: var(--font); }
.lbl { font-size: 11px; fill: var(--ink); font-family: var(--font); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; z-index: 4; pointer-events: none; background: var(--surface-3); border-radius: 12px; box-shadow: var(--shadow-lift); padding: 8px 11px; font-size: 12px; white-space: nowrap; display: flex; flex-direction: column; gap: 2px; }
.tip .h { color: var(--muted); }

/* ---------- forms ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; min-width: 0; }
label.f input, label.f select, label.f textarea { font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); background: var(--surface-2); border: 0; border-radius: 12px; padding: 12px 13px; width: 100%; min-width: 0; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s var(--ease); color-scheme: dark; }
label.f input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--amber); }
label.f .hint { font-size: 12px; color: var(--muted); font-weight: 450; }
label.f .hint:empty { display: none; }
label.f .hint.warn { color: var(--warn); }
label.f.big input { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; padding: 14px 16px; }
.search { font: inherit; font-size: 16px; width: 100%; color: var(--ink); background: var(--surface); border: 0; border-radius: var(--r-btn); padding: 14px 16px 14px 44px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b919e' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 15px center/19px no-repeat; }
.search:focus { outline: none; box-shadow: inset 0 0 0 2px var(--amber); }
.seg { display: flex; background: var(--surface-2); border-radius: 13px; padding: 3px; gap: 3px; }
.seg button { all: unset; cursor: pointer; flex: 1; text-align: center; padding: 10px 4px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--muted); transition: background .2s var(--ease), color .2s; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { all: unset; cursor: pointer; font-size: 13px; font-weight: 600; padding: 8px 13px; border-radius: 99px; background: var(--surface-2); color: var(--ink); transition: background .2s, transform .3s var(--spring); }
.chip:active { transform: scale(.94); }
.chip.on { background: var(--amber); color: var(--amber-ink); }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-chip { align-self: flex-start; }
.yr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.yr-grid div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.yr-grid b { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; }
.yr-grid span { font-size: 11.5px; color: var(--muted); }
.yr-sel { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2); border: 0; border-radius: 11px; padding: 8px 12px; }
#miles-body .kpi { background: var(--surface-2); }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; background: var(--panel); width: 100%; max-width: 640px; max-height: calc(100dvh - var(--sat) - 12px); overflow: auto; overscroll-behavior: contain; border-radius: 28px 28px 0 0;
  padding: 28px max(18px, var(--sal)) calc(18px + var(--sab)) max(18px, var(--sar)); display: flex; flex-direction: column; gap: 16px; }
.sheet::before { content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 38px; height: 5px; border-radius: 99px; background: var(--surface-3); }
@media (prefers-reduced-motion: no-preference) {
  .scrim:not([hidden]) { animation: fade .22s ease both; }
  .scrim:not([hidden]) .sheet { animation: sheetUp .45s var(--spring) both; }
  .scrim.closing { animation: fadeOut .22s ease both; pointer-events: none; }
  .scrim.closing .sheet { animation: sheetDown .24s cubic-bezier(.4, 0, 1, 1) both; }
  @keyframes fade { from { opacity: 0; } } @keyframes fadeOut { to { opacity: 0; } }
  @keyframes sheetUp { from { transform: translateY(80px); opacity: .3; } }
  @keyframes sheetDown { to { transform: translateY(80px); opacity: 0; } }
  .wiz-body.step-in { animation: stepIn .3s var(--ease) both; } .wiz-body.step-back { animation: stepBack .3s var(--ease) both; }
  @keyframes stepIn { from { opacity: 0; transform: translateX(20px); } } @keyframes stepBack { from { opacity: 0; transform: translateX(-20px); } }
}
.sheet header { display: flex; align-items: center; gap: 10px; }
.sheet header h2 { margin-right: auto; }
.sheet .foot { display: flex; gap: 10px; position: sticky; bottom: calc(-18px - var(--sab)); margin: 0 -18px calc(-18px - var(--sab)); padding: 12px 18px calc(18px + var(--sab)); background: linear-gradient(transparent, var(--panel) 16px); }
.sheet .foot:empty { display: none; }
.sheet .foot .btn { flex: 1; padding: 16px; font-size: 16px; }
.wiz { min-height: min(30rem, 80dvh); }
.wiz header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.wiz header .btn.small { background: var(--surface-2); }
.wiz-head { display: flex; flex-direction: column; text-align: center; min-width: 0; }
.sheet .wiz-head h2 { font-size: 20px; margin: 0; }
.wiz-kind { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
#wiz-back[hidden] { display: inline-block !important; visibility: hidden; }
.dots { display: flex; gap: 4px; }
.dots i { flex: 1; height: 4px; border-radius: 99px; background: var(--surface-3); transition: background .3s var(--ease); }
.dots i.done { background: color-mix(in srgb, var(--amber) 45%, var(--surface-3)); }
.dots i.on { background: var(--amber); }
.wiz-body { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { all: unset; box-sizing: border-box; cursor: pointer; border-radius: 18px; padding: 24px 10px; text-align: center; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; background: var(--surface-2); display: flex; flex-direction: column; gap: 3px; transition: transform .3s var(--spring), background .2s; }
.choice:active { transform: scale(.95); background: var(--surface-3); }
.choice .c-s { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.choice.on { box-shadow: inset 0 0 0 2px var(--amber); }
.review { display: flex; flex-direction: column; background: var(--surface-2); border-radius: var(--r-sm); padding: 2px 14px; }
.rv { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 8px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: center; }
.rv:last-child { border-bottom: 0; }
.rv-k { color: var(--muted); font-size: 13px; font-weight: 600; }
.rv-v { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-e { font-size: 12px; font-weight: 700; color: var(--amber); }
.extras summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; }
/* menu sheet */
.sheet.menu { gap: 4px; padding-top: 30px; }
.menu-item { all: unset; cursor: pointer; display: grid; grid-template-columns: 1fr; padding: 13px 14px; border-radius: 14px; transition: background .15s; }
.menu-item:active { background: var(--surface-2); }
.menu-item b { font-size: 16px; font-weight: 650; }
.menu-item small { color: var(--muted); font-size: 13px; }
.menu-item[hidden] { display: none; }
.sheet.menu > .btn { margin-top: 8px; }

/* recap / price check / pay check */
.recap-big { font-weight: 700; font-size: 44px; line-height: 1.05; letter-spacing: -0.04em; }
.recap-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recap-row:last-child { border-bottom: 0; }
.recap-row span:first-child { color: var(--muted); font-size: 13px; font-weight: 600; }
.recap-row b { text-align: right; }
.recap-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); border-radius: var(--r-sm); padding: 11px 13px; font-size: 14px; }
.pc-big { display: flex; flex-direction: column; align-items: flex-start; }
.pc-big b { font-weight: 700; font-size: 42px; line-height: 1.1; letter-spacing: -0.04em; }
.pc-out { display: flex; flex-direction: column; gap: 12px; }
.pc-quote { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-radius: var(--r-sm); background: var(--amber-soft); }
.pc-quote b { font-weight: 700; font-size: 24px; color: var(--amber); }
.pc-why { font-size: 14px; padding: 11px 13px; border-radius: var(--r-sm); background: var(--surface-2); }
.pc-why.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pc-why.ok { background: color-mix(in srgb, var(--cash) 14%, transparent); }
#pay-gaps { margin-top: 8px; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--sab) + 18px); width: max-content; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-weight: 650; z-index: 30; font-size: 14px; box-shadow: var(--shadow-lift); }
.toast-undo { all: unset; cursor: pointer; font-weight: 800; color: #9a6a00; padding: 2px 4px; }
@media (prefers-reduced-motion: no-preference) { .toast:not([hidden]) { animation: toastIn .35s var(--spring) both; } @keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } } }

/* night mode: warm dim layer + larger targets */
#dim-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; background: rgba(40, 14, 0, .4); mix-blend-mode: multiply; opacity: 0; transition: opacity .4s var(--ease); }
:root[data-dim] #dim-layer { opacity: 1; }
:root[data-dim] .live-grid .v { font-size: 20px; }
:root[data-dim] .live-actions .btn { padding: 15px 10px; font-size: 16px; }
:root[data-dim] .choice { padding: 32px 10px; font-size: 23px; }
:root[data-dim] .sheet .foot .btn { padding: 19px; font-size: 18px; }

/* settings */
#view-settings .panel .btn { flex: 1 1 auto; }
#view-settings .panel > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; }

/* wide screens (PC browser): keep it a phone-width column, nav centred */
@media (min-width: 700px) {
  .tabs { left: 50%; right: auto; transform: translateX(-50%); width: 480px; bottom: 16px; height: var(--nav-h); border-radius: 24px; border: 1px solid var(--line); padding: 0 6px; }
  .toast { bottom: calc(var(--nav-h) + 34px); }
  .scrim { align-items: center; }
  .sheet { border-radius: 28px; max-height: 90dvh; }
  .sheet::before { display: none; }
}
.empty:empty, .list:has(> .empty:only-child:empty) { display: none; }
.section > .tablebox { background: var(--surface); border-radius: var(--r); margin: 0; padding: 4px 16px; }
