/* Suivi des mobilisations — sobre, lisible, détails soignés. */
:root {
  --blue: #2f4bd8;
  --navy: #1c2a6e;
  --red: #e5484d;
  --bg: #fafafa;
  --card: #ffffff;
  --ink: #171717;
  --muted: #6b6b6b;
  --line: #ebebeb;
  --track: #f1f1f1;
  --ok: #16803c;
  --verify: #a15c00;
  --disputed: #c42b3a;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .05);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #7b90ff;
    --navy: #aab6ff;
    --red: #ff6369;
    --bg: #0a0a0a;
    --card: #111111;
    --ink: #ededed;
    --muted: #a1a1a1;
    --line: #242424;
    --track: #1a1a1a;
    --ok: #3dd68c;
    --verify: #ffb454;
    --disputed: #ff7b86;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { a:hover { text-decoration-color: currentColor; } }
code { background: var(--track); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); font-size: .88rem; margin-top: 12px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- En-tête ---------- */
.top { padding-bottom: 8px; }
.flagbar { display: grid; grid-template-columns: 1fr 1fr 1fr; height: 3px; }
.flagbar i { display: block; animation: wipe 600ms var(--ease-out) both; }
.flagbar i:nth-child(1) { background: #2f4bd8; }
.flagbar i:nth-child(2) { background: var(--line); animation-delay: 90ms; }
.flagbar i:nth-child(3) { background: #e5484d; animation-delay: 180ms; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.hero { padding-top: 44px; }
.hero > * { animation: rise 420ms var(--ease-out) both; }
.hero > :nth-child(1) { animation-delay: 80ms; }
.hero > :nth-child(2) { animation-delay: 120ms; }
.hero > :nth-child(3) { animation-delay: 160ms; }
.hero > :nth-child(4) { animation-delay: 200ms; }
.eyebrow { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.1; font-weight: 600; margin: 8px 0 12px; letter-spacing: -0.035em; }
.lead { max-width: 58ch; font-size: 1rem; color: var(--muted); }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 20px 0 0; }
.pills li { background: var(--card); box-shadow: var(--shadow); padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 500; color: var(--muted); }
.pills .navlink { text-decoration: none; display: inline-block; transition: transform 160ms var(--ease-out); }
.pills .navlink:active { transform: scale(0.97); }
.pills li:has(.navlink) { background: var(--ink); box-shadow: none; }
.pills li:has(.navlink) .navlink { color: var(--bg); }

/* ---------- Actualisation automatique ---------- */
.live { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; transition: background-color 400ms ease; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #2fb36a; display: inline-block; margin-right: 2px; animation: beat 2000ms ease-in-out infinite; }
.live.fast .pulse { background: var(--red); animation-duration: 800ms; }
.live.loading .pulse { animation-duration: 400ms; }
.live.flash { background: color-mix(in srgb, var(--red) 10%, var(--card)); }
.live button { font: inherit; font-size: .76rem; font-weight: 500; color: var(--ink); background: var(--track); border: 0; border-radius: 999px; padding: 1px 10px; margin-left: 4px; cursor: pointer; transition: transform 160ms var(--ease-out), background-color 160ms ease; }
.live button:active { transform: scale(0.97); }
.live button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .live button:hover { background: var(--line); } }
@keyframes beat { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }
.quiet .view *, .quiet .view *::before { animation: none !important; }

/* ---------- Onglets ---------- */
.seg-wrap { margin-top: 20px; position: relative; z-index: 2; }
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--track); border-radius: 10px; padding: 3px; max-width: 100%; }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; font: inherit; font-weight: 500; font-size: .86rem; color: var(--muted); padding: 7px 16px; border-radius: 8px; cursor: pointer; transition: color 160ms ease, transform 160ms var(--ease-out); white-space: nowrap; }
.seg button:active { transform: scale(0.97); }
.seg button[aria-selected="true"] { color: var(--ink); }
.seg .pill { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 8px; background: var(--card); box-shadow: var(--shadow); transition: transform 240ms var(--ease-in-out), width 240ms var(--ease-in-out); }
.seg button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Vues ---------- */
main { padding: 20px 0 8px; }
.view[hidden] { display: none; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.rise { animation: rise 320ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-top: 16px; }
.view .card { margin-top: 0; }
.card > h2, .card > .head h2 { font-size: .98rem; font-weight: 600; letter-spacing: -0.012em; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sub { color: var(--muted); font-size: .84rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .7rem; font-weight: 500; padding: 1px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; background: color-mix(in srgb, currentColor 11%, transparent); }
.badge.ok { color: var(--ok); }
.badge.verify { color: var(--verify); }
.badge.disputed { color: var(--disputed); }

/* ---------- Chiffres clés ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius); padding: 18px 18px 16px; }
.kpi .lab { font-size: .8rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .lab::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex: none; }
.kpi.red .lab::before { background: var(--red); }
.kpi.white .lab::before { background: var(--muted); opacity: .5; }
.kpi .val { font-size: clamp(1.7rem, 4.5vw, 2.1rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1.15; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.kpi .src { font-size: .78rem; color: var(--muted); margin-top: 8px; }
.kpi .s a, .kpi > a { font-size: .78rem; color: var(--muted); }
.kpi .pending { color: var(--muted); font-size: 1.15rem; font-weight: 500; letter-spacing: 0; }

/* ---------- Carte ---------- */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.map svg { width: 100%; height: auto; display: block; }
.map .fr { fill: var(--track); stroke: color-mix(in srgb, var(--muted) 45%, var(--card)); stroke-width: 1.2; stroke-linejoin: round; }
.dot { cursor: pointer; transform-box: fill-box; transform-origin: center; animation: pop 320ms var(--ease-out) both; animation-delay: calc(var(--i) * 25ms + 120ms); outline: none; }
.dot circle.d { fill: var(--blue); fill-opacity: .4; stroke: var(--blue); stroke-width: 1.2; transition: fill-opacity 160ms ease, stroke 160ms ease; }
.dot.none circle.d { fill: transparent; stroke-dasharray: 3 3; }
.dot.ban circle.d { fill: var(--red); fill-opacity: .3; stroke: var(--red); }
.dot.expected circle.d { fill: var(--blue); fill-opacity: .15; stroke-dasharray: 3 3; }
.dot.route circle.d { fill: var(--card); stroke: var(--blue); }
.dot.sel circle.d { fill-opacity: .75; stroke: var(--ink); stroke-width: 2; }
.dot:focus-visible circle.d { stroke: var(--ink); stroke-width: 3; }
.dot text { font-size: 11px; font-weight: 500; fill: var(--ink); paint-order: stroke; stroke: var(--track); stroke-width: 3px; pointer-events: none; opacity: 0; transition: opacity 160ms ease; }
.dot.sel text { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .dot:hover circle.d { fill-opacity: .7; }
  .dot:hover text { opacity: 1; }
}
.ring { fill: none; stroke: var(--ink); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.dot.sel .ring { animation: ring 1800ms var(--ease-out) infinite; }
@keyframes ring { 0% { opacity: .5; transform: scale(1); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }

.detail { min-height: 260px; }
.detail .inner { animation: fade 200ms var(--ease-out) both; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.detail h3 { font-size: 1.35rem; font-weight: 600; margin-bottom: 12px; letter-spacing: -0.03em; }
.fig { padding: 12px 0; border-top: 1px solid var(--line); }
.fig:first-of-type { border-top: 0; padding-top: 0; }
.fig .k { font-size: .78rem; color: var(--muted); font-weight: 500; }
.fig .n { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-right: 8px; }
.fig .n.none { color: var(--muted); font-size: .95rem; font-weight: 500; letter-spacing: 0; }
.fig .s { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.fig .warn { font-size: .8rem; color: var(--disputed); margin-top: 4px; }
.fig ul { margin: 6px 0 0; padding-left: 18px; font-size: .88rem; }

/* ---------- Barres ---------- */
.legend-bars { display: flex; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-bottom: 14px; }
.legend-bars span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.sw.stripe { background: repeating-linear-gradient(135deg, var(--blue) 0 2px, transparent 2px 5px); border: 1px solid var(--blue); }
.sw.light { background: color-mix(in srgb, var(--blue) 30%, transparent); }
.rows { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 12px; align-items: center; }
.row .city { font-weight: 500; font-size: .86rem; text-align: right; color: var(--ink); }
.row .bars { display: grid; gap: 3px; }
.bline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.track { flex: 1; height: 10px; min-width: 0; }
.bar { height: 100%; width: calc(var(--w) * 1%); min-width: 3px; border-radius: 0 4px 4px 0; background:
    linear-gradient(90deg, var(--c) var(--x), color-mix(in srgb, var(--c) 30%, transparent) var(--x));
  animation: reveal 520ms var(--ease-out) both; animation-delay: calc(var(--i) * 30ms + 100ms); }
.bar.verify { background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.5) 0 2px, transparent 2px 5px),
    linear-gradient(90deg, var(--c) var(--x), color-mix(in srgb, var(--c) 30%, transparent) var(--x)); }
.bar.org { --c: var(--red); }
.bar.pol { --c: var(--blue); }
.bline .t { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 84px; }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- Tableau ---------- */
.tablewrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
th { text-align: left; font-size: .74rem; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.c { font-weight: 500; }
td .n { font-weight: 600; font-variant-numeric: tabular-nums; }
td .badge { margin-left: 6px; }
td .none { color: var(--muted); }
td .small { display: block; font-size: .74rem; color: var(--muted); margin-top: 2px; }
tbody tr { transition: background-color 160ms ease; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { tbody tr:hover { background: var(--track); } }

/* ---------- En attente / vide ---------- */
.pending-box { border: 1px dashed color-mix(in srgb, var(--muted) 40%, var(--line)); border-radius: 12px; padding: 26px 20px; text-align: center; color: var(--muted); font-size: .88rem; }
.pending-box strong { color: var(--ink); display: block; font-size: .95rem; font-weight: 600; margin-bottom: 4px; }

/* ---------- Comparaison ---------- */
.cmp { display: grid; gap: 22px; }
.cmp-row h3 { font-size: .92rem; font-weight: 600; }
.cmp-row .note { font-size: .78rem; color: var(--muted); margin: 2px 0 8px; }
.cmp-line { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center; margin-top: 6px; }
.cmp-line .d { font-weight: 500; font-size: .8rem; color: var(--muted); }
.cmp-line .track { height: 18px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cmp-line .bar { height: 18px; flex: none; width: calc((100% - 210px) * var(--w) / 100); min-width: 4px; }
.cmp-line .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.02em; }
.cmp-line .wait { font-size: .8rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 1px 10px; }
.cmp-line .bar.pol { --c: var(--blue); }
.cmp-line .bar.org { --c: var(--red); }

/* ---------- Listes ---------- */
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 12px; }
.legend p { margin-top: 8px; font-size: .86rem; color: var(--muted); }
.unknown { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: .9rem; color: var(--muted); }
.unknown strong { color: var(--ink); font-weight: 600; }
.srcs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; }
.srcs li { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.srcs span { font-size: .76rem; color: var(--muted); }
.foot { padding: 24px 0 56px; color: var(--muted); font-size: .8rem; }
.list24 { display: grid; gap: 8px; margin-top: 8px; font-size: .9rem; }

/* ---------- En direct ---------- */
.dotlive { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 7px; vertical-align: middle; animation: beat 1400ms ease-in-out infinite; }
.dotlive.big { width: 8px; height: 8px; margin-right: 8px; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.fchip { font: inherit; font-size: .8rem; font-weight: 500; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.fchip b { font-weight: 500; opacity: .7; margin-left: 3px; font-variant-numeric: tabular-nums; }
.fchip:active { transform: scale(0.97); }
.fchip[aria-pressed="true"] { color: var(--bg); border-color: var(--ink); background: var(--ink); }
.fchip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .fchip[aria-pressed="false"]:hover { color: var(--ink); border-color: var(--muted); } }

.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed::before { content: ""; position: absolute; left: 58px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.li { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 0 26px; padding: 9px 0; position: relative; animation: rise 300ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); }
.li::before { content: ""; position: absolute; left: 54px; top: 17px; width: 9px; height: 9px; border-radius: 50%; background: var(--card); border: 2px solid var(--c, var(--blue)); }
.li.mesure { --c: var(--blue); }
.li.rassemblement { --c: var(--muted); }
.li.incident { --c: var(--red); }
.li.chiffre { --c: var(--ok); }
.li.info { --c: var(--muted); }
.lt { font-weight: 500; font-variant-numeric: tabular-nums; font-size: .86rem; padding-top: 4px; text-align: right; color: var(--muted); }
.lm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 2px; }
.lm .city { font-weight: 600; font-size: .92rem; }
.lm .kind { font-size: .7rem; font-weight: 500; color: var(--c, var(--muted)); }
.lb p { font-size: .9rem; }
.lb a { font-size: .76rem; color: var(--muted); }
.li.fresh { border-radius: 10px; animation: freshin 380ms var(--ease-out) both, freshfade 2400ms ease-out 380ms both; }
@keyframes freshin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes freshfade { from { background-color: color-mix(in srgb, var(--red) 10%, transparent); } to { background-color: transparent; } }
.quiet .view .li.fresh { animation: freshin 380ms var(--ease-out) both, freshfade 2400ms ease-out 380ms both !important; }

@media (max-width: 760px) {
  .mapgrid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 82px minmax(0, 1fr); }
  .card { padding: 18px; }
  .feed::before { left: 48px; }
  .li { grid-template-columns: 38px minmax(0, 1fr); gap: 0 22px; }
  .li::before { left: 44px; }
}
@media (max-width: 480px) {
  .seg { display: grid; grid-template-columns: repeat(4, auto); width: 100%; }
  .seg button { padding: 7px 4px; font-size: .78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .flagbar i, .hero > *, .rise, .dot, .bar, .li, .li.fresh, .quiet .view .li.fresh { animation: fade-only 200ms ease both !important; animation-delay: 0ms; }
  .dot.sel .ring, .pulse, .dotlive { animation: none !important; }
  .seg .pill { transition: none; }
  @keyframes fade-only { from { opacity: 0; } to { opacity: 1; } }
}
