/* ─────────────────────────────────────────────────────────────
   CHARTE COMMUNE DU HUB SAV — feuille de style unique.
   Toutes les pages l'utilisent. Pour changer une couleur partout,
   modifiez seulement les variables ci-dessous (--…).
   ───────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;
  --fond: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --bord: #dde3e8;
  --texte: #17212b;
  --texte-2: #5a6773;
  --accent: #1f5f8b;
  --accent-doux: #e6f0f7;
  --bon: #1d7a4d;
  --bon-doux: #e5f4ec;
  --attention: #a35f00;
  --attention-doux: #fdf1df;
  --critique: #b42318;
  --critique-doux: #fdeceb;
  --serie-1: #1f5f8b;
  --serie-2: #2a9d8f;
  --serie-3: #c77d1a;
  --serie-4: #7b5ea7;
  --grille: #e8ecef;
  --ombre: 0 1px 2px rgba(16, 24, 40, .06);
  --rayon: 10px;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Mode sombre : automatique selon l'ordinateur, ou forcé par le bouton du menu. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    color-scheme: dark;
    --fond: #0f1419; --surface: #171e25; --surface-2: #1c242c; --bord: #2a343e;
    --texte: #e6ebef; --texte-2: #9aa7b2; --accent: #6fb0e0; --accent-doux: #1a2c3b;
    --bon: #4cc38a; --bon-doux: #15291f; --attention: #e5a54b; --attention-doux: #2d2214;
    --critique: #f2766b; --critique-doux: #2f1a19;
    --serie-1: #6fb0e0; --serie-2: #4fc1b3; --serie-3: #e5a54b; --serie-4: #b39ddb;
    --grille: #24303a; --ombre: none;
  }
}
:root[data-theme="sombre"] {
  color-scheme: dark;
  --fond: #0f1419; --surface: #171e25; --surface-2: #1c242c; --bord: #2a343e;
  --texte: #e6ebef; --texte-2: #9aa7b2; --accent: #6fb0e0; --accent-doux: #1a2c3b;
  --bon: #4cc38a; --bon-doux: #15291f; --attention: #e5a54b; --attention-doux: #2d2214;
  --critique: #f2766b; --critique-doux: #2f1a19;
  --serie-1: #6fb0e0; --serie-2: #4fc1b3; --serie-3: #e5a54b; --serie-4: #b39ddb;
  --grille: #24303a; --ombre: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 var(--police); font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.05rem; font-weight: 650; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Barre de navigation commune ─────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px max(16px, calc((100vw - 1440px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--bord);
}
.nav__marque { font-weight: 650; text-decoration: none; color: var(--texte); display: flex; align-items: center; gap: 8px; }
.nav__marque img { width: 22px; height: 22px; }
.nav__liens { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav__lien {
  text-decoration: none; color: var(--texte-2); padding: 6px 10px; border-radius: 6px; font-size: .92rem;
}
.nav__lien:hover { background: var(--surface-2); color: var(--texte); }
.nav__lien[aria-current="page"] { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.nav__outils { display: flex; gap: 8px; align-items: center; }

/* ── Mise en page ─────────────────────────────────────────── */
.page { max-width: 1440px; margin: 0 auto; padding: 24px 16px 48px; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.entete p { margin: 4px 0 0; color: var(--texte-2); }
.section { margin-top: 24px; }
.grille-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }

/* ── Boutons et champs ────────────────────────────────────── */
.bouton {
  font: inherit; font-size: .92rem; cursor: pointer;
  background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px;
}
.bouton--discret { background: transparent; color: var(--texte-2); border: 1px solid var(--bord); }
.bouton--discret:hover { color: var(--texte); background: var(--surface-2); }
select, input[type="password"], input[type="search"] {
  font: inherit; font-size: .92rem; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bord); border-radius: 6px; padding: 7px 10px;
}

/* ── Sommaire en tuiles ───────────────────────────────────── */
.tuiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.tuile {
  display: flex; flex-direction: column; gap: 10px; min-height: 180px;
  padding: 20px; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: var(--ombre); text-decoration: none; color: var(--texte);
  transition: border-color .15s, transform .15s;
}
a.tuile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tuile__icone {
  width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent-doux); color: var(--accent);
}
.tuile__icone svg { width: 22px; height: 22px; }
.tuile p { margin: 0; color: var(--texte-2); flex: 1; }
.tuile__date { font-size: .82rem; color: var(--texte-2); }
.tuile--inactive { opacity: .55; border-style: dashed; box-shadow: none; }
.tuile--inactive .tuile__icone { background: var(--surface-2); color: var(--texte-2); }

