/* PitStop — interface mobile.
   Identité : la plaque française. Bleu européen, blanc rétroréfléchissant,
   chiffres condensés façon plaque. Les prix parlent la même langue. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --eu: #003399;            /* bande bleue de la plaque */
  --eu-ink: #002266;
  --eu-soft: #dfe6f7;
  --star: #ffcc00;          /* étoiles européennes : réservé au « meilleur prix » */
  --plate: #ffffff;         /* blanc rétroréfléchissant */
  --plate-ink: #000000;
  --road: #e8ecf3;          /* fond de page */
  --surface: #ffffff;
  --text: #1b1e24;
  --muted: #5d6573;
  --line: #d3d9e4;
  --ok: #1e7b3a;
  --warn: #9a5b00;
  --bad: #b42318;
  --link: #003399;
  --focus: #003399;
  --shadow: 0 1px 2px rgba(0, 20, 60, .12), 0 6px 18px rgba(0, 20, 60, .08);
  --radius: 10px;
  --ui: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --road: #071331; --surface: #0d1c42; --text: #e9edf7; --muted: #a4afc6; --line: #213366;
    --eu-soft: #17295a; --link: #9db8ff; --focus: #ffcc00; --ok: #5fd08a; --warn: #f2b14d; --bad: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --road: #071331; --surface: #0d1c42; --text: #e9edf7; --muted: #a4afc6; --line: #213366;
  --eu-soft: #17295a; --link: #9db8ff; --focus: #ffcc00; --ok: #5fd08a; --warn: #f2b14d; --bad: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--road); color: var(--text);
  font: 400 16px/1.5 var(--ui); font-feature-settings: "tnum" 1;
  min-height: 100vh; min-height: 100dvh;
}
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- en-tête */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--eu); color: #fff;
  padding: 0 16px; height: 52px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none;
  font: 700 24px/1 var(--cond); letter-spacing: .01em; }
