/* Bazon design system — single source of truth for every server-rendered page.
   Structure: tokens → base → shell/navigation → components → motion → responsive.
   Replaces the stacked redesign skins; keeps every legacy class name working. */

/* ---------------------------------------------------------------- tokens -- */
:root {
  /* Brand: orange accent on near-black sidebar chrome, light content. */
  --brand-deep: #10141a;
  --brand-base: #0d1015;
  --brand-bright: #f59e0b;
  --color-accent: #b45309;
  --color-accent-hover: #92400e;
  --accent-bright: #f59e0b;
  --accent-soft: #fff7e6;
  --color-canvas: #f4f5f7;
  --color-surface: #ffffff;
  --color-soft: #f4f5f7;
  --color-ink: #16181d;
  --color-muted: #5b6472;
  --color-faint: #8a94a3;
  --color-line: #e6e9ee;
  --color-line-strong: #d3d9e2;
  --color-sidebar-text: #99a3b0;
  --color-sidebar-muted: #6d7887;
  --sidebar-active: #1b212b;
  --button-dark: #14171c;
  --button-dark-hover: #242933;

  /* Semantic */
  --color-green: #15803d;
  --color-green-bg: #e8f7ee;
  --color-green-line: #bce4cb;
  --color-amber: #92610a;
  --color-amber-bg: #fdf3dd;
  --color-amber-line: #ecd9a0;
  --color-red: #b42334;
  --color-red-bg: #fdecee;
  --color-red-line: #f2c3cd;
  --color-blue: #1d4ed8;
  --color-blue-bg: #e3ecfd;
  --color-blue-line: #c4d4f8;

  /* Legacy aliases (older rules and page modules reference these) */
  --ink: var(--color-ink);
  --muted: var(--color-muted);
  --line: var(--color-line);
  --surface: var(--color-surface);
  --canvas: var(--color-canvas);
  --blue: var(--color-blue);
  --green: var(--color-green);
  --amber: var(--color-amber);
  --red: var(--color-red);
  --radius: 14px;

  /* Shape and depth */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(20, 24, 32, .04);
  --shadow-2: 0 1px 2px rgba(20, 24, 32, .04), 0 10px 30px -12px rgba(20, 24, 32, .14);
  --shadow-3: 0 24px 64px -16px rgba(20, 24, 32, .3);

  /* Motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur-fast: .15s;
  --dur: .25s;
  --dur-slow: .42s;

  color-scheme: light;
}

/* ------------------------------------------------------------------ base -- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--color-canvas); }
body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-ink);
  font: 400 14.5px/1.6 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
p { margin: 0 0 12px; }
h1, h2, h3, h4 { margin: 0; color: var(--color-ink); }
a { color: var(--color-accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
small, .muted { color: var(--color-muted); }
pre, code, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
table { border-collapse: collapse; width: 100%; }
td, th { text-align: left; vertical-align: top; border-bottom: 1px solid var(--color-line); padding: 12px 16px; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
::selection { background: #cfe5fa; color: var(--brand-deep); }

/* Typography scale — quiet, information-first headers */
.content h1, h1 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 700; line-height: 1.15; letter-spacing: -.024em; }
.content h2, h2 { font-size: 17px; font-weight: 650; line-height: 1.35; letter-spacing: -.015em; margin: 0 0 4px; }
.content h3, h3 { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.content h2 + .muted, .section-head .muted { font-size: 13px; }
.content label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 6px; }
.subtitle { margin: 6px 0 0; max-width: 60ch; }

