:root {
  --papier: #fafaf9;
  --encre: #131b17;
  --emeraude: #008f70;
  --action: #006e53;
  --vermillon: #e52b20;
  --surface: #ffffff;
  --trait: #e4e4e2;
  --texte-2: #626862;
  --neutre: #f1f1ef;
  --danger: #bd271e;
  --rayon: 10px;
  --police: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --courbe: cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #efefed; color: var(--encre); font: 15px/1.55 var(--police); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--emeraude); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.logo { font-weight: 850; font-size: 26px; letter-spacing: -.055em; line-height: 1; }
.logo i { font-style: normal; color: var(--vermillon); }

.app { max-width: 1080px; min-height: 100dvh; margin: 0 auto; background: var(--papier); display: flex; flex-direction: column; position: relative; }
@media (min-width: 900px) {
  body { padding: 24px; }
  .app { min-height: calc(100dvh - 48px); border: 1px solid #dcded9; border-radius: 22px; overflow: hidden; box-shadow: 0 12px 45px #131b170b; }
}

.entete { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--trait); }
.entete .espace { flex: 1; }
.statut { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--texte-2); white-space: nowrap; }
.statut .point { width: 8px; height: 8px; border-radius: 50%; background: #a2aaa3; transition: background .25s; }
.statut[data-etat=ecoute] .point, .statut[data-etat=parle] .point, .statut[data-etat=tu-parles] .point { background: var(--emeraude); }
.statut[data-etat=reflechit] .point { background: var(--emeraude); animation: pulse 1s infinite alternate; }
.statut[data-etat=micro-coupe] .point, .statut[data-etat=erreur] .point { background: var(--vermillon); }
@keyframes pulse { to { opacity: .3; } }
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 14px; border-radius: 9px; border: 1px solid #dededb; background: var(--surface); font-size: 13px; font-weight: 550; transition: background .18s; }
.bouton:hover:not(:disabled) { background: var(--neutre); }
.bouton.primaire { background: var(--action); border-color: var(--action); color: #fff; }
.bouton.primaire:hover:not(:disabled) { background: #005c45; }
.bouton.danger { background: transparent; color: var(--danger); border-color: #efcec9; }
.bouton.fantome { background: transparent; border-color: transparent; color: var(--texte-2); }
.bouton svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.compteur { font-variant-numeric: tabular-nums; color: var(--texte-2); }
.compteur b { color: var(--danger); font-weight: 650; }

.scene { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 20px 24px 8px; overflow-y: auto; }
.accueil { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-bottom: 12px; }
.accueil canvas { width: min(100%, 420px); height: 290px; display: block; }
.accueil h1 { font-size: 28px; font-weight: 560; letter-spacing: -.035em; margin: 4px 0 2px; }
.accueil p { margin: 0; color: var(--texte-2); }
.sous-titres { min-height: 48px; max-width: 640px; margin: 18px auto 0; font-size: 14px; color: var(--texte-2); }
.sous-titres .toi { color: var(--encre); }
.sous-titres .elle::before { content: 'Donna · '; color: var(--emeraude); font-weight: 600; }
.sous-titres .toi::before { content: 'Toi · '; color: var(--texte-2); font-weight: 600; }

.panneau { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; animation: entree .3s var(--courbe); }
@keyframes entree { from { opacity: 0; transform: translateY(6px); } }
.panneau-tete { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.panneau-tete .titres { flex: 1; min-width: 0; }
.panneau-tete h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; line-height: 1.2; }
.panneau-tete p { margin: 4px 0 0; color: var(--texte-2); font-size: 13px; }
.fermer { width: 38px; height: 38px; border: 1px solid var(--trait); background: transparent; border-radius: 9px; font-size: 20px; color: var(--texte-2); flex-shrink: 0; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.ligne { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--trait); }
.ligne:last-child { border-bottom: 0; }
.ligne .corps { flex: 1; min-width: 0; }
.ligne .corps b { display: block; font-weight: 600; }
.ligne small, .meta { color: var(--texte-2); font-size: 13px; }
.ligne .valeur { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ligne.alerte .valeur { color: var(--danger); }
.ligne.alerte { box-shadow: inset 3px 0 var(--vermillon); }
button.ligne { width: 100%; text-align: left; background: var(--surface); border: 0; border-bottom: 1px solid var(--trait); font: inherit; }
button.ligne:hover { background: var(--neutre); }
.numero { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--neutre); font-size: 12px; font-weight: 650; flex-shrink: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--neutre); border: 1px solid var(--trait); font-size: 12px; font-weight: 650; flex-shrink: 0; }
.badge { font-size: 11px; border: 1px solid var(--trait); border-radius: 6px; padding: 3px 7px; white-space: nowrap; color: var(--texte-2); }
.pied-carte { padding: 12px 16px; background: var(--neutre); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; }

.jour-titre { padding: 10px 16px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); background: var(--neutre); border-bottom: 1px solid var(--trait); }
.horaire { width: 64px; flex-shrink: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.horaire small { display: block; font-weight: 400; }
.barre-ev { width: 3px; align-self: stretch; border-radius: 3px; background: var(--emeraude); }

.email .champ { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--trait); font-size: 14px; }
.email .champ span:first-child { width: 52px; color: var(--texte-2); flex-shrink: 0; }
.email .texte, .document .texte { padding: 18px 16px; white-space: pre-wrap; line-height: 1.65; }
.document { background: #ededeb; padding: 18px; border-radius: var(--rayon); }
.document .feuille { background: var(--surface); box-shadow: 0 2px 10px #1111; padding: 28px 30px; max-width: 720px; margin: 0 auto; }
.document .feuille h3 { font-size: 22px; margin: 0 0 14px; letter-spacing: -.02em; }
.texte-riche h4 { margin: 16px 0 6px; font-size: 15px; }
.texte-riche p { margin: 0 0 10px; }
.texte-riche ul { margin: 0 0 10px; padding-left: 20px; }
.texte-riche a { color: var(--action); }
.reponse-recherche { padding: 18px 16px; line-height: 1.65; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 16px; }
.sources a { font-size: 12px; border: 1px solid var(--trait); border-radius: 6px; padding: 5px 9px; color: var(--action); text-decoration: none; }

.cartes-nod { width: 100%; max-width: 860px; margin: 10px auto 0; display: grid; gap: 10px; }
.carte-nod { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 16px; animation: entree .3s var(--courbe); }
.carte-nod .etiquette { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-2); }
.carte-nod.validation .etiquette { color: var(--danger); }
.carte-nod h3 { margin: 6px 0 8px; font-size: 16px; }
.carte-nod .champs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; margin-bottom: 8px; }
.carte-nod .champs dt { color: var(--texte-2); }
.carte-nod .champs dd { margin: 0; overflow-wrap: anywhere; }
.carte-nod pre { white-space: pre-wrap; font: inherit; font-size: 14px; background: var(--neutre); border-radius: 8px; padding: 12px; margin: 0 0 10px; max-height: 260px; overflow: auto; }
.carte-nod .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.carte-nod .choix { display: grid; gap: 6px; margin-top: 6px; }
.carte-nod .choix button { justify-content: flex-start; text-align: left; }
.carte-nod.travail { display: flex; align-items: center; gap: 12px; }
.carte-nod.sans-cadre { background: none; border: 0; padding: 0; animation: none; }
.carte-nod.travail .corps { flex: 1; min-width: 0; }
.carte-nod.travail .corps div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fileur { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cfe7df; border-top-color: var(--emeraude); animation: tourne .9s linear infinite; flex-shrink: 0; }
@keyframes tourne { to { transform: rotate(360deg); } }
.message { margin: 0 auto; max-width: 860px; width: 100%; font-size: 13px; padding: 10px 14px; border-left: 2px solid var(--emeraude); background: var(--neutre); border-radius: 0 8px 8px 0; }
.message.erreur { border-color: var(--vermillon); }

.barre { display: flex; align-items: center; gap: 8px; padding: 12px 24px 18px; background: var(--papier); position: sticky; bottom: 0; }
.barre .voix-btn { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #dededb; background: transparent; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; flex-shrink: 0; }
.barre .voix-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.barre .voix-btn.coupe { background: var(--encre); color: #fff; border-color: var(--encre); }
.barre .voix-btn.raccrocher { color: var(--danger); border-color: #efcec9; }
.barre .voix-btn.appeler { background: var(--action); color: #fff; border-color: var(--action); }
.saisie { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 1px solid #dededb; border-radius: 10px; min-height: 44px; padding: 4px 4px 4px 12px; background: var(--surface); }
.saisie input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.saisie .envoyer { width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--action); color: #fff; font-size: 17px; flex-shrink: 0; }
.reglages { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 24px 14px; font-size: 12px; color: var(--texte-2); }
.reglages select { border: 1px solid var(--trait); border-radius: 6px; background: var(--surface); padding: 3px 6px; font-size: 12px; }
.reglages button { border: 0; background: transparent; color: var(--texte-2); text-decoration: underline; font-size: 12px; padding: 0; }

.journal { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: var(--surface); border-left: 1px solid var(--trait); box-shadow: -12px 0 40px #131b1712; display: flex; flex-direction: column; z-index: 20; animation: glisse .3s var(--courbe); }
@keyframes glisse { from { transform: translateX(24px); opacity: 0; } }
.journal header { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; border-bottom: 1px solid var(--trait); }
.journal header h2 { flex: 1; margin: 0; font-size: 18px; }
.journal ol { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.journal li { padding: 12px 18px; border-bottom: 1px solid var(--trait); font-size: 13px; }
.journal li time { color: var(--texte-2); font-variant-numeric: tabular-nums; margin-right: 6px; }
.journal li details { margin-top: 6px; }
.journal li details pre { white-space: pre-wrap; font: inherit; font-size: 12px; color: var(--texte-2); margin: 6px 0 0; }
.journal .vide { padding: 18px; color: var(--texte-2); font-size: 13px; }
.journal footer { padding: 12px 18px; border-top: 1px solid var(--trait); }

.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.connexion form { width: min(380px, 100%); background: var(--papier); border: 1px solid #dcded9; border-radius: 18px; padding: 32px 28px; display: grid; gap: 16px; box-shadow: 0 12px 45px #131b170b; }
.connexion .logo { font-size: 36px; }
.connexion p { margin: 0; color: var(--texte-2); font-size: 14px; }
.connexion label { display: grid; gap: 6px; font-size: 13px; color: var(--texte-2); }
.connexion input { border: 1px solid var(--trait); border-radius: 9px; padding: 11px 12px; background: var(--surface); font-size: 15px; }
.connexion .erreur { color: var(--danger); font-size: 13px; min-height: 1em; }

@media (max-width: 640px) {
  .entete { padding: 14px 14px; gap: 8px; }
  .logo { font-size: 22px; }
  .entete .bouton { padding: 6px 10px; font-size: 12px; }
  .scene { padding: 14px 14px 6px; }
  .accueil canvas { height: 230px; }
  .accueil h1 { font-size: 23px; }
  .barre { flex-wrap: wrap; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
  .saisie { flex-basis: 100%; order: 3; }
  .barre .voix-btn { flex: 1; justify-content: center; }
  .reglages { padding: 0 14px 12px; }
  .ligne .masquable { display: none; }
  .panneau-tete h2 { font-size: 20px; }
  .document .feuille { padding: 20px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
