/* Hervé : interface commune (Mac, Android, navigateur). Couleurs de la mascotte : bleu nuit et bleu clair. */
:root {
  --fond: #f4f8ff; --fond-2: #eaf1fc; --surface: #ffffff; --surface-2: #eef4fd; --survol: rgba(23, 36, 59, .06);
  --bord: #d8e3f3; --texte: #17243b; --texte-2: #526580; --texte-3: #788ba7;
  --accent: #7a3fe0; --accent-fort: #5a27b8; --accent-doux: #ece2ff; --sur-accent: #ffffff;
  --ok: #2b9455; --alerte: #c77a06; --erreur: #cc3329;
  --bulle: #ece4fb; --code: #eaf1fc;
  --ajout: #d5f2dd; --ajout-texte: #11602d; --suppr: #fbdcd8; --suppr-texte: #9f261e;
  --ombre: 0 10px 34px rgba(23, 36, 59, .14), 0 1px 3px rgba(23, 36, 59, .08);
  --rayon: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0b1424; --fond-2: #111e32; --surface: #17273e; --surface-2: #1b2e48; --survol: rgba(220, 236, 255, .07);
    --bord: #29415e; --texte: #edf4ff; --texte-2: #a7bad4; --texte-3: #7188a7;
    --accent: #b08cff; --accent-fort: #c9b0ff; --accent-doux: #3a2466; --sur-accent: #1c0f3a;
    --ok: #4cc27a; --alerte: #f0a634; --erreur: #ff6b5e;
    --bulle: #2c2150; --code: #101e32;
    --ajout: #173d24; --ajout-texte: #93e2ab; --suppr: #4a1e1a; --suppr-texte: #f6a59d;
    --ombre: 0 10px 34px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0b1424; --fond-2: #111e32; --surface: #17273e; --surface-2: #1b2e48; --survol: rgba(220, 236, 255, .07);
  --bord: #29415e; --texte: #edf4ff; --texte-2: #a7bad4; --texte-3: #7188a7;
  --accent: #b08cff; --accent-fort: #c9b0ff; --accent-doux: #3a2466; --sur-accent: #1c0f3a;
  --ok: #4cc27a; --alerte: #f0a634; --erreur: #ff6b5e;
  --bulle: #2c2150; --code: #101e32;
  --ajout: #173d24; --ajout-texte: #93e2ab; --suppr: #4a1e1a; --suppr-texte: #f6a59d;
  --ombre: 0 10px 34px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fond); color: var(--texte);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden; -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.espace { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ibtn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--texte-2); flex: none;
}
.ibtn:hover { background: var(--survol); color: var(--texte); }
.ibtn svg { width: 20px; height: 20px; }

