/* Police Archivo (variable, 400–800) servie par l'appli : rien ne part vers Google, lisible hors ligne. */
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/archivo-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/archivo-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Couleurs de référence du CDC §9.4 */
:root {
  --nuit: #0B2A6F;
  --jaune: #F2C94C;
  --jaune-pale: #FDF3D3;
  --bleu-clair: #DCEBF7;
  --fond: #F3F7FC;
  --carte: #FFFFFF;
  --texte: #14213D;
  --gris: #5B6478;
  --bord: #E2E8F0;
  --orange: #B4530F;
  --orange-pale: #FDEBDC;
  --vert: #2E7D32;
  --vert-pale: #E3F4E6;
  --rouge: #B42318;
  --rouge-pale: #FDE7E5;
  --rayon: 14px;
  --nav: 64px;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--texte);
  -webkit-text-size-adjust: 100%;
}

/* Mode sombre : suit le réglage de l'iPhone. Le bleu nuit devient un bleu clair pour le texte ;
   l'en-tête foncé garde sa couleur via --nuit-fond. */
@media (prefers-color-scheme: dark) {
  :root {
    --nuit: #A7C0F7;
    --nuit-fond: #0B2A6F;
    --jaune-pale: #3A3010;
    --bleu-clair: #1E3357;
    --fond: #0F172A;
    --carte: #1B2537;
    --texte: #E6EBF5;
    --gris: #9AA6BD;
    --bord: #2C3A52;
    --orange: #F0A868;
    --orange-pale: #3A2512;
    --vert: #7BD389;
    --vert-pale: #11311B;
    --rouge: #F08A82;
    --rouge-pale: #3A1613;
    color-scheme: dark;
  }
  html .puce.actif, html .avatar.m, html .bouton.principal, html .badge.nuit, html .pastille, html .bouton.danger, html .glisse-bouton { color: var(--fond); }
  html .entete.nuit .surtitre, html .entete.nuit .retour, html .entete.nuit h1 { color: #fff; }
  html .badge.jaune, html .alertes li.info { color: #F2C94C; }
  html .badge.gris { background: var(--bord); }
  html .badge.vocal { background: #312E81; color: #C7D2FE; }
  html textarea.reponse, html input.saisie, html textarea.saisie, html select.saisie, html dialog { background: var(--carte); color: var(--texte); border-color: var(--bord); }
  html textarea.reponse { border-color: var(--nuit); }
  html dialog::backdrop { background: rgba(0, 0, 0, .55); }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); }
body { min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--nuit); }

#ecran {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 0 calc(var(--nav) + 24px + env(safe-area-inset-bottom));
}
.avec-actions #ecran { padding-bottom: calc(var(--nav) + 150px + env(safe-area-inset-bottom)); }

