/* One Less Car dashboard. Chart colors are the dataviz reference palette's
   slots 1 and 2, validated for colour-blind separation in both modes. */
:root {
  color-scheme: light;
  --surface-0: #f4f3ef;
  --surface-1: #fcfcfb;
  --surface-2: #efeee9;
  --line: #dedcd5;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7973;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-rest: #b9b8b1;
  --good: #0f7a3d;
  --warn: #9a6200;
  --radius: 10px;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --line: #34332f;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #6da7ec;
    --accent-ink: #0b0b0b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-rest: #55544f;
    --good: #4cc27c;
    --warn: #e0a440;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface-1); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { padding: 4px 10px 18px; }
.brand strong { display: block; font-size: 17px; }
.brand span { color: var(--text-secondary); font-size: 13px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-secondary); text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--text-primary); }
.nav a.active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.nav .count { margin-left: auto; background: var(--series-2); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 7px; }
.sidebar .spacer { flex: 1; }
.who { font-size: 13px; color: var(--text-secondary); padding: 10px; border-top: 1px solid var(--line); }
.who button { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; }
main { padding: 28px 36px 60px; max-width: 1280px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
.lede { color: var(--text-secondary); margin: 0 0 22px; max-width: 760px; }
h2 { font-size: 17px; margin: 0 0 4px; }
.help-link { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); align-items: center; justify-content: center; font-size: 11px; color: var(--text-secondary); text-decoration: none; margin-left: 6px; vertical-align: 2px; }
.help-link:hover { border-color: var(--accent); color: var(--accent); }

/* Filters: one row above everything they scope. */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.segmented { display: inline-flex; background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.segmented button { border: none; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--text-secondary); }
.segmented button.on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.filters select, .filters input { background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.loading main .content { opacity: 0.55; transition: opacity .2s; }

/* Cards and tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--text-secondary); font-size: 13px; }
.tile .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--text-muted); font-size: 12.5px; }
.tile.hero { grid-column: span 2; }
.tile.hero .value { font-size: 40px; }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card .head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card .head p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }
.card .head .tools { margin-left: auto; }
.linkish { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } .tile.hero { grid-column: span 1; } }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .bar { cursor: default; }
.chart .bar:hover, .chart .bar:focus { filter: brightness(1.12); outline: none; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); margin: 2px 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.12); white-space: nowrap; z-index: 5; }
.tooltip .t { color: var(--text-secondary); margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 8px; }
.tooltip .row b { font-variant-numeric: tabular-nums; }
.tooltip .key { width: 12px; height: 2px; display: inline-block; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12.5px; border-bottom: 1px solid var(--line); padding: 8px 10px; }
td { border-bottom: 1px solid var(--line); padding: 8px 10px; font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: none; }
.pill { display: inline-block; border-radius: 10px; padding: 0 8px; font-size: 12px; background: var(--surface-2); color: var(--text-secondary); }
.pill.good { color: var(--good); }
.pill.warn { color: var(--warn); }
.empty { color: var(--text-muted); padding: 24px 0; text-align: center; }

/* Forms and buttons */
.btn { text-decoration: none; display: inline-block; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.btn.secondary { background: var(--surface-2); color: var(--text-primary); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; max-width: 460px; }
.field label { font-weight: 600; font-size: 13.5px; }
.field .hint { color: var(--text-muted); font-size: 12.5px; }
.field input, .field textarea, .field select { background: var(--surface-0); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.notice { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; color: var(--text-secondary); margin-bottom: 16px; }
.narrative { background: var(--surface-0); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; line-height: 1.6; }

/* Sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.signin form { background: var(--surface-1); border: 1px solid var(--line); border-radius: 14px; padding: 30px; width: 380px; }
.signin h1 { font-size: 22px; }
.error { color: #c0392b; font-size: 13.5px; min-height: 20px; }
