/* =========================================================================
   Scanline design system
   Cues from Volkswagen's design language: deep navy, a bright interaction
   blue, lots of white space, light-weight large headlines, pill buttons and
   flat, quiet cards. (Cues only: no VW logo, wordmark or proprietary fonts.)
   ========================================================================= */

:root {
  /* Brand */
  --navy: #001E50;
  --navy-2: #0A2A66;
  --blue: #0040C5;
  --sky: #00B0F0;
  --header-bg: #001E50;
  --header-ink: #FFFFFF;

  /* Surfaces & text */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F2F4F7;
  --rail: #F7F8FA;
  --ink: #001E50;
  --ink-2: #3B4A66;
  --muted: #6A7891;
  --line: #DFE4E8;
  --line-strong: #C2CAD3;

  /* Interaction */
  --accent: #0040C5;
  --accent-soft: #E7EEFB;
  --btn-bg: #001E50;
  --btn-ink: #FFFFFF;
  --btn-hover: #0040C5;
  --focus: 0 0 0 3px rgba(0, 64, 197, .35);

  /* Status */
  --concern: #DA0C1F;
  --concern-soft: #FDEBED;
  --watch: #B35400;
  --watch-soft: #FFF2E0;
  --ok: #028A3B;
  --ok-soft: #E5F5EB;
  --info: #0040C5;
  --info-soft: #E7EEFB;

  /* Charts */
  --a: #0040C5;
  --b: #E06D00;
  --wot: rgba(0, 176, 240, .16);
  --flag-hl: rgba(224, 109, 0, .16);
  --grid: rgba(0, 30, 80, .07);

  /* Shape & type */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 30, 80, .04), 0 8px 24px rgba(0, 30, 80, .05);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --header-bg: #000B22;
    --bg: #000F2C;
    --surface: #001A44;
    --surface-2: #062456;
    --rail: #00133A;
    --ink: #FFFFFF;
    --ink-2: #C8D2E3;
    --muted: #8D9DBB;
    --line: #12305E;
    --line-strong: #24467E;
    --accent: #00B0F0;
    --accent-soft: #08305E;
    --btn-bg: #FFFFFF;
    --btn-ink: #001E50;
    --btn-hover: #00B0F0;
    --focus: 0 0 0 3px rgba(0, 176, 240, .45);
    --concern: #FF6B77;
    --concern-soft: #3A0E1C;
    --watch: #FFB547;
    --watch-soft: #3A2610;
    --ok: #4BD58A;
    --ok-soft: #0B3322;
    --info: #5CC8FF;
    --info-soft: #0A2D57;
    --a: #5CC8FF;
    --b: #FFA552;
    --wot: rgba(0, 176, 240, .13);
    --flag-hl: rgba(255, 165, 82, .18);
    --grid: rgba(255, 255, 255, .08);
    --shadow: none;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; color: var(--ink); }
h1 { font-weight: 300; letter-spacing: -0.015em; }
svg { display: block; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-ink); text-decoration: none; font-weight: 500;
}
.skip-link:focus { top: 10px; }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.fine { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hint { font-size: 13px; color: var(--muted); }
.eyebrow { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--accent); }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.lede { font-size: 18px; font-weight: 300; color: var(--ink-2); max-width: 680px; margin: 14px 0 0; }
.lede.small { font-size: 16px; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg); color: var(--header-ink);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar-inner { height: var(--header-h); display: flex; align-items: center; gap: 24px; padding: 0 28px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--header-ink); flex: none; }
.brand-mark { width: 32px; height: 32px; }
.brand-mark rect { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 1.6; }
.brand-mark path { fill: none; stroke: var(--sky); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-size: 19px; font-weight: 500; letter-spacing: .01em; }

.nav-top { display: flex; align-self: stretch; gap: 4px; margin-left: 12px; }
.nav-top a {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--header-ink); text-decoration: none;
  font-size: 15px; opacity: .78; border-bottom: 3px solid transparent; border-top: 3px solid transparent;
  transition: opacity .15s, border-color .15s;
}
.nav-top a:hover { opacity: 1; }
.nav-top a.active { opacity: 1; border-bottom-color: var(--sky); }
.nav-count:empty { display: none; }
.nav-count {
  font-size: 11.5px; font-weight: 500; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; background: rgba(255, 255, 255, .14);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.share-brand { font-size: 14px; color: rgba(255, 255, 255, .85); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .9); border: 1px solid rgba(255, 255, 255, .14);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .5); }