.brand svg { width: 26px; height: 26px; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; }
.topbar nav a { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; font-size: 15px; white-space: nowrap; }
@media (max-width: 360px) { .brand span { display: none; } }
.topbar nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); }
.topbar nav a svg { width: 22px; height: 22px; display: block; }
.topbar nav a:has(svg) { padding: 7px 8px; }
.demo-ribbon { background: var(--star); color: #000; text-align: center; font-weight: 600; font-size: 14px; padding: 4px 12px; }

main { max-width: 600px; margin: 0 auto; padding: 0 16px 96px; }

/* ---------------------------------------------------------------- la plaque */
.hero { background: var(--eu); margin: 0 -16px; padding: 20px 16px 28px; }
.hero-inner { max-width: 600px; margin: 0 auto; }
.plate {
  display: flex; align-items: stretch; background: var(--plate); color: var(--plate-ink);
  border: 3px solid #000; border-radius: 10px; height: 76px; overflow: hidden;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .9);
}
.plate-band {
  flex: 0 0 44px; background: var(--eu); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; padding: 7px 0 5px;
  font: 700 22px/1 var(--cond);
}
.plate-band svg { width: 26px; height: 26px; }
.plate-band .dept { font-size: 21px; }
.plate input, .plate .chars {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; color: var(--plate-ink);
  font: 700 46px/1 var(--cond); letter-spacing: .03em; text-align: center; text-transform: uppercase;
  padding: 0 6px; display: flex; align-items: center; justify-content: center;
}
.plate input::placeholder { color: #b9bec7; }
.plate input:focus { outline: none; }
.plate:focus-within { box-shadow: 0 0 0 4px var(--star), 0 2px 0 rgba(0, 0, 0, .35); }
.plate.is-mini { height: 34px; border-width: 2px; border-radius: 6px; box-shadow: none; display: inline-flex; vertical-align: middle; }
.plate.is-mini .plate-band { flex-basis: 18px; padding: 3px 0 2px; font-size: 11px; }
.plate.is-mini .plate-band svg { width: 13px; height: 13px; }
.plate.is-mini .plate-band .dept { font-size: 11px; }
.plate.is-mini .chars { font-size: 21px; padding: 0 8px; letter-spacing: .02em; }
.plate.is-blank .chars { color: #8a919c; font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; }

.hero form { display: grid; gap: 12px; }
.hero .hint { color: #cfdaf5; font-size: 14px; margin: 2px 0 0; }
.hero .hint a, .hero .hint button { color: #fff; }
.hero .error { background: #fff; color: var(--bad); border-radius: 8px; padding: 8px 12px; font-weight: 500; }

/* ---------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 0 18px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none;
  font: 600 17px/1 var(--ui); background: var(--eu); color: #fff;
}
.btn:hover { background: var(--eu-ink); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.on-blue { background: #fff; color: var(--eu); }
.btn.on-blue:hover { background: var(--star); color: #000; }
.btn.quiet { background: transparent; color: var(--link); border: 1.5px solid var(--line); }
.btn.quiet:hover { border-color: var(--link); background: var(--eu-soft); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 15px; }
.btn.full { width: 100%; }
.linkish { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font-weight: 500; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 8px; cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--eu-soft); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; flex: none; }

/* ---------------------------------------------------------------- sections */
.section { margin-top: 28px; }
.section > h2, .section-head h2 {
  font: 600 25px/1.15 var(--cond); margin: 0 0 12px; letter-spacing: .005em;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { margin-bottom: 12px; }
.lead { color: var(--muted); margin: -6px 0 14px; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.empty { color: var(--muted); padding: 8px 0; }
.note { font-size: 14px; color: var(--muted); }
.note:empty { display: none; }
.section, .vehicle, .ticket { scroll-margin-top: 64px; }

/* ---------------------------------------------------------------- véhicule */
.vehicle { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.vehicle-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vehicle-name { font: 600 27px/1.1 var(--cond); margin: 12px 0 10px; }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 16px; margin: 0; }
.specs div { min-width: 0; }
.specs dt { font-size: 13px; color: var(--muted); }
.specs dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.vehicle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.source { font-size: 14px; color: var(--muted); margin-top: 10px; }
.saved-mark { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; font-size: 15px; white-space: nowrap; }
.saved-mark svg, .tag svg { width: 16px; height: 16px; flex: none; }

.attempts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: 15px; }
.attempts li { display: flex; gap: 8px; align-items: baseline; }
.attempts .dot { flex: none; transform: translateY(1px); }
.attempts.on-blue { color: #fff; margin-top: 16px; }
.attempts.on-blue .dot.running { border-color: #fff; border-right-color: transparent; }
.hero .error + .btn { margin-top: 10px; }

/* ---------------------------------------------------------------- formulaires */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
label.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); font-weight: 500; }
.field input, .field select, .inline-add input {
  min-height: 44px; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--surface); color: var(--text); font-size: 16px; width: 100%;
}
.field input:focus, .field select:focus, .inline-add input:focus { border-color: var(--link); outline: none; box-shadow: 0 0 0 3px var(--eu-soft); }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- pièces */
.parts { display: flex; flex-wrap: wrap; gap: 8px; }
.part-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px 0 10px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  font-weight: 600; color: var(--text);
}
.part-toggle svg { width: 22px; height: 22px; color: var(--muted); }
.part-toggle[aria-pressed="true"] { background: var(--eu); border-color: var(--eu); color: #fff; }
.part-toggle[aria-pressed="true"] svg { color: #fff; }

/* ---------------------------------------------------------------- références */
.refgroup { margin-top: 18px; }
.refgroup h3 { display: flex; align-items: center; gap: 8px; font: 600 21px/1.2 var(--cond); margin: 0 0 8px; }
.refgroup h3 svg { width: 22px; height: 22px; color: var(--link); }
.reflist { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.reflist li + li { border-top: 1px solid var(--line); }
.refrow { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 14px; cursor: pointer; }
.refrow input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--eu); margin: 0; }
.ref-id { min-width: 0; }
.ref-brand { display: block; font-weight: 600; font-size: 13px; color: var(--muted); line-height: 1.3; }
.ref-code { display: block; font: 600 22px/1.1 var(--cond); letter-spacing: .01em; overflow-wrap: anywhere; }
.ref-meta { grid-column: 2 / -1; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ref-hint { text-align: right; font: 600 19px/1 var(--cond); }
.ref-hint small { display: block; font: 400 12px/1.3 var(--ui); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--eu-soft); color: var(--text); }
.tag.best { background: var(--star); color: #000; }
.tag.good { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.equivs { grid-column: 2 / -1; font-size: 14px; }
.equivs summary { cursor: pointer; color: var(--link); }
.equivs ul { margin: 6px 0 0; padding-left: 18px; }
.inline-add { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.options { display: grid; gap: 10px; margin: 18px 0 14px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--eu); }

/* ---------------------------------------------------------------- sites (progression) */
.sitechips { display: flex; flex-wrap: wrap; gap: 6px; }
.sitechip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; cursor: default;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; display: inline-block; }
.dot.running { background: transparent; border: 2px solid var(--link); border-right-color: transparent; animation: spin .8s linear infinite; }
.dot.ok { background: var(--ok); }
.dot.empty { background: #9aa3b2; }
.dot.blocked, .dot.error, .dot.ko { background: var(--bad); }
.dot.partiel, .dot.warn { background: var(--warn); }
.sitechip .count { font: 600 15px/1 var(--cond); color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- ticket (panier) */
.ticket {
  position: relative; background: var(--plate); color: #1b1e24; padding: 18px 18px 26px;
  border-radius: 10px 10px 0 0; box-shadow: var(--shadow); margin-bottom: 14px;
  --zig: 10px;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--zig)) var(--zig) repeat-x;
          mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--zig)) var(--zig) repeat-x;
}
.ticket h2 { font: 600 22px/1.1 var(--cond); margin: 0 0 2px; color: var(--eu); }
.ticket .sub { font-size: 14px; color: #5d6573; margin: 0 0 12px; }
.ticket-lines { list-style: none; margin: 0; padding: 0; }
.ticket-lines li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px dashed #c9cfd9; }
.ticket-lines .what { min-width: 0; }
.ticket-lines .what b { font-weight: 600; }
.ticket-lines .what span { display: block; font-size: 14px; color: #5d6573; overflow-wrap: anywhere; }
.ticket-lines .amount { font: 600 21px/1.1 var(--cond); text-align: right; white-space: nowrap; }
.ticket-lines .ship .what { font-size: 15px; }
.ticket-lines .ship .amount { font-size: 18px; color: #5d6573; }
.ticket-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 12px; }
.ticket-total span { font-weight: 600; }
.ticket-total strong { font: 700 44px/1 var(--cond); letter-spacing: .01em; }
.ticket .saving { display: inline-block; margin-top: 8px; background: var(--star); color: #000; font-weight: 600; border-radius: 6px; padding: 3px 8px; font-size: 14px; }
.ticket .go { display: grid; gap: 8px; margin-top: 16px; }
.ticket .go a { justify-content: space-between; }
.ticket .missing { color: var(--bad); font-weight: 500; margin-top: 8px; font-size: 15px; }
.alt { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 15px; }
.alt b { font: 600 19px/1 var(--cond); }

/* ---------------------------------------------------------------- offres */
.offers-part { margin-top: 22px; }
.offers-part h3 { display: flex; align-items: center; gap: 8px; font: 600 21px/1.2 var(--cond); margin: 0 0 8px; }
.offers-part h3 svg { width: 22px; height: 22px; color: var(--link); }
.offers { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.offers li + li { border-top: 1px solid var(--line); }
.offer { display: grid; grid-template-columns: 86px 1fr; gap: 2px 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.offer:hover { background: var(--eu-soft); }
.offer-price { grid-row: span 3; font: 700 27px/1 var(--cond); }
.offer-price small { display: block; font: 500 12.5px/1.3 var(--ui); color: var(--muted); margin-top: 4px; }
.offer-site { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.offer-site .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.offer-title { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.offer-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.offer.is-best .offer-price { color: var(--eu); }
:root[data-theme="dark"] .offer.is-best .offer-price { color: var(--star); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .offer.is-best .offer-price { color: var(--star); } }
.more { display: block; width: 100%; padding: 10px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--link); font-weight: 600; cursor: pointer; }

/* ---------------------------------------------------------------- garage */
.garage { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.garage a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.garage a:hover { background: var(--eu-soft); }
.garage .gname { display: block; font: 600 20px/1.15 var(--cond); }
.garage .gsub { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.garage .gtext { min-width: 0; }
@media (max-width: 480px) {
  .garage a { grid-template-columns: 1fr auto; }
  .garage a .plate { grid-column: 1; justify-self: start; }
  .garage a .gtext { grid-column: 1; grid-row: 2; }
  .garage a > svg { grid-column: 2; grid-row: 1 / span 2; }
}
.garage svg { width: 20px; height: 20px; color: var(--muted); }

/* ---------------------------------------------------------------- réglages */
.site-rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.site-rows > li { padding: 14px; }
.site-rows > li + li { border-top: 1px solid var(--line); }
.site-row-head { display: flex; align-items: center; gap: 10px; }
.site-row-head .swatch { width: 12px; height: 12px; border-radius: 3px; }
.site-row-head b { font-size: 17px; }
.site-row-head .switch { margin-left: auto; font-size: 15px; }
.site-row-head .verdict { font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.site-rows details { margin-top: 8px; }
.site-rows details > summary { cursor: pointer; color: var(--link); font-weight: 500; font-size: 15px; }
.site-row-body { display: grid; gap: 10px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.site-row-body .form-grid { gap: 8px; }
.report { font-size: 14px; }
.report b { color: var(--text); }
.advice { color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
code { font-size: 13.5px; background: var(--eu-soft); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- divers */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  background: #000; color: #fff; padding: 12px 16px; border-radius: 10px; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 12px 0; }
.spark { vertical-align: middle; }
.login { max-width: 420px; margin: 0 auto; padding-top: 32px; }
.login .plate { margin-bottom: 22px; }
.login form { display: grid; gap: 14px; }

@media (min-width: 960px) {
  main.wide { max-width: 1080px; }
  .results-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
  .results-grid .ticket-col { position: sticky; top: 72px; grid-column: 2; grid-row: 1 / span 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
  .dot.running { border-right-color: var(--link); }
}