/* ------------------------------------------------------ shell and sidebar -- */
.shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar {
  position: sticky; top: 0;
  width: 240px; flex-basis: 240px; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--brand-base);
  color: var(--color-sidebar-text);
  padding: 22px 14px 16px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 26px; color: #fff; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-bright);
  color: #16181d; font-size: 16px; font-weight: 800;
}
.brand-text small { display: block; margin-top: 1px; color: var(--color-sidebar-muted); font-size: 11px; font-weight: 500; letter-spacing: 0; }
.nav-group + .nav-group { margin-top: 26px; }
.nav-label {
  padding: 0 12px 8px;
  color: var(--color-sidebar-muted); font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
}
.nav { display: grid; gap: 2px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 40px; padding: 7px 10px 7px 12px;
  border-radius: var(--r-sm);
  color: var(--color-sidebar-text); font-weight: 550; font-size: 13.5px;
  text-decoration: none;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
.nav a:hover .nav-icon { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active:hover { background: var(--sidebar-active); }
/* Orange position marker on the sidebar's left edge, aligned with the item. */
.nav a.active::before {
  content: ""; position: absolute;
  left: -22px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent-bright);
}
.nav-badge {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 9999px;
  color: var(--color-sidebar-text); font-size: 11px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.nav a.active .nav-badge { color: #fff; border-color: rgba(255, 255, 255, .22); }
.nav-icon {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  color: var(--color-sidebar-text);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease);
}
.nav-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover .nav-icon { transform: scale(1.06); }
.nav a.active .nav-icon { color: var(--accent-bright); background: rgba(245, 158, 11, .14); }
.sidebar-footer {
  margin-top: auto; padding: 16px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: var(--color-sidebar-muted); font-size: 11.5px; line-height: 1.7;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: #3ecf8e; }
.build-version { display: block; opacity: .8; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- app bar -- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 9px 28px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
}
.appbar-crumb { display: grid; gap: 0; min-width: 0; }
.appbar-group { color: var(--color-faint); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.appbar-page { color: var(--color-ink); font-size: 14px; font-weight: 650; white-space: nowrap; }
.appbar-search {
  position: relative;
  flex: 0 1 380px;
  display: flex; align-items: center;
}
.appbar-search-icon {
  position: absolute; left: 12px; display: grid; place-items: center;
  color: var(--color-faint); pointer-events: none;
}
.appbar-search-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.appbar-search input {
  width: 100%; min-height: 36px;
  padding: 7px 14px 7px 36px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--color-canvas); color: var(--color-ink);
  font: inherit; font-size: 13px;
}
.appbar-search input:focus {
  outline: none; border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
  background: var(--color-surface);
}
.appbar-side { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--color-line); border-radius: 9999px;
  background: var(--color-surface);
  color: var(--color-ink) !important; font-size: 12px; font-weight: 650;
  white-space: nowrap; text-decoration: none;
  transition: border-color var(--dur-fast) ease;
}
.conn-pill:hover { border-color: var(--color-line-strong); text-decoration: none; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #d9a441; }
.conn-dot.on { background: #3ecf8e; animation: ping-dot 2.6s var(--ease) infinite; }
@keyframes ping-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, .4); }
  55% { box-shadow: 0 0 0 5px rgba(62, 207, 142, 0); }
}
.sync-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--color-line); border-radius: 9999px;
  background: var(--color-surface);
  color: var(--color-muted); font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.sync-pill svg { width: 14px; height: 14px; fill: none; stroke: var(--accent-bright); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* -------------------------------------------------------------- content -- */
.content {
  flex: 1; min-width: 0;
  padding: 34px clamp(24px, 4vw, 56px) 72px;
}
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 20px; margin-bottom: 26px; }
.eyebrow { color: var(--color-faint); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 6px 0 0; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.account {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--r-md); padding: 8px 12px;
}
.avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9999px;
  background: var(--color-soft); color: var(--color-accent); font-weight: 700;
}
.topbar > a.tool { min-height: 40px; padding: 9px 16px; white-space: nowrap; font-size: 13.5px; }

/* ---------------------------------------------------------------- panels -- */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.panel-pad { padding: clamp(20px, 2.6vw, 28px); }
article {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--r-md); padding: 14px 16px; margin: 0 0 14px;
  box-shadow: var(--shadow-1);
}
article strong { color: var(--color-ink); }

