/* Suivi des demandes — identité La Normandie Conquérante
   Cera Pro, cinq couleurs du logo + anthracite, caractères droits (l'italique reste au logo). */

@font-face { font-family: "Cera Pro"; src: url("/polices/CeraPro-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cera Pro"; src: url("/polices/CeraPro-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cera Pro"; src: url("/polices/CeraPro-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cera Pro"; src: url("/polices/CeraPro-Black.ttf") format("truetype"); font-weight: 900; font-style: normal; font-display: swap; }

:root {
  /* couleurs du logo */
  --vert: #86BC25;
  --bleu: #0094AC;
  --violet: #8C1D81;
  --orange: #EB5C32;
  --jaune: #F5BB00;
  --encre: #1D1D1B;
  /* interface */
  --fond: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #ECEBE6;
  --texte: #1D1D1B;
  --doux: #63635F;
  --ligne: #DDDCD7;
  --accent: #1D1D1B;
  --accent-texte: #FFFFFF;
  --rayon: 10px;
  --police: "Cera Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121211;
    --surface: #1E1E1C;
    --surface-2: #292926;
    --texte: #F2F1EC;
    --doux: #A9A8A1;
    --ligne: #363633;
    --accent: #F2F1EC;
    --accent-texte: #1D1D1B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.5 var(--police); }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.chargement { padding: 48px 16px; text-align: center; color: var(--doux); }
.cache { display: none !important; }
.doux { color: var(--doux); }
.petit { font-size: 14px; }
.rouge { color: var(--orange); font-weight: 700; }
.orange { color: var(--orange); font-weight: 700; }

/* ---------- en-tête (anthracite, logo blanc) ---------- */
.entete {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--encre); color: #fff;
}
.marque { display: flex; align-items: center; gap: 14px; margin-right: auto; min-width: 0; text-decoration: none; color: #fff; }
.marque-logo { height: 38px; width: auto; display: block; flex: none; }
.marque-nom { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .25); }
@media (max-width: 439px) { .marque-nom { display: none; } }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a:not(.btn):not(.avatar) { color: #CFCEC8; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.nav a.actif:not(.btn):not(.avatar) { color: #fff; background: rgba(255, 255, 255, .12); }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--encre); font-weight: 900; font-size: 13px; text-decoration: none;
}
.avatar.actif { box-shadow: 0 0 0 2px var(--vert); }
.mode-test { max-width: 880px; margin: 8px auto 0; padding: 0 16px; font-size: 13px; color: var(--doux); }
.principal { max-width: 880px; margin: 0 auto; padding: 22px 16px 110px; }
.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20;
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--vert); color: var(--encre); font-size: 34px; font-weight: 900; line-height: 1; text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
@media (min-width: 760px) { .fab { display: none; } }
@media (max-width: 759px) { .nav .btn-nouvelle, .nav .lien-accueil { display: none; } }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--ligne); background: var(--surface); color: var(--texte);
  font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--texte); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primaire { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.btn-primaire:hover { border-color: var(--accent); filter: brightness(1.25); }
.btn-cta { background: var(--vert); border-color: var(--vert); color: var(--encre); }
.btn-cta:hover { border-color: var(--vert); filter: brightness(1.06); }
.btn-danger { color: var(--orange); }
.btn-petit { min-height: 36px; padding: 4px 14px; font-size: 14px; }
.btn-lien { border: 0; background: none; color: var(--texte); padding: 4px 0; min-height: 0; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.btn-lien.rouge { color: var(--orange); }
.btn-icone { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.actions-secondaires { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 8px; }

/* ---------- titres ---------- */
.titre-page { font-size: 30px; font-weight: 900; letter-spacing: -.015em; margin: 2px 0 16px; }
.retour { display: inline-block; margin-bottom: 10px; color: var(--doux); text-decoration: none; font-size: 15px; font-weight: 500; }
.section { margin: 30px 0 10px; }
.section > h2 { font-size: 19px; font-weight: 900; margin-bottom: 12px; }
.groupe-titre { font-size: 15px; font-weight: 900; margin: 24px 0 8px; }
.groupe-titre.retard { color: var(--orange); }

/* ---------- chiffres clés ---------- */
.chiffres { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 4px 0 22px; }
@media (max-width: 420px) { .chiffres { gap: 10px 20px; } .chiffre-cle b { font-size: 36px; } }
.chiffre-cle { display: grid; }
.chiffre-cle b { font-size: 40px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.chiffre-cle span { font-size: 13.5px; color: var(--doux); font-weight: 500; }
.chiffre-cle.retard b { color: var(--orange); }

/* ---------- onglets ---------- */
.onglets { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglets button {
  flex: 1; border: 0; background: none; padding: 9px 12px; border-radius: 7px; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--doux); white-space: nowrap;
}
.onglets button.actif { background: var(--accent); color: var(--accent-texte); font-weight: 700; }

/* ---------- recherche / filtres ---------- */
.barre { display: flex; gap: 8px; align-items: center; margin: 14px 0 10px; }
.barre input[type=search] { flex: 1; min-width: 0; }
.filtres { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); margin-bottom: 12px; }

/* ---------- cartes ---------- */
.liste { display: grid; gap: 8px; }
.carte {
  display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon);
  color: var(--texte); text-decoration: none;
}
.carte:hover { border-color: var(--texte); }
.carte-haut { display: flex; gap: 12px; align-items: flex-start; }
.carte-titre { font-weight: 700; font-size: 16.5px; line-height: 1.3; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.carte-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 14px; color: var(--doux); align-items: center; }
.echeance { font-size: 14px; white-space: nowrap; color: var(--doux); font-weight: 500; }
.echeance.retard, .echeance.aujourdhui { padding: 2px 9px; border-radius: 6px; font-weight: 700; }
.echeance.retard { background: var(--orange); color: #fff; }
.echeance.aujourdhui { background: var(--jaune); color: var(--encre); }
.echeance.demain { color: var(--texte); font-weight: 700; }
td.echeance.retard, td.echeance.aujourdhui { border-radius: 0; }
.vide { padding: 40px 16px; text-align: center; color: var(--doux); background: var(--surface); border: 1px dashed var(--ligne); border-radius: var(--rayon); }

.pastille { display: inline-block; padding: 1px 9px; border-radius: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.st-nouvelle { background: var(--bleu); color: #fff; }
.st-en_cours { box-shadow: inset 0 0 0 1.5px var(--texte); color: var(--texte); }
.st-bloquee { background: var(--violet); color: #fff; }
.st-faite { background: var(--vert); color: var(--encre); }
.st-annulee { background: var(--surface-2); color: var(--doux); }
.marque-urgent { color: var(--orange); font-weight: 900; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.marque-conf { color: var(--violet); font-weight: 700; font-size: 13px; }
@media (prefers-color-scheme: dark) { .marque-conf { color: #D78BCF; } }

/* ---------- tableau ---------- */
.tableau-conteneur { overflow-x: auto; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
table.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--ligne); vertical-align: top; }
.tableau th { font-size: 13px; color: var(--doux); font-weight: 700; white-space: nowrap; background: var(--surface-2); }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover td { background: var(--surface-2); }
.tableau .nombre { text-align: right; white-space: nowrap; }
.tableau .inactif td { color: var(--doux); }

/* ---------- formulaires ---------- */
.formulaire { display: grid; gap: 18px; }
.champ { display: grid; gap: 6px; }
.champ > label, .champ > .libelle { font-weight: 700; font-size: 15px; }
.aide { font-size: 13.5px; color: var(--doux); }
input[type=text], input[type=email], input[type=search], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; font-size: 16px;
  background: var(--surface); border: 1.5px solid var(--ligne); border-radius: 8px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--texte); }
.btn:focus-visible, .puce:focus-visible, .onglets button:focus-visible, a:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }
.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .deux-colonnes { grid-template-columns: 1fr; } }
.case { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.case input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--encre); }
@media (prefers-color-scheme: dark) { .case input { accent-color: var(--vert); } }
details.plus { border: 1.5px solid var(--ligne); border-radius: var(--rayon); background: var(--surface); padding: 0 14px; }
details.plus > summary { cursor: pointer; padding: 13px 0; font-weight: 700; }
details.plus[open] > summary { margin-bottom: 4px; }
details.plus > .formulaire { padding-bottom: 14px; }
.erreur-form { color: var(--orange); font-size: 15px; font-weight: 700; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--jaune); color: var(--encre); font-size: 14.5px; font-weight: 500; }
.envoi { font-size: 14.5px; color: var(--doux); }

.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce {
  min-height: 42px; min-width: 52px; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--ligne); background: var(--surface); font-size: 15px; font-weight: 700;
}
.puce.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.personnes { display: flex; flex-wrap: wrap; gap: 6px; }
.personne {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-radius: 8px;
  background: var(--surface-2); font-size: 14.5px; font-weight: 500;
}
.personne button { border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 6px; color: var(--doux); }

/* ---------- pièces jointes ---------- */
.ajout-pieces { display: flex; gap: 8px; flex-wrap: wrap; }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.piece {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: var(--surface);
  border: 1px solid var(--ligne); border-radius: 8px; font-size: 13px; color: var(--texte); text-decoration: none; overflow: hidden;
}
.piece img { width: 100%; height: 96px; object-fit: cover; border-radius: 5px; background: var(--surface-2); }
.piece .icone-fichier { height: 96px; display: grid; place-items: center; background: var(--surface-2); border-radius: 5px; font-weight: 900; color: var(--doux); font-size: 15px; }
.piece .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.piece .suppr { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(29, 29, 27, .7); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }

/* ---------- fiche demande ---------- */
.fiche-haut { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.fiche-titre { font-size: 27px; font-weight: 900; letter-spacing: -.01em; margin: 0 0 12px; overflow-wrap: anywhere; }
.fiche-echeance { font-size: 17px; margin-bottom: 4px; }
.fiche-echeance .sous { font-size: 15px; }
.infos { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 14px 0; font-size: 15px; }
.infos dt { color: var(--doux); }
.infos dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.texte-libre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 12px 14px; }
.encart { padding: 12px 14px; border-radius: var(--rayon); margin: 12px 0; }
.encart h3 { font-size: 15px; font-weight: 900; margin-bottom: 4px; }
.encart.fait { background: var(--vert); color: var(--encre); }
.encart.bloque { background: var(--violet); color: #fff; }
.encart p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.composer { display: grid; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.composer textarea { min-height: 70px; }
.composer-bas { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.fil { display: grid; gap: 4px; margin-top: 14px; }
.fil-comm { padding: 10px 14px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); margin: 6px 0; }
.fil-comm .qui { font-size: 14px; color: var(--doux); margin-bottom: 4px; }
.fil-comm .qui b { color: var(--texte); }
.fil-comm .pieces { margin-top: 8px; }
.fil-evt { font-size: 13.5px; color: var(--doux); padding: 4px 2px 4px 14px; border-left: 2px solid var(--ligne); margin-left: 6px; overflow-wrap: anywhere; }

/* ---------- admin ---------- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 18px; }
.tuile { padding: 14px 16px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.tuile .chiffre { font-size: 34px; font-weight: 900; line-height: 1.05; letter-spacing: -.02em; }
.tuile .chiffre.rouge { color: var(--orange); }
.tuile .lib { font-size: 14px; color: var(--doux); font-weight: 500; }

/* ---------- compte ---------- */
.carte-simple { padding: 16px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); display: grid; gap: 12px; }
.etapes { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.invitation { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 14px; background: var(--surface-2); border-radius: var(--rayon); font-size: 15px; }
.invitation .boutons { display: flex; gap: 6px; align-items: center; flex: none; }

/* ---------- écran de connexion (anthracite) ---------- */
.ecran-connexion { min-height: 100vh; min-height: 100dvh; background: var(--encre); color: #fff; }
.connexion { max-width: 420px; margin: 0 auto; padding: max(48px, env(safe-area-inset-top)) 22px 40px; }
.connexion .logo-connexion { width: 230px; display: block; margin-bottom: 40px; }
.connexion h1 { font-size: 32px; font-weight: 900; letter-spacing: -.015em; margin-bottom: 10px; }
.connexion p { color: #D6D5CF; }
.connexion b { color: #fff; }
.connexion .champ > label { color: #fff; }
.connexion input { background: #fff; color: var(--encre); border-color: #fff; }
.connexion .btn-primaire { background: var(--vert); border-color: var(--vert); color: var(--encre); }
.connexion .btn-lien { color: #fff; }
.connexion .erreur-form { color: #FF9A78; }
.code-saisie { font-size: 30px !important; font-weight: 900; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- dialogues, messages ---------- */
dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  background: var(--surface); color: var(--texte); box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(29, 29, 27, .6); }
dialog form { display: grid; gap: 14px; padding: 22px; }
dialog h2 { font-size: 21px; font-weight: 900; }
.dialogue-boutons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
dialog.large { width: min(760px, calc(100vw - 24px)); }
dialog iframe { width: 100%; height: 60vh; border: 1px solid var(--ligne); border-radius: 8px; background: #fff; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(460px, calc(100vw - 24px)); }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--encre); color: #fff; font-size: 15px; font-weight: 500; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.toast.erreur { background: var(--orange); }
.copie { display: flex; gap: 8px; }
.copie input { flex: 1; font-size: 14px !important; }
