:root {
  --bg: #0b1020; --panel: #141b30; --card: #1b2440; --line: #263150;
  --fg: #e6ebf5; --muted: #8a97b5; --accent: #5b8cff; --accent2: #36d399;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; position: sticky; top: 0; background: rgba(11,16,32,.9);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); z-index: 5;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.logo { color: var(--accent); }
.live { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent2);
  box-shadow: 0 0 0 0 rgba(54,211,153,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(54,211,153,.5);} 70% { box-shadow: 0 0 0 8px rgba(54,211,153,0);} 100% { box-shadow: 0 0 0 0 rgba(54,211,153,0);} }
.tabs { display: flex; gap: 8px; padding: 12px 18px; flex-wrap: wrap; }
.tabs button {
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 16px; cursor: pointer; font-size: 14px;
}
.tabs button.active { color: var(--fg); border-color: var(--accent); background: #1c2a52; }
main { padding: 0 18px 30px; max-width: 1100px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-top: 16px; }
h2 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card { text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; cursor: pointer; color: var(--fg); transition: .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-h { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-n { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpis { display: flex; gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; flex: 1; }
.kpi-n { font-size: 28px; font-weight: 700; }
.kpi-l { color: var(--muted); font-size: 12px; }
/* Courbe de tendance (SVG ligne + aire) */
.chartbox, .spark { margin: 6px 0 4px; }
.chart { width: 100%; height: 150px; display: block; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(91,140,255,.14); stroke: none; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px;
  font-variant-numeric: tabular-nums; padding: 4px 2px 0; }
.chart-wrap { position: relative; }
/* touch-action:none → le geste tactile pilote la courbe (pas le scroll). */
.chart-hit { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.chart-marker { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--accent); opacity: .65; pointer-events: none; }
.chart-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--accent); border: 2px solid #0b1020;
  box-shadow: 0 0 0 1px var(--accent); pointer-events: none; }
.chart-tip { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap;
  background: #0b1020; border: 1px solid var(--accent); color: var(--fg); font-size: 12px;
  padding: 3px 8px; border-radius: 7px; pointer-events: none; z-index: 3;
  font-variant-numeric: tabular-nums; }
#spark { margin-bottom: 18px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 14px; }
.rows .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .val { color: var(--accent2); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 13px; margin-left: auto; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
.gate { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #141b30, #0b1020 70%); padding: 24px; }
/* L'attribut `hidden` doit l'emporter sur `display:flex` ci-dessus (sinon le
   voile reste affiché par-dessus le dashboard une fois authentifié). */
.gate[hidden] { display: none; }
.gate-card { text-align: center; max-width: 360px; }
.gate-logo { font-size: 64px; color: var(--accent); line-height: 1; filter: drop-shadow(0 0 24px rgba(91,140,255,.5)); }
.gate-card h1 { margin: 14px 0 6px; font-size: 22px; }
.gate-card p { color: var(--muted); margin: 6px 0 20px; }
.gate-btn { background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 13px 26px; font-size: 16px; font-weight: 600; cursor: pointer; }
.gate-btn:disabled { opacity: .6; cursor: default; }
.gate-err { color: #ff6b8a; min-height: 18px; margin-top: 14px; font-size: 13px; }
