/* ═══ STATISTIQUES (/statistiques) ═══ */
.st-body,.st-header{
  --st-s1:#3b8fe6;          /* série 1 (validée sur fond sombre) */
  --st-s2:#d96a26;          /* série 2 */
  --st-s3:#7c8db0;
  --st-grid:rgba(148,178,220,.09);
  --st-axis:var(--text-3);
  --st-card:var(--bg-2);
  --st-cell:rgba(148,178,220,.06);
  --st-good:var(--green);
  --st-warn:var(--amber);
  --st-bad:var(--red);
}
body.light .st-body,body.light .st-header{
  --st-s1:#1f6fe0;
  --st-s2:#d97706;
  --st-s3:#94a3b8;
  --st-grid:rgba(15,27,51,.08);
  --st-card:#fff;
  --st-cell:rgba(15,27,51,.05);
}

.st-body{padding:8px 0 96px}
.st-body section{padding:0}
.st-body h2{font-size:clamp(1.35rem,2.6vw,1.75rem);margin:0 0 6px}

/* ── En-tête : carte « en direct » ── */
.st-live{
  min-width:230px;padding:18px 20px 14px;border-radius:22px;
  background:var(--glass-bg);border:1px solid var(--glass-border);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  box-shadow:inset 0 1px 0 var(--glass-hi);
}
.st-live-top{display:flex;align-items:center;gap:8px;font-size:.8rem;color:var(--text-2);font-weight:600}
.st-live-time{margin-left:auto;color:var(--text-3);font-weight:500;font-variant-numeric:tabular-nums}
.st-dot{width:8px;height:8px;border-radius:50%;background:var(--text-3);position:relative}
.st-live[data-state="online"] .st-dot{background:var(--green)}
.st-live[data-state="online"] .st-dot::after{content:'';position:absolute;inset:-4px;border-radius:50%;border:1.5px solid var(--green);opacity:0;animation:stPulse 2.4s var(--ease-out) infinite}
@keyframes stPulse{0%{transform:scale(.6);opacity:.7}100%{transform:scale(1.6);opacity:0}}
.st-live-value{display:flex;align-items:baseline;gap:8px;margin-top:10px}
.st-live-value strong{font-family:var(--font-head);font-size:2.6rem;font-weight:700;line-height:1;letter-spacing:-.02em;color:var(--text)}
.st-live-value span{font-size:1rem;color:var(--text-3);font-weight:600}
.st-live-label{font-size:.82rem;color:var(--text-3);margin-top:4px}
.st-live-spark{height:36px;margin-top:12px}
.st-live-spark svg{display:block;width:100%;height:100%;overflow:visible}

/* ── Chiffres clés ── */
.st-kpis{
  display:grid;grid-template-columns:repeat(4,1fr);margin:-8px 0 64px;
  border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--st-card);overflow:hidden;
}
.st-kpi{display:flex;flex-direction:column;gap:6px;padding:24px 26px;min-width:0}
.st-kpi + .st-kpi{border-left:1px solid var(--border)}
.st-kpi-label{font-size:.82rem;font-weight:600;color:var(--text-2)}
.st-kpi-value{font-family:var(--font-head);font-size:clamp(1.9rem,3.4vw,2.5rem);font-weight:700;line-height:1.05;letter-spacing:-.02em;color:var(--text)}
.st-kpi-sub{font-size:.82rem;color:var(--text-3);line-height:1.4}

/* ── Sections ── */
.st-section{margin-bottom:64px}
.st-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px 24px;flex-wrap:wrap;margin-bottom:18px}
.st-head p{color:var(--text-2);font-size:.95rem;max-width:560px;margin:0}
.st-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:0 32px}
.st-grid-2 > .st-section{min-width:0;display:flex;flex-direction:column}
.st-grid-2 > .st-section > .st-card{flex:1}

.st-card{
  position:relative;padding:22px 24px;border-radius:var(--radius-xl);
  background:var(--st-card);border:1px solid var(--border);
}
.st-card-flush{padding:6px 0}
.st-card-chart{padding-bottom:16px}

