/* Premium polish layer: typeface, atmosphere, depth, motion and friendlier states. Loaded after style.css; remove the
   <link> in index.html to go back to the plain look. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(lib/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(lib/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, sans-serif;
  --radius: 22px;
  --ring: color-mix(in srgb, var(--accent) 55%, transparent);
  --glass: color-mix(in srgb, var(--card) 72%, transparent);
  --hair: color-mix(in srgb, var(--line) 75%, transparent);
  --shadow: 0 1px 1px rgba(16,24,40,.03), 0 2px 8px rgba(16,24,40,.04), 0 18px 36px -18px rgba(16,24,40,.12);
  --shadow-up: 0 2px 4px rgba(16,24,40,.04), 0 10px 22px rgba(16,24,40,.07), 0 28px 48px -20px rgba(16,24,40,.18);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d14; --card: #121826; --card-2: #172033; --line: #222d44;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 30px -14px rgba(0,0,0,.65);
    --shadow-up: 0 1px 0 rgba(255,255,255,.06) inset, 0 18px 44px -14px rgba(0,0,0,.8);
  }
}

/* ---------------------------------------------------------------- type */
body { font-family: var(--font); font-feature-settings: "cv11", "ss03", "calt"; letter-spacing: -.011em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { letter-spacing: -.026em; }
h1 { font-size: 28px; font-weight: 720; }
h3 { font-weight: 660; }
.num, .r .end .big, .hstat .v, .chart-sum .v { font-feature-settings: "tnum", "cv11"; }
.plate, code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ---------------------------------------------------------------- atmosphere */
body { background:
  radial-gradient(900px 460px at 88% -140px, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
  radial-gradient(760px 420px at -8% -160px, color-mix(in srgb, #8b5cf6 10%, transparent), transparent 70%),
  var(--bg); background-attachment: fixed; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--faint) 50%, transparent) transparent; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 10px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---------------------------------------------------------------- shell */
.top { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.brand .logo { background: linear-gradient(140deg, #4f6bff, #8b5cf6); box-shadow: 0 6px 16px -4px color-mix(in srgb, #5b5cf6 60%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
.nav { gap: 2px; padding: 4px; border-radius: 16px; background: color-mix(in srgb, var(--card) 60%, transparent); border: 1px solid var(--hair); flex: none; margin: 0 auto; }
.nav button { padding: 8px 16px; border-radius: 12px; transition: color .15s, background .15s, box-shadow .2s; }
.nav button:hover { background: color-mix(in srgb, var(--card) 80%, transparent); }
.nav button.active { background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 4px 12px -4px rgba(16,24,40,.12); }
.icon-btn { background: var(--glass); backdrop-filter: blur(10px); transition: transform .15s var(--ease), border-color .15s; }
.icon-btn:hover { transform: translateY(-1px); border-color: var(--faint); }

/* ---------------------------------------------------------------- depth: cards and rows */
.card { border-radius: var(--radius); border: 1px solid var(--hair); box-shadow: var(--shadow); }
.card.flush { padding: 4px; }
.r { padding: 13px 14px; transition: background .15s; }
.r.click:hover { background: color-mix(in srgb, var(--accent) 5%, var(--card-2)); }
.r.click:active { background: var(--accent-soft); }
.r .ico { border-radius: 14px; }
.car-card, .qa, .opt, .gal-card, .chip-car, .make { transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; }
.car-card:hover, .gal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.car-card:active, .gal-card:active, .opt:active, .make:active { transform: translateY(-1px) scale(.992); }
.opt:hover, .make:hover { box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--accent) 45%, transparent); }
.pill { font-weight: 640; letter-spacing: -.005em; }

/* ---------------------------------------------------------------- buttons */
.btn { border-radius: 13px; padding: 10px 17px; background: var(--card); border-color: var(--hair); box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: transform .15s var(--ease), box-shadow .2s, background .15s, border-color .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 4px 14px -6px rgba(16,24,40,.18); transform: translateY(-1px); }
.btn:active { transform: scale(.97); box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent)); border-color: color-mix(in srgb, var(--accent-2) 70%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent-2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 12px 26px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn.ghost, .btn.ghost:hover { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
input, select, textarea { border-radius: 13px; border-color: var(--hair); background: color-mix(in srgb, var(--card) 92%, var(--card-2)); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.seg { background: color-mix(in srgb, var(--card-2) 90%, var(--line)); border: 1px solid var(--hair); }
.seg button { transition: background .15s, color .15s, box-shadow .15s; }
.seg button.active { box-shadow: 0 1px 3px rgba(16,24,40,.12); }

/* ---------------------------------------------------------------- Home: greeting + hero */
.greet { display: flex; align-items: center; gap: 14px; margin: 12px 2px 14px; flex-wrap: wrap; }
.greet .g-hi { font-size: 13px; font-weight: 650; color: var(--muted); }
.greet .g-title { font-size: 22px; font-weight: 720; letter-spacing: -.03em; line-height: 1.2; margin-top: 2px; }
.greet .g-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.greet .g-dot { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; flex: none; background: var(--green-soft); color: var(--green); }
.greet .g-dot svg { width: 24px; height: 24px; }
.greet .g-dot.soon { background: var(--amber-soft); color: var(--amber); }
.greet .g-dot.overdue { background: var(--red-soft); color: var(--red); }
.greet .grow { flex: 1; min-width: 0; }
.hero { box-shadow: var(--shadow-up); border: 1px solid var(--hair); overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.35), transparent 40%); opacity: .5; mix-blend-mode: soft-light; }
.hero .photo-wrap::before, .hero .car-art::before { content: ""; position: absolute; inset: 6% 6% 0; background: radial-gradient(60% 55% at 50% 60%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%); filter: blur(14px); z-index: -1; }
.hero h1 { font-weight: 740; letter-spacing: -.035em; }
.hstat { background: var(--glass); border: 1px solid var(--hair); box-shadow: 0 1px 0 rgba(255,255,255,.4) inset; }
.hstat .v { font-weight: 740; }
.ring { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 12%, transparent); }

.quick { gap: 12px; }
.qa { border-radius: 20px; padding: 16px 8px; font-weight: 640; font-size: 14px; background: var(--card); }
.qa:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.qa .ic { transition: transform .25s var(--ease); }
.qa:hover .ic { transform: scale(1.08) rotate(-4deg); }
.qa.primary { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent-2)); color: var(--on-accent); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 14px 28px -12px color-mix(in srgb, var(--accent) 80%, transparent); }
.qa.primary .ic { background: color-mix(in srgb, var(--on-accent) 20%, transparent); color: var(--on-accent); }

.section-title h3 { font-size: 17px; font-weight: 680; }
.banner { border-radius: 18px; border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent); }
.banner.warn { border-color: color-mix(in srgb, var(--amber) 22%, transparent); }
.chart .b { box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--accent) 70%, transparent); transition: height .5s var(--ease); }
.chart-sum > div { border: 1px solid var(--hair); background: color-mix(in srgb, var(--card-2) 70%, var(--card)); }
.spec { border: 1px solid var(--hair); background: color-mix(in srgb, var(--card-2) 60%, var(--card)); transition: transform .2s var(--ease); }
.spec:hover { transform: translateY(-1px); }