/* ---------- Structure ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.barre {
  width: 272px; flex: none; background: var(--fond-2); border-right: 1px solid var(--bord);
  display: flex; flex-direction: column; transition: margin-left .22s ease, transform .22s ease; z-index: 30;
  padding-top: env(safe-area-inset-top);
}
.app.barre-repliee .barre { margin-left: -273px; }
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; padding-top: env(safe-area-inset-top); }
.voile { display: none; }

.barre-tete { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; flex: none; }
.logo { width: 28px; height: 28px; border-radius: 50%; }
.marque { font-weight: 700; letter-spacing: .04em; flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.marque-ligne { display: flex; align-items: baseline; gap: 8px; }
.version-app { font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--texte-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.marque small { font-weight: 500; letter-spacing: 0; font-size: 11px; color: var(--texte-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-boutons { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.lien-barre {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; font-weight: 500;
}
.lien-barre:hover, .lien-barre.actif { background: var(--survol); }
.lien-barre.actif { color: var(--accent); }
.recherche {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 0 10px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--bord); color: var(--texte-3);
}
.recherche input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--texte); }
.recherche svg { width: 16px; height: 16px; }

.liste-conv { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.groupe-conv { font-size: 12px; font-weight: 600; color: var(--texte-3); padding: 14px 10px 4px; }
.conv {
  display: flex; align-items: center; border-radius: 10px; position: relative;
}
.conv a {
  flex: 1; min-width: 0; padding: 7px 10px; color: var(--texte); text-decoration: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 14px; border-radius: 10px;
}
.conv:hover, .conv.actif { background: var(--survol); }
.conv.actif a { font-weight: 600; }
.conv .ibtn { width: 30px; height: 30px; opacity: 0; }
.conv:hover .ibtn, .conv.actif .ibtn { opacity: 1; }
.conv .ibtn svg { width: 16px; height: 16px; }
.conv-vide { color: var(--texte-3); font-size: 13px; padding: 12px 10px; }

.barre-pied {
  display: flex; align-items: center; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--bord);
}
.etat { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; text-align: left; }
.etat:hover { background: var(--survol); }
.etat-textes { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
#etat-titre { font-size: 13px; font-weight: 600; }
.etat-detail { font-size: 12px; color: var(--texte-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pastille { width: 9px; height: 9px; border-radius: 50%; background: var(--texte-3); flex: none; }
.pastille.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.pastille.ko { background: var(--erreur); box-shadow: 0 0 0 3px color-mix(in srgb, var(--erreur) 22%, transparent); }

.entete { height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 10px; flex: none; }
.app:not(.barre-repliee) #btn-menu { display: none; }
.choix-modele {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; font-weight: 600; font-size: 16px; max-width: 70vw;
}
.choix-modele span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choix-modele:hover { background: var(--survol); }
.choix-modele svg { color: var(--texte-3); width: 16px; height: 16px; }
.bandeau {
  margin: 0 16px 6px; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: var(--accent-doux); color: var(--texte);
  display: flex; gap: 8px; align-items: center;
}
.bandeau.ko { background: color-mix(in srgb, var(--erreur) 16%, var(--surface)); }

.vue { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Discussion ---------- */
.fil { flex: 1; overflow-y: auto; padding: 0 16px 20px; overscroll-behavior: contain; }
.messages, .accueil { max-width: 780px; margin: 0 auto; }
.accueil { text-align: center; padding: min(12vh, 110px) 0 20px; }
.accueil-logo { width: 72px; height: 72px; border-radius: 50%; box-shadow: var(--ombre); }
.accueil h1 { font-size: 26px; margin: 18px 0 4px; letter-spacing: -.01em; }
.accueil-sous { color: var(--texte-2); margin: 0 0 26px; }
.raccourcis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; text-align: left; }
.raccourci {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--rayon); border: 1px solid var(--bord);
  background: var(--surface); text-align: left; transition: border-color .15s, transform .15s;
}
.raccourci:hover { border-color: var(--accent); transform: translateY(-1px); }
.raccourci svg { color: var(--accent); width: 20px; height: 20px; }
.raccourci b { font-size: 14px; }
.raccourci small { color: var(--texte-2); font-size: 12.5px; line-height: 1.4; }

.msg { margin: 22px 0; }
.msg-u { display: flex; flex-direction: column; align-items: flex-end; }
.msg-u .bulle {
  background: var(--bulle); padding: 10px 15px; border-radius: 20px 20px 6px 20px; max-width: min(85%, 620px);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-u .pieces-msg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; max-width: 85%; }