/* Sélecteur de période */
.st-seg{display:inline-flex;gap:2px;padding:4px;border-radius:999px;background:var(--st-card);border:1px solid var(--border)}
.st-seg button{
  min-height:36px;padding:0 16px;border:0;border-radius:999px;background:none;cursor:pointer;
  font:600 .84rem var(--font-body);color:var(--text-2);transition:background .2s,color .2s;
}
.st-seg button:hover{color:var(--text)}
.st-seg button[aria-selected="true"]{background:var(--bg-5);color:var(--text)}
body.light .st-seg button[aria-selected="true"]{background:var(--bg-2)}
.st-seg button:focus-visible{outline:2px solid var(--st-s1);outline-offset:2px}

/* Résumé au-dessus d'un graphique */
.st-summary{display:flex;flex-wrap:wrap;gap:12px 40px;margin:0 0 18px}
.st-summary > div{min-width:0}
.st-summary dt{font-size:.78rem;color:var(--text-3);font-weight:600;margin-bottom:4px}
.st-summary dd{margin:0;font-family:var(--font-head);font-size:1.45rem;font-weight:700;color:var(--text);line-height:1.1}
.st-summary dd small{font-family:var(--font-body);font-size:.8rem;font-weight:500;color:var(--text-3)}
.st-summary-tight{gap:12px 32px}

/* ── Graphiques ── */
.st-chart{position:relative;height:220px;touch-action:pan-y}
.st-chart-lg{height:300px}
.st-chart svg{display:block;width:100%;height:100%;overflow:visible}
.st-chart:focus-visible{outline:2px solid var(--st-s1);outline-offset:6px;border-radius:8px}
.st-chart .grid line{stroke:var(--st-grid);stroke-width:1}
.st-chart .axis text{fill:var(--st-axis);font:500 11px var(--font-body);font-variant-numeric:tabular-nums}
.st-chart .line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.st-chart .s1{stroke:var(--st-s1)}
.st-chart .s2{stroke:var(--st-s2)}
.st-chart .area{stroke:none}
.st-chart .fill-s1{fill:var(--st-s1)}
.st-chart .fill-s2{fill:var(--st-s2)}
.st-chart .cross{stroke:var(--text-3);stroke-width:1}
.st-chart .dot{stroke:var(--st-card);stroke-width:2}
.st-chart .bar{transition:opacity .15s}
.st-chart.is-hover .bar:not(.on){opacity:.45}
.st-chart .end-label{fill:var(--text);font:600 11px var(--font-body)}
.st-chart .gap{fill:var(--st-cell)}
.st-empty-chart{display:grid;place-items:center;height:100%;color:var(--text-3);font-size:.9rem;text-align:center}

.st-legend{display:flex;flex-wrap:wrap;gap:8px 20px;margin-top:14px;font-size:.82rem;color:var(--text-2)}
.st-legend span{display:inline-flex;align-items:center;gap:8px}
.st-key{display:inline-block;width:14px;height:3px;border-radius:2px;background:var(--st-s1)}
.st-key-s1{background:var(--st-s1)}
.st-key-s2{background:var(--st-s2)}
.st-key-area{height:10px;border-radius:3px;background:color-mix(in srgb,var(--st-s1) 28%,transparent)}
.st-key-box{width:10px;height:10px;border-radius:3px}

/* Info-bulle */
.st-tip{
  position:fixed;z-index:60;pointer-events:none;min-width:150px;max-width:240px;padding:10px 12px;border-radius:12px;
  background:var(--glass-bg-strong);border:1px solid var(--glass-border);box-shadow:var(--shadow-lg);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  font-size:.8rem;color:var(--text-2);opacity:0;transform:translateY(4px);transition:opacity .12s,transform .12s;
}
.st-tip.on{opacity:1;transform:none}
.st-tip b{display:block;color:var(--text);font-weight:600;margin-bottom:6px}
.st-tip div{display:flex;align-items:center;gap:8px;justify-content:space-between}
.st-tip div span{display:inline-flex;align-items:center;gap:6px}
.st-tip div strong{color:var(--text);font-variant-numeric:tabular-nums}
.st-tip .st-key{width:10px}