/* KPI strip: one white container, cells split by hairline dividers. */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; }
.kpi {
  position: relative; padding: 18px 22px;
  background: transparent;
  border: 0; border-left: 1px solid var(--color-line);
  border-radius: 0; box-shadow: none;
}
.kpis > :first-child { border-left: 0; }
.kpis a.kpi { display: block; color: var(--color-ink); text-decoration: none; transition: background var(--dur-fast) ease, transform var(--dur-fast) var(--ease); }
.kpis a.kpi:hover { background: #fafbfc; transform: none; text-decoration: none; }
.kpis a.kpi.blue:hover { box-shadow: inset 0 -2px 0 var(--color-blue); }
.kpis a.kpi.green:hover { box-shadow: inset 0 -2px 0 var(--color-green); }
.kpis a.kpi.amber:hover { box-shadow: inset 0 -2px 0 var(--accent-bright); }
.kpis a.kpi:last-child:hover { box-shadow: inset 0 -2px 0 var(--color-red); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--color-muted); }
.kpi-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; flex-shrink: 0; }
.kpi.amber .kpi-label::before { background: var(--accent-bright); }
.kpi.green .kpi-label::before { background: #22c55e; }
.kpi:last-child .kpi-label::before { background: #ef4444; }
/* Attention states breathe: the eye lands on what needs an operator. */
.kpi.amber .kpi-label::before,
.kpi:last-child .kpi-label::before { animation: breathe-dot 2.6s ease-in-out infinite; }
@keyframes breathe-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.kpi-value { margin-top: 8px; font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-note { margin-top: 4px; font-size: 12.5px; color: var(--color-faint); }
.kpi.amber .kpi-value { color: var(--color-amber); }
.kpi.green .kpi-value { color: var(--color-green); }
.kpi:last-child .kpi-value { color: var(--color-red); }

/* Two-column work areas */
.workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .85fr); gap: 20px; align-items: start; }
.overview-content .workspace > div { min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.section-head > div > .muted { margin: 4px 0 0; }
.section-head a { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------------- buttons -- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 16px;
  border: 1px solid var(--color-line); border-radius: var(--r-sm);
  background: var(--color-surface); color: var(--color-ink);
  font: 600 13.5px/1.2 Inter, sans-serif;
  cursor: pointer; text-decoration: none;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease,
    color var(--dur-fast) ease, transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) ease;
}
button:hover { background: var(--color-soft); border-color: var(--color-line-strong); text-decoration: none; }
button:active { transform: translateY(1px); }
button.primary { background: var(--button-dark); border-color: var(--button-dark); color: #fff; }
button.primary:hover { background: var(--button-dark-hover); border-color: var(--button-dark-hover); transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(10, 12, 16, .5); }
button.primary:active { transform: translateY(0); box-shadow: none; }
button.ghost { background: var(--color-canvas); }
button.ghost:hover { background: var(--color-soft); }
button:disabled, button.primary:disabled {
  background: var(--color-canvas); color: var(--color-faint);
  border-color: var(--color-line); cursor: not-allowed; transform: none; box-shadow: none;
}
button.danger { color: var(--color-red); background: var(--color-red-bg); border-color: var(--color-red-line); }
.vehicles-page .link-button {
  min-height: 32px; padding: 5px 12px; font-size: 12.5px;
  background: var(--color-canvas); color: var(--color-red); border-color: var(--color-red-line);
}
/* Anchor-shaped buttons */
a.button-ghost {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 9px 16px;
  border: 1px solid var(--color-line); border-radius: var(--r-sm);
  background: var(--color-surface); color: var(--color-ink);
  font-weight: 600; font-size: 13.5px; text-decoration: none;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
a.button-ghost:hover { background: var(--color-soft); border-color: var(--color-line-strong); text-decoration: none; }

/* ----------------------------------------------------------------- forms -- */
input, textarea, select {
  width: 100%; min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--color-line-strong); border-radius: var(--r-sm);
  background: var(--color-surface); color: var(--color-ink);
  font: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
input::placeholder, textarea::placeholder { color: var(--color-faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent-bright); }
.quick-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 16px; max-width: 640px; }
.quick-form label { grid-column: 1 / -1; margin: 0; }
.quick-form input { min-width: 0; }
.quick-form button { padding-inline: 22px; }
.helper { margin: 12px 0 0; font-size: 12.5px; color: var(--color-muted); }

/* -------------------------------------------------------- status and chips -- */
.status {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 9999px; flex-shrink: 0;
  background: var(--color-soft); color: var(--color-muted);
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
}
.status.ready { background: var(--color-green-bg); color: var(--color-green); }
.status.needs_review { background: var(--color-amber-bg); color: var(--color-amber); }
.status.published { background: var(--color-blue-bg); color: var(--color-blue); }
.status.error { background: var(--color-red-bg); color: var(--color-red); }
.status.skipped, .status.verification_failed { background: var(--color-red-bg); color: var(--color-red); }
.missing {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  background: var(--color-amber-bg); color: var(--color-amber);
  font-size: 12px; font-weight: 600;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.chips a {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border: 1px solid var(--color-line); border-radius: 9999px;
  background: var(--color-surface); color: var(--color-ink) !important;
  font-weight: 600; font-size: 13px; text-decoration: none;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.chips a:hover { border-color: var(--color-line-strong); background: var(--color-soft); color: var(--color-ink) !important; text-decoration: none; }
.chips a.active { background: var(--button-dark); border-color: var(--button-dark); color: #fff !important; }

/* ---------------------------------------------------------------- banners -- */
.error-banner, .alert {
  display: block; padding: 12px 16px; border-radius: var(--r-md);
  margin: 0 0 16px; font-size: 13.5px; line-height: 1.55;
}
.error-banner { background: var(--color-red-bg); color: #97273a; border: 1px solid var(--color-red-line); }
.error-banner strong { color: #97273a; }
.alert, .missing-banner { background: var(--color-amber-bg); color: #7a5600; border: 1px solid var(--color-amber-line); }
.alert { display: block; }
p.alert { margin: 0 0 16px; }
.vehicle-match {
  padding: 12px 16px; margin: 0 0 16px;
  background: var(--color-soft); color: var(--color-ink);
  border: 1px solid #cde2f7; border-left: 3px solid var(--brand-bright);
  border-radius: var(--r-md); font-size: 13.5px;
}

/* ------------------------------------------------------------ draft cards -- */
/* Feed rows inside one panel: hairline dividers, hover wash, no card chrome. */
.draft-list { display: grid; gap: 0; }
.draft {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  margin: 0 -12px; padding: 13px 16px;
  border: 0; border-top: 1px solid var(--color-line);
  border-radius: 0;
  background: transparent;
  transition: background var(--dur-fast) ease;
}
.draft:first-child { border-top: 0; }
.draft:hover { background: #f8f9fb; }
.draft-icon {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: var(--r-md);
  border: 1px solid var(--color-line);
  background: var(--color-canvas); color: var(--color-faint);
  transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.draft:hover .draft-icon { transform: scale(1.05); color: var(--color-accent); border-color: var(--color-line-strong); }
.draft-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.draft-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 650; color: var(--color-ink); }
.draft-title a { color: var(--color-ink); }
.draft-summary { margin-top: 3px; color: var(--color-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-cost { margin-top: 3px; color: var(--color-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.draft-action {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--color-ink) !important; font-weight: 550; font-size: 13px;
  white-space: nowrap; text-decoration: none;
  transition: color var(--dur-fast) ease;
}
.draft-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur-fast) var(--ease); }
.draft-action:hover { color: var(--color-accent) !important; text-decoration: none; }
.draft-action:hover svg { transform: translateX(2px); }
.draft-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.draft-actions .draft-retry { margin: 0; }
.draft-actions .draft-retry button { min-height: 32px; padding: 5px 12px; font-size: 12px; }
.list-count { margin: 10px 2px 0; color: var(--color-faint); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }

/* Tool cards (quick navigation) */
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 14px 16px;
  border: 1px solid var(--color-line); border-radius: var(--r-md);
  background: var(--color-surface); color: var(--color-ink) !important;
  font-weight: 600; font-size: 13.5px; text-decoration: none;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) ease;
}
.tool:hover { background: var(--color-soft); border-color: var(--color-line-strong); transform: translateY(-1px); box-shadow: var(--shadow-2); text-decoration: none; }
.tool:hover .tool-icon { transform: scale(1.08); }
.tool-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--r-sm); background: var(--color-soft); color: var(--color-accent); transition: transform var(--dur-fast) var(--ease); }
.tool-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Tool rows: icon + title + subtitle + arrow, stacked like the mockup list. */
.tool-rows { display: grid; }
.tool-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 13px 2px;
  border-top: 1px solid var(--color-line);
  color: var(--color-ink) !important; text-decoration: none;
  transition: background var(--dur-fast) ease;
}
.tool-row:first-child { border-top: 0; }
.tool-row:hover { background: #f8f9fb; text-decoration: none; }
.tool-row .tool-icon { width: 40px; height: 40px; border: 1px solid var(--color-line); background: var(--color-canvas); color: var(--color-ink); }
.tool-row:hover .tool-icon { color: var(--color-accent); border-color: #f0d9ae; background: var(--accent-soft); }
.tool-text strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--color-ink); }
.tool-text small { display: block; margin-top: 1px; color: var(--color-muted); font-size: 12.5px; font-weight: 400; }
.tool-arrow { display: grid; place-items: center; color: var(--color-faint); transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease); }
.tool-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-row:hover .tool-arrow { color: var(--color-accent); transform: translateX(2px); }

/* Session and settings */
.session {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  margin: 0 0 16px; padding: 13px 15px;
  background: var(--color-canvas); border: 1px solid var(--color-line); border-radius: var(--r-md);
}
.session-state { display: flex; align-items: center; gap: 9px; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.state-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--color-green); }
.state-dot.off { background: var(--color-line-strong); }
.session-meta { color: var(--color-muted); font-size: 12px; text-align: right; line-height: 1.55; font-variant-numeric: tabular-nums; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; max-width: 1180px; }
.settings-card form { display: grid; gap: 4px; }
.settings-card form label { margin: 8px 0 2px; }
.settings-card form button { width: 100%; margin-top: 12px; }
.settings-secondary { margin-top: 10px; }
.settings-secondary button { margin-top: 0; background: var(--color-canvas); }
.settings-link {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 13px 0; border-top: 1px solid var(--color-line);
  color: var(--color-ink) !important; text-decoration: none;
}
.settings-link:hover { color: var(--color-accent) !important; text-decoration: none; }
.settings-link:hover strong { color: var(--color-accent); }
.settings-link small { display: block; margin-top: 2px; color: var(--color-muted); font-weight: 400; }
.settings-link .tool-icon { width: 34px; height: 34px; }

/* Vehicles */
.vehicle-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.vehicle-option {
  display: flex !important; gap: 10px; align-items: flex-start;
  margin: 0 !important; padding: 12px 14px;
  border: 1px solid var(--color-line); border-radius: var(--r-md);
  background: var(--color-surface); font-weight: 500 !important;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.vehicle-option:hover { border-color: var(--color-line-strong); background: var(--color-soft); }
.vehicle-option input { width: auto; margin-top: 3px; }
.vehicle-option small { display: block; margin-top: 3px; color: var(--color-muted); }
.saved-vehicles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.saved-vehicles li {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--color-line); border-radius: var(--r-md);
  background: var(--color-surface); font-size: 13.5px;
}
.saved-vehicles li strong { color: var(--color-ink); }
.inline-form { display: inline !important; margin-left: auto; }
.vehicles-page { max-width: 1240px; }
.vehicles-page .quick-form { grid-template-columns: minmax(0, 1fr) auto; }
.vehicles-page .saved-vehicles { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.vehicles-page > .panel { max-width: 1240px; }

/* ---------------------------------------------------------------- tables -- */
.draft-table, .batch-table-scroll {
  overflow: auto;
  border: 1px solid var(--color-line); border-radius: var(--r-md);
  background: var(--color-surface);
  margin-bottom: 20px;
}
.draft-table table { min-width: 640px; margin: 0; }
td, th { font-size: 13.5px; }
th { color: var(--color-muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; background: var(--color-canvas); }
tbody tr { transition: background var(--dur-fast) ease; }
tbody tr:hover { background: #f7fafd; }
.draft-table td:first-child { font-weight: 650; color: var(--color-ink); white-space: nowrap; }
.field-row pre { color: var(--color-ink); }
.batch-table-scroll { max-height: min(62vh, 720px); }
.batch-table-scroll table { min-width: 820px; }
.batch-table-scroll thead th { position: sticky; top: 0; z-index: 1; }
.batch-table-scroll th:first-child, .batch-table-scroll td:first-child { width: 56px; text-align: center; }
.batch-table-scroll tbody tr:hover { background: var(--color-soft); }
.batch-actions, .batch-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.batch-actions { padding: 12px 0; border-top: 1px solid var(--color-line); }
.batch-action-buttons { display: flex; gap: 8px; }
.batch-action-buttons button { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.batch-range { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--color-line); }
.batch-range > div { display: flex; align-items: center; gap: 8px; max-width: 680px; }
.batch-range input { max-width: 180px; }
.batch-range button { white-space: nowrap; }
.batch-footer { justify-content: flex-end; margin-top: 16px; }
.batch-footer button { padding-inline: 22px; }

/* -------------------------------------------------------------- photos -- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-width: 1000px; margin: 0 0 24px; }
.photo-grid img { display: block; width: 100%; height: 130px; margin: 0; object-fit: cover; border: 1px solid var(--color-line); border-radius: var(--r-md); background: var(--color-soft); }
.photo-grid .photo-open {
  display: block; width: 100%; min-height: 0 !important; margin: 0; padding: 0 !important;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  border-radius: var(--r-md); cursor: zoom-in; line-height: 0;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) ease;
}
.photo-grid .photo-open:hover { transform: scale(1.02); box-shadow: var(--shadow-2) !important; }
.photo-view {
  width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  margin: auto; padding: 16px; overflow: auto;
  border: 0; border-radius: var(--r-lg);
  background: #101d2d; color: #f2f6fa;
}
.photo-view::backdrop { background: rgba(12, 24, 40, .72); }
.content .photo-view img {
  display: block; width: auto; max-width: 100%; height: auto;
  max-height: calc(100vh - 140px); margin: 12px auto 0; object-fit: contain;
  background: transparent; border: 0; border-radius: var(--r-sm);
}
.photo-view .photo-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.photo-view .photo-count { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- dialogs -- */
.debug-dialog {
  width: min(860px, calc(100% - 28px));
  border: 0; border-radius: var(--r-lg); padding: 24px;
  background: var(--color-surface); color: var(--color-ink);
  box-shadow: var(--shadow-3);
}
.debug-dialog::backdrop { background: rgba(12, 24, 40, .55); }
.debug-dialog textarea {
  margin: 10px 0 14px;
  background: var(--color-canvas); color: var(--color-ink);
  border: 1px solid var(--color-line); border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.5;
}
.debug-dialog .section-head { margin-bottom: 8px; }

/* --------------------------------------------------------- job progress -- */
.progress { height: 8px; margin: 18px 0; overflow: hidden; border-radius: 999px; background: #e3ecf6; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-bright); transition: width var(--dur) var(--ease); }
progress {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden;
  background: #eceef2; accent-color: var(--accent-bright);
}
progress::-webkit-progress-bar { background: #e3ecf6; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent-bright); border-radius: 999px; transition: width var(--dur) var(--ease); }
progress::-moz-progress-bar { background: var(--accent-bright); border-radius: 999px; }
.loading-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(23, 43, 68, .45); }
.loading-backdrop.is-hidden { display: none; }
.loading-card {
  width: min(420px, 100%); padding: 26px; text-align: center;
  border: 1px solid var(--color-line); border-radius: var(--r-lg);
  background: var(--color-surface); color: var(--color-ink);
  box-shadow: var(--shadow-3);
}
.loading-spinner {
  width: 32px; height: 32px; margin: 0 auto 14px;
  border: 3px solid var(--color-line); border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ empty state -- */
.empty-state { display: grid; place-items: center; gap: 4px; padding: 36px 24px; text-align: center; }
.empty-state .empty-icon { color: var(--color-faint); margin-bottom: 6px; animation: pulse 2.4s ease-in-out infinite; }
.empty-state .empty-icon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty-state strong { font-size: 14px; color: var(--color-ink); }
.empty-state .muted { font-size: 13px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ----------------------------------------------------- drafts hub extras -- */
.launch-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  margin: 0 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--color-line);
}
.drafts-launch { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.drafts-launch label { margin: 0 0 6px; font-size: 12.5px; color: var(--color-muted); }
.drafts-launch input { width: 220px; }
.drafts-search { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; max-width: 480px; margin: 0 0 18px; }
.drafts-search label { margin: 0; font-size: 12.5px; color: var(--color-muted); }

/* ----------------------------------------------------------- skip link -- */
.skip {
  position: fixed; top: -64px; left: 12px; z-index: 60;
  padding: 10px 16px;
  background: var(--color-surface); color: var(--color-ink);
  border: 1px solid var(--color-line); border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none;
  transition: top var(--dur-fast) ease;
}
.skip:focus { top: 12px; }

/* ----------------------------------------------------------------- misc -- */
.legacy-page { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.react-status { color: var(--color-faint); font-size: 12.5px; }
details { margin: 12px 0; }
details summary { cursor: pointer; }
.react-status, pre, .debug-dialog textarea { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; }

/* ---------------------------------------------------------------- motion --
   CSS-only entrance: content is never gated behind JavaScript or a CDN.
   Elements start visible-by-default; the animation only enhances. */
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
.topbar, .content > * { animation: rise-in var(--dur-slow) var(--ease) backwards; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(5) { animation-delay: .16s; }
.content > *:nth-child(n+6) { animation-delay: .2s; }
.draft-list .draft, .tool-grid .tool { animation: rise-in var(--dur) var(--ease) backwards; }
.draft-list .draft:nth-child(1), .tool-grid .tool:nth-child(1) { animation-delay: .05s; }
.draft-list .draft:nth-child(2), .tool-grid .tool:nth-child(2) { animation-delay: .09s; }
.draft-list .draft:nth-child(3), .tool-grid .tool:nth-child(3) { animation-delay: .13s; }
.draft-list .draft:nth-child(n+4), .tool-grid .tool:nth-child(n+4) { animation-delay: .17s; }
/* The sidebar deliberately has NO entrance animation: every navigation is a
   fresh server render, so a replayed cascade reads as flicker. The sidebar is
   chrome — it must be simply there; only hover reacts (see .nav rules). */
dialog[open] { animation: dialog-in var(--dur) var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
dialog[open]::backdrop { animation: fade-in var(--dur) ease backwards; }

/* ---------------------------------------------------------- reduced motion -- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  .nav a.active { outline: 2px solid Highlight; }
  button, input, select, textarea { border: 1px solid ButtonText; }
}

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 1060px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace, .settings-grid { grid-template-columns: 1fr; }
  .job-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { width: 68px; flex-basis: 68px; padding: 20px 8px 16px; }
  .brand { justify-content: center; padding: 0 0 22px; }
  .brand-text, .nav-label, .nav a span:not(.nav-icon), .sidebar-footer { display: none; }
  .nav a { justify-content: center; padding: 10px; min-width: 0; }
  .nav a.active::before { left: -8px; }
  .appbar { padding: 8px 16px; gap: 12px; }
  .appbar-search { display: none; }
  .content { padding: 28px 20px 56px; }
  .topbar { margin-bottom: 22px; }
}
@media (max-width: 620px) {
  .content { padding: 22px 14px 48px; }
  .topbar { display: block; }
  .topbar > a.tool { margin-top: 12px; min-height: 40px; width: 100%; justify-content: center; }
  /* The sync note cannot fit next to a long page title on phones (and the
     container's fallback fonts run wider than Inter); it lives on /settings. */
  .topbar .sync-pill { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > :nth-child(3) { border-left: 0; }
  .kpis > :nth-child(n+3) { border-top: 1px solid var(--color-line); }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .panel-pad { padding: 18px; }
  .quick-form, .drafts-search { grid-template-columns: 1fr; }
  .quick-form button, .drafts-search button, .drafts-launch button, .drafts-launch input { width: 100%; }
  .vehicle-options { grid-template-columns: 1fr; }
  .draft { grid-template-columns: 40px minmax(0, 1fr); }
  .draft-icon { width: 40px; height: 40px; }
  .draft-actions { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .batch-range > div { flex-wrap: wrap; }
  .batch-range input { flex: 1 1 120px; max-width: none; }
  .batch-footer { flex-direction: column-reverse; align-items: stretch; }
  .batch-footer button { width: 100%; }
  .settings-card .session { flex-direction: column; align-items: flex-start; gap: 8px; }
  .session-meta { text-align: left; }
}
@media (max-width: 400px) {
  .kpis { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
}