/* ── Bandeau de KPI ───────────────────────────────────────── */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.kpi {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 14px 16px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 4px;
  border-top: 3px solid var(--bord);
}
.kpi__libelle { font-size: .82rem; color: var(--texte-2); }
.kpi__valeur { font-size: 1.7rem; font-weight: 650; letter-spacing: -.01em; }
.kpi__detail { font-size: .8rem; color: var(--texte-2); }
.kpi--bon { border-top-color: var(--bon); }
.kpi--attention { border-top-color: var(--attention); }
.kpi--critique { border-top-color: var(--critique); }
.kpi--indispo .kpi__valeur { font-size: 1rem; font-weight: 500; color: var(--texte-2); }

/* ── Panneaux (graphiques, tableaux) ──────────────────────── */
.panneau {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 16px; min-width: 0;
}
.panneau__tete { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panneau__tete p { margin: 2px 0 0; font-size: .85rem; color: var(--texte-2); }
.source { margin-top: 12px; font-size: .78rem; color: var(--texte-2); border-top: 1px solid var(--grille); padding-top: 8px; }

/* ── Filtres ──────────────────────────────────────────────── */
.filtres { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filtres label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--texte-2); }
.maj { font-size: .82rem; color: var(--texte-2); }

/* ── Tableaux ─────────────────────────────────────────────── */
.tableau-defile { overflow-x: auto; }
table.donnees { width: 100%; border-collapse: collapse; font-size: .9rem; }
.donnees th, .donnees td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--grille); white-space: nowrap; }
.donnees th:first-child, .donnees td:first-child { text-align: left; }
.donnees th { white-space: normal; min-width: 72px; vertical-align: bottom; font-size: .78rem; font-weight: 600; color: var(--texte-2); background: var(--surface-2); position: sticky; top: 0; }
.donnees th[data-tri] { cursor: pointer; user-select: none; }
.donnees th[aria-sort="ascending"]::after { content: " ▲"; }
.donnees th[aria-sort="descending"]::after { content: " ▼"; }
.donnees tbody tr:hover { background: var(--surface-2); }
.donnees .secondaire { color: var(--texte-2); font-size: .8rem; }
.donnees tfoot td { font-weight: 650; border-top: 2px solid var(--bord); }

/* ── Pastilles et alertes ─────────────────────────────────── */
.pastille { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pastille--bon { background: var(--bon-doux); color: var(--bon); }
.pastille--attention { background: var(--attention-doux); color: var(--attention); }
.pastille--critique { background: var(--critique-doux); color: var(--critique); }
.alerte { margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; font-size: .88rem; background: var(--attention-doux); color: var(--attention); border: 1px solid transparent; }
.alerte--critique { background: var(--critique-doux); color: var(--critique); }
.alerte--info { background: var(--accent-doux); color: var(--accent); }
.indispo { padding: 24px 12px; text-align: center; color: var(--texte-2); font-size: .9rem; }

/* ── Graphiques ───────────────────────────────────────────── */
.graphique svg { display: block; width: 100%; height: auto; overflow: visible; }
.graphique text { fill: var(--texte-2); font-size: 11px; font-family: var(--police); }
.graphique .axe { stroke: var(--bord); }
.graphique .grille { stroke: var(--grille); }
.legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--texte-2); margin-bottom: 8px; }
.legende span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c); vertical-align: -1px; }

/* ── Retours clients (CSAT) ───────────────────────────────── */
.retours { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.retours li { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: .88rem; }
.retours .meta { font-size: .78rem; color: var(--texte-2); margin-top: 4px; }

/* ── Page de connexion ────────────────────────────────────── */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.carte-connexion {
  width: min(100%, 380px); background: var(--surface); border: 1px solid var(--bord);
  border-radius: var(--rayon); padding: 28px; box-shadow: var(--ombre);
}
.carte-connexion .marque { margin: 0 0 6px; color: var(--texte-2); }
.carte-connexion h1 { margin-bottom: 18px; }
.connexion { display: flex; flex-direction: column; gap: 10px; }
.connexion input { width: 100%; }

@media (max-width: 640px) {
  .page { padding-top: 16px; }
  h1 { font-size: 1.25rem; }
  .kpi__valeur { font-size: 1.4rem; }
  .nav__liens { order: 3; flex-basis: 100%; }
  .graphique { overflow-x: auto; }
  .graphique svg { min-width: 560px; }
}
@media (min-width: 1800px) {
  body { font-size: 16px; }
}
