/* Carflex web: the apps' one token set (ui/theme/Color.kt and Theme.kt in the Android app, UI/Theme.swift on iPhone).
   Light values on :root, dark values under [data-theme="dark"]; "system" follows the device. */

:root {
  --navy: #0C2340; --navy-raised: #2E4259; --navy-line: #3C5166; --on-navy: #FFFFFF; --on-navy-muted: #D5DFE8;
  --primary: #087F75; --primary-ink: #06564E; --on-primary: #FFFFFF; --primary-soft: #D9F3EB; --primary-bright: #46CFB1; --primary-band: #9FE3D2;
  --selected: #0C2340; --on-selected: #FFFFFF;
  --header-start: #0C2340; --header-end: #0A6E66; --on-header: #FFFFFF; --on-header-muted: #D5DFE8; --on-header-accent: #46CFB1;
  --attention: #FF8A3D; --badge-red: #E5482B;
  --canvas: #EDF1F5; --canvas-wash: #DDF1EC; --card: #FFFFFF; --raised: #F4F6F8; --line: #E3E7EB; --line-soft: #EDF0F3; --field: #CDD5DC;
  --ink: #0F1E2E; --ink2: #3B4A59; --muted: #5B6B7A; --faint: #7B8C99;
  --scrim: rgba(11, 20, 27, 0.6); --inverse: #1F2A33; --on-inverse: #FFFFFF; --paper: #FFFFFF; --paper-ink: #11263B; --viewer: #08192E;
  --success-bg: var(--primary-soft); --success-fg: var(--primary-ink);
  --warning-soft: #FCE9C3; --warning-fg: #6E4400; --warning-solid: #FACC15; --on-warning-solid: #0F1E2E;
  --danger-soft: #F9DFD9; --danger-fg: #8C2A1C; --danger-solid: #B91C1C; --on-danger-solid: #FFFFFF;
  --info-soft: #E3ECF7; --info-fg: #1F4E86; --info-solid: #1D4ED8; --on-info-solid: #FFFFFF;
  --neutral-soft: #E6ECEF; --neutral-fg: #43535F;
  --attention-ink: #C2410C;
  --deal-steal: #15803D; --deal-good: #4D7C0F; --deal-potential: #A16207; --deal-entertain: #B91C1C; --deal-neutral: #475569;
  --chart-age1: #46CFB1; --chart-age2: #F59E0B; --chart-age3: #F97316; --chart-age4: #DC2626;
  --team1: #D8B4FE; --team2: #FCA5A5; --team3: #A5B4FC;
  --header: linear-gradient(90deg, var(--header-start), var(--header-end));
  --primary-button: linear-gradient(135deg, var(--primary), var(--primary-ink));
  --section-stripe: linear-gradient(180deg, var(--primary-bright), var(--primary));
  --card-shadow: 0 0.8px 1.5px rgba(12, 35, 64, 0.16), 0 0 1px rgba(12, 35, 64, 0.08);
  --card-border: none;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --dock-h: 52px;
  --rail-w: 92px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --is-dark: 1; }
}