.pill-ok::before { background: #4BD58A; }
.pill-warn::before { background: #FFB547; }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: var(--header-ink);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn-light { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.icon-btn-light:hover { border-color: var(--ink); }
.only-mobile { display: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-size: 15px; font-weight: 500; line-height: 1;
  background: transparent; color: var(--ink); border: 1.5px solid var(--ink);
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.btn-primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: #fff; }
.btn-small { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-quiet { border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger:hover { background: var(--concern-soft); color: var(--concern); }
.btn-inverse { background: #fff; color: #001E50; border-color: #fff; }
.btn-inverse:hover { background: #E7EEFB; color: #001E50; border-color: #E7EEFB; }
.btn-outline-inverse { color: #fff; border-color: rgba(255, 255, 255, .85); }
.btn-outline-inverse:hover { background: #fff; color: #001E50; }
.btn-link-inverse { border-color: transparent; color: #fff; text-decoration: underline; text-underline-offset: 4px; padding: 0 8px; }
.btn-link-inverse:hover { background: transparent; color: var(--sky); }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar {
  background: var(--rail); border-right: 1px solid var(--line);
  padding: 24px 18px 40px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto;
}
main { padding: 40px 48px 96px; min-width: 0; max-width: 1480px; width: 100%; }
main:focus { outline: none; }
.scrim { display: none; }

/* ---------------------------------------------------------------- library rail */
.dropzone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 22px 16px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 1.5px dashed var(--line-strong);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.dropzone-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: 15px; font-weight: 500; }
.dropzone span:last-child { font-size: 13px; color: var(--muted); }

.side-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.side-section h2 { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-sub { font-size: 12px; color: var(--muted); padding: 8px 10px 3px; font-weight: 500; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px;
  background: none; border: 0; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none;
}
.side-item:hover { background: var(--surface); }
.side-item.active { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.side-item .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-item .name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); }
.dot.concern { background: var(--concern); }
.dot.watch { background: var(--watch); }
.sample-icon { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.sample-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.search {
  width: 100%; height: 38px; padding: 0 14px; margin-bottom: 8px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px;
}
.search:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }

.nav-side { flex-direction: column; gap: 2px; }
.nav-side a {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav-side a:hover { background: var(--surface); }
.nav-side a.active { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.nav-side .nav-count { background: var(--surface-2); color: var(--ink-2); }

/* ---------------------------------------------------------------- home */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; align-items: center;
  background: var(--navy); color: #fff; border-radius: 20px; padding: 56px 56px 52px; overflow: hidden;
  position: relative;
}
.hero::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 176, 240, .25), transparent 70%); pointer-events: none;
}
.hero .eyebrow { color: var(--sky); }
.hero h1 { color: #fff; font-size: clamp(36px, 4.6vw, 58px); line-height: 1.05; }
.hero .lede { color: rgba(255, 255, 255, .82); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 30px; }
.hero-art svg { width: 100%; height: auto; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin: 48px 0 8px; }
.tile { border-top: 2px solid var(--ink); padding-top: 18px; }
.tile-num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.tile h3 { font-size: 21px; font-weight: 400; margin: 8px 0 6px; }
.tile p { margin: 0; color: var(--ink-2); font-size: 15px; }
.home-section { margin-top: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 28px; font-weight: 300; }
.section-head .fine { margin: 0; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.sample-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; cursor: pointer;
  padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.sample-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.sample-card strong { font-size: 16px; font-weight: 500; color: var(--ink); }
.sample-card .sub { font-size: 13.5px; color: var(--muted); }
.sample-kind {
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.sample-kind.scan { background: var(--surface-2); color: var(--ink-2); }
.home-foot { margin-top: 40px; }

/* ---------------------------------------------------------------- page header */
.log-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.log-head-main { min-width: 0; }
.log-head h1 { font-size: clamp(30px, 3.2vw, 42px); word-break: break-word; }
.log-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; flex: none; max-width: 52%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); white-space: nowrap; border: 0;
}
.chip b { font-weight: 400; color: var(--muted); }
.chip.mono { font-family: var(--mono); font-size: 12.5px; }
.chip-link { text-decoration: none; }
.chip-link:hover { background: var(--accent-soft); color: var(--accent); }
.owner-notes {
  margin-top: 16px; max-width: 760px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14.5px;
  background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); color: var(--ink-2); white-space: pre-wrap;
}
.owner-notes b { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.engine-slot:empty { display: none; }
.engine-card { margin-top: 14px; max-width: 760px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: 14.5px; }
.engine-card summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.engine-card summary b { font-weight: 500; }
.engine-card .chip { font-size: 12px; padding: 2px 10px; }
.engine-card ul { margin: 8px 0 2px; padding-left: 20px; color: var(--ink-2); }
.engine-card p { margin: 8px 0 0; }

.notice {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14.5px; margin-bottom: 14px;
  background: var(--watch-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--watch);
}

/* ---------------------------------------------------------------- menus */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 310px; max-height: 360px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0, 30, 80, .18);
}
.menu p { margin: 8px 10px; font-size: 13px; color: var(--muted); }
.menu .menu-sub { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.menu button, .menu-link {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 9px 12px;
  border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--ink); text-decoration: none; font-size: 14.5px;
}
.menu button:hover, .menu-link:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button span { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- forms */
.details-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.form-title { font-size: 20px; font-weight: 400; }
.details-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); min-width: 0; }
.details-form input:not([type="checkbox"]), .details-form textarea, .details-form select, .picker select, .repair-form input {
  min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 400; resize: vertical;
}
.details-form input:focus, .details-form textarea:focus, .details-form select:focus, .picker select:focus, .repair-form input:focus {
  border-color: var(--accent); box-shadow: var(--focus); outline: none;
}
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row label { flex: 1 1 220px; }
.form-actions { display: flex; gap: 8px; }
.details-form .fine { margin: 0; }
.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 10px; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------------------------------------------------------------- findings */
.block { margin-bottom: 8px; }
.section-h { font-size: 24px; font-weight: 300; margin: 0 0 16px; }
.flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-bottom: 24px; }
.flag {
  display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer;
  padding: 18px 20px; border-radius: var(--radius); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-top: 4px solid var(--info);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.flag:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.flag.selected { border-color: var(--accent); box-shadow: var(--focus); }
.flag.concern { border-top-color: var(--concern); }
.flag.watch { border-top-color: var(--watch); }
.flag.info { border-top-color: var(--ok); }
.flag-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flag h3 { font-size: 16.5px; font-weight: 500; }
.flag p { margin: 0; font-size: 14px; color: var(--ink-2); }
.flag .when { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.sev { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.sev.concern { background: var(--concern-soft); color: var(--concern); }
.sev.watch { background: var(--watch-soft); color: var(--watch); }
.sev.info { background: var(--ok-soft); color: var(--ok); }
.conf-badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.conf-badge.low { color: var(--watch); border-color: var(--watch); }
.flags-none { grid-column: 1 / -1; padding: 16px 20px; border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.dig-deeper { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -10px 0 24px; font-size: 14px; color: var(--muted); }
.dig-deeper:empty { display: none; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; min-width: 0; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 20px; font-weight: 400; }
.card-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr); gap: 18px; align-items: start; }
.workspace > .card { margin-bottom: 0; }
.workspace { margin-bottom: 18px; }

/* ---------------------------------------------------------------- charts */
.panel-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toggle {
  height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
}
.toggle:hover { border-color: var(--ink); color: var(--ink); }
.toggle[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.legend-key { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.legend-key span { display: inline-flex; align-items: center; gap: 7px; }
.legend-key i { display: inline-block; width: 18px; height: 10px; }
.key-solid { border-top: 2px solid var(--ink-2); height: 0 !important; }
.key-dash { border-top: 2px dashed var(--ink-2); height: 0 !important; }
.key-wot { background: var(--wot); border-radius: 2px; }
.key-flag { background: var(--flag-hl); border-radius: 2px; }
.key-a { border-top: 2.5px solid var(--a); height: 0 !important; }
.key-b { border-top: 2.5px solid var(--b); height: 0 !important; }
.chart-panel { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.chart-panel:first-child { border-top: 0; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.chart-title h3 { font-size: 14.5px; font-weight: 500; }
.readout { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.series-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.series-legend span { display: inline-flex; align-items: center; gap: 6px; }
.series-legend i { width: 16px; height: 0; border-top: 2.5px solid; display: inline-block; }
.series-legend i.dashed { border-top-style: dashed; }
.chart-box { position: relative; height: 180px; }
.chart-box canvas { cursor: crosshair; }

/* ---------------------------------------------------------------- AI */
.ai-card { position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); display: flex; flex-direction: column; }
#ai-body, #cmp-ai-body { overflow-y: auto; min-height: 0; }
.ai-empty p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.ai-setup { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; }
.ai-setup pre { font-family: var(--mono); font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; overflow-x: auto; margin: 8px 0 12px; }
.md { font-size: 15px; }
.md h2 { font-size: 13px; font-weight: 700; color: var(--ink); margin: 20px 0 6px; letter-spacing: .02em; }
.md h2:first-child { margin-top: 0; }
.md h3 { font-size: 15px; font-weight: 500; margin: 14px 0 4px; }
.md p { margin: 0 0 10px; color: var(--ink-2); }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; color: var(--ink-2); }
.md li { margin-bottom: 6px; }
.md strong { font-weight: 500; color: var(--ink); }
.md code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.md .verdict { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 500; }
.md .verdict.ok { background: var(--ok-soft); color: var(--ok); }
.md .verdict.watch { background: var(--watch-soft); color: var(--watch); }
.md .verdict.concern { background: var(--concern-soft); color: var(--concern); }
.md .conf { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-weight: 500; }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; padding: 6px 0; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-error { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--concern-soft); color: var(--concern); font-size: 14.5px; margin: 8px 0; }
.chat { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.chat-log { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 42vh; }
.chat-log:empty { display: none; }
.msg { padding: 11px 14px; border-radius: 16px; font-size: 14.5px; max-width: 100%; }
.msg.user { align-self: flex-end; max-width: 85%; background: var(--btn-bg); color: var(--btn-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.assistant .md > :last-child { margin-bottom: 0; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestion { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.suggestion:hover { border-color: var(--accent); color: var(--accent); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 16px; border-radius: 22px;
  border: 1px solid var(--line-strong); background: var(--surface); line-height: 1.4;
}
.chat-form textarea:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.disclaimer { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.stats td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stats tbody tr { cursor: pointer; }
.stats tbody tr:hover td { background: var(--surface-2); }
.stats .num { text-align: right; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.stats .ident { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stats .note { font-family: var(--font); font-size: 12px; color: var(--muted); margin-left: 6px; }
.info-dot {
  display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 6px; border-radius: 50%;
  font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); cursor: help; vertical-align: 1px;
}
.pulls-card { margin-bottom: 18px; }
#pulls-table { width: auto; min-width: min(100%, 580px); }
.stats.pulls tbody tr { cursor: default; }
.stats.pulls tbody tr:hover td { background: none; }
.stats.pulls th.pull-col { cursor: pointer; text-align: right; color: var(--accent); }
.stats.pulls th.pull-col:hover { text-decoration: underline; }
.th-sub { display: block; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); }
th.col-a { color: var(--a) !important; }
th.col-b { color: var(--b) !important; }
.delta { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--concern); }
.delta.same { color: var(--muted); }
.glossary { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.glossary summary { cursor: pointer; font-weight: 500; color: var(--accent); }
.glossary dl { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: 10px 20px; margin: 14px 0 2px; font-size: 14px; }
.glossary dt { font-weight: 500; }
.glossary dd { margin: 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- compare */
.compare-pickers { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.picker { display: flex; flex-direction: column; gap: 6px; flex: 1 1 260px; max-width: 400px; min-width: 0; }
.picker-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.picker.a .picker-label { color: var(--a); }
.picker.b .picker-label { color: var(--b); }
.picker select { width: 100%; }
.picker.a select { box-shadow: inset 4px 0 0 var(--a); }
.picker.b select { box-shadow: inset 4px 0 0 var(--b); }
#swap { margin-bottom: 2px; }
#swap svg { width: 18px; height: 18px; }
.findings-diff { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.diff-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; border-top: 4px solid var(--line-strong); }
.diff-col.resolved { border-top-color: var(--ok); }
.diff-col.new { border-top-color: var(--concern); }
.diff-col.persisting { border-top-color: var(--watch); }
.diff-col h3 { font-size: 15px; font-weight: 500; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.diff-col h3 .count { font-family: var(--mono); font-size: 12px; min-width: 24px; height: 22px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-2); }
.diff-col ul { margin: 0; padding-left: 18px; font-size: 14.5px; color: var(--ink-2); }
.diff-col li { margin-bottom: 6px; }
.diff-col li strong { color: var(--ink); font-weight: 500; }
.diff-col .none { font-size: 14px; color: var(--muted); margin: 0; }
#compare-view .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); }
#cmp-pull .stats td, #cmp-pull .stats th { padding: 8px 10px; }
#cmp-pull .stats td:first-child { min-width: 110px; }

/* ---------------------------------------------------------------- scans */
.count-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.count-card { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.count-card strong { font-size: 40px; font-weight: 300; line-height: 1; }
.count-card span { font-size: 14px; color: var(--muted); }
.count-card.attention strong { color: var(--concern); }
.count-card.watch strong { color: var(--watch); }
.count-card.ok strong { color: var(--ok); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-bottom: 18px; }
.checks .flag { cursor: default; }
.checks .flag:hover { transform: none; box-shadow: none; }
.checks .flag.info { border-top-color: var(--info); }
.checks .sev.info { background: var(--info-soft); color: var(--info); }
.fault-group { margin-bottom: 16px; }
.level-h { font-size: 14px; font-weight: 700; margin: 14px 0 10px; color: var(--ink-2); }
.level-h.attention { color: var(--concern); }
.level-h.watch { color: var(--watch); }
.fault { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--line-strong); margin-bottom: 10px; background: var(--surface); }
.fault.attention { box-shadow: inset 4px 0 0 var(--concern); }
.fault.watch { box-shadow: inset 4px 0 0 var(--watch); }
.fault-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.fault-code { margin-left: auto; font-family: var(--mono); font-size: 12.5px; }
.fault h4 { margin: 6px 0 4px; font-size: 16px; font-weight: 500; }
.fault-sub { font-weight: 400; color: var(--ink-2); }
.fault-why { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.badges { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-transform: capitalize; white-space: nowrap; }
.badge.safety { background: var(--concern-soft); color: var(--concern); text-transform: none; font-weight: 500; }
.link-head .badge { text-transform: none; }
.badge.link-confirmed { background: var(--watch-soft); color: var(--watch); }
.badge.link-not-seen { background: var(--info-soft); color: var(--info); }
.badge.link-not-logged { color: var(--muted); }
.ff { margin-top: 8px; font-size: 13.5px; }
.ff summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.ff dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 8px 0 0; font-family: var(--mono); font-size: 12.5px; }
.ff dt { color: var(--muted); }
.ff dd { margin: 0; }
.link-line { margin: 8px 0 0; font-size: 13.5px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); }
.link-line.confirmed { background: var(--watch-soft); }
.link-line.clear { background: var(--info-soft); }

/* ---------------------------------------------------------------- used-car check */
.verdict-banner { display: flex; gap: 16px; align-items: flex-start; padding: 20px 24px; border-radius: var(--radius); margin-bottom: 16px; background: var(--surface-2); }
.verdict-banner strong { font-size: 24px; font-weight: 300; }
.verdict-banner p { margin: 6px 0 0; color: var(--ink-2); font-size: 14.5px; }
.verdict-dot { width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--muted); }
.verdict-banner.green { background: var(--ok-soft); }
.verdict-banner.green .verdict-dot { background: var(--ok); }
.verdict-banner.amber { background: var(--watch-soft); }
.verdict-banner.amber .verdict-dot { background: var(--watch); }
.verdict-banner.red { background: var(--concern-soft); }
.verdict-banner.red .verdict-dot { background: var(--concern); }
#check-view .findings-diff { margin-top: 18px; }
#check-view .diff-col li { margin-bottom: 10px; }
ul.compact { margin: 0 0 8px; padding-left: 18px; font-size: 14.5px; color: var(--ink-2); }
ul.compact li { margin-bottom: 6px; }
ul.compact strong { color: var(--ink); font-weight: 500; }
.link-row { margin-bottom: 12px; font-size: 14.5px; }
.link-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.links .link-row { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.links .link-row:last-child { border-bottom: 0; }
.steps-list { margin: 0; padding-left: 22px; font-size: 15px; color: var(--ink-2); }
.steps-list li { margin-bottom: 8px; }

/* ---------------------------------------------------------------- garage */
.garage-group { margin-bottom: 24px; }
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.vehicle-card {
  display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; border-radius: var(--radius); text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.vehicle-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.vehicle-card strong { font-size: 18px; font-weight: 400; }
.vehicle-card .sub { font-size: 13.5px; color: var(--muted); }
#garage-view .details-form, #vehicle-view .details-form { margin-top: 18px; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.trend-box { height: 170px; }
.repairs { list-style: none; margin: 0 0 14px; padding: 0; }
.repairs li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.repairs strong { font-weight: 500; }
.repairs p { margin: 2px 0 0; }
.repair-actions { display: flex; gap: 6px; flex: none; }
.repair-form { display: flex; gap: 8px; flex-wrap: wrap; }
.repair-form input[name="title"] { flex: 1 1 260px; }
.repair-form input[name="odometer_km"] { width: 120px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.timeline a { font-weight: 500; text-decoration: none; }
.timeline a:hover { text-decoration: underline; }
.tl-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); min-width: 104px; }
.tl-kind { text-transform: none; }
.tl-repair .tl-kind { background: var(--accent-soft); color: var(--accent); }
.tl-scan .tl-kind { background: var(--watch-soft); color: var(--watch); }
.tl-findings { flex-basis: 100%; padding-left: 114px; margin: 0; }

/* ---------------------------------------------------------------- recipes */
.recipes-top { grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); }
.safety-card { box-shadow: inset 4px 0 0 var(--watch); }
.safety-card p { margin: 0; font-size: 15px; color: var(--ink-2); }
.recipe-filter { margin-bottom: 16px; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.recipe { padding: 0; margin: 0; }
.recipe summary { cursor: pointer; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; list-style: none; }
.recipe summary::-webkit-details-marker { display: none; }
.recipe summary strong { font-size: 17px; font-weight: 500; }
.recipe summary .chip { font-size: 12px; padding: 2px 10px; }
.recipe[open] { border-color: var(--accent); }
.recipe[open] summary { border-bottom: 1px solid var(--line); }
.recipe-symptoms { margin: 0; }
.recipe-body { padding: 6px 20px 18px; font-size: 14.5px; color: var(--ink-2); }
.recipe-body h4 { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.recipe-body ul, .recipe-body ol { margin: 0; padding-left: 20px; }
.recipe-body li { margin-bottom: 4px; }
.recipe-body code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; color: var(--ink); }

/* ---------------------------------------------------------------- overlays */
.drop-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 30, 80, .55); backdrop-filter: blur(3px); }
.drop-overlay div { padding: 26px 40px; border-radius: 20px; background: var(--surface); color: var(--ink); border: 2px dashed var(--accent); font-size: 20px; font-weight: 300; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 20px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 14.5px; box-shadow: 0 12px 32px rgba(0, 30, 80, .3);
}
.toast.error { background: var(--concern); }

/* ---------------------------------------------------------------- read-only share */
body.readonly .sidebar, body.readonly .ro-hide { display: none !important; }
body.readonly .shell { grid-template-columns: 1fr; }
body.readonly main { margin: 0 auto; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .workspace, #compare-view .workspace, .recipes-top { grid-template-columns: 1fr; }
  .ai-card { position: static; max-height: none; }
  .chat-log { max-height: none; }
}
@media (max-width: 1024px) {
  .only-mobile { display: grid; }
  .nav-side.only-mobile { display: flex; }
  .nav-top { display: none; }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: min(330px, 88vw); height: auto; z-index: 35;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 30, 80, .25);
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 34; background: rgba(0, 30, 80, .35); }
  main { padding: 28px 24px 72px; }
  .log-head { flex-direction: column; }
  .log-actions { max-width: none; justify-content: flex-start; }
  .hint { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  main { padding: 20px 16px 64px; }
  .topbar-right .pill { display: none; }
  #header-upload span { display: none; }
  #header-upload { width: 40px; padding: 0; }
  .hero { grid-template-columns: 1fr; padding: 32px 24px; border-radius: 16px; }
  .hero-art { display: none; }
  .tiles { grid-template-columns: 1fr; gap: 20px; margin-top: 32px; }
  .findings-diff { grid-template-columns: 1fr; }
  .count-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .count-card strong { font-size: 32px; }
  .glossary dl { grid-template-columns: 1fr; gap: 2px; }
  .glossary dd { margin-bottom: 10px; }
  .menu { left: 0; right: auto; width: min(310px, calc(100vw - 32px)); }
  .chart-box { height: 155px; }
  .tl-findings { padding-left: 0; }
  .recipe-grid, .trend-grid { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
}

/* ---------------------------------------------------------------- print */
:root[data-print] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F2F4F7; --ink: #001E50; --ink-2: #33415C; --muted: #5E6B82;
  --line: #DFE4E8; --line-strong: #C2CAD3; --accent: #0040C5; --accent-soft: #E7EEFB;
  --concern: #DA0C1F; --concern-soft: #FDEBED; --watch: #B35400; --watch-soft: #FFF2E0; --ok: #028A3B; --ok-soft: #E5F5EB;
  --info: #0040C5; --info-soft: #E7EEFB; --a: #0040C5; --b: #E06D00;
  --wot: rgba(0, 176, 240, .16); --flag-hl: rgba(224, 109, 0, .16); --grid: rgba(0, 30, 80, .08); --shadow: none; color-scheme: light;
}
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .topbar, .sidebar, .scrim, .log-actions, .panel-toggles, .card-tools, .hint, .chat-form, .suggestions, .skip-link,
  #regen, #cmp-regen, .ai-empty, .toast, .drop-overlay, .details-form, #swap, .glossary summary,
  .ro-hide, .nav, .dig-deeper, .repair-form, .recipe-filter, .hero-actions { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .workspace, #compare-view .workspace { display: block; }
  .card, .flag, .diff-col, .count-card, .fault, .verdict-banner, .link-row { break-inside: avoid; box-shadow: none; }
  #vehicle-view .card, #check-view .card, #scan-view .card { break-inside: auto; }
  .ai-card { position: static; max-height: none; }
  #ai-body, #cmp-ai-body, .chat-log { overflow: visible; max-height: none; }
  .chart-panel { break-inside: avoid; }
  .chart-box { height: 150px; }
  .glossary > dl { display: grid !important; }
  .picker select { appearance: none; border: 0; padding: 0; font-weight: 500; box-shadow: none; }
  .flag:hover, .vehicle-card:hover, .sample-card:hover { transform: none; }
  body[data-brand]::before {
    content: attr(data-brand); display: block; font-weight: 700; font-size: 14px; color: #001E50;
    padding-bottom: 8px; margin-bottom: 16px; border-bottom: 2px solid #001E50;
  }
}

/* ---------------------------------------------------------------- browser build (GitHub Pages) */
.static-mode .server-only { display: none !important; }
.form-actions.wrap { flex-wrap: wrap; }
.boot-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px;
  background: var(--navy); color: #fff;
}
.boot-card { width: min(460px, 100%); text-align: left; }
.boot-mark { width: 48px; height: 48px; margin-bottom: 22px; }
.boot-mark rect { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 1.6; }
.boot-mark path { fill: none; stroke: var(--sky); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.boot-card h1 { color: #fff; font-size: 34px; }
.boot-step { margin: 12px 0 14px; color: rgba(255, 255, 255, .85); }
.boot-bar { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--sky); transition: width .4s ease; }
.boot-card .fine { color: rgba(255, 255, 255, .6); margin-top: 18px; }
.boot-overlay.failed .boot-bar { display: none; }
.boot-overlay.failed .boot-step { color: #FFB3BA; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center; padding: 10vh 16px 16px; background: rgba(0, 30, 80, .45); backdrop-filter: blur(2px); overflow-y: auto; }
.modal { width: min(460px, 100%); background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: 0 24px 64px rgba(0, 30, 80, .35); outline: none; }
.modal.wide { width: min(680px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.modal-head h2 { font-size: 20px; font-weight: 500; margin: 0; }
.modal-head .icon-btn { width: 34px; height: 34px; }
.modal-body { padding: 14px 22px 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; }
.modal-form { display: grid; gap: 12px; }
.modal-form label, .paste-body label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.paste-body { display: grid; gap: 12px; }
.paste-area { width: 100%; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; min-height: 220px; }

/* ---------------------------------------------------------------- toast action */
.toast { display: flex; align-items: center; gap: 14px; }
.toast[hidden] { display: none; }
.toast-action { flex: none; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font: inherit; font-weight: 700; padding: 5px 14px; border-radius: 999px; cursor: pointer; }
.toast-action:hover { background: rgba(255, 255, 255, .28); }
.toast.error { border-radius: 18px; }

/* ---------------------------------------------------------------- header search button + palette */
.btn-ghost-inverse { color: rgba(255, 255, 255, .9); border-color: rgba(255, 255, 255, .25); }
.btn-ghost-inverse:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .5); }
kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.palette-btn kbd { font-size: 11.5px; opacity: .75; border-color: rgba(255, 255, 255, .25); background: transparent; }
.palette { display: grid; gap: 10px; }
.palette-input { width: 100%; height: 48px; font-size: 16px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.palette-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.palette-list { list-style: none; margin: 0 0 6px; padding: 0; max-height: 52vh; overflow-y: auto; }
.palette-item { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.palette-item.active { background: var(--accent-soft); }
.palette-kind { flex: none; width: 62px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.palette-label { font-weight: 500; }
.palette-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-none { padding: 10px 12px; }
.paste-btn { width: 100%; margin-top: -16px; }

/* ---------------------------------------------------------------- charts: title tools */
.chart-title-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chart-png { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.chart-png:hover { color: var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------- tags */
.chips.tags { margin-top: 8px; }
.chip.tag { border: 0; cursor: pointer; font: inherit; font-size: 13px; background: var(--accent-soft); color: var(--accent); }
.chip.tag:hover { background: var(--accent); color: #fff; }

/* ---------------------------------------------------------------- code library on fault cards */
.lib-line { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
details.lib-line { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
details.lib-line summary { cursor: pointer; }
details.lib-line p { margin: 6px 0 0; }
.badge.urg { text-transform: none; font-weight: 500; }
.badge.urg.high { background: var(--concern-soft); color: var(--concern); }
.badge.urg.medium { background: var(--watch-soft); color: var(--watch); }
.badge.urg.low { background: var(--ok-soft); color: var(--ok); }

/* ---------------------------------------------------------------- dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 32px; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); text-decoration: none; }
a.stat-tile:hover { background: var(--accent-soft); }
.stat-tile strong { font-size: 36px; font-weight: 300; line-height: 1.05; }
.stat-tile span { font-size: 14px; color: var(--muted); }
.stat-tile.concern strong { color: var(--concern); }
.dash-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.dash-car { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.dash-car.needs { box-shadow: inset 4px 0 0 var(--concern); }
.dash-car-name { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.dash-car-name strong { font-size: 18px; font-weight: 500; }
.dash-car-name:hover strong { color: var(--accent); }
.dash-car-name .sub { font-size: 13.5px; color: var(--muted); }
.dash-car-status { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; width: 100%; }
.dash-car-status li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.dash-car-status li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.dash-car-status li.concern::before { background: var(--concern); }
.dash-car-status li.watch::before { background: var(--watch); }
.dash-car-status li.muted { color: var(--muted); }
.dash-car-status li.muted::before { background: var(--line-strong); }
.dash-car-status a { margin-left: auto; font-size: 13px; }
.dash-recent { list-style: none; margin: 0; padding: 6px 0; }
.dash-recent a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; text-decoration: none; color: var(--ink); flex-wrap: wrap; }
.dash-recent a:hover { background: var(--surface-2); }
.dash-recent .name { font-weight: 500; }
.dash-recent .sub { color: var(--muted); font-size: 13.5px; }
.block + .block { margin-top: 32px; }

/* ---------------------------------------------------------------- code library */
.codes-search-row { margin: 8px 0 22px; }
.codes-search { max-width: 640px; height: 50px; font-size: 16px; }
.code-detail { margin-bottom: 24px; box-shadow: inset 4px 0 0 var(--accent); }
.code-detail-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-big { font-family: var(--mono); font-size: 28px; font-weight: 500; margin-right: 8px; }
.code-detail h2 { font-size: 22px; font-weight: 400; margin: 14px 0 8px; }
.code-detail p { color: var(--ink-2); }
.code-grid { display: grid; gap: 2px; margin-bottom: 18px; }
.code-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 160px 96px; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.code-row:hover { background: var(--surface-2); }
.code-mono { font-family: var(--mono); font-weight: 500; }
.code-sys { color: var(--muted); font-size: 13.5px; }
.code-row .badge { justify-self: start; }

/* ---------------------------------------------------------------- scan vs scan */
.verdict-strip { padding: 14px 20px; border-radius: var(--radius); margin-bottom: 16px; font-size: 16px; background: var(--info-soft); }
.verdict-strip.concern { background: var(--concern-soft); color: var(--concern); }
.verdict-strip.watch { background: var(--watch-soft); color: var(--watch); }
.verdict-strip.ok { background: var(--ok-soft); color: var(--ok); }
.count-card.concern strong { color: var(--concern); }
.count-card.historical strong { font-size: 30px; }
.diff-list { display: grid; }
.badge.diff { text-transform: none; font-weight: 500; }
.badge.diff.new { background: var(--concern-soft); color: var(--concern); }
.badge.diff.cleared { background: var(--ok-soft); color: var(--ok); }
.badge.diff.changed { background: var(--watch-soft); color: var(--watch); }
.fault.diff-cleared { opacity: .8; }
#scancompare-view .card { margin-bottom: 16px; }

/* ---------------------------------------------------------------- maintenance */
.badge.maint { text-transform: none; font-weight: 500; }
.badge.maint.overdue { background: var(--concern-soft); color: var(--concern); }
.badge.maint.soon { background: var(--watch-soft); color: var(--watch); }
.badge.maint.ok { background: var(--ok-soft); color: var(--ok); }
.stats.maint td { vertical-align: middle; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 4px; }
.maint-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.maint-form[hidden] { display: none; }
.maint-form input[name="title"] { flex: 1 1 220px; }
.maint-form input[type="number"] { width: 150px; }
.spend { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.cost { margin-left: 8px; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.repair-form input[name="cost"] { width: 120px; }
.badge.recur-on { background: var(--watch-soft); color: var(--watch); text-transform: none; }
.badge.recur-off { background: var(--ok-soft); color: var(--ok); text-transform: none; }

/* ---------------------------------------------------------------- checklist */
.checklist-card { margin-top: 18px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.cl-label { font-size: 15px; }
.cl-star { color: var(--watch); margin-right: 6px; }
.cl-ok .cl-label { color: var(--ok); }
.cl-problem .cl-label { color: var(--concern); font-weight: 500; }
.cl-na .cl-label { color: var(--muted); text-decoration: line-through; }
.cl-note { grid-column: 1 / -1; }
input.cl-note { width: 100%; }
.seg { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.seg-btn { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px; padding: 6px 14px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-strong); }
.seg-btn:hover { background: var(--surface-2); }
.seg-btn.ok.on { background: var(--ok); color: #fff; }
.seg-btn.problem.on { background: var(--concern); color: #fff; }
.seg-btn.na.on { background: var(--muted); color: #fff; }
.badge.cl.ok { background: var(--ok-soft); color: var(--ok); }
.badge.cl.problem { background: var(--concern-soft); color: var(--concern); }

@media (max-width: 1024px) {
  .palette-btn kbd { display: none; }
  .palette-btn { width: 40px; padding: 0; }
}
@media (max-width: 720px) {
  .code-row { grid-template-columns: 70px minmax(0, 1fr); }
  .code-sys, .code-row .badge { display: none; }
  .checklist li { grid-template-columns: 1fr; }
  .modal-backdrop { padding-top: 4vh; }
  .stats.maint .row-actions { white-space: normal; }
}
@media print {
  .modal-backdrop, .palette-btn, .paste-btn, .maint-form, .seg, input.cl-note, .chart-png, .dash-actions { display: none !important; }
}

/* ---------------------------------------------------------------- built-in explanation */
.quick-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted);
  background: var(--surface-2); border-radius: 999px; padding: 3px 12px; margin-bottom: 10px; }
.quick-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.quick-note.ai::before { background: var(--accent); }
.ai-upgrade { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.chat-form[hidden] { display: none; }

/* ---------------------------------------------------------------- insights */
.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.insight-grid > .card { margin: 0; }
.patterns { margin-bottom: 18px; box-shadow: inset 4px 0 0 var(--accent); }
.pattern-list { margin: 0 0 8px; padding-left: 20px; font-size: 15px; color: var(--ink-2); }
.pattern-list li { margin-bottom: 6px; }
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bar-row { display: block; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
a.bar-row:hover, .bar-list li:hover .bar-row { background: var(--surface-2); }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-family: var(--mono); font-weight: 500; flex: none; }
.bar-track { height: 8px; margin: 6px 0 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar-fill.danger { background: var(--concern); }
.bar-sub { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- system check */
.check-list { list-style: none; margin: 16px 0 0; padding: 6px 0; }
.ck { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.ck:last-child { border-bottom: 0; }
.ck-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.ck.pass .ck-icon { background: var(--ok); color: #fff; }
.ck.fail .ck-icon { background: var(--concern); color: #fff; }
.ck.run .ck-icon { background: var(--accent-soft); color: var(--accent); }
.ck-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ck-main strong { font-weight: 500; }
.ck-status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ck.fail .ck-status { color: var(--concern); font-weight: 500; }
#systemcheck-view .verdict-strip { margin-top: 8px; }

@media (max-width: 900px) {
  .insight-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .ck { grid-template-columns: 24px minmax(0, 1fr); padding: 10px 14px; }
  .ck-status { grid-column: 2; }
}
@media print {
  .ai-upgrade { display: none !important; }
}

/* ---------------------------------------------------------------- reference library + public data */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 22px; overflow-x: auto; }
.tab { padding: 10px 16px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.ext-link { font-weight: 500; white-space: nowrap; }
.code-links { margin-top: 12px; }
.code-structure { margin-top: 10px; font-size: 14px; }
.code-structure summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.ref-line { margin: 8px 0 0; }
.ff-bits { margin: 10px 0 0; }
.ident.about { font-family: var(--font); font-size: 12.5px; }
.modules-ref td { vertical-align: top; }
.modules-ref .badge { margin-left: 8px; }
.code-anatomy { font-family: var(--mono); font-size: 13px; background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; }
.guide-list { padding-left: 20px; color: var(--ink-2); font-size: 14.5px; }
.guide-list li { margin-bottom: 6px; }
.ref-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; font-size: 14px; }
.ref-dl dt { font-weight: 500; }
.ref-dl dd { margin: 0; color: var(--ink-2); }
.ftb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; font-size: 14px; color: var(--ink-2); }
.ftb { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ftb .code-mono { color: var(--ink); min-width: 24px; }
.nhtsa-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.nhtsa-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
.nhtsa-out { margin-top: 14px; }
.recall-list { list-style: none; margin: 0 0 12px; padding: 0; }
.recall-list li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.recall-list p { margin: 6px 0 0; color: var(--ink-2); }
.recall-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recall-list details summary { cursor: pointer; color: var(--accent); font-weight: 500; margin-top: 6px; }
.source { margin-top: 10px; }
@media (max-width: 720px) { .nhtsa-form { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- live */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.live-tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.live-tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.live-value { font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--ink); }
.live-chart { height: 90px; margin-top: 6px; }
.pid-pick summary { cursor: pointer; color: var(--accent); font-weight: 500; margin: 6px 0; }
.pid-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; font-size: 14px; margin: 8px 0 12px; }
.live-ecu + .live-ecu { margin-top: 10px; }
.badge.live-stored { background: var(--concern-soft); color: var(--concern); margin-left: 8px; }
.badge.live-pending { background: var(--watch-soft); color: var(--watch); margin-left: 8px; }
.badge.live-permanent { background: var(--surface-2); color: var(--ink-2); margin-left: 8px; }
.not-here summary, .traffic summary { cursor: pointer; font-weight: 500; }
.traffic pre { max-height: 360px; overflow: auto; }
#live-view .card { margin-bottom: 16px; }
#live-view .insight-grid > .card { margin-bottom: 0; }

/* ---------------------------------------------------------------- installation list + coding */
.stats.install td { vertical-align: top; }
.stats td.small, .stats .small { font-size: 13px; }
.coding summary { cursor: pointer; color: var(--accent); }
.coding-table { margin-top: 6px; font-size: 12.5px; border-collapse: collapse; }
.coding-table td, .coding-table th { padding: 2px 8px; text-align: left; }
.bits span { color: var(--muted); }
.bits span.on { color: var(--ink); font-weight: 700; }
tr.status-only td { color: var(--ink-2); }
.change-list { list-style: none; padding: 0; margin: 0; }
.change-list > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.change-list > li:last-child { border-bottom: 0; }
.change-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-top: 4px; }
.change-row .old { text-decoration: line-through; color: var(--muted); }

/* Top nav: never wrap labels; tighten as the window narrows. */
.nav-top a { white-space: nowrap; }
@media (max-width: 1360px) { .nav-top a { padding: 0 9px; font-size: 14px; } .topbar-inner { gap: 14px; } }
@media (max-width: 1180px) { .palette-btn kbd { display: none; } .palette-btn { width: 36px; padding: 0; } #ai-status { display: none; } }

/* ---------------------------------------------------------------- cookie consent */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 75; max-width: 640px; margin: 0 auto;
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-radius: 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 16px 48px rgba(0, 30, 80, .25);
}
.consent p { margin: 0; flex: 1 1 320px; font-size: 14px; color: var(--ink-2); }
.consent p strong { color: var(--ink); }
.consent-actions { display: flex; gap: 8px; flex: none; }
@media print { .consent { display: none !important; } }
