/* Radar de niches : feuille unique (CSP default-src 'self' : aucun style en ligne). Thème clair et sombre. */
:root {
  --fond: #f7f7f5; --surface: #ffffff; --texte: #1d1d1b; --discret: #6b6b66; --bord: #e3e2dc;
  --accent: #1f5fbf; --accent-doux: #e8f0fb; --vert: #1e7a46; --vert-doux: #e4f4ea; --rouge: #b3261e;
  --rouge-doux: #fbe9e7; --ambre: #8a5a00; --ambre-doux: #fdf1d8; --violet: #6b3fa0; --violet-doux: #f1e9fa;
  --s0: #1f5fbf; --s1: #d9730d; --grille: #e3e2dc;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #161615; --surface: #1f1f1d; --texte: #ecebe6; --discret: #a09f98; --bord: #33332f;
    --accent: #7fb0ff; --accent-doux: #1d2a3d; --vert: #6fd39b; --vert-doux: #17301f; --rouge: #ff8a80;
    --rouge-doux: #3a1d1a; --ambre: #f3c165; --ambre-doux: #352a12; --violet: #c9a5f5; --violet-doux: #2b2238;
    --s0: #7fb0ff; --s1: #f5a35c; --grille: #33332f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
code { background: var(--accent-doux); padding: 1px 4px; border-radius: 4px; }
.discret { color: var(--discret); font-size: .88em; font-weight: normal; }
.aide { color: var(--discret); max-width: 820px; }
.vide { color: var(--discret); font-style: italic; }
.fort { font-weight: 600; }
.fil { color: var(--discret); margin: 0; }

/* En-tête */
.entete { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 2; }
.marque { font-weight: 700; color: var(--texte); }
.entete nav { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; }
.deconnexion { display: flex; gap: 8px; align-items: center; }
.qui { color: var(--discret); font-size: .9em; }

/* Formulaires */
button { font: inherit; padding: 6px 12px; border: 1px solid var(--bord); border-radius: 6px;
  background: var(--surface); color: var(--texte); cursor: pointer; }
button:hover { border-color: var(--accent); }
input, select, textarea { font: inherit; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bord); border-radius: 6px; padding: 5px 8px; max-width: 100%; }
.filtres { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 12px;
  background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; margin-bottom: 10px; }
.filtres label { display: flex; flex-direction: column; font-size: .85em; color: var(--discret); gap: 2px; }
.filtres label.case { flex-direction: row; align-items: center; gap: 6px; }
.filtres button { background: var(--accent); color: #fff; border-color: var(--accent); }
.reinit { font-size: .9em; padding-bottom: 6px; }

.connexion { max-width: 360px; margin: 10vh auto; background: var(--surface); padding: 24px;
  border: 1px solid var(--bord); border-radius: 10px; }
.connexion form { display: flex; flex-direction: column; gap: 6px; }
.connexion input { padding: 8px 10px; }
.connexion button { margin-top: 12px; background: var(--accent); color: #fff; border-color: var(--accent); padding: 9px; }
.erreur { background: var(--rouge-doux); color: var(--rouge); padding: 8px 10px; border-radius: 6px; }

/* Cartes de l'accueil */
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; padding: 14px 16px; }
.carte h2 { margin: 0 0 8px; }
.top { margin: 8px 0 0; padding-left: 20px; }
.top li { margin: 3px 0; }

/* Chiffres clés */
.chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.chiffres.larges { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 14px 0; }
.chiffres div { background: var(--fond); border-radius: 6px; padding: 6px 8px; }
.chiffres.larges div { background: var(--surface); border: 1px solid var(--bord); }
.chiffres dt { font-size: .78em; color: var(--discret); }
.chiffres dd { margin: 0; font-size: 1.15em; font-weight: 600; font-variant-numeric: tabular-nums; }
.fiche { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.fiche dt { color: var(--discret); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }

/* Tableaux */
.tableau { overflow-x: auto; background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--surface); font-size: .85em; color: var(--discret); white-space: nowrap; }
thead th a { color: var(--discret); }
thead th a.actif { color: var(--texte); font-weight: 700; }
.num { text-align: right; white-space: nowrap; }
tr.separateur th { background: var(--accent-doux); color: var(--texte); font-size: .9em; }
tr.non-candidate td { opacity: .6; }
tr.faible td:first-child { border-left: 3px solid var(--vert); }
tr.courant td { background: var(--accent-doux); }
table.compact { background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; }
.hausse { color: var(--vert); }
.baisse { color: var(--rouge); }

/* Pastilles et étiquettes */
.pastille, .etiquette, .decision { display: inline-block; font-size: .75em; padding: 1px 7px; border-radius: 999px;
  background: var(--fond); color: var(--discret); border: 1px solid var(--bord); white-space: nowrap; }
.pastille.nouvelle { background: var(--vert-doux); color: var(--vert); border-color: transparent; }
.pastille.adulte { background: var(--rouge-doux); color: var(--rouge); border-color: transparent; }
.pastille.hausse { background: var(--vert-doux); border-color: transparent; }
.e-editorial, .e-outil { background: var(--accent-doux); color: var(--accent); border-color: transparent; }
.e-boutique { background: var(--ambre-doux); color: var(--ambre); border-color: transparent; }
.e-illicite { background: var(--rouge-doux); color: var(--rouge); border-color: transparent; }
.e-saisonnier { background: var(--violet-doux); color: var(--violet); border-color: transparent; }
.decision.d-0, button.d-0 { background: var(--vert-doux); color: var(--vert); border-color: transparent; }
.decision.d-1, button.d-1 { background: var(--rouge-doux); color: var(--rouge); border-color: transparent; }
.decision.d-2, button.d-2 { background: var(--ambre-doux); color: var(--ambre); border-color: transparent; }

/* Fiches */
.deux-colonnes { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
.decision-form { display: flex; flex-direction: column; gap: 6px; }
.boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.historique { list-style: none; padding: 0; }
.historique li { padding: 6px 0; border-bottom: 1px solid var(--bord); overflow-wrap: anywhere; }
.sortant { font-size: .55em; font-weight: normal; margin-left: 8px; }

/* Courbes SVG */
.graphe { margin: 0; background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 8px; }
.courbe { width: 100%; height: auto; display: block; }
.courbe .grille { stroke: var(--grille); stroke-width: 1; }
.courbe .axe { fill: var(--discret); font-size: 11px; }
.courbe .serie-0 { fill: none; stroke: var(--s0); stroke-width: 2; }
.courbe .serie-1 { fill: none; stroke: var(--s1); stroke-width: 2; }
.courbe .point-0 { fill: var(--s0); }
.courbe .point-1 { fill: var(--s1); }
figcaption { display: flex; gap: 16px; font-size: .85em; color: var(--discret); padding: 4px 8px 0; }
.legende-0::before, .legende-1::before { content: ""; display: inline-block; width: 12px; height: 3px;
  margin-right: 6px; vertical-align: middle; }
.legende-0::before { background: var(--s0); }
.legende-1::before { background: var(--s1); }

@media (max-width: 800px) {
  .deux-colonnes { grid-template-columns: 1fr; }
  .chiffres { grid-template-columns: repeat(2, 1fr); }
  .entete nav { order: 3; flex-basis: 100%; }
}