:root[data-theme="dark"], :root[data-theme="system-dark"] {
  --navy: #2A3E54; --navy-raised: #3A5068; --navy-line: #3F5A66; --on-navy: #E8EFF3; --on-navy-muted: #A9BAC4;
  --primary: #7DD8C3; --primary-ink: #7DD8C3; --on-primary: #0C2340; --primary-soft: #173F42; --primary-bright: #7DD8C3; --primary-band: #7DD8C3;
  --selected: #7DD8C3; --on-selected: #0C2340;
  --header-start: #0F2131; --header-end: #0D4643;
  --canvas: #0B141B; --canvas-wash: #0F2229; --card: #15212A; --raised: #213039; --line: #2D3F4A; --line-soft: #213039; --field: #3A4D59;
  --ink: #E8EFF3; --ink2: #C9D5DC; --muted: #A9BAC4; --faint: #8DA2AE;
  --inverse: #2D3F4A;
  --warning-soft: #4A3410; --warning-fg: #F6D28A; --warning-solid: #EAB308;
  --danger-soft: #4B2420; --danger-fg: #F2A79B; --danger-solid: #DC2626;
  --info-soft: #1E3350; --info-fg: #A9C7F0; --info-solid: #2563EB;
  --neutral-soft: #213039; --neutral-fg: #A9BAC4;
  --attention-ink: #F59E6B;
  --chart-age1: #7DD8C3; --chart-age2: #FCD34D; --chart-age3: #FDBA74; --chart-age4: #FCA5A5;
  --primary-button: var(--primary);
  --card-shadow: none;
  --card-border: 1px solid var(--line);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 19px; color: var(--ink);
  background: var(--canvas); min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
img { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Material Symbols, the web form of the apps' Material icons. */
.ms {
  font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr;
  -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; flex-shrink: 0; user-select: none; overflow: hidden; width: 1em; height: 1em;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* Type scale: ui/theme/Type.kt */
.t-display-l { font-size: 26px; line-height: 30px; font-weight: 700; }
.t-display-m { font-size: 23px; line-height: 27px; font-weight: 700; }
.t-display-s { font-size: 20px; line-height: 24px; font-weight: 700; }
.t-headline-m { font-size: 18px; line-height: 22px; font-weight: 700; }
.t-headline-s { font-size: 15px; line-height: 20px; font-weight: 700; }
.t-title-l { font-size: 16px; line-height: 21px; font-weight: 700; }
.t-title-m { font-size: 14px; line-height: 18px; font-weight: 600; }
.t-title-s { font-size: 13px; line-height: 17px; font-weight: 600; }
.t-body-l { font-size: 14px; line-height: 19px; font-weight: 400; }
.t-body-m { font-size: 13px; line-height: 18px; font-weight: 400; }
.t-body-s { font-size: 12px; line-height: 16px; font-weight: 400; }
.t-label-l { font-size: 14px; line-height: 18px; font-weight: 600; }
.t-label-m { font-size: 12.5px; line-height: 16px; font-weight: 600; }
.t-label-s { font-size: 11px; line-height: 14px; font-weight: 600; }
.c-ink { color: var(--ink); } .c-ink2 { color: var(--ink2); } .c-muted { color: var(--muted); } .c-faint { color: var(--faint); }
.c-primary { color: var(--primary); } .c-primary-ink { color: var(--primary-ink); } .c-danger { color: var(--danger-fg); } .c-warning { color: var(--warning-fg); } .c-info { color: var(--info-fg); }
.bold { font-weight: 700; } .semibold { font-weight: 600; } .center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Layout helpers */
.row { display: flex; align-items: center; min-width: 0; }
.row.top { align-items: flex-start; }
.row.baseline { align-items: baseline; }
.col { display: flex; flex-direction: column; min-width: 0; }
.grow { flex: 1 1 0; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.gap2 { gap: 2px; } .gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.p10 { padding: 10px; } .p12 { padding: 12px; } .p16 { padding: 16px; } .px12 { padding-left: 12px; padding-right: 12px; } .py8 { padding-top: 8px; padding-bottom: 8px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* App shell ------------------------------------------------------------------------------------------------------- */
#app { min-height: 100vh; min-height: 100dvh; }
.canvas { background: linear-gradient(180deg, var(--canvas-wash) 0%, var(--canvas) 50%, var(--canvas) 100%); background-attachment: fixed; min-height: 100vh; min-height: 100dvh; }
.shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.shell-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.page { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 100%; }
.page-body { flex: 1 1 auto; padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 1180px; margin: 0 auto; }
.page-body.flush { padding: 0; gap: 0; }
.page-body.narrow { max-width: 760px; }
.with-dock .page-body { padding-bottom: calc(var(--dock-h) + 20px + var(--safe-bottom)); }
.with-footer .page-body { padding-bottom: 96px; }
.page-enter { animation: fadeIn 0.12s ease-out; }
.tab-enter { animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* CfTopBar: the brand header on every page */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--header); color: var(--on-header);
  padding: calc(3px + var(--safe-top)) 4px 3px; min-height: 48px; display: flex; align-items: center;
}
.topbar-inner { display: flex; align-items: center; width: 100%; max-width: 1180px; margin: 0 auto; min-height: 42px; }
.topbar-title { flex: 1 1 0; min-width: 0; padding-left: 8px; }
.topbar.has-back .topbar-title { padding-left: 2px; }
.topbar-title h1 { margin: 0; font-size: 18px; line-height: 22px; font-weight: 700; color: var(--on-header); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-sub { font-size: 12px; line-height: 16px; color: var(--on-header-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-sub.lit { color: var(--on-header-accent); }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 20px; border: 0; background: transparent; color: inherit;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(127, 127, 127, 0.12); }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }
.topbar button:focus-visible, .steps button:focus-visible { outline-color: var(--on-header); outline-offset: -3px; }
.icon-btn .ms { font-size: 21px; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--badge-red); border: 1.5px solid var(--header-end); }
.header-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px 0 12px; border-radius: 16px; border: 0;
  background: rgba(255, 255, 255, 0.16); color: var(--on-header); font-weight: 700; font-size: 13px; margin: 0 4px;
}
.header-pill.on { background: var(--primary-bright); color: var(--navy); }

/* StepsHeader for multi-step forms */
.steps { position: sticky; top: 0; z-index: 20; background: var(--header); color: var(--on-header); padding: calc(2px + var(--safe-top)) 4px 8px; }
.steps-inner { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 5px; }
.steps-bar { display: flex; gap: 3px; padding: 0 8px; }
.steps-bar span { flex: 1 1 0; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); transition: background 0.25s; }
.steps-bar span.on { background: var(--primary-bright); }

/* CfBottomNav: the floating dock in the brand gradient */
.dock-wrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 2px 10px calc(4px + var(--safe-bottom)); pointer-events: none; }
.dock {
  pointer-events: auto; max-width: 560px; margin: 0 auto; height: 46px; border-radius: 23px; background: var(--header); padding: 4px;
  display: flex; align-items: center; box-shadow: 0 8px 24px rgba(12, 35, 64, 0.45); border: 1px solid rgba(255, 255, 255, 0.10);
}
.dock-tab {
  flex: 1 1 0; height: 100%; border: 0; background: transparent; border-radius: 19px; color: var(--on-header);
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; transition: flex-grow 0.25s cubic-bezier(0.3, 1.3, 0.5, 1), background 0.22s;
  text-decoration: none; min-width: 0;
}
.dock-tab .ms { font-size: 19px; opacity: 0.9; }
.dock-tab .lbl { font-size: 9.5px; line-height: 11px; font-weight: 600; color: var(--on-header-muted); white-space: nowrap; }
.dock-tab.on { flex-grow: 1.8; background: #FFFFFF; flex-direction: row; gap: 6px; color: var(--primary-ink); }
:root[data-theme="dark"] .dock-tab.on, :root[data-theme="system-dark"] .dock-tab.on { background: var(--primary-bright); color: var(--navy); }
.dock-tab.on .ms { opacity: 1; animation: bounce 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
.dock-tab.on .lbl { font-size: 12.5px; line-height: 16px; font-weight: 700; color: inherit; }
@keyframes bounce { from { transform: scale(0.78); } to { transform: scale(1); } }
.dock-badge {
  position: absolute; top: 2px; left: 50%; margin-left: 4px; min-width: 15px; height: 15px; border-radius: 8px; padding: 0 4px;
  background: var(--badge-red); color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.9); font-size: 9.5px; line-height: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Wide screens: the dock becomes a rail on the left, in the same gradient, and pages use the width as a tablet does. */
@media (min-width: 900px) {
  .shell.has-rail { flex-direction: row; }
  .shell.has-rail .shell-main { min-width: 0; }
  .dock-wrap.rail { position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; height: 100dvh; width: var(--rail-w); padding: 10px 0 10px 10px; flex-shrink: 0; }
  .dock-wrap.rail .dock { flex-direction: column; height: 100%; width: 100%; max-width: none; border-radius: 23px; padding: 10px 6px; gap: 6px; justify-content: flex-start; }
  .dock-wrap.rail .rail-logo { width: 62px; margin: 4px auto 14px; opacity: 0.95; }
  .dock-wrap.rail .dock-tab { flex: 0 0 auto; width: 100%; height: 58px; flex-direction: column; gap: 2px; }
  .dock-wrap.rail .dock-tab.on { flex-direction: column; gap: 2px; }
  .dock-wrap.rail .dock-tab.on .lbl { font-size: 11px; line-height: 14px; }
  .with-dock.rail-mode .page-body { padding-bottom: 24px; }
  .page-body { padding: 14px 16px 24px; gap: 12px; }
}
.rail-logo { display: none; }
.dock-wrap.rail .rail-logo { display: block; }

/* Cards and groups */
.card { background: var(--card); border-radius: 12px; box-shadow: var(--card-shadow); border: var(--card-border); }
.group { background: var(--card); border-radius: 12px; box-shadow: var(--card-shadow); border: var(--card-border); overflow: hidden; display: flex; flex-direction: column; }
.group > .divider:first-child { display: none; }
.divider { height: 1px; background: var(--line-soft); flex-shrink: 0; }
.well { background: var(--raised); border-radius: 10px; padding: 8px 10px; }

/* CfRow */
.cf-row {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 12px; width: 100%; background: transparent; border: 0;
  text-align: left; color: var(--ink); text-decoration: none;
}
button.cf-row:hover, a.cf-row:hover { background: rgba(127, 127, 127, 0.06); }
.cf-row .title { font-size: 14px; line-height: 18px; font-weight: 600; color: var(--ink); }
.cf-row.danger .title { color: var(--danger-fg); }
.cf-row .sub { font-size: 12px; line-height: 16px; color: var(--muted); }
.cf-row .value { font-size: 12.5px; line-height: 16px; font-weight: 600; color: var(--ink2); flex-shrink: 0; }
.cf-row .chev { font-size: 16px; color: var(--faint); }

/* IconBadge */
.icon-badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.icon-badge.primary { background: linear-gradient(135deg, #3A9A92, var(--primary)); }
.icon-badge.info { background: linear-gradient(135deg, #4C6E99, var(--info-fg)); }
.icon-badge.warning { background: linear-gradient(135deg, #8C6A33, var(--warning-fg)); }
.icon-badge.danger { background: linear-gradient(135deg, #A55548, var(--danger-fg)); }
.icon-badge.view-ad { background: var(--info-solid); }
.icon-badge.mark { background: var(--warning-solid); color: var(--on-warning-solid); }
.icon-badge.dealer { background: var(--danger-solid); }
:root[data-theme="dark"] .icon-badge.primary, :root[data-theme="system-dark"] .icon-badge.primary { background: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] .icon-badge.info, :root[data-theme="system-dark"] .icon-badge.info, :root[data-theme="dark"] .icon-badge.view-ad, :root[data-theme="system-dark"] .icon-badge.view-ad { background: var(--info-soft); color: var(--info-fg); }
:root[data-theme="dark"] .icon-badge.warning, :root[data-theme="system-dark"] .icon-badge.warning, :root[data-theme="dark"] .icon-badge.mark, :root[data-theme="system-dark"] .icon-badge.mark { background: var(--warning-soft); color: var(--warning-fg); }
:root[data-theme="dark"] .icon-badge.danger, :root[data-theme="system-dark"] .icon-badge.danger, :root[data-theme="dark"] .icon-badge.dealer, :root[data-theme="system-dark"] .icon-badge.dealer { background: var(--danger-soft); color: var(--danger-fg); }

/* CfButton */
.cf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 10px; border-radius: 11px;
  border: 1px solid transparent; font-size: 14px; line-height: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.12s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.15s; text-decoration: none; max-width: 100%;
}
.cf-btn:active:not(:disabled) { transform: scale(0.96); }
.cf-btn:disabled, .cf-btn.busy { opacity: 0.55; cursor: default; }
.cf-btn.small { min-height: 36px; font-size: 13px; }
.cf-btn .ms { font-size: 18px; }
.cf-btn.small .ms { font-size: 16px; }
.cf-btn.block { width: 100%; }
.btn-teal { background: var(--primary-button); color: var(--on-primary); border-color: var(--primary); }
.btn-navy { background: var(--header); color: var(--on-navy); border-color: var(--navy); }
:root[data-theme="dark"] .btn-navy, :root[data-theme="system-dark"] .btn-navy { background: var(--navy); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--field); }
.btn-red { background: var(--card); color: var(--danger-fg); border-color: var(--danger-fg); }
.btn-redsolid { background: var(--danger-solid); color: var(--on-danger-solid); border-color: var(--danger-solid); }
.btn-mint { background: var(--primary-soft); color: var(--primary-ink); border-color: var(--primary-soft); }
.btn-blue { background: var(--info-solid); color: var(--on-info-solid); border-color: var(--info-solid); }
.btn-yellow { background: var(--warning-solid); color: var(--on-warning-solid); border-color: var(--warning-solid); }
.btn-bluesoft { background: var(--info-soft); color: var(--info-fg); border-color: var(--info-solid); }
.btn-yellowsoft { background: var(--warning-soft); color: var(--warning-fg); border-color: var(--warning-solid); }
.btn-redsoft { background: var(--danger-soft); color: var(--danger-fg); border-color: var(--danger-solid); }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; flex-shrink: 0; }
.spinner.big { width: 30px; height: 30px; border-width: 3px; color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* CfBarButton: the three equal buttons under a car */
.bar-btn {
  flex: 1 1 0; height: 52px; border-radius: 12px; border: 1px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3px 4px; min-width: 0; font-size: 12.5px; line-height: 16px; font-weight: 600; transition: transform 0.12s;
}
.bar-btn:active:not(:disabled) { transform: scale(0.96); }
.bar-btn .ms { font-size: 19px; }
.bar-btn.detail .ms { font-size: 15px; }
.bar-btn .lbl { margin-top: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-btn .det { font-size: 10.5px; line-height: 12px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-btn.muted { opacity: 0.75; border-color: transparent !important; }
.bar-btn:disabled { opacity: 0.55; }

/* Chips and pills */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.flush { padding-left: 0; padding-right: 0; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  height: 30px; border-radius: 15px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0;
  background: var(--card); border: 1px solid var(--line); color: var(--ink2); font-size: 12.5px; font-weight: 600;
}
.chip.dot-first { padding-left: 10px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.on { background: var(--header); color: var(--on-selected); border-color: transparent; }
:root[data-theme="dark"] .chip.on, :root[data-theme="system-dark"] .chip.on { background: var(--selected); }
.chip.on .dot { box-shadow: 0 0 0 1px var(--on-selected); }
.pill { min-height: 34px; border-radius: 9px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--line); color: var(--ink2); font-size: 12.5px; font-weight: 600; }
.pill.on { background: var(--header); color: var(--on-selected); border-color: transparent; }
:root[data-theme="dark"] .pill.on, :root[data-theme="system-dark"] .pill.on { background: var(--selected); }

/* SegmentedTabs */
.segments { display: flex; gap: 3px; padding: 3px; margin-top: 6px; background: var(--neutral-soft); border-radius: 11px; }
.segment { flex: 1 1 0; height: 30px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.segment.on { background: var(--card); color: var(--primary-ink); font-weight: 700; box-shadow: var(--card-shadow); border: var(--card-border); }

/* Tags */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; line-height: 14px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.tag-teal { background: var(--primary); color: var(--on-primary); }
.tag-steal { background: var(--deal-steal); color: #fff; } .tag-good { background: var(--deal-good); color: #fff; }
.tag-potential { background: var(--deal-potential); color: #fff; } .tag-entertain { background: var(--deal-entertain); color: #fff; }
.tag-dealneutral { background: var(--deal-neutral); color: #fff; }
.tag-mint { background: var(--success-bg); color: var(--success-fg); }
.tag-amber { background: var(--warning-soft); color: var(--warning-fg); }
.tag-red, .tag-outline { background: var(--danger-soft); color: var(--danger-fg); }
.tag-redsolid { background: var(--danger-solid); color: var(--on-danger-solid); }
.tag-grey { background: var(--neutral-soft); color: var(--neutral-fg); }
.tag-blue { background: var(--info-soft); color: var(--info-fg); }
.tag-navy { background: var(--navy); color: var(--on-navy); }
.tag-white { background: var(--card); color: var(--primary-ink); }

/* Banners */
.banner { display: flex; gap: 8px; padding: 10px; border-radius: 10px; font-size: 13px; line-height: 18px; }
.banner .ms { font-size: 18px; margin-top: 0; }
.banner .b-title { font-weight: 600; }
.banner-mint { background: var(--success-bg); color: var(--success-fg); }
.banner-amber { background: var(--warning-soft); color: var(--warning-fg); }
.banner-red { background: var(--danger-soft); color: var(--danger-fg); }
.banner-blue { background: var(--info-soft); color: var(--info-fg); }
.banner-navy { background: var(--navy); color: var(--on-navy); }

/* SectionHeading */
.section-heading { display: flex; align-items: center; min-height: 28px; }
.section-heading .stripe { width: 4px; height: 15px; border-radius: 2px; background: var(--section-stripe); margin-right: 7px; flex-shrink: 0; }
.section-heading h2 { margin: 0; font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink); }
.section-heading .help { width: 30px; height: 28px; border: 0; background: transparent; color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.section-heading .help .ms { font-size: 16px; }
.section-heading .more { margin-left: auto; border: 0; background: transparent; color: var(--primary); font-size: 12.5px; font-weight: 600; padding: 4px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label, .field .lbl { font-size: 12.5px; line-height: 16px; font-weight: 600; color: var(--ink2); }
.input-box { position: relative; display: flex; align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 11px; border-radius: 9px; border: 1px solid var(--field); background: var(--card);
  color: var(--ink); font-size: 16px; line-height: 22px; font-weight: 500; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea { resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 0.5px var(--primary); }
.input::placeholder, .textarea::placeholder { color: var(--faint); font-weight: 400; font-size: 13px; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--line-soft); color: var(--muted); }
.field.error .input, .field.error .select, .field.error .textarea { border-color: var(--danger-fg); }
.field .note { font-size: 12px; line-height: 16px; color: var(--muted); }
.field .err { font-size: 12px; line-height: 16px; color: var(--danger-fg); }
.input-box .trailing { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; }
.input-box.has-trailing .input { padding-right: 46px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

/* Switch row */
.switch-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 2px 6px 2px 12px; width: 100%; border: 0; background: transparent; text-align: left; color: var(--ink); }
.switch-row .title { font-size: 14px; line-height: 18px; font-weight: 600; }
.switch-row .sub { font-size: 12px; line-height: 16px; color: var(--muted); }
.switch { width: 40px; height: 24px; border-radius: 12px; background: var(--faint); position: relative; flex-shrink: 0; transition: background 0.15s; margin-right: 6px; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s, width 0.15s; }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(16px); background: var(--on-primary); }

/* Amount rows */
.amount-row { border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: flex-start; padding: 5px 0; gap: 12px; }
.amount-row .l { font-size: 13px; line-height: 18px; color: var(--ink2); }
.amount-row .v { font-size: 13px; line-height: 17px; font-weight: 600; color: var(--ink); text-align: right; }
.amount-row.bold { border-top-color: var(--ink); }
.amount-row.bold .l { font-size: 14px; font-weight: 700; color: var(--ink); }
.amount-row.bold .v { font-size: 14px; font-weight: 700; }

/* StatTile */
.stat { background: var(--primary-soft); border-radius: 12px; padding: 7px 10px; min-width: 0; }
.stat .v { font-size: 16px; line-height: 20px; font-weight: 700; color: var(--primary-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .stat .v, :root[data-theme="system-dark"] .stat .v { color: var(--ink); }
.stat .v.mid { font-size: 14px; } .stat .v.small { font-size: 12px; }
.stat .l { font-size: 11px; line-height: 14px; font-weight: 500; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .stat .l, :root[data-theme="system-dark"] .stat .l { color: var(--primary); }
.stat .n { font-size: 11px; line-height: 14px; font-weight: 600; color: var(--primary-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* EmptyState */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 28px; text-align: center; }
.empty h3 { margin: 0; font-size: 18px; line-height: 22px; font-weight: 700; color: var(--ink); }
.empty p { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink2); }

/* Skeleton shimmer */
.skeleton { background: var(--line-soft); border-radius: 8px; position: relative; overflow: hidden; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent); animation: sweep 1.15s linear infinite; }
:root[data-theme="dark"] .skeleton::after, :root[data-theme="system-dark"] .skeleton::after { background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.08), transparent); }
@keyframes sweep { to { transform: translateX(100%); } }

/* FormFooter */
.form-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--card); box-shadow: 0 -4px 14px rgba(12, 35, 64, 0.12); border-top: var(--card-border); }
.form-footer-inner { max-width: 760px; margin: 0 auto; padding: 8px 10px calc(8px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; }
.shell.has-rail .form-footer, .shell.has-rail .bottom-bar { left: calc(var(--rail-w) + 10px); }
@media (max-width: 899px) { .shell.has-rail .form-footer, .shell.has-rail .bottom-bar { left: 0; } }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--card); box-shadow: 0 -4px 14px rgba(12, 35, 64, 0.12); border-top: var(--card-border); }
.bottom-bar-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; padding: 8px 10px calc(8px + var(--safe-bottom)); }

/* Sheets, dialogs, menus */
.scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); animation: fadeIn 0.15s ease-out; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 88vh; max-height: 88dvh; overflow: auto; background: var(--card); color: var(--ink);
  border-radius: 18px 18px 0 0; padding: 8px 12px calc(16px + var(--safe-bottom)); animation: sheetUp 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet .handle { width: 36px; height: 4px; border-radius: 2px; background: var(--field); margin: 2px auto 10px; }
.sheet-heading { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 4px 8px; }
.sheet-close { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--raised); color: var(--ink2); font-weight: 600; margin-left: auto; }
.sheet-close:hover { background: var(--primary-soft); color: var(--primary-ink); }
@keyframes sheetUp { from { transform: translateY(40%); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (min-width: 900px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 18px; max-height: 80vh; padding-bottom: 16px; }
  .sheet .handle { display: none; }
}
.dialog { width: calc(100% - 32px); max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--card); border-radius: 18px; padding: 18px; align-self: center; animation: fadeIn 0.15s; }
.dialog h3 { margin: 0 0 8px; font-size: 18px; line-height: 22px; }
.dialog p { margin: 0 0 14px; color: var(--ink2); font-size: 14px; }
.dialog-actions { flex-wrap: wrap; }
.dialog-actions .cf-btn { min-height: 44px; }
.dialog-actions .cf-btn .ellipsis { white-space: normal; overflow: visible; text-overflow: clip; }
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + 22px + var(--safe-bottom)); z-index: 80; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast { background: var(--inverse); color: var(--on-inverse); border-radius: 10px; padding: 10px 14px; font-size: 13px; max-width: 520px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); animation: fadeIn 0.15s; pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast button { border: 0; background: transparent; color: var(--primary-bright); font-weight: 700; padding: 2px 4px; }

/* Car photos and tiles (shared by Cars, Today and the car pages) */
.photo { position: relative; background: var(--line-soft); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.photo .ph .ms { font-size: 30px; }
.photo.greyed img { filter: grayscale(1); opacity: 0.6; }
.on-photo { background: var(--scrim); color: #fff; border-radius: 6px; height: 22px; padding: 0 6px; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; }
.on-photo.round { width: 22px; padding: 0; justify-content: center; border-radius: 11px; }

/* Help sheet and misc */
.help-body p { margin: 0 0 10px; color: var(--ink2); }
.kbd { font-family: ui-monospace, Consolas, monospace; }
.link-btn { border: 0; background: transparent; color: var(--primary); font-weight: 600; font-size: 12.5px; padding: 4px; }
.hr { height: 1px; background: var(--line); margin: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Sign-in, welcome */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-hero { background: var(--header); color: var(--on-header); padding: calc(36px + var(--safe-top)) 24px 40px; border-radius: 0 0 28px 28px; }
.auth-hero img { width: 150px; margin-bottom: 18px; }
.auth-body { width: 100%; max-width: 440px; margin: -22px auto 0; padding: 0 16px 32px; }
@media (min-width: 900px) {
  .auth { align-items: center; justify-content: center; background: var(--header); }
  .auth-hero { background: transparent; border-radius: 0; text-align: center; padding-bottom: 28px; }
  .auth-hero img { margin-left: auto; margin-right: auto; }
  .auth-body { margin-top: 0; }
}
