/* Bis — design tokens + base components, charte « Signalisation » (see docs/charte-graphique.md).
   Lives under /assets/ so the login page can load it before authentication. */
:root {
  color-scheme: light;
  --bg: #eef1ee; --surface: #ffffff; --surface-2: #f5f7f5; --border: #d3dad5; --grid: #e3e8e4;
  --text: #0e1a14; --text-2: #4a5a52;
  --accent: #00704a; --accent-ink: #ffffff; --accent-soft: #e1f2ea;
  --good: #11733a; --warn: #9a5300; --bad: #c42b1c;
  --good-soft: #e5f4ea; --warn-soft: #fcf0dc; --bad-soft: #fce8e6; --neutral-soft: #e8ece9; --seg-on: #ffffff;
  --shadow: none;
  --shadow-pop: 0 6px 24px rgba(10, 30, 20, .16);
  /* signage */
  --sign: #ffcc00; --sign-ink: #1a1300;              /* jaune : badge « Le plus rapide » */
  --rn: #c1272d; --rn-ink: #ffffff;                  /* cartouche autoroute / nationale */
  --rd: #ffd200; --rd-ink: #111111;                  /* cartouche départementale */
  --re: #00843d; --re-ink: #ffffff;                  /* cartouche européenne */
  --pmv-bg: #111513; --pmv-border: #2b332e; --pmv-led: #ffb21a; --pmv-text: #e9edf0; --pmv-text-2: #aeb8b2;
  /* charts */
  --c-today: #0050a0; --c-avg: #374151; --c-hier: #c0267d; --c-j7: #0b6e77;
  --c-aller: #0050a0; --c-retour: #c2410c;
  /* AI identity (Conseil IA): indigo → violet, deliberately outside the road-sign palette */
  --ai-from: #3b2fc9; --ai-to: #8b3fd9; --ai-ink: #ffffff; --ai-soft: #efeafd; --ai-text: #5b2fc0;
  --band-low: #d7f0df; --band-usual: #e3e7e4; --band-busy: #fbe3b0; --band-heavy: #f8c9c4;
  /* type & shape */
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --r-card: 6px; --r-ctl: 4px; --r-tag: 3px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1310; --surface: #121c17; --surface-2: #18241e; --border: #26352d; --grid: #1f2c25;
    --text: #e6eee9; --text-2: #9db0a5;
    --accent: #3fcf8e; --accent-ink: #04140c; --accent-soft: #143326;
    --good: #5ccb86; --warn: #f2b04c; --bad: #ff7b6e;
    --good-soft: #17301f; --warn-soft: #382a12; --bad-soft: #3d1c19; --neutral-soft: #22302a; --seg-on: #26372e;
    --shadow: none; --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55);
    --c-today: #6fb2ff; --c-avg: #c9d3cd; --c-hier: #f472b6; --c-j7: #2cc5ce;
    --c-aller: #6fb2ff; --c-retour: #ff8a4c;
    --ai-from: #8f87ff; --ai-to: #d08bff; --ai-ink: #0d0820; --ai-soft: #272046; --ai-text: #c6b8ff;
    --band-low: #17392a; --band-usual: #26302b; --band-busy: #4a3610; --band-heavy: #561f1c;
    --pmv-bg: #070a09; --pmv-border: #33413a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1310; --surface: #121c17; --surface-2: #18241e; --border: #26352d; --grid: #1f2c25;
  --text: #e6eee9; --text-2: #9db0a5;
  --accent: #3fcf8e; --accent-ink: #04140c; --accent-soft: #143326;
  --good: #5ccb86; --warn: #f2b04c; --bad: #ff7b6e;
  --good-soft: #17301f; --warn-soft: #382a12; --bad-soft: #3d1c19; --neutral-soft: #22302a; --seg-on: #26372e;
  --shadow: none; --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55);
  --c-today: #6fb2ff; --c-avg: #c9d3cd; --c-hier: #f472b6; --c-j7: #2cc5ce;
  --c-aller: #6fb2ff; --c-retour: #ff8a4c;
  --ai-from: #8f87ff; --ai-to: #d08bff; --ai-ink: #0d0820; --ai-soft: #272046; --ai-text: #c6b8ff;
  --band-low: #17392a; --band-usual: #26302b; --band-busy: #4a3610; --band-heavy: #561f1c;
  --pmv-bg: #070a09; --pmv-border: #33413a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.icon.sm { width: 16px; height: 16px; vertical-align: -3px; }