.msg-a .tete { display: flex; align-items: center; gap: 8px; color: var(--texte-2); font-size: 13px; margin-bottom: 6px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; }
.statut { color: var(--texte-2); font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.statut::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent;
  animation: tourne .8s linear infinite; flex: none;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.erreur-msg {
  color: var(--erreur); background: color-mix(in srgb, var(--erreur) 10%, transparent); border-radius: 10px; padding: 8px 12px;
  font-size: 14px; display: flex; gap: 8px; align-items: flex-start; margin-top: 6px;
}
.erreur-msg svg { margin-top: 2px; }
details.reflexion { margin: 0 0 10px; color: var(--texte-2); font-size: 13.5px; }
details.reflexion summary { cursor: pointer; list-style: none; display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border-radius: 8px; }
details.reflexion summary::-webkit-details-marker { display: none; }
details.reflexion summary:hover { background: var(--survol); }
details.reflexion summary svg { width: 15px; height: 15px; }
.reflexion-texte { white-space: pre-wrap; border-left: 2px solid var(--bord); padding: 4px 0 4px 12px; margin: 6px 0 0 6px; max-height: 320px; overflow-y: auto; }
.actions-msg { display: flex; gap: 2px; margin-top: 4px; align-items: center; min-height: 32px; }
.actions-msg .ibtn { width: 30px; height: 30px; }
.actions-msg .ibtn svg { width: 16px; height: 16px; }
.msg-u .actions-msg { opacity: 0; transition: opacity .15s; }
.msg-u:hover .actions-msg { opacity: 1; }
.stats { color: var(--texte-3); font-size: 12px; margin-left: 6px; }
.curseur::after { content: ""; display: inline-block; width: 8px; height: 15px; background: var(--accent); border-radius: 2px; margin-left: 2px; vertical-align: -2px; animation: clignote 1s steps(1) infinite; }
@keyframes clignote { 50% { opacity: 0; } }

/* Texte mis en forme */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote, .md .bloc-code { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 24px; }
.md li { margin: 3px 0; }
.md li > p { margin: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 20px 0 8px; line-height: 1.3; }
.md h1 { font-size: 21px; } .md h2 { font-size: 19px; } .md h3 { font-size: 17px; } .md h4 { font-size: 15px; }
.md a { color: var(--accent); }
.md code { font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--code); padding: 1px 5px; border-radius: 5px; }
.md blockquote { border-left: 3px solid var(--bord); padding-left: 12px; color: var(--texte-2); }
.md hr { border: 0; border-top: 1px solid var(--bord); margin: 18px 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; }
.md th, .md td { border: 1px solid var(--bord); padding: 6px 10px; text-align: left; vertical-align: top; overflow-wrap: normal; min-width: 6em; hyphens: auto; }
.md th { background: var(--surface-2); }
.md input[type=checkbox] { margin-right: 6px; accent-color: var(--accent); }
.bloc-code { border-radius: 12px; overflow: hidden; border: 1px solid var(--bord); background: var(--code); }
.bloc-code-tete { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; font-size: 12px; color: var(--texte-3); border-bottom: 1px solid var(--bord); }
.bloc-code-tete button { font-size: 12px; padding: 3px 8px; border-radius: 6px; color: var(--texte-2); }
.bloc-code-tete button:hover { background: var(--survol); }
.bloc-code pre { margin: 0; padding: 12px; overflow-x: auto; }
.bloc-code code { background: none; padding: 0; white-space: pre; }

