/* Cockpit CODIR. En-tête fixe, trois vues ; le résumé avant le détail ; tableau en colonnes à défilement horizontal propre. */
:root {
  --fond: #f2f5f6;
  --surface: #ffffff;
  --creux: #e6ecee;
  --encre: #13222a;
  --encre-2: #4b5d66;
  --trait: #cfd8dc;
  --accent: #0c5f73;
  --accent-encre: #ffffff;
  --accent-doux: #d9ebef;
  --critique: #b3261e;
  --critique-doux: #fbe3e0;
  --alerte: #8a5a00;
  --alerte-doux: #fbeed0;
  --titre: "Archivo", "Arial Narrow", Arial, sans-serif;
  --texte: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f171a;
    --surface: #18232a;
    --creux: #121c21;
    --encre: #e7eff2;
    --encre-2: #9fb3bb;
    --trait: #2d3d45;
    --accent: #62c3d8;
    --accent-encre: #06222a;
    --accent-doux: #163640;
    --critique: #ff8f85;
    --critique-doux: #3b1b19;
    --alerte: #f0c050;
    --alerte-doux: #3a2e12;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--encre); font: 400 15px/1.5 var(--texte); }
h1, h2, h3 { font-family: var(--titre); text-wrap: balance; margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.marque { font-family: var(--titre); font-weight: 800; font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.chapo { color: var(--encre-2); max-width: 65ch; margin-top: 6px; }
.inter { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--encre-2); margin: 28px 0 10px; }
.date, .repere { font-family: var(--mono); font-size: 12.5px; color: var(--encre-2); font-variant-numeric: tabular-nums; }
.pousse { flex: 1 1 auto; }

/* seuil : connexion, refus, erreur */
.seuil { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.seuil-boite { background: var(--surface); border: 1px solid var(--trait); border-top: 4px solid var(--accent); border-radius: 10px; padding: 28px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 12px; }
.seuil-texte { color: var(--encre-2); }
.seuil-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* boutons */
.btn { border: 1px solid var(--trait); background: var(--surface); border-radius: 7px; padding: 7px 13px; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); font-weight: 600; }
.btn.discret { border-color: transparent; background: transparent; color: var(--accent); padding: 5px 8px; }
.btn.danger { color: var(--critique); border-color: var(--critique); }
.btn:disabled, .fleche:disabled { opacity: 0.5; cursor: default; }

/* en-tête */
.entete { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--trait); padding: 10px 20px 0; }
.entete-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.compte { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.compte-nom { font-weight: 600; }
.onglets { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; }
.onglet { padding: 8px 14px; text-decoration: none; color: var(--encre-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.onglet:hover { color: var(--encre); }
.onglet[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.page { padding: 24px 20px 12px; max-width: 1500px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.page > section { display: flex; flex-direction: column; gap: 14px; }
.info { background: var(--alerte-doux); color: var(--alerte); border-radius: 7px; padding: 8px 12px; font-weight: 500; }
.pied { padding: 18px 20px 32px; max-width: 1500px; margin: 0 auto; color: var(--encre-2); font-size: 13px; display: flex; flex-direction: column; gap: 2px; }

/* pastilles */
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pastille { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; font-weight: 600; border: 1px solid transparent; }
.pastille.neutre { background: var(--creux); color: var(--encre-2); }
.pastille.accent { background: var(--accent-doux); color: var(--accent); }
.pastille.critique { background: var(--critique-doux); color: var(--critique); }
.pastille.alerte { background: var(--alerte-doux); color: var(--alerte); }
.pastille.contour { border-color: var(--alerte); color: var(--alerte); }

/* problématiques */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tuile { background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tuile h2 { font-size: 19px; font-weight: 700; }
.tuile blockquote { margin: 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--accent); font-size: 16px; font-weight: 500; }
.etiquette { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--encre-2); font-weight: 600; }
.tuile-bas { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--trait); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tuile-compte { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }

/* compteurs et filtres */
.compteurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.chiffre { background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; text-align: left; }
.chiffre.bouton { cursor: pointer; }
.chiffre.bouton:hover { border-color: var(--accent); }
.chiffre.bouton[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-doux); }
.chiffre-n { font-family: var(--titre); font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chiffre-t { font-size: 13px; color: var(--encre-2); font-weight: 500; }
.chiffre[data-ton="retard"] .chiffre-n { color: var(--critique); }
.chiffre[data-ton="proche"] .chiffre-n, .chiffre[data-ton="confirmer"] .chiffre-n { color: var(--alerte); }
.filtres { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filtres label { font-size: 13px; color: var(--encre-2); font-weight: 600; }
select, input[type="text"], input[type="date"], textarea { background: var(--surface); border: 1px solid var(--trait); border-radius: 7px; padding: 6px 9px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }

/* tableau */
.tableau { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.colonne { flex: 1 0 256px; min-width: 256px; background: var(--creux); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.colonne h2 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 4px; }
.colonne-n { font-family: var(--mono); font-weight: 500; color: var(--encre-2); }
.vide { color: var(--encre-2); font-size: 13px; padding: 6px 4px; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-left: 4px solid var(--trait); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.carte[data-etat="retard"] { border-left-color: var(--critique); }
.carte[data-etat="proche"] { border-left-color: var(--alerte); }
.carte[data-etat="clos"] { opacity: 0.75; }
.carte[draggable="true"] { cursor: grab; }
.carte-titre { all: unset; cursor: pointer; font-weight: 600; line-height: 1.35; }
.carte-titre:hover { color: var(--accent); }
.carte-titre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.carte-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.resp { font-weight: 600; }
.resp.manque { color: var(--critique); }
.carte-actions { display: flex; justify-content: flex-end; gap: 4px; }
.fleche { border: 1px solid var(--trait); background: var(--surface); border-radius: 6px; width: 30px; height: 26px; cursor: pointer; line-height: 1; }
.fleche:hover { border-color: var(--accent); color: var(--accent); }

/* fiche */
dialog { border: 1px solid var(--trait); border-radius: 12px; background: var(--surface); color: var(--encre); padding: 0; width: min(640px, calc(100% - 24px)); max-height: calc(100% - 24px); }
dialog::backdrop { background: rgba(8, 20, 26, 0.55); }
.fiche-form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.fiche-form h2 { font-size: 20px; font-weight: 800; }
.champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.champ label, legend, .fiche-journal h3 { font-size: 13px; font-weight: 600; color: var(--encre-2); }
.champ input, .champ select { width: 100%; }
.deux { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
fieldset { border: 1px solid var(--trait); border-radius: 8px; padding: 8px 12px 10px; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 12px; }
.case { display: flex; align-items: baseline; gap: 6px; font-size: 14px; }
.journal { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.fiche-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; }

/* agents */
.agents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.agent { background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.agent-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.agent-tete h3 { font-size: 20px; font-weight: 800; }
.agent-role { color: var(--encre-2); flex: 1 1 200px; }
.rang { font-family: var(--mono); font-weight: 500; background: var(--accent); color: var(--accent-encre); border-radius: 6px; padding: 0 8px; }
.agent dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 20px; }
.agent dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--encre-2); font-weight: 600; }
.agent dd { margin: 2px 0 0; }
.socle { background: var(--accent-doux); border-radius: 10px; padding: 12px 16px; }
.liste-simple, .echelle { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; max-width: 70ch; }
.deux-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 32px; }

@media (max-width: 520px) {
  h1 { font-size: 23px; }
  .page, .pied { padding-left: 16px; padding-right: 16px; }
  .entete { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .chiffre.bouton, .fleche { transition: border-color 0.12s ease; }
}