.icon.xs { width: 13px; height: 13px; vertical-align: -2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* buttons & fields */
.btn { font: inherit; font-size: 14px; font-weight: 600; min-height: 40px; padding: 8px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
/* AI: gradient button + sparkle mark, so the AI nature of the advice is obvious */
.btn.ai { background: linear-gradient(105deg, var(--ai-from), var(--ai-to)); border: 0; color: var(--ai-ink); padding: 9px 16px; }
.btn.ai:hover { filter: brightness(1.08); }
.btn.ai .icon { fill: currentColor; stroke-width: 1; }
.ai-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--ai-ink);
  background: linear-gradient(135deg, var(--ai-from), var(--ai-to)); flex: none; }
.ai-mark .icon { width: 16px; height: 16px; fill: currentColor; stroke-width: 1; vertical-align: 0; }
.tag.ai-tag { color: var(--ai-text); background: var(--ai-soft); }
.tag.ai-tag .icon { fill: currentColor; stroke-width: 1; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.icon-only { padding: 8px; min-width: 40px; }
.field { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%; }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
@media (pointer: coarse) { .btn { min-height: 44px; } }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-tag); font-size: 12px; font-weight: 600;
  line-height: 20px; white-space: nowrap; color: var(--text-2); background: var(--neutral-soft); vertical-align: 1px; }
.tag.good { color: var(--good); background: var(--good-soft); }
.tag.warn { color: var(--warn); background: var(--warn-soft); }
.tag.bad { color: var(--bad); background: var(--bad-soft); }
.tag.accent { color: var(--accent); background: var(--accent-soft); }

/* segmented control */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { flex: 1 1 0; min-width: 0; font: inherit; font-size: 14px; font-weight: 600; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button.two-line { display: grid; line-height: 1.2; padding: 6px 8px; }
.seg button small { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--seg-on); color: var(--text); box-shadow: var(--shadow); }
@media (pointer: coarse) { .seg button { min-height: 42px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Signalisation ---------- */
h1, h2, h3, .head-font { font-family: var(--font-head); }
.seg button { font-family: var(--font-head); font-size: 15px; border-radius: 4px; }
.seg { border-radius: 6px; }

/* Wordmark « Bis »: plain bold text next to the blue logo (system font, like the logo's own style) */
.wordmark { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; font-weight: 700; letter-spacing: -.02em; }
.wordmark .tagline, .wordmark + p { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 400; letter-spacing: 0; }

/* Road-number cartouches (A13, N118, D938, E5), French signage colours */
.rn { display: inline-block; font-family: var(--font-head); font-weight: 700; font-size: .86em; line-height: 1; letter-spacing: .02em;
  padding: 2px 4px 1px; border-radius: 3px; vertical-align: .08em; white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--rn); color: var(--rn-ink); }
.rn.d { background: var(--rd); color: var(--rd-ink); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.rn.e { background: var(--re); color: var(--re-ink); }

/* PMV: the recommended option looks like a motorway variable-message sign (stays dark in both themes) */
.pmv { --text: var(--pmv-text); --text-2: var(--pmv-text-2); --surface: var(--pmv-bg); --surface-2: #1b211e; --border: var(--pmv-border);
  --good: #5ccb86; --warn: #f2b04c; --bad: #ff7b6e; --good-soft: #17301f; --warn-soft: #382a12; --bad-soft: #3d1c19; --neutral-soft: #26302b;
  color: var(--text); border: 3px solid var(--pmv-border) !important; border-radius: 6px !important; padding: 11px 13px !important;
  background-color: var(--pmv-bg) !important;
  background-image: radial-gradient(rgba(255, 255, 255, .06) .8px, transparent 1.1px) !important; background-size: 4px 4px !important;
  box-shadow: inset 0 0 0 1px #000, 0 1px 0 rgba(255, 255, 255, .04); }
.pmv .k { color: var(--pmv-led) !important; font-family: var(--font-head); letter-spacing: .06em; text-transform: uppercase; font-size: 13px !important; }
.pmv .v b { color: var(--pmv-led); font-family: var(--font-head); text-shadow: 0 0 10px rgba(255, 178, 26, .45); }
.pmv .v .u { color: var(--pmv-led) !important; opacity: .85; font-family: var(--font-head); }
.pmv .best-badge { margin-left: auto; background: var(--sign); color: var(--sign-ink); font-family: var(--font-head); font-weight: 700;
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; }