/* Saisie */
.zone-saisie { padding: 0 16px calc(12px + env(safe-area-inset-bottom)); flex: none; }
.compositeur {
  max-width: 780px; margin: 0 auto; background: var(--surface); border: 1px solid var(--bord); border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .05); padding: 10px 10px 8px 16px; transition: border-color .15s;
}
.compositeur:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--bord)); }
.compositeur.depot { border-color: var(--accent); border-style: dashed; }
#saisie { width: 100%; border: 0; outline: 0; resize: none; background: transparent; max-height: 40vh; min-height: 26px; padding: 4px 0; display: block; }
#saisie::placeholder, #outil-texte::placeholder { color: var(--texte-3); }
.compo-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.bascule {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; font-size: 13.5px;
  color: var(--texte-2); border: 1px solid var(--bord);
}
.bascule:hover { background: var(--survol); }
.bascule.actif { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-doux); }
.bascule:disabled { opacity: .45; cursor: default; }
.bascule-web { width: 34px; padding: 0; justify-content: center; flex-shrink: 0; }
.bascule-web:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.web-indication { max-width: 780px; margin: 6px auto 0; padding: 0 16px; font-size: 12px; color: var(--texte-2); }
.sources-web { margin: 12px 0 4px; color: var(--texte-2); font-size: 13px; }
.sources-web summary { cursor: pointer; }
.sources-web ol { padding-left: 22px; margin: 8px 0; }
.sources-web li { margin: 5px 0; overflow-wrap: anywhere; }
.sources-web a { color: var(--accent); }
/* Jauge de contexte : ce que le modèle relit à chaque réponse, sur sa capacité */
.jauge-ctx {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 0 10px 0 6px; cursor: help; outline: 0;
  font-size: 11.5px; line-height: 1; color: var(--texte-3); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.jauge-ctx[hidden] { display: none; }
.jauge-ctx:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.jauge-ctx-barre { width: 92px; height: 4px; border-radius: 2px; background: var(--bord); overflow: hidden; }
.jauge-ctx-barre i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent); transition: width .35s ease, background-color .2s; }
.jauge-ctx.attention { color: var(--alerte); }
.jauge-ctx.attention .jauge-ctx-barre i { background: var(--alerte); }
.jauge-ctx.plein { color: var(--erreur); }
.jauge-ctx.plein .jauge-ctx-barre i { background: var(--erreur); }
@media (max-width: 480px) { .jauge-ctx { margin: 0 6px 0 2px; } .jauge-ctx-barre { width: 64px; } }
.btn-envoyer {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--sur-accent); display: grid; place-items: center;
}
.btn-envoyer svg { width: 20px; height: 20px; stroke-width: 2.2; }
.btn-envoyer:disabled { opacity: .35; cursor: default; }
.btn-envoyer.stop { background: var(--texte); color: var(--fond); }
.pieces { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 8px; }
.piece {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; border-radius: 10px; background: var(--surface-2);
  font-size: 13px; max-width: 260px; border: 1px solid var(--bord);
}
.piece-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piece small { color: var(--texte-3); white-space: nowrap; }
.piece .ibtn { width: 24px; height: 24px; }
.piece .ibtn svg { width: 14px; height: 14px; }
.piece-image { padding: 0; position: relative; border-radius: 12px; overflow: hidden; }
.piece-image img { width: 64px; height: 64px; object-fit: cover; display: block; }
.piece-image .ibtn { position: absolute; top: 3px; right: 3px; background: rgba(0, 0, 0, .55); color: #fff; }
.piece.chargement { opacity: .6; }
.vignette { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; cursor: zoom-in; border: 1px solid var(--bord); }
.mention { text-align: center; font-size: 12px; color: var(--texte-3); margin: 8px 0 0; }

/* ---------- Outils ---------- */
.outils-defile { flex: 1; overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.outils { max-width: 780px; margin: 0 auto; }
.outils-titre { font-size: 22px; margin: 8px 0 14px; letter-spacing: -.01em; }
.outils-saisie { position: relative; }
#outil-texte {
  width: 100%; min-height: 170px; max-height: 45vh; resize: vertical; border-radius: var(--rayon); border: 1px solid var(--bord);
  background: var(--surface); padding: 14px 44px 14px 16px; outline: 0; display: block; line-height: 1.55;
}
#outil-texte:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--bord)); }
.vider { position: absolute; top: 8px; right: 8px; }
.outil-boutons { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.outil {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--bord);
  background: var(--surface); font-weight: 500; font-size: 14.5px; transition: border-color .15s, background .15s;
}
.outil svg { color: var(--accent); }
.outil:hover { border-color: var(--accent); }
.outil.actif { background: var(--accent); color: var(--sur-accent); border-color: var(--accent); }
.outil.actif svg { color: var(--sur-accent); }
.outil.ajout { color: var(--texte-2); border-style: dashed; }
.outil.ajout svg { color: var(--texte-2); }
.resultat { border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--surface); padding: 14px 16px; box-shadow: 0 2px 12px rgba(0, 0, 0, .04); }
.resultat-tete { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.resultat-titre { font-weight: 600; }
.resultat-info { font-size: 12.5px; color: var(--texte-3); text-align: right; }
.resultat-corps { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 24px; }
.resultat-corps.md { white-space: normal; }
.resultat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.diff-plus { background: var(--ajout); color: var(--ajout-texte); border-radius: 4px; padding: 0 1px; }
.diff-moins { background: var(--suppr); color: var(--suppr-texte); text-decoration: line-through; border-radius: 4px; padding: 0 1px; }
.outils-astuce { color: var(--texte-3); font-size: 13px; margin-top: 18px; }
.outils-astuce kbd { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--bord); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--bord);
  background: var(--surface); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; }