/* En-tête */
.entete { background: var(--carte); padding: calc(16px + env(safe-area-inset-top)) 16px 14px; border-bottom: 1px solid var(--bord); }
.entete.nuit { background: var(--nuit-fond, var(--nuit)); color: #fff; border: 0; }
.surtitre { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--gris); text-transform: uppercase; }
.entete.nuit .surtitre, .entete.nuit .retour { color: #fff; }
h1 { margin: 2px 0 0; font-size: 28px; font-weight: 800; color: var(--nuit); letter-spacing: -.01em; }
.entete.nuit h1 { color: #fff; font-size: 24px; }
.sous-titre { color: var(--gris); margin: 4px 0 0; font-size: 14px; }
.entete.nuit .sous-titre { color: #DCE4F5; }
.ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.retour { display: inline-block; font-weight: 600; text-decoration: none; margin-bottom: 8px; color: var(--nuit); }

.avatars { display: flex; gap: 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.avatar.m { background: var(--nuit); color: #fff; }
.avatar.t { background: var(--jaune); color: var(--nuit); }
.avatar.inactif { opacity: .35; }

/* Filtres */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.puce { border: 1px solid var(--bord); background: var(--carte); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.puce.actif { background: var(--nuit); color: #fff; border-color: var(--nuit); }
.puce:disabled { opacity: .5; cursor: default; }

/* Sections et cartes */
.section { padding: 0 16px; }
.titre-section { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--gris); text-transform: uppercase; margin: 20px 0 8px; }
.carte { display: block; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; margin-bottom: 10px; text-decoration: none; color: inherit; }
a.carte:active { transform: scale(.995); }
.carte.relais { border: 2px solid var(--jaune); }
/* Carte glissable : les actions attendent sous la carte, à droite ; la carte coulisse par-dessus. */
.glissable { position: relative; margin-bottom: 10px; touch-action: pan-y; }
.glissable > .carte { position: relative; z-index: 1; margin-bottom: 0; background: var(--carte); will-change: transform; }
.glisse-actions { position: absolute; inset: 0 0 0 auto; width: 176px; display: flex; gap: 8px; padding-left: 8px; }
.glisse-bouton { flex: 1; border: 0; border-radius: var(--rayon); background: var(--nuit); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.glisse-bouton.rouge { background: var(--rouge); }
.glisse-bouton:disabled { opacity: .55; }
.glissable:not(.ouvert) .glisse-actions { pointer-events: none; }
.glissable:not(.ouvert):not(.glisse) .glisse-actions { visibility: hidden; }  /* rien ne dépasse sous une carte fermée */
input.recherche { margin-top: 14px; }
.carte.pointille { border-style: dashed; }
.carte.jaune { background: var(--jaune-pale); border-color: #F5DE94; }
.pseudo { font-weight: 700; font-size: 16px; }
.citation { margin: 8px 0 6px; line-height: 1.4; }
.meta { color: var(--gris); font-size: 13px; }
.lien-fort { font-weight: 700; color: var(--nuit); font-size: 14px; }
.vide { text-align: center; color: var(--gris); padding: 40px 16px; }

.badge { display: inline-block; border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.jaune { background: var(--jaune-pale); color: #7A5A00; }
.badge.nuit { background: var(--nuit); color: #fff; }
.badge.orange { background: var(--orange-pale); color: var(--orange); }
.badge.vert { background: var(--vert-pale); color: var(--vert); }
.badge.rouge { background: var(--rouge-pale); color: var(--rouge); }
.badge.gris { background: #EDF0F5; color: var(--gris); }

/* Brouillon */
.bloc { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; line-height: 1.45; }
.sources { display: flex; flex-wrap: wrap; gap: 8px; }
.source { background: var(--bleu-clair); color: var(--nuit); font-weight: 600; font-size: 13px; border-radius: 6px; padding: 5px 9px; }
textarea.reponse { width: 100%; min-height: 190px; border: 2px solid var(--nuit); border-radius: var(--rayon); padding: 14px; line-height: 1.45; resize: vertical; background: #fff; }
textarea.reponse:focus { outline: 3px solid var(--bleu-clair); }
.compteur { text-align: right; font-size: 12px; color: var(--gris); margin-top: 4px; }
.alertes { list-style: none; margin: 0; padding: 0; }
.alertes li { border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: 14px; }
.alertes li.bloquant { background: var(--rouge-pale); color: var(--rouge); font-weight: 600; }
.alertes li.info { background: var(--jaune-pale); color: #6B4E00; }
.presence { display: flex; gap: 10px; align-items: center; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 10px 12px; color: var(--gris); font-size: 14px; }
.presence .avatar { width: 26px; height: 26px; font-size: 12px; flex: none; }
details.historique summary { cursor: pointer; font-weight: 600; color: var(--nuit); }
details.historique ol { padding-left: 18px; color: var(--gris); font-size: 14px; }

/* Actions fixées en bas, au-dessus de la barre d'onglets */
.actions { position: fixed; z-index: 5; left: 0; right: 0; bottom: calc(var(--nav) + env(safe-area-inset-bottom)); background: var(--fond); border-top: 1px solid var(--bord); padding: 12px 16px; }
.actions-int { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.actions .secondaires { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.bouton { border: 1px solid var(--bord); background: var(--carte); border-radius: 12px; padding: 14px 10px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; color: var(--nuit); }
.bouton.principal { background: var(--nuit); color: #fff; border-color: var(--nuit); font-size: 17px; }
.bouton.danger { background: var(--rouge); color: #fff; border-color: var(--rouge); }
.bouton.contour { border: 2px solid var(--nuit); }
.bouton:disabled { opacity: .55; cursor: progress; }

/* Relais */
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.etiquette { font-size: 13px; color: var(--gris); }
.valeur { font-weight: 700; }
ol.echanges { margin: 0; padding-left: 20px; line-height: 1.45; }
ol.echanges li { margin-bottom: 8px; }
pre.resume { white-space: pre-wrap; font: inherit; margin: 0; }

/* Formulaires */
label.champ { display: block; margin: 14px 0 6px; font-weight: 700; font-size: 14px; }
.aide { font-weight: 400; color: var(--gris); font-size: 13px; }
input.saisie, textarea.saisie, select.saisie { width: 100%; border: 1px solid #C9D3E3; border-radius: 10px; padding: 12px; background: #fff; }
textarea.saisie { min-height: 110px; line-height: 1.4; }
.erreurs { background: var(--rouge-pale); color: var(--rouge); border-radius: 10px; padding: 10px 14px; margin-top: 12px; }
.erreurs ul { margin: 0; padding-left: 18px; }
.interrupteur { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.interrupteur input { width: 52px; height: 30px; accent-color: var(--nuit); }
.interrupteur input.arret { accent-color: var(--rouge); }

/* Connexion */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.connexion form { width: 100%; max-width: 360px; background: var(--carte); border-radius: 18px; padding: 24px; border: 1px solid var(--bord); }
.logo { width: 56px; height: 56px; border-radius: 50%; display: block; margin-bottom: 12px; }

/* Barre d'onglets */
#onglets { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--carte); border-top: 1px solid var(--bord); display: grid; grid-template-columns: repeat(5, 1fr); }
#onglets a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--gris); text-decoration: none; }
#onglets a .ico { font-size: 18px; line-height: 1; filter: grayscale(1); }
#onglets a.actif { color: var(--nuit); font-weight: 800; }
#onglets a.actif .ico { filter: none; }
.pastille[hidden] { display: none; }
.pastille { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--rouge); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; display: grid; place-items: center; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav) + 160px + env(safe-area-inset-bottom)); background: var(--texte); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 32px); z-index: 10; }

dialog { border: 0; border-radius: 16px; padding: 20px; width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(11, 42, 111, .35); }
.bandeau-arret { background: var(--rouge); color: #fff; text-align: center; font-weight: 700; padding: 8px 12px; font-size: 14px; }
.bandeau-obs { background: var(--jaune-pale); color: #6B4E00; text-align: center; font-weight: 600; padding: 7px 12px; font-size: 13px; }

@media (min-width: 700px) {
  h1 { font-size: 32px; }
}

/* Messages vocaux : pastille et transcription en italique (texte produit par une machine). */
.badge.vocal{background:#EEF2FF;color:#3730A3;display:inline-block;margin-bottom:4px}
.transcription{font-style:italic}