/* ── Heures de pointe ── */
.st-heat{display:grid;grid-template-columns:34px repeat(24,minmax(0,1fr));gap:3px;align-items:center}
.st-heat .lbl{font-size:.72rem;color:var(--text-3);font-weight:600}
.st-heat .hr{font-size:.66rem;color:var(--text-3);text-align:center;font-variant-numeric:tabular-nums}
.st-heat .cell{
  aspect-ratio:1;min-height:10px;border-radius:4px;border:0;padding:0;cursor:default;
  background:color-mix(in oklab,var(--st-s1) calc(var(--v,0) * 100%),var(--st-cell));
}
.st-heat .cell.none{background:transparent;box-shadow:inset 0 0 0 1px var(--st-cell)}
.st-heat .cell:hover,.st-heat .cell:focus-visible{outline:2px solid var(--text);outline-offset:1px}
.st-heat-foot{display:flex;align-items:center;justify-content:space-between;gap:12px 20px;flex-wrap:wrap;margin-top:18px}
.st-grid-2 .st-card{display:flex;flex-direction:column}
.st-heat-summary{margin:auto 0 0;padding-top:22px;border-top:1px solid var(--border);gap:12px 32px}
.st-heat-foot{margin-bottom:22px}
.st-insight{margin:0;font-size:.88rem;color:var(--text-2)}
.st-insight strong{color:var(--text)}
.st-scale{display:flex;align-items:center;gap:8px;font-size:.74rem;color:var(--text-3)}
.st-scale i{width:96px;height:8px;border-radius:4px;background:linear-gradient(90deg,var(--st-cell),var(--st-s1))}

/* ── Records ── */
.st-records{list-style:none;margin:0;padding:0}
.st-records li{display:grid;grid-template-columns:1fr auto;grid-template-areas:"label value" "when value";gap:2px 16px;padding:15px 24px;align-items:center}
.st-records li + li{border-top:1px solid var(--border)}
.st-rec-label{grid-area:label;font-size:.9rem;color:var(--text);font-weight:500}
.st-rec-when{grid-area:when;font-size:.78rem;color:var(--text-3);min-height:1em}
.st-rec-value{grid-area:value;font-family:var(--font-head);font-size:1.35rem;font-weight:700;color:var(--text);text-align:right;white-space:nowrap}

/* ── Durée des sessions ── */
.st-bars{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:12px}
.st-bars li{display:grid;grid-template-columns:118px 1fr 44px;align-items:center;gap:14px;font-size:.84rem}
.st-bar-label{color:var(--text-2)}
.st-bar-track{height:10px;border-radius:0 5px 5px 0;background:var(--st-cell);overflow:hidden}
.st-bar-track i{display:block;height:100%;width:var(--w);border-radius:0 4px 4px 0;background:var(--st-s1);transform-origin:left;transition:transform .9s var(--ease-out)}
.st-bar-value{color:var(--text);font-weight:600;text-align:right;font-variant-numeric:tabular-nums}

/* ── Disponibilité ── */
.st-up-top{display:flex;align-items:flex-end;justify-content:space-between;gap:20px 40px;flex-wrap:wrap;margin-bottom:22px}
.st-up-main strong{display:block;font-family:var(--font-head);font-size:clamp(2.2rem,4.4vw,3rem);font-weight:700;line-height:1;letter-spacing:-.02em;color:var(--text)}
.st-up-main span{font-size:.84rem;color:var(--text-3)}
.st-up-windows{display:flex;flex-wrap:wrap;gap:10px 36px;margin:0}
.st-up-windows dt{font-size:.76rem;color:var(--text-3);font-weight:600;margin-bottom:3px}
.st-up-windows dd{margin:0;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}
.st-up-windows dd small{font-weight:500;color:var(--text-3)}
/* Peu de jours mesurés : bande calée à droite, barres de 16 px max. */
.st-uptime,.st-uptime-axis{width:min(100%,max(240px,calc(var(--n,90) * 18px)));margin-left:auto}
.st-uptime{display:flex;justify-content:flex-end;gap:2px;height:40px;align-items:stretch}
.st-uptime .day{max-width:16px}
.st-uptime .day{flex:1;min-width:0;border-radius:3px;border:0;padding:0;background:var(--st-good);cursor:default;transition:transform .15s}
.st-uptime .day:hover,.st-uptime .day:focus-visible{transform:scaleY(1.12);outline:none}
.st-uptime .day.warn{background:var(--st-warn)}
.st-uptime .day.bad{background:var(--st-bad)}
.st-uptime .day.none{background:var(--st-cell)}
.st-uptime-axis{display:flex;justify-content:space-between;margin-top:10px;font-size:.74rem;color:var(--text-3)}

