/* =====================================================================
   Tableau de projets — styles
   Couleurs : celles des thèmes identifient ; le rouge est réservé aux
   retards et points bloquants, l'orange aux alertes ; le reste est neutre.
   ===================================================================== */

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/polices/atkinson-hyperlegible-next.woff2') format('woff2');
}

:root {
  --fond: #E9EEF2;
  --fond-pale: #F4F7F9;
  --surface: #FFFFFF;
  --encre: #16212C;
  --encre-douce: #556373;
  --encre-pale: #6E7C8B;
  --trait: #D3DBE2;
  --trait-leger: #E6EBEF;
  --trait-grille: #E3E8ED;
  --trait-aujourdhui: #2B3A4A;
  --trait-champ: #BCC7D1;
  --survol: #F1F5F8;
  --selection: #E1E9F1;
  --surbrillance: #D7E5F4;
  --critique: #C42B2B;
  --critique-fond: #FBEDED;
  --alerte: #9C5C00;
  --alerte-vif: #E39B1F;
  --alerte-fond: #FCF2DF;
  --focus: #1D5FD6;
  --ombre-flottante: 0 18px 44px rgba(22, 33, 44, .16), 0 2px 6px rgba(22, 33, 44, .08);
  --largeur-taches: clamp(340px, 31vw, 460px);
  --police: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  color-scheme: light;
  font-family: var(--police);
  font-size: 14px;
  line-height: 1.45;
  color: var(--encre);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; background: var(--fond); }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.visuellement-cache {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.icone {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.icone .plein { fill: currentColor; stroke: none; }

.pastille {
  display: inline-block; flex: none;
  width: 9px; height: 9px; border-radius: 2.5px;
  background: var(--couleur, var(--encre-pale));
}
.pastille-vide { background: transparent; border: 1.5px dashed var(--encre-pale); }

/* ---------------------------------------------------------------------
   Boutons et champs
   --------------------------------------------------------------------- */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 13px;
  border: 1px solid transparent; border-radius: 6px;
  font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  cursor: pointer; background: none;
}
.bouton:disabled { opacity: .5; cursor: default; }
.bouton-principal { background: var(--encre); color: #fff; }
.bouton-principal:hover:not(:disabled) { background: #2A3B4E; }
.bouton-secondaire { background: var(--surface); border-color: var(--trait); }
.bouton-secondaire:hover:not(:disabled) { background: var(--survol); }
.bouton-discret { color: var(--encre); }
.bouton-discret:hover:not(:disabled) { background: rgba(22, 33, 44, .07); }
.bouton-danger { color: var(--critique); }
.bouton-danger:hover:not(:disabled) { background: var(--critique-fond); }
.bouton-danger.est-a-confirmer { background: var(--critique); color: #fff; }
.bouton-icone { width: 32px; min-height: 32px; padding: 0; color: var(--encre-douce); }
.bouton-icone:hover:not(:disabled) { color: var(--encre); }
.bouton-retour { padding-left: 6px; color: var(--encre-douce); font-weight: 600; }

input[type="text"], input[type="search"], input[type="email"], input[type="date"],
input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--trait-champ); border-radius: 6px;
  background: var(--surface);
}
textarea { resize: vertical; line-height: 1.45; }
select { padding-right: 28px; }
input::placeholder, textarea::placeholder { color: var(--encre-pale); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--encre); }

kbd.raccourci {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  min-width: 20px; padding: 2px 6px;
  border: 1px solid var(--trait); border-bottom-width: 2px; border-radius: 4px;
  background: var(--fond-pale); color: var(--encre-douce);
  font: 600 11px/1.3 var(--police); text-align: center;
  pointer-events: none;
}
input:focus ~ kbd.raccourci, input:not(:placeholder-shown) ~ kbd.raccourci { visibility: hidden; }

/* ---------------------------------------------------------------------
   Page de connexion
   --------------------------------------------------------------------- */

.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.carte-connexion {
  width: 100%; max-width: 380px; padding: 30px 28px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 12px;
}
.entete-connexion { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.entete-connexion h1 { font-size: 20px; }
.discret { color: var(--encre-douce); }
.page-connexion form { display: grid; gap: 6px; }
.page-connexion label { font-size: 13px; font-weight: 650; margin-top: 10px; }
.page-connexion .case { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; margin-top: 14px; }
.page-connexion button {
  margin-top: 18px; min-height: 42px; border: 0; border-radius: 7px;
  background: var(--encre); color: #fff; font-weight: 650; cursor: pointer;
}
.page-connexion button:hover { background: #2A3B4E; }
.page-connexion button:disabled { opacity: .6; cursor: wait; }
.message {
  margin-top: 12px; padding: 10px 12px; border-radius: 7px;
  background: var(--critique-fond); color: #8E1F1F; font-size: 14px;
}

/* ---------------------------------------------------------------------
   Écran principal
   --------------------------------------------------------------------- */

body.ecran { height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
body.est-en-chargement .zones { opacity: .6; }

.barre { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.logo {
  display: flex; align-items: center; gap: 9px; margin-right: 6px;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.ajout-rapide { position: relative; flex: 1 1 360px; max-width: 620px; }
.ajout-rapide input {
  height: 42px; padding: 0 44px 0 14px;
  font-size: 15px; border-color: var(--trait-champ); border-radius: 8px;
}
.ajout-rapide input[aria-busy="true"] { background: var(--fond-pale); }
.recherche { position: relative; flex: 0 1 260px; min-width: 160px; }
.recherche input { height: 42px; padding: 0 36px 0 12px; border-radius: 8px; }
.barre-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.barre-actions .bouton-principal { margin-right: 6px; }

.resultats {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  width: max(100%, 440px); max-height: 60vh; overflow-y: auto; padding: 6px 0;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 8px;
  box-shadow: var(--ombre-flottante);
}
.resultats-titre { padding: 8px 14px 4px; font-size: 12px; font-weight: 650; color: var(--encre-douce); }
.resultat { display: flex; align-items: center; gap: 9px; padding: 7px 14px; cursor: pointer; }
.resultat[aria-selected="true"], .resultat:hover { background: var(--selection); }
.resultat-libelle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resultat-detail { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--encre-douce); white-space: nowrap; }
.resultats-vide { padding: 10px 14px; color: var(--encre-douce); }

.compte { position: relative; margin-left: 4px; }
.bouton-compte {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--trait-champ); background: var(--surface);
  font-weight: 700; cursor: pointer;
}
.bouton-compte:hover { background: var(--survol); }
.menu-compte {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  display: grid; gap: 10px; min-width: 220px; padding: 14px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 8px;
  box-shadow: var(--ombre-flottante);
}
.menu-compte-identite { color: var(--encre-douce); }
.menu-compte-identite strong { color: var(--encre); }

/* Une seule feuille, partagée en deux zones par un trait */
.zones {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--largeur-taches);
  min-height: 0; margin: 0 16px 16px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 8px;
  overflow: hidden;
}
.zone { display: flex; flex-direction: column; min-height: 0; }
.zone-projets { border-right: 1px solid var(--trait); }
.zone-entete {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--trait);
}
.zone-compte { margin-left: 6px; font-weight: 500; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.zone-precision { font-size: 12.5px; color: var(--encre-douce); }

.vide { padding: 28px 20px; color: var(--encre-douce); }
.vide strong { display: block; margin-bottom: 4px; color: var(--encre); font-weight: 650; }

/* Petites étiquettes (liste des référents) */
.tache-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.marque {
  display: inline-block; padding: 0 7px; border-radius: 9px;
  border: 1px solid var(--trait); background: var(--fond-pale);
  font-size: 11.5px; line-height: 18px; font-weight: 600; color: var(--encre-douce); white-space: nowrap;
}

/* ---------------- Projets et diagramme ---------------- */

.zone-entete-projets { align-items: center; }
.frise-commandes { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.segments-compacts { margin-right: 6px; }
.segments-compacts .segment span { padding: 3px 10px; font-size: 12.5px; }
.bouton-compact { min-height: 30px; padding: 4px 10px; font-size: 13px; }

.defilement-projets { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* Une ligne = 40 px exactement : les pointillés d'« aujourd'hui » se raccordent d'une ligne à l'autre */
.frise-entete, .projet {
  display: grid; grid-template-columns: 6px minmax(240px, 36%) minmax(0, 1fr);
  column-gap: 12px; padding: 0 16px 0 14px;
}
.frise-entete {
  position: sticky; top: 0; z-index: 3;
  height: 42px; align-items: stretch;
  background: var(--surface); box-shadow: inset 0 -1px 0 var(--trait);
}
.frise-entete-titre { align-self: center; font-size: 12px; color: var(--encre-pale); }

.axe { position: relative; overflow: hidden; background: var(--grille, none); }
.axe::before {
  content: ''; position: absolute; top: 25px; bottom: 0; left: var(--x-aujourdhui, -10%);
  width: 1.5px; margin-left: -.75px;
  background: linear-gradient(to bottom, var(--trait-aujourdhui) 50%, transparent 0) 0 0 / 1.5px 8px repeat-y;
}
.axe-colonne {
  position: absolute; top: 5px;
  display: flex; justify-content: center; align-items: baseline; gap: 5px;
  overflow: hidden; white-space: nowrap; font-size: 12.5px;
}
.axe-principal { font-weight: 650; color: var(--encre); }
.axe-precision { color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.axe-aujourdhui {
  position: absolute; bottom: 2px; transform: translateX(-50%);
  padding: 0 4px; background: var(--surface);
  font-size: 11.5px; font-weight: 700; color: var(--trait-aujourdhui); white-space: nowrap;
}

.projet {
  align-items: center; height: 40px;
  box-shadow: inset 0 -1px 0 var(--trait-leger);
  cursor: pointer;
}
.projet:hover { background: var(--survol); }
.projet.est-selectionne { background: var(--selection); box-shadow: inset 3px 0 0 var(--encre), inset 0 -1px 0 var(--trait-leger); }
.projet.est-modifie { animation: surbrillance 2.4s ease-out; }
.projet.est-en-mouvement { position: relative; z-index: 2; }
.projet.est-en-mouvement:not(.est-selectionne) { background: var(--surface); }
.projet-puce { width: 6px; height: 20px; border-radius: 2px; background: var(--couleur); }
.projet-nom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.projet-titre {
  min-width: 0; padding: 0; border: 0; background: none; cursor: pointer;
  font-weight: 650; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.projet-titre:hover { text-decoration: underline; text-underline-offset: 3px; }
.projet-icones { display: inline-flex; flex: none; gap: 1px; }
.projet-etat { flex: none; font-size: 12px; color: var(--encre-douce); white-space: nowrap; }
.est-en-pause .projet-titre { color: var(--encre-douce); }

/* Icônes d'état : point bloquant (rouge), attente de retour (sablier), sans prochaine action (orange) */
.icone-etat {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%; cursor: default;
}
.icone-etat .icone { width: 17px; height: 17px; }
.icone-etat:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.icone-etat-bloquant { color: var(--critique); }
.icone-etat-bloquant .fond { fill: color-mix(in srgb, var(--critique) 16%, transparent); }
.icone-etat-attente { color: var(--encre); }
.icone-etat-alerte { color: var(--alerte); }
.icone-etat-alerte .fond { fill: color-mix(in srgb, var(--alerte-vif) 26%, transparent); stroke: var(--alerte-vif); }

/* Colonne du diagramme : grille des colonnes et ligne « aujourd'hui » en pointillés */
.projet-frise {
  position: relative; align-self: stretch; min-width: 0; overflow: hidden;
  background: var(--grille, none);
}
.projet-frise::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: var(--x-aujourdhui, -10%);
  width: 1.5px; margin-left: -.75px;
  background: linear-gradient(to bottom, var(--trait-aujourdhui) 50%, transparent 0) 0 0 / 1.5px 8px repeat-y;
}

/* Jauge : couleur du thème, partie foncée = avancement */
.jauge {
  position: absolute; top: 50%; height: 14px; margin-top: -7px;
  left: var(--debut); width: calc(var(--fin) - var(--debut)); min-width: 4px;
  border: 1.25px solid var(--couleur); border-radius: 7px;
  background: color-mix(in srgb, var(--couleur) 16%, transparent);
  overflow: hidden; cursor: pointer;
}
.jauge-avancement {
  position: absolute; top: 0; bottom: 0; left: 0; width: var(--avancement);
  background: color-mix(in srgb, var(--couleur) 62%, transparent);
}
.jauge.est-en-retard { border: 2px solid var(--critique); }
.jauge.est-en-pause { border-style: dashed; background: color-mix(in srgb, var(--couleur) 8%, transparent); }
.jauge.est-en-pause .jauge-avancement { display: none; }
.projet:hover .jauge { box-shadow: 0 0 0 3px color-mix(in srgb, var(--couleur) 14%, transparent); }

.jauge-retard {
  position: absolute; top: 50%; transform: translateY(-50%);
  left: calc(max(var(--fin), 0%) + 7px);
  padding: 0 2px;
  font-size: 12px; font-weight: 700; color: var(--critique); white-space: nowrap;
  text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface), 0 0 3px var(--surface);
}

/* Repères quand la jauge sort de la période affichée, ou sans dates */
.frise-message {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--encre-douce); white-space: nowrap;
}
.frise-avant { left: 4px; }
.frise-apres { right: 4px; }
.frise-avant, .frise-apres { display: none; cursor: pointer; }
.projet-frise.est-avant .frise-avant, .projet-frise.est-apres .frise-apres { display: block; }
.projet-frise.est-avant .jauge, .projet-frise.est-avant .jauge-retard,
.projet-frise.est-apres .jauge { display: none; }
.projet-frise.est-en-retard .frise-avant { color: var(--critique); font-weight: 700; }
.frise-a-completer { left: 4px; color: var(--alerte); font-weight: 600; }

/* Légende */
.legende {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; flex: none;
  padding: 7px 16px; border-top: 1px solid var(--trait);
  font-size: 12.5px; color: var(--encre-douce);
}
.legende-element { display: inline-flex; align-items: center; gap: 4px; }
.legende .icone-etat { width: 20px; height: 20px; }
.legende-aide { margin-left: auto; color: var(--encre-pale); }

/* Bulles d'information au survol */
.bulle {
  position: fixed; z-index: 40; max-width: 360px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--encre); color: #fff; box-shadow: var(--ombre-flottante);
  font-size: 13px; line-height: 1.4; pointer-events: none;
}
.bulle-titre { font-weight: 700; }
.bulle-texte { margin-top: 3px; white-space: pre-line; }
.bulle-date { margin-top: 5px; font-size: 12px; color: #B8C4D0; }
.bulle-liste { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 6px 0 0; }
.bulle-liste dt { color: #B8C4D0; }
.bulle-liste dd { margin: 0; }
.bulle .est-critique { color: #FFB8B8; }
.bulle .est-alerte { color: #FFCF8A; }

/* ---------------- Tâches ---------------- */

.panneau-taches { flex: 1; overflow-y: auto; }
.taches-section { padding: 4px 0 8px; border-bottom: 1px solid var(--trait-leger); }
.taches-section:last-child { border-bottom: 0; }
.taches-section-titre { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px 4px; }
.taches-section-nombre { font-weight: 500; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.taches-section-precision { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--encre-douce); }

.tache {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 26px;
  align-items: start; column-gap: 9px;
  padding: 6px 10px 6px 16px;
}
.tache:hover { background: var(--survol); }
.tache-case { width: 16px; height: 16px; margin: 2px 0 0; cursor: pointer; }
.tache-corps { min-width: 0; }
.tache-titre {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.tache-titre:hover { text-decoration: underline; text-underline-offset: 3px; }
.tache-meta { display: flex; margin-top: 2px; font-size: 12px; color: var(--encre-douce); }
.tache-theme { display: inline-flex; align-items: center; gap: 5px; }
.tache-attente { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.tache-attente .icone-etat { width: 18px; height: 18px; }
.tache-attente .icone-etat .icone { width: 15px; height: 15px; }
.tache.est-en-mouvement { position: relative; z-index: 2; background: var(--surface); }
.lien-discret {
  max-width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--encre-douce); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lien-discret:hover { color: var(--encre); text-decoration: underline; }
.tache-age {
  padding-top: 2px; font-size: 12px; color: var(--encre-douce);
  font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
}
.tache-epingle {
  display: grid; place-items: center; width: 26px; height: 24px;
  padding: 0; border: 0; border-radius: 5px; background: none; cursor: pointer;
  color: var(--encre-pale); opacity: 0;
}
.tache:hover .tache-epingle, .tache-epingle:focus-visible { opacity: 1; }
.tache-epingle:hover { background: rgba(22, 33, 44, .08); color: var(--encre); }
.tache-epingle.est-active { opacity: 1; color: var(--encre); }
.tache-epingle .icone { width: 15px; height: 15px; }
.tache-epingle:not(.est-active) .icone .plein { fill: none; stroke: currentColor; stroke-width: 1.5; }

.tache.est-terminee .tache-titre { text-decoration: line-through; color: var(--encre-douce); }
.tache.est-nouvelle { animation: surbrillance 2s ease-out; }
@keyframes surbrillance { from { background: var(--surbrillance); } to { background: transparent; } }

.dossier-entete {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px; list-style: none; cursor: pointer; font-weight: 600;
}
.dossier-entete::-webkit-details-marker { display: none; }
.dossier-entete:hover { background: var(--survol); }
.dossier-triangle { width: 14px; height: 14px; margin-left: -4px; color: var(--encre-douce); transition: transform .12s ease-out; }
.dossier[open] > .dossier-entete .dossier-triangle { transform: rotate(90deg); }
.dossier-carre { width: 10px; height: 10px; border-radius: 2.5px; background: var(--couleur); }
.dossier-carre-vide { background: transparent; border: 1.5px dashed var(--encre-pale); }
.dossier-nombre { margin-left: auto; font-weight: 500; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.dossier .liste-taches { padding-bottom: 4px; }
.dossier .tache { padding-left: 36px; }
.dossier-terminees { border-top: 1px solid var(--trait-leger); margin-top: 6px; }

/* Mode projet */
.zone-entete-projet { align-items: center; padding: 8px 12px 8px 8px; }
.raccourci-discret { margin-left: auto; font-size: 12px; color: var(--encre-pale); }
.projet-entete { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px 8px; }
.projet-entete .projet-puce { margin-top: 3px; }
.projet-entete-titre { font-size: 16px; line-height: 1.3; }
.projet-entete-detail { margin-top: 2px; font-size: 12.5px; color: var(--encre-douce); }
.ajout-projet { padding: 4px 16px 10px; }

/* ---------------------------------------------------------------------
   Fiches : par-dessus l'écran, la colonne des tâches restant visible
   --------------------------------------------------------------------- */

.fiche {
  position: absolute; top: 0; bottom: 0; right: var(--largeur-taches); z-index: 10;
  display: flex; flex-direction: column;
  width: min(600px, calc(100% - var(--largeur-taches)));
  background: var(--surface);
  border-left: 1px solid var(--trait); border-right: 1px solid var(--trait);
  box-shadow: var(--ombre-flottante);
  transform: translateX(14px); opacity: 0;
  transition: transform .16s ease-out, opacity .16s ease-out;
}
.fiche.est-ouverte { transform: none; opacity: 1; }
.fiche:focus { outline: none; }
.fiche-bandeau { height: 4px; flex: none; background: var(--couleur, var(--trait)); }
.fiche-entete { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px 12px; border-bottom: 1px solid var(--trait-leger); }
.fiche-entete-textes { flex: 1; min-width: 0; }
.fiche-entete-textes .bouton-retour { margin: -4px 0 6px -8px; min-height: 28px; }
.fiche-surtitre { font-size: 12.5px; color: var(--encre-douce); }
.fiche-titre { margin-top: 2px; font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.fiche-corps { flex: 1; overflow-y: auto; padding: 16px 20px 28px; }
.fiche-pied {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--trait-leger);
}
.fiche-pied .espace { flex: 1; }
.fiche-mention { margin: 4px 0 0; font-size: 12.5px; color: var(--encre-douce); }
.fiche-mention-haut { margin: -6px 0 14px; }
.fiche-section { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--trait-leger); }
.fiche-section h3 { display: flex; gap: 8px; margin-bottom: 8px; }
.fiche-section-nombre { font-weight: 500; color: var(--encre-douce); }

.formulaire { display: grid; gap: 14px; }
.champ { display: grid; align-content: start; gap: 5px; min-width: 0; margin: 0; padding: 0; border: 0; }
.champ-libelle { padding: 0; font-size: 13px; font-weight: 650; }
.champ-requis { color: var(--encre-douce); font-weight: 500; }
.champ-aide { font-size: 12.5px; color: var(--encre-douce); }
.champ-erreur { font-size: 12.5px; color: var(--critique); font-weight: 600; }
.est-en-erreur input, .est-en-erreur select, .est-en-erreur textarea { border-color: var(--critique); }
.champs-ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.champ .champ-court { width: 120px; }

.choix-themes { display: flex; flex-wrap: wrap; gap: 6px; }
.puce-choix {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 9px; border: 1px solid var(--trait); border-radius: 16px;
  font-size: 13px; cursor: pointer; background: var(--surface);
}
.puce-choix:hover { background: var(--survol); }
.puce-choix input { position: absolute; opacity: 0; pointer-events: none; }
.puce-choix:has(input:checked) { border-color: var(--encre); background: var(--selection); font-weight: 650; }
.puce-choix:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.puce-choix:has(input:disabled) { cursor: default; opacity: .55; }
.puce-choix:has(input:disabled:checked) { opacity: 1; }
.puce-choix-pastille { width: 10px; height: 10px; border-radius: 3px; background: var(--couleur); }
.puce-choix-pastille-vide { background: transparent; border: 1.5px dashed var(--encre-pale); }

.segments { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 8px; background: var(--fond); justify-self: start; }
.segment { position: relative; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: block; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--encre-douce); }
.segment:hover span { color: var(--encre); }
.segment:has(input:checked) span { background: var(--surface); color: var(--encre); font-weight: 650; box-shadow: 0 1px 2px rgba(22, 33, 44, .14); }
.segment:has(input:focus-visible) span { outline: 2px solid var(--focus); outline-offset: 1px; }

.case { display: flex; align-items: center; gap: 9px; cursor: pointer; flex-wrap: wrap; }
.case input { width: 16px; height: 16px; margin: 0; }
.case-libelle { font-weight: 650; }
.case-aide { font-size: 12.5px; color: var(--encre-douce); }

.signalement { margin: 0; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 8px; }
.signalement-bloquant:has(> .case input:checked) { border-color: #E5AFAF; background: var(--critique-fond); }
.signalement-bloquant:has(> .case input:checked) .case-libelle { color: var(--critique); }
.signalement-attente:has(> .case input:checked) { border-color: var(--trait-champ); background: var(--fond-pale); }
.signalement-date { margin-left: auto; font-size: 12.5px; color: var(--encre-douce); }
.signalement-detail { display: grid; gap: 10px; margin-top: 10px; }

.referents { display: grid; gap: 8px; }
.referents-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce-referent { display: inline-flex; align-items: center; border: 1px solid var(--trait); border-radius: 16px; background: var(--fond-pale); }
.puce-referent-nom { padding: 4px 4px 4px 12px; border: 0; background: none; cursor: pointer; font-weight: 600; }
.puce-referent-nom:hover { text-decoration: underline; }
.puce-referent-retirer {
  display: grid; place-items: center; width: 26px; height: 26px; margin-right: 2px;
  border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--encre-douce);
}
.puce-referent-retirer:hover { background: rgba(22, 33, 44, .08); color: var(--encre); }
.puce-referent-retirer .icone { width: 12px; height: 12px; }
.referents-ajouts { display: grid; grid-template-columns: 1fr; gap: 6px; max-width: 360px; }

.liens { display: grid; gap: 6px; }
.liens-liste { display: grid; gap: 6px; }
.lien-ligne { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 32px 32px; gap: 6px; align-items: center; }
.lien-action { display: grid; }
.bouton-ajout { justify-self: start; padding-left: 8px; color: var(--encre-douce); }
.liens-trouves { display: grid; gap: 2px; margin-top: -6px; }
.lien-trouve { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--encre-douce); }
.lien-trouve-adresse { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avancement-calcule { color: var(--encre-douce); }
.avancement-calcule strong { color: var(--encre); font-size: 15px; }

.liste-liens { display: grid; gap: 2px; }
.lien-liste {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left;
}
.lien-liste:hover { background: var(--survol); }
.lien-liste-detail { margin-left: auto; padding-left: 10px; font-size: 12px; color: var(--encre-douce); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pastille-tache { border-radius: 50%; background: var(--encre-pale); }

.barre-fiche { display: flex; gap: 8px; margin-bottom: 12px; }
.liste-referents { display: grid; }
.ligne-referent {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nom compteurs" "detail compteurs";
  width: 100%; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--trait-leger);
  background: none; cursor: pointer; text-align: left;
}
.ligne-referent:hover { background: var(--survol); }
.ligne-referent-nom { grid-area: nom; font-weight: 650; }
.ligne-referent-detail { grid-area: detail; font-size: 12.5px; color: var(--encre-douce); }
.ligne-referent-compteurs { grid-area: compteurs; align-self: center; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--encre-douce); }

.themes-liste { display: grid; margin: 14px 0 0; border-top: 1px solid var(--trait-leger); }
.theme-ligne { padding: 8px 0; border-bottom: 1px solid var(--trait-leger); }
.theme-ligne-principale { display: flex; align-items: center; gap: 8px; }
.theme-pastille {
  flex: none; width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--surface); outline: 1px solid var(--trait-champ);
  background: var(--couleur);
}
.theme-pastille[aria-expanded="true"] { outline: 2px solid var(--encre); }
.theme-nom { flex: 1; min-width: 0; }
.theme-usage { flex: none; width: 120px; font-size: 12px; color: var(--encre-douce); text-align: right; }
.theme-nouveau { margin-top: 22px; display: grid; gap: 10px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 4px 34px; }
.theme-nouveau .palette { padding-left: 0; }
.palette-couleur {
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--surface); outline: 1px solid transparent;
  background: var(--couleur);
}
.palette-couleur[aria-checked="true"] { outline: 2px solid var(--encre); }
.palette-couleur:hover { outline-color: var(--encre-pale); }
.filtre { flex: 1; }

/* ---------------------------------------------------------------------
   Notifications
   --------------------------------------------------------------------- */

.notifications { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: grid; gap: 8px; justify-items: end; }
.notification {
  display: flex; align-items: center; gap: 14px; max-width: min(440px, calc(100vw - 32px));
  padding: 10px 14px; border-radius: 8px;
  background: var(--encre); color: #fff; box-shadow: var(--ombre-flottante);
  animation: apparition .16s ease-out;
}
.notification-erreur { background: var(--critique); }
.notification-attention { background: #5B4300; }
.notification.est-sortante { opacity: 0; transition: opacity .18s; }
.notification-action {
  flex: none; padding: 3px 10px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 5px;
  background: none; color: #fff; font-weight: 650; cursor: pointer;
}
.notification-action:hover { background: rgba(255, 255, 255, .12); }
@keyframes apparition { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
   Écrans étroits et mouvements réduits
   --------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .logo-nom { display: none; }
  .barre-actions .bouton-discret { padding: 6px 9px; }
}

@media (max-width: 900px) {
  body.ecran { height: auto; min-height: 100vh; overflow: auto; }
  .barre { flex-wrap: wrap; }
  .ajout-rapide, .recherche { flex-basis: 100%; max-width: none; }
  .zones { grid-template-columns: minmax(0, 1fr); }
  .zone-projets { border-right: 0; border-bottom: 1px solid var(--trait); }
  .defilement-projets, .panneau-taches { overflow: visible; }
  .frise-entete, .projet { grid-template-columns: 6px minmax(0, 1fr); }
  .frise-entete-titre { display: none; }
  .projet { height: auto; grid-template-rows: 30px 30px; }
  .projet-frise { grid-column: 2; }
  .frise-commandes { margin-left: 0; flex-wrap: wrap; }
  .legende-aide { margin-left: 0; }
  .fiche { position: fixed; inset: 0; width: auto; }
  .champs-ligne { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
