/* Page « Statistiques » de l'admin (refonte du 29/10/2026, maquette de Claude Design 2a) : cartes de chiffres comparés, graphe en barres
   avec contour de la période de comparaison, colonne Origine / Par site / Par langue, sous-onglet Détail. Préfixe ks- (voir
   assets/admin-stats.js). Valeurs : README du handoff (§1 et §3). */

[data-ka-pane="stats"] { --ks-ink: #221E1A; --ks-ink2: #4E4740; --ks-ink3: #6F675E; --ks-ink4: #8A8178; --ks-line: #E2DBD1; --ks-line2: #F1ECE5;
  --ks-teal: #0B7387; --ks-soft: #9CCFD7; --ks-ras: #E01B5D; --ks-green: #1F8A4C; --ks-red: #C1272D; }

/* pastille « en direct » */
.ks-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ks-green); white-space: nowrap; }
.ks-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ks-green); flex: 0 0 auto; }
.ks-live.idle { color: var(--ks-ink4); }
.ks-live.idle i { background: #B9AFA3; }

/* barre de filtres */
.ks-fbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.ks-custom { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ks-ink3); }
.ks-custom input { height: 34px; border: 1px solid var(--ks-line); border-radius: 9px; background: #fff; padding: 0 10px; font: 13px Archivo, sans-serif; color: var(--ks-ink); }
.ks-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ks-pills button { height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--ks-line); background: #fff; color: #3A342E; font: 600 13px Archivo, sans-serif; cursor: pointer; white-space: nowrap; }
.ks-pills button:hover { border-color: #B9AFA3; }
.ks-pills button.on { background: #E5F1F3; border-color: #9CCFD7; color: #0B5C6B; font-weight: 700; }
.ks-bar-label { font-size: 12.5px; color: var(--ks-ink3); }

/* cartes */
.ks-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: #fff; border: 1px solid var(--ks-line); border-radius: 13px; min-width: 0; }
.ks-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ks-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-title small { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ks-ink4); margin-left: 6px; }
.ks-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ks-empty { color: var(--ks-ink4); font-size: 12.5px; padding: 4px 0; }

/* cinq chiffres */
.ks-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ks-kpi { gap: 4px; }
.ks-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ks-big b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ks-d { font-size: 12.5px; font-weight: 700; color: var(--ks-ink3); }
.ks-d.up { color: var(--ks-green); } .ks-d.down { color: var(--ks-red); }
.ks-sub { font-size: 12px; color: var(--ks-ink4); line-height: 1.35; }

/* disposition */
.ks-main { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.ks-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ks-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.ks-grid2 .ks-wide { grid-column: 1 / -1; }
.ks-stackcol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ks-foot { font-size: 12.5px; color: var(--ks-ink3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; position: relative; }
.ks-info { width: 18px; height: 18px; border-radius: 50%; border: 1px solid #B9AFA3; background: #fff; color: var(--ks-ink3); font: 700 11px Archivo, sans-serif; line-height: 1; cursor: pointer; padding: 0; display: inline-grid; place-items: center; }
.ks-info:hover, .ks-how.open .ks-info { border-color: #0B5C6B; color: #0B5C6B; }
.ks-pop { display: none; position: absolute; left: 0; bottom: 28px; width: min(640px, 100%); background: #221E1A; color: #fff; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.5; z-index: 30; box-shadow: 0 12px 32px rgba(34,30,26,.3); }
.ks-how:hover .ks-pop, .ks-how:focus-within .ks-pop, .ks-how.open .ks-pop { display: block; }
.ks-how { display: inline-flex; align-items: center; gap: 6px; position: static; }

/* graphe */
.ks-chart { min-height: 380px; }
.ks-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ks-ctl .grow { flex: 1 1 0; min-width: 0; }
.ks-ctl .ka-seg button { padding: 5px 9px; }
.ks-ctl span.lab { font-size: 12.5px; color: var(--ks-ink3); }
.ks-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ks-ink3); }
.ks-legend span { display: flex; align-items: center; gap: 6px; }
.ks-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.ks-legend i.cur { background: var(--ks-soft); } .ks-legend i.prev { border: 1.5px dashed #B9AFA3; } .ks-legend i.now { background: var(--ks-ras); }
.ks-plot { flex: 1; min-height: 250px; display: grid; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 20px; column-gap: 8px; margin-top: 4px; }
.ks-yaxis { position: relative; }
.ks-yaxis .in, .ks-gridbox { position: absolute; left: 0; right: 0; top: 22px; bottom: 1px; }
.ks-yaxis span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--ks-ink4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ks-area { position: relative; display: flex; align-items: flex-end; border-bottom: 1px solid var(--ks-line); padding-top: 22px; box-sizing: border-box; }
.ks-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed #EDE8E1; pointer-events: none; }
.ks-slot { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.ks-slot:hover { background: rgba(11, 115, 135, .06); }
.ks-prev { position: absolute; left: 18%; right: 18%; bottom: 0; border: 1.5px dashed #B9AFA3; border-bottom: 0; border-radius: 3px 3px 0 0; pointer-events: none; }
.ks-bar { position: relative; width: 100%; background: var(--ks-soft); border-radius: 3px 3px 0 0; min-height: 0; }
.ks-slot.now .ks-bar { background: var(--ks-ras); }
.ks-chip { position: absolute; transform: translateX(-50%); left: 50%; background: #221E1A; color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap; z-index: 3; pointer-events: none; }
.ks-xaxis { position: relative; grid-column: 2; }
.ks-xaxis span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 11px; color: var(--ks-ink4); white-space: nowrap; }
.ks-xaxis span.now { color: var(--ks-ink); font-weight: 800; }
.ks-tip { position: fixed; z-index: 60; pointer-events: none; background: #221E1A; color: #fff; font-size: 11.5px; line-height: 1.45; padding: 5px 9px; border-radius: 7px; white-space: nowrap; display: none; }
.ks-tablewrap { max-height: 420px; overflow: auto; border: 1px solid var(--ks-line); border-radius: 11px; }
.ks-tablewrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ks-tablewrap th { position: sticky; top: 0; background: #F8F6F2; text-align: right; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ks-ink3); padding: 9px 12px; border-bottom: 1px solid var(--ks-line); white-space: nowrap; }
.ks-tablewrap td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--ks-line2); color: var(--ks-ink2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ks-tablewrap th:first-child, .ks-tablewrap td:first-child { text-align: left; }
.ks-tablewrap td:first-child { color: var(--ks-ink); font-weight: 600; }

/* barre empilée Origine / Appareils */
.ks-stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.ks-stack i { display: block; min-width: 3px; }
.ks-stack-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ks-ink3); }
.ks-stack-leg span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.ks-stack-leg i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ks-stack-leg b { color: var(--ks-ink); }
.ks-stackrow { display: flex; flex-direction: column; gap: 6px; }
.ks-stackrow + .ks-stackrow { margin-top: 8px; }
.ks-stackrow .t { font-size: 12px; font-weight: 700; color: var(--ks-ink2); }

/* listes avec barre */
.ks-rows { display: flex; flex-direction: column; gap: 5px; }
.ks-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 44px; gap: 10px; align-items: center; font-size: 13px; }
.ks-row .lab { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-row .bar { height: 7px; border-radius: 4px; background: #EDE8E1; overflow: hidden; }
.ks-row .bar i { display: block; height: 100%; background: var(--ks-teal); }
.ks-row b { text-align: right; font-variant-numeric: tabular-nums; }
.ks-row.pct { grid-template-columns: minmax(0, 1fr) 90px 80px; }
.ks-row.pct b { font-weight: 600; color: var(--ks-ink3); }
.ks-langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 5px; }
.ks-lang { display: grid; grid-template-columns: 86px minmax(0, 1fr) 32px; gap: 8px; align-items: center; font-size: 13px; }
.ks-lang .lab { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-lang .bar { height: 7px; border-radius: 4px; background: #EDE8E1; overflow: hidden; }
.ks-lang .bar i { display: block; height: 100%; background: var(--ks-ras); }
.ks-lang b { text-align: right; font-variant-numeric: tabular-nums; }

/* sous-onglet Détail */
.ks-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.ks-tbl th { position: static; background: transparent; text-align: right; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ks-ink3); padding: 4px 0 6px; border-bottom: 1px solid var(--ks-line); white-space: nowrap; }
.ks-tbl td { text-align: right; height: 34px; padding: 0; border-bottom: 1px solid var(--ks-line2); color: var(--ks-ink2); font-variant-numeric: tabular-nums; }
.ks-tbl th:first-child, .ks-tbl td:first-child { text-align: left; padding-right: 10px; }
.ks-tbl td:first-child { font-weight: 600; color: var(--ks-ink); max-width: 0; width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-tbl tr:last-child td { border-bottom: 0; }
.ks-tbl a { color: #0B5C6B; text-decoration: none; font-weight: 700; }
.ks-tbl a:hover { text-decoration: underline; }
.ks-tbl td .bar { display: inline-block; vertical-align: middle; width: 70px; height: 5px; border-radius: 3px; background: #EDE8E1; overflow: hidden; margin-left: 8px; }
.ks-tbl td .bar i { display: block; height: 100%; background: var(--ks-teal); }
.ks-more { align-self: flex-start; border: 0; background: none; padding: 4px 0 0; font: 700 13px Archivo, sans-serif; color: #0B5C6B; cursor: pointer; }
.ks-more:hover { text-decoration: underline; }
.ks-subttl { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ks-ink3); margin-top: 10px; }
.ks-heat { display: grid; grid-template-columns: 38px repeat(24, 22px); gap: 3px; justify-content: start; font-size: 10.5px; color: var(--ks-ink4); }
.ks-heat .d { display: flex; align-items: center; height: 18px; }
.ks-heat .h { text-align: center; }
.ks-heat .c { height: 18px; border-radius: 3px; background: #E5F1F3; }
.ks-heat .c[data-l="1"] { background: #9CCFD7; } .ks-heat .c[data-l="2"] { background: #3E93A3; } .ks-heat .c[data-l="3"] { background: #0B7387; } .ks-heat .c[data-l="4"] { background: #0B5C6B; }
.ks-heatwrap { overflow-x: auto; padding-bottom: 2px; }
.ks-scale { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ks-ink4); margin-top: 6px; }
.ks-scale i { width: 22px; height: 14px; border-radius: 3px; display: inline-block; }
.ks-tag { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: #EAE5DD; color: var(--ks-ink3); margin-left: 8px; }
.ks-tag.g { background: #E3F3E9; color: var(--ks-green); }
.ks-steps { display: flex; align-items: stretch; gap: 6px; }
.ks-step { flex: 1 1 0; min-width: 0; border-radius: 11px; background: #F4F1EC; padding: 10px 12px; }
.ks-step .l { font-size: 12px; color: var(--ks-ink2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-step .n { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.25; }
.ks-step .p { font-size: 11.5px; color: var(--ks-ink3); }
.ks-arrow { flex: 0 0 auto; align-self: center; display: flex; flex-direction: column; align-items: center; font-size: 11.5px; font-weight: 800; color: #0B5C6B; }
.ks-arrow::before { content: "→"; font-size: 16px; line-height: 1; color: #B9AFA3; }

@media (max-width: 1180px) {
  .ks-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .ks-main, .ks-grid2 { grid-template-columns: minmax(0, 1fr); }
  .ks-steps { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .ks-langs { grid-template-columns: minmax(0, 1fr); }
  .ks-ctl .grow { display: none; }
}
