/* Admin OHINTEL — repris du dashboard d'ohweed (server/dashboard/dashboard.css : base, connexion, double
   authentification, onglet « Trafic »), aux couleurs d'OHINTEL (bleu nuit + cyan). Une seule couleur de données. */
:root {
  --bg: #0A1220;
  --surface: #111C2E;
  --surface-2: #18263D;
  --surface-alt: #0D1727;
  --border: #233552;
  --text: #E6EDF7;
  --muted: #9FB3CF;
  --heading: #FFFFFF;
  --accent: #3CC8F0;
  --accent-ink: #04121C;
  --danger: #ff6b6b;
  --warn: #F2C14E;
  --radius: 14px;
  --radius-sm: 8px;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
h2, h3 { color: var(--heading); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
a { color: var(--accent); }

/* Boutons & champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid transparent; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 800; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #22B2DC; }
.btn--ghost { background: transparent; color: var(--heading); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: 7px 14px; font-size: .85rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn:focus-visible, .input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input { width: 100%; padding: 10px 12px; background: var(--surface-2); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius-sm); font: inherit; }
.input:focus { border-color: var(--accent); outline: none; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .85rem; color: var(--heading); }
.form-error { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin: 6px 0 0; }
.logo { font-weight: 800; font-size: 1.3rem; letter-spacing: .04em; color: var(--heading); white-space: nowrap; }
.logo span { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 3px 8px; border-radius: 6px; vertical-align: middle; margin-left: 6px; }
code.code { font-family: ui-monospace, Consolas, monospace; color: var(--heading); font-weight: 700; user-select: all; }

/* Connexion + double authentification */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login__card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.login__card form { display: flex; flex-direction: column; gap: 10px; }
.mfa { display: flex; flex-direction: column; gap: 10px; }
.mfa__title { font-size: 1.15rem; }
.mfa__steps { margin: 0; padding-left: 18px; font-size: .88rem; display: flex; flex-direction: column; gap: 4px; }
.mfa__qr { align-self: center; background: #fff; padding: 8px; border-radius: 10px; width: 200px; height: 200px; }
#mfa-secret { word-break: break-all; }

/* En-tête : logo, onglets, choix du site, déconnexion */
.top { position: sticky; top: 0; z-index: 20; background: rgba(10, 18, 32, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top__in { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tab { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; padding: 8px 6px; font: inherit; font-weight: 800; cursor: pointer; }
.tab.is-active { color: var(--heading); border-bottom-color: var(--accent); }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.select { padding: 8px 10px; background: var(--surface-2); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-weight: 700; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.panel { display: none; }
.panel.is-active { display: block; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font: inherit; font-weight: 800; font-size: .82rem; cursor: pointer; }
.chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.chart-card { margin-bottom: 18px; }
.chart-card h3 { font-size: 1.02rem; margin-bottom: 4px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.empty { text-align: center; color: var(--muted); padding: 36px; }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--heading); }
.tag--warn { color: var(--warn); }
.tag--site { color: var(--accent); }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.is-extra { display: none; }
.table-wrap.is-all tr.is-extra { display: table-row; }
.more-rows { display: block; width: 100%; margin-top: 8px; padding: 9px; border: 1px dashed var(--border); border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: .84rem; font-weight: 800; cursor: pointer; }
.more-rows:hover { color: var(--accent); border-color: var(--accent); }

/* Infobulle partagée */
.viz-tip { position: fixed; z-index: 60; max-width: 300px; background: #0b1424; color: var(--heading); border: 1px solid var(--accent); border-radius: 8px; padding: 7px 11px; font-size: .82rem; font-weight: 700; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }

/* Chiffres clés, colonnes par jour */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi b { display: block; font-size: 1.5rem; color: var(--heading); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi .delta { display: block; margin-top: 4px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.kpis--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 180px; padding-top: 6px; }
.col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.col__bar { width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 1px; }
.col:hover .col__bar, .col:focus-visible .col__bar { filter: brightness(1.2); }
.col:focus-visible { outline: none; }
.col__label { font-size: .65rem; color: var(--muted); height: 12px; white-space: nowrap; }

/* Trafic (repris d'ohweed, 28 oct. + 3 nov. 2026) */
.live-pill { font-size: .82rem; font-weight: 800; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid2 > .card { min-width: 0; }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-alt); border-left: 3px solid var(--border); }
.insight p { margin: 0; font-size: .9rem; }
.insight--alert { border-left-color: var(--danger); }
.insight--warn { border-left-color: var(--warn); }
.insight--ok { border-left-color: var(--accent); }
.funnel { display: grid; gap: 2px; }
.funnel + .funnel-title { margin-top: 18px; }
.funnel-title { font-size: .92rem; margin: 0 0 6px; color: var(--heading); }
.funnel__row, .hbar { display: grid; grid-template-columns: minmax(150px, 300px) 1fr minmax(110px, auto); align-items: center; gap: 12px; padding: 5px 6px; border-radius: 6px; font-size: .86rem; }
.funnel__row:hover, .hbar:hover, .funnel__row:focus-visible, .hbar:focus-visible { background: rgba(255, 255, 255, .04); outline: none; }
.funnel__track, .hbar__track { height: 14px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.funnel__bar, .hbar__fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.funnel__value, .hbar__value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.funnel__value b { color: var(--heading); }
.funnel__loss { padding: 0 6px 0 calc(min(300px, 30%) + 18px); font-size: .76rem; font-weight: 700; color: var(--muted); }
.funnel__loss.is-worst { color: var(--warn); }
.funnel__loss.is-worst::before { content: "⚠️ "; }
.funnel__extra { margin: 6px 0 0; font-size: .84rem; color: var(--muted); }
.hbars { display: grid; gap: 2px; }
.hbar { grid-template-columns: minmax(120px, 230px) 1fr minmax(90px, auto); }
.hbar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { display: inline-block; width: 60px; height: 6px; background: var(--surface-2); border-radius: 3px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.journeys { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; }
.journeys__list { display: grid; gap: 6px; max-height: 620px; overflow-y: auto; padding-right: 4px; align-content: start; }
.journey { display: grid; gap: 2px; text-align: left; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; color: var(--text); font: inherit; cursor: pointer; }
.journey:hover, .journey.is-open { border-color: var(--accent); }
.journey__top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.journeys__detail { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; max-height: 620px; overflow-y: auto; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.timeline__item { display: grid; grid-template-columns: 48px 22px 1fr; gap: 6px; font-size: .86rem; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.timeline__item:last-child { border-bottom: 0; }
.timeline__t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .76rem; padding-top: 2px; }
.timeline__item--goal { color: var(--heading); font-weight: 700; }
.jump { position: sticky; top: 62px; z-index: 15; display: flex; gap: 6px; overflow-x: auto; margin: 0 -4px 16px; padding: 8px 4px; scrollbar-width: none;
  background: linear-gradient(var(--bg) 70%, transparent); }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .82rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.jump a:hover, .jump a:focus-visible { color: var(--heading); border-color: var(--accent); }
[id^="tr-"], [id^="dl-"], #traffic-session { scroll-margin-top: 130px; }
.journey-back { margin-bottom: 10px; }

@media (max-width: 1200px) { .kpis--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid2, .journeys { grid-template-columns: 1fr; } .journeys__list { max-height: 360px; } }
@media (max-width: 720px) {
  .top__in { padding: 8px 16px; gap: 8px; }
  .top__right { margin-left: 0; width: 100%; }
  .top__right .select { flex: 1; }
  .wrap { padding: 16px 16px 48px; }
  .jump { top: 148px; margin-inline: -12px; padding-inline: 12px; }
  [id^="tr-"], [id^="dl-"], #traffic-session { scroll-margin-top: 200px; }
  .kpis--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpis .kpi { padding: 10px; }
  .kpis .kpi b { font-size: 1.1rem; }
  .kpis .kpi span { font-size: .7rem; line-height: 1.3; display: block; }
  .kpis .kpi .delta { font-size: .64rem; }
  .funnel__row, .hbar { grid-template-columns: 1fr auto; row-gap: 4px; }
  .funnel__track, .hbar__track { grid-column: 1 / -1; grid-row: 2; }
  .funnel__loss { padding-left: 6px; }
  table { font-size: .78rem; }
  th, td { padding: 7px 8px; }
  td:first-child { min-width: 110px; }
  .meter { width: 34px; }
  .journeys__list { max-height: 320px; }
  #traffic-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } #traffic-filter .chip { flex: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