/* friendlier empty states */
.empty { padding: 34px 20px; background: radial-gradient(70% 90% at 50% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%); }
.card.empty { border-style: dashed; }

/* fix: spending legend ran off the card */
.pie-body { gap: 14px 18px; }
.pie-legend { flex: 1 1 190px; min-width: 0; }
.pie-row { min-width: 0; }

/* ---------------------------------------------------------------- Garage cards */
.car-card { overflow: hidden; }
.car-card .bd h3 { font-size: 17px; letter-spacing: -.02em; }
.add-card { border-radius: var(--radius); transition: background .2s, border-color .2s, transform .25s var(--ease); }
.add-card:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-2px); }

/* ---------------------------------------------------------------- sheets and toasts */
dialog { border: 1px solid var(--hair); box-shadow: var(--shadow-up), 0 40px 90px -30px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(10, 14, 24, .46); backdrop-filter: blur(6px) saturate(1.2); -webkit-backdrop-filter: blur(6px) saturate(1.2); }
.sheet-head h2 { letter-spacing: -.03em; }
.toast { border-radius: 16px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); font-weight: 600; }

/* ---------------------------------------------------------------- motion */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
main.enter > * { animation: rise .5s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .05s; }
main.enter > *:nth-child(3) { animation-delay: .09s; }
main.enter > *:nth-child(4) { animation-delay: .13s; }
main.enter > *:nth-child(5) { animation-delay: .17s; }
main.enter > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel { border-radius: var(--radius); background: linear-gradient(100deg, var(--card) 30%, color-mix(in srgb, var(--card-2) 70%, var(--card)) 50%, var(--card) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border: 1px solid var(--hair); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* ---------------------------------------------------------------- phone */
@media (max-width: 760px) {
  h1 { font-size: 24px; }
  .greet .g-title { font-size: 20px; }
  .bottom-nav { border-radius: 22px 22px 0 0; border-top: 1px solid var(--hair); box-shadow: 0 -10px 30px -14px rgba(16,24,40,.18); }
  .bottom-nav button { position: relative; padding: 9px 0 6px; transition: color .15s; }
  .bottom-nav button::before { content: ""; position: absolute; top: 0; left: 50%; width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); transform: translateX(-50%) scaleX(0); transition: transform .25s var(--ease); }
  .bottom-nav button.active::before { transform: translateX(-50%) scaleX(1); }
  .bottom-nav button.active svg { transform: translateY(-1px); }
  .qa { padding: 14px 4px; font-size: 13px; }
  .btn { padding: 11px 16px; }
  .btn.sm { padding: 8px 12px; }
  .r { padding: 12px 10px; }
}

/* hero chips */
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hero-chips .pill { padding: 4px 11px; font-size: 12.5px; }
.hero-chips .pill svg { width: 13px; height: 13px; }

/* spending legend: name on top, figures underneath, never cut off */
.pie-row { display: grid; grid-template-columns: 12px minmax(0, 1fr); column-gap: 8px; align-items: center; }
.pie-row .dot { grid-row: 1 / span 2; }
.pie-k { white-space: normal; line-height: 1.25; }
.pie-v { grid-column: 2; font-size: 12px; }

/* maintenance plan groups as tidy accordion cards */
details.plan-grp { background: var(--card); border: 1px solid var(--hair); border-radius: 18px; padding: 2px 14px; box-shadow: var(--shadow); margin-bottom: 8px; transition: box-shadow .2s; }
details.plan-grp > summary { padding: 12px 0; min-height: 48px; }
details.plan-grp[open] { padding-bottom: 12px; }
details.plan-grp[open] > summary { border-bottom: 1px solid var(--hair); margin-bottom: 8px; }
details.plan-grp .card, details.plan-grp .card.flush { box-shadow: none; border: 0; background: transparent; padding: 0; }
details.plan-grp .pg-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; }
details.plan-grp .pg-ic svg { width: 17px; height: 17px; }