/* ── La ville ── */
.st-city{display:grid;grid-template-columns:repeat(3,1fr) 1.6fr;gap:16px}
.st-city-tile{
  display:flex;flex-direction:column;gap:6px;min-width:0;padding:22px 24px;border-radius:var(--radius-xl);
  background:var(--st-card);border:1px solid var(--border);
}
.st-city-tile strong{font-family:var(--font-head);font-size:2rem;font-weight:700;line-height:1.05;letter-spacing:-.02em;color:var(--text)}
.st-mini{height:30px;margin-top:auto}
.st-city-tile .st-kpi-sub{margin-bottom:8px}
.st-mini svg{display:block;width:100%;height:100%;overflow:visible}
.st-split{display:flex;gap:2px;height:10px;margin-top:auto;border-radius:5px;overflow:hidden}
.st-split i{display:block;min-width:2px}
.st-split-1{background:var(--st-s1)}
.st-split-2{background:var(--st-s2)}
.st-split-3{background:var(--st-s3)}
.st-split-legend{display:flex;flex-wrap:wrap;gap:4px 16px;margin-top:10px;font-size:.78rem;color:var(--text-2)}
.st-split-legend span{display:inline-flex;align-items:center;gap:6px}
.st-split-legend .st-key{width:8px;height:8px;border-radius:2px}

/* ── Ces 30 derniers jours ── */
.st-counters{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));border-top:1px solid var(--border)}
.st-counters li{display:flex;flex-direction:column;gap:4px;padding:22px 20px 22px 0;border-bottom:1px solid var(--border)}
.st-counters strong{font-family:var(--font-head);font-size:1.7rem;font-weight:700;color:var(--text);line-height:1.1;letter-spacing:-.01em}
.st-counters strong small{font-size:.9rem;color:var(--text-3);font-weight:600}
.st-counters span{font-size:.9rem;color:var(--text-2)}
.st-counters em{font-style:normal;font-size:.76rem;color:var(--text-3)}

.st-note{margin:-24px 0 0;font-size:.8rem;color:var(--text-3)}
.st-empty{max-width:560px;margin:24px auto 40px;text-align:center;padding:48px 24px;border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--st-card)}
.st-empty p{color:var(--text-2)}

/* Apparition (seulement si JS et mouvement autorisé) */
@media (prefers-reduced-motion:no-preference){
  .st-anim .st-kpis,.st-anim .st-section{opacity:0;transform:translateY(14px);transition:opacity .6s var(--ease-out),transform .6s var(--ease-out)}
  .st-anim .is-in{opacity:1;transform:none}
}

/* ── Responsive ── */
@media (max-width:1060px){
  .st-city{grid-template-columns:repeat(3,1fr)}
  .st-city-money{grid-column:1/-1}
}
@media (max-width:900px){
  .st-kpis{grid-template-columns:repeat(2,1fr)}
  .st-kpi:nth-child(3){border-left:0}
  .st-kpi:nth-child(n+3){border-top:1px solid var(--border)}
  .st-grid-2{grid-template-columns:1fr}
}
@media (max-width:640px){
  .st-live{width:100%}
  .st-kpi{padding:18px}
  .st-card{padding:18px 16px}
  .st-card-flush{padding:4px 0}
  .st-records li{padding:13px 16px}
  .st-chart-lg{height:240px}
  .st-chart{height:200px}
  .st-section{margin-bottom:48px}
  .st-seg{width:100%}
  .st-seg button{flex:1;padding:0 8px}
  .st-city{grid-template-columns:1fr 1fr;gap:12px}
  .st-city-tile:nth-child(3){grid-column:1/-1}
  .st-city-tile{padding:18px 16px}
  .st-city-tile strong{font-size:1.6rem}
  .st-heat{grid-template-columns:26px repeat(24,minmax(0,1fr));gap:2px}
  .st-heat .hr:not(.major){visibility:hidden}
  .st-heat .cell{border-radius:2px}
  .st-bars li{grid-template-columns:100px 1fr 40px;gap:10px}
  .st-uptime{height:32px;gap:1px}
  .st-summary{gap:12px 28px}
  .st-summary dd{font-size:1.25rem}
  .st-counters{grid-template-columns:1fr 1fr;column-gap:16px}
  .st-counters li{padding:18px 0}
  .st-counters strong{font-size:1.4rem}
}
