/* ------------------------------------------------------------------
   Jetons de design, repris de l'application de suivi (palette
   océan/corail). Polices du système : la page reste locale, sans appel
   à un service extérieur.
   ------------------------------------------------------------------ */

:root {
  color-scheme: light;
  --fond:      #F8FAFC;
  --carte:     #FFFFFF;
  --encre:     #0F172A;
  --profond:   #0891B2;
  --profond-fonce: #0C3547;
  --craie:     #64748B;
  --trait:     #E2E8F0;
  --accent:    #F97316;
  --acquis:    #16A34A;
  --acquis-clair: #F0FDF4;
  --en-cours:  #B26B00;
  --en-cours-clair: #FEF3C7;
  --danger:    #B91C1C;
  --danger-clair: #FEF2F2;
  --bulle-moi: #0C6E86;

  --r:  16px;
  --r-s: 8px;
  --pas:   8px;
  --pas-2: 16px;
  --pas-3: 24px;
  --pas-4: 40px;
  --ombre: 0 4px 24px rgba(8, 145, 178, .15);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fond:      #0B1220;
    --carte:     #111A2B;
    --encre:     #E2E8F0;
    --profond:   #22B8D6;
    --profond-fonce: #0C4A5E;
    --craie:     #94A3B8;
    --trait:     #243047;
    --acquis:    #4ADE80;
    --acquis-clair: #0F2A1A;
    --en-cours:  #F5B544;
    --en-cours-clair: #2A2110;
    --danger:    #F87171;
    --danger-clair: #2A1414;
    --bulle-moi: #0C6E86;
    --ombre: 0 4px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2 { margin: 0; font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; margin-bottom: var(--pas); }
p  { margin: 0 0 var(--pas-2); max-width: 75ch; }

.bandeau { padding: var(--pas-2) var(--pas-2) 0; max-width: 1500px; margin: 0 auto; }
.bandeau h1 { margin-bottom: var(--pas); }
main { padding: var(--pas-2); max-width: 1500px; margin: 0 auto; }

button { font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: var(--r-s);
         background: none; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid var(--profond); outline-offset: 2px; }

input, textarea { font: inherit; color: inherit; padding: 10px 12px; border: 1px solid var(--trait);
                  border-radius: var(--r-s); background: var(--carte); width: 100%; }
textarea { resize: vertical; }
label { display: block; margin: var(--pas) 0; font-weight: 700; font-size: .9375rem; }

.bouton-principal { background: linear-gradient(135deg, var(--profond-fonce), var(--profond)); color: #fff;
                    padding: 12px 20px; font-weight: 600; min-height: 44px; }
.bouton-principal:disabled { background: var(--craie); opacity: 1; }
.bouton-discret { border-color: var(--trait); background: var(--carte); padding: 10px 16px; min-height: 44px; }
.lien { background: none; border: none; padding: 0 4px; min-height: 44px; color: var(--profond);
        text-decoration: underline; }

.carte { background: var(--carte); border-radius: var(--r); box-shadow: var(--ombre); padding: var(--pas-2); }
.secondaire { color: var(--craie); font-size: .875rem; }
.alerte { border-left: 4px solid var(--en-cours); background: var(--en-cours-clair); padding: var(--pas-2);
          border-radius: var(--r-s); margin-bottom: var(--pas-2); overflow-wrap: anywhere; }
.vide { padding: var(--pas-4) var(--pas-2); text-align: center; color: var(--craie); }
[hidden] { display: none !important; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.actions { display: flex; gap: var(--pas); flex-wrap: wrap; justify-content: flex-end; margin-top: var(--pas); }

/* Écran du code */
.verrou { max-width: 560px; padding: var(--pas-3); margin-top: var(--pas-2); }
.verrou input { font-family: ui-monospace, monospace; letter-spacing: .15em; text-transform: uppercase; }
.verrou .actions { justify-content: flex-start; }

/* Disposition : sessions | conversation | livraison */
.disposition { display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; gap: var(--pas-2);
               align-items: start; margin-top: var(--pas-2); }

.sessions form .bouton-principal { width: 100%; margin-top: var(--pas); }
.sessions ul { list-style: none; margin: var(--pas-2) 0 0; padding: 0; display: grid; gap: var(--pas); }
.session { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.session .nom { font-weight: 700; }
.session .secondaire { overflow-wrap: anywhere; }
.session.actif { border-color: var(--profond); box-shadow: inset 3px 0 0 var(--profond); }

.conversation { display: flex; flex-direction: column; min-height: 60vh; }
#avec-session { display: flex; flex-direction: column; flex: 1; }
.fil { flex: 1; overflow-y: auto; max-height: 65vh; display: flex; flex-direction: column; gap: var(--pas);
       padding: var(--pas) 0; }
.bulle { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 14px; border-radius: var(--r); max-width: 90%; }
.bulle.moi { align-self: flex-end; background: var(--bulle-moi); color: #fff; }
.bulle.moi .qui { display: block; font-size: .75rem; opacity: .8; }
.bulle.assistant { align-self: flex-start; background: var(--fond); border: 1px solid var(--trait); }
.outil { font-family: ui-monospace, monospace; font-size: .8125rem; color: var(--craie); overflow-wrap: anywhere; }
.outil.erreur summary { color: var(--danger); cursor: pointer; }
.fin { text-align: center; font-size: .75rem; }
.evenement { border-left: 4px solid var(--trait); padding: var(--pas) var(--pas-2); background: var(--fond);
             border-radius: var(--r-s); }
.evenement.ok { border-color: var(--acquis); background: var(--acquis-clair); }
.evenement.ko { border-color: var(--danger); background: var(--danger-clair); }
.evenement .texte { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75rem; max-height: 320px; overflow-y: auto; }
.attente { font-style: italic; margin: var(--pas) 0 0; }

.saisie { border-top: 1px solid var(--trait); padding-top: var(--pas); margin-top: var(--pas); }
.saisie.survol { outline: 2px dashed var(--profond); outline-offset: 4px; border-radius: var(--r-s); }
.danger { color: var(--danger); border-color: var(--danger); }
.pieces { list-style: none; margin: var(--pas) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--pas); }
.pieces:empty { display: none; }
.pieces li { display: flex; align-items: center; gap: 6px; padding-left: 12px; border: 1px solid var(--trait);
             border-radius: var(--r-s); background: var(--fond); max-width: 100%; }
.nom-piece { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.retirer { min-width: 44px; border: none; background: none; }
.joindre { display: inline-flex; align-items: center; cursor: pointer; margin: 0 auto 0 0; font-weight: 400; }
.joindre.inactif { opacity: .5; cursor: not-allowed; }

.controles { list-style: none; margin: var(--pas) 0; padding: 0; display: grid; gap: 4px; color: var(--danger); }
.controles .ok { color: var(--acquis); }
.commits { padding-left: 1.25rem; font-size: .8125rem; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.etapes { display: grid; gap: var(--pas); margin-top: var(--pas-2); }
.etapes > .bouton-discret { text-align: left; }
.confirmation { border: 2px solid var(--accent); border-radius: var(--r-s); padding: var(--pas-2); }
.confirmation .actions { justify-content: flex-start; }

@media (max-width: 1100px) {
  .disposition { grid-template-columns: minmax(0, 1fr); }
  .fil { max-height: 55vh; }
}