.pie-row .dot { align-self: start; margin-top: 4px; }
.vc-wrap { margin-left: auto; margin-right: auto; }

/* progressive disclosure inside long forms */
details.more { border: 1px solid var(--hair); border-radius: 16px; background: color-mix(in srgb, var(--card-2) 55%, var(--card)); padding: 0 14px; }
details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 13px 0; flex-wrap: wrap; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg { width: 18px; height: 18px; color: var(--accent); transition: transform .2s var(--ease); }
details.more[open] > summary svg { transform: rotate(45deg); }
details.more[open] > summary { border-bottom: 1px solid var(--hair); margin-bottom: 12px; }
details.more .more-in { display: grid; gap: 14px; padding-bottom: 14px; }

/* security card */
.sec-list { display: grid; gap: 8px; }
.sec-item { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.sec-item svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.sec-item.ok svg { color: var(--green); }
.sec-item.warn svg { color: var(--amber); }

/* tester feedback button */
.fb-btn { gap: 6px; border-radius: 12px; height: 40px; padding: 0 14px; }
.fb-btn svg { width: 16px; height: 16px; color: var(--accent); }
@media (max-width: 760px) { .fb-btn { width: 40px; padding: 0; } .fb-btn span { display: none; } .fb-btn svg { width: 19px; height: 19px; } }

/* login: two fields */
.login form input + input { margin-top: -2px; }