.btn-primaire { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.btn-primaire:hover { background: var(--accent-fort); border-color: var(--accent-fort); }
.btn-danger { color: var(--erreur); }

/* ---------- Menus et fenêtres ---------- */
.menu-modeles, .menu-flottant {
  position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; box-shadow: var(--ombre);
  padding: 6px; overflow-y: auto;
}
.menu-modeles { width: 380px; max-height: min(620px, calc(100dvh - 80px)); }
.menu-groupe { font-size: 12px; font-weight: 600; color: var(--texte-3); padding: 10px 10px 4px; }
.modele {
  display: flex; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; align-items: flex-start;
}
.modele:hover { background: var(--survol); }
.modele .coche { width: 18px; color: var(--accent); margin-top: 2px; }
.modele-textes { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.modele-nom { font-weight: 600; font-size: 14.5px; display: flex; gap: 8px; align-items: center; }
.modele-role { font-size: 12.5px; color: var(--texte-2); line-height: 1.4; }
.etiquette { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: var(--surface-2); color: var(--texte-2); }
.etiquette.chaud { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.menu-pied { border-top: 1px solid var(--bord); margin-top: 6px; padding: 8px 6px 4px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texte-2); }
.menu-flottant { min-width: 190px; }
.menu-flottant button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 14px; text-align: left; }
.menu-flottant button:hover { background: var(--survol); }
.menu-flottant button.danger { color: var(--erreur); }
.menu-flottant svg { width: 16px; height: 16px; }

.dlg {
  border: 1px solid var(--bord); border-radius: 18px; padding: 0; background: var(--surface); color: var(--texte); box-shadow: var(--ombre);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
}
.dlg::backdrop { background: rgba(10, 8, 5, .45); }
.dlg-petit { width: min(400px, calc(100vw - 24px)); }
.dlg-corps { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg-tete { display: flex; justify-content: space-between; align-items: center; margin: -4px -8px -4px 0; }
.dlg h2 { font-size: 18px; margin: 0; }
.dlg p { margin: 0; }
.champ { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.champ > span { font-weight: 600; font-size: 13px; color: var(--texte-2); }
.champ input, .champ select, .champ textarea, #question-champ {
  border: 1px solid var(--bord); border-radius: 10px; padding: 9px 11px; background: var(--fond); outline: 0; width: 100%; resize: vertical;
}
.champ input:focus, .champ select:focus, .champ textarea:focus { border-color: var(--accent); }
.case { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.case input { margin-top: 3px; accent-color: var(--accent); }
.segments { display: inline-flex; border: 1px solid var(--bord); border-radius: 10px; overflow: hidden; align-self: flex-start; }
.segments button { padding: 7px 14px; font-size: 14px; }
.segments button.actif { background: var(--accent); color: var(--sur-accent); }
.reg-outils { display: flex; flex-direction: column; gap: 4px; }
.reg-outil { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; border-radius: 10px; background: var(--fond); }
.reg-outil span { flex: 1; font-size: 14px; }
.petit { font-size: 12px; color: var(--texte-3); }
.dlg-pied { display: flex; gap: 8px; align-items: center; }

.loupe { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .85); display: grid; place-items: center; cursor: zoom-out; }
.loupe img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 90;
  background: var(--texte); color: var(--fond); padding: 9px 16px; border-radius: 12px; font-size: 14px; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Collègues ---------- */
.dlg-large { width: min(620px, calc(100vw - 24px)); }
.texte-doux { font-size: 14px; color: var(--texte-2); }
.col-modeles { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; border: 1px solid var(--bord); border-radius: 12px; padding: 6px; background: var(--fond); }
.col-modeles .menu-groupe { padding: 8px 8px 2px; }
.col-modele { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.col-modele:hover { background: var(--survol); }
.col-modele input { margin-top: 3px; accent-color: var(--accent); width: auto; flex: none; padding: 0; }
.col-modele small { display: block; color: var(--texte-3); font-size: 12px; }
.col-alerte { font-size: 13px; color: var(--alerte); background: color-mix(in srgb, var(--alerte) 12%, transparent); padding: 8px 10px; border-radius: 10px; margin: 0; }
.col-liste { display: flex; flex-direction: column; gap: 6px; }
.col-personne { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 12px; border-radius: 12px; background: var(--fond); border: 1px solid var(--bord); }
.col-personne.inactif { opacity: .55; }
.col-personne .infos { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.col-personne b { font-size: 14px; }
.col-personne small { font-size: 12px; color: var(--texte-3); }
.col-ajout { display: flex; gap: 8px; }
.col-ajout input { flex: 1; border: 1px solid var(--bord); border-radius: 10px; padding: 8px 11px; background: var(--fond); outline: 0; min-width: 0; }
.col-ajout input:focus { border-color: var(--accent); }
.hor-detail { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 0 26px; }
.hor-detail.eteint { opacity: .4; pointer-events: none; }
.hor-jours { display: flex; flex-wrap: wrap; gap: 6px; }
.hor-jour { display: inline-flex; }
.hor-jour input { position: absolute; opacity: 0; pointer-events: none; }
.hor-jour span { min-width: 44px; text-align: center; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--bord); font-size: 14px; cursor: pointer; user-select: none; }
.hor-jour input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.hor-jour input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.hor-heures { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.hor-heures input { border: 1px solid var(--bord); border-radius: 10px; padding: 6px 10px; background: var(--fond); color: var(--texte); }
.col-personne .ferme { color: var(--alerte); }
.coord { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.coord input:first-child { grid-column: 1 / -1; }
.accueil-coord { margin: -12px auto 22px; display: inline-block; font-size: 13.5px; color: var(--accent); border: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 10px; padding: 7px 12px; }
.accueil-coord:hover { background: var(--accent-doux); }
#inv-texte { width: 100%; border: 1px solid var(--bord); border-radius: 12px; padding: 12px; background: var(--fond); font-size: 14px; line-height: 1.5; resize: vertical; outline: 0; }

/* ---------- Petits écrans (téléphone) ---------- */
@media (max-width: 860px) {
  .barre { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); margin-left: 0 !important; box-shadow: var(--ombre); width: min(300px, 86vw); }
  .app.barre-ouverte .barre { transform: none; }
  .app.barre-ouverte .voile { display: block; position: fixed; inset: 0; background: rgba(10, 8, 5, .4); z-index: 25; }
  #btn-menu { display: inline-grid !important; }
  #btn-replier { display: none; }
  .conv .ibtn { opacity: 1; }
  .msg-u .actions-msg { opacity: 1; }
  .menu-modeles { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); max-height: 75dvh; border-radius: 20px; }
  .fil { padding: 0 12px 16px; }
  .zone-saisie { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .accueil { padding-top: 7vh; }
  .raccourcis { grid-template-columns: 1fr 1fr; }
  .outils-defile { padding: 0 12px calc(20px + env(safe-area-inset-bottom)); }
  .outil { height: 38px; padding: 0 12px; font-size: 14px; }
  .mention { display: none; }
}
@media (hover: none) {
  .conv .ibtn, .msg-u .actions-msg { opacity: 1; }
}
/* Mode « traiter un texte » d'Android (menu de sélection) : rien que l'outil. */
.mode-traiter #btn-menu, .mode-traiter #btn-nouvelle-entete, .mode-traiter .barre, .mode-traiter .outils-titre { display: none !important; }

/* ---------- Suivi d'utilisation (réservé à Olivier, panneau qui contient la page suivi.html) ---------- */
.dlg-suivi { width: min(1100px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-height: none; padding: 0; overflow: hidden; }
.dlg-suivi[open] { display: block; }
.dlg-suivi iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--fond); }
.suivi-fermer { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 10px; z-index: 20; }
