:root {
  --fond: #050506; --surface: #0f0f12; --surface-2: #17171b; --bord: #232329; --bord-fort: #33333b;
  --texte: #ededf0; --texte-2: #a6a6b0; --texte-3: #6e6e79;
  --accent: #ff5a3c; --accent-doux: rgba(255, 90, 60, .12);
  --ok: #3dbf7a; --attente: #e8a33d; --ko: #ff4d5e;
  --r: 12px; --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  --barre: 56px; --nav: 210px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.55 var(--sans); -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
.sous { color: var(--texte-2); margin: 0 0 22px; }
.discret { color: var(--texte-3); font-size: 13px; }
.meta { font-size: 13px; color: var(--texte-3); margin: 0; }
.erreur { color: var(--ko); margin: 8px 0 0; font-size: 14px; }
.etiquette { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--texte-3); margin: 24px 0 10px; }
.lien { background: none; border: 0; color: var(--texte-2); padding: 6px 8px; border-radius: 8px; }
.lien:hover { color: var(--texte); background: var(--surface-2); }
.danger { background: none; border: 1px solid var(--ko); color: var(--ko); border-radius: 8px; padding: 4px 12px; font-size: 13px; }
.danger-lien:hover { color: var(--ko); }
kbd { font: 11px var(--mono); opacity: .7; margin-left: 6px; }
input[type=text], input[type=password], input[type=number], input[type=time], textarea, select {
  background: var(--fond); border: 1px solid var(--bord-fort); border-radius: 10px; padding: 9px 11px; font-size: 15px; color: var(--texte); }
textarea { resize: vertical; width: 100%; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.principal-btn { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; white-space: nowrap; }
.principal-btn.petit { padding: 7px 14px; font-size: 14px; }
.principal-btn:disabled { opacity: .5; }
.secondaire { background: none; border: 1px solid var(--bord-fort); border-radius: 10px; padding: 8px 14px; color: var(--texte-2); white-space: nowrap; }
.secondaire:hover { color: var(--texte); border-color: var(--texte-3); }
.boutons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Barre et navigation ---------- */
.barre { position: sticky; top: 0; z-index: 6; height: var(--barre); display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  background: rgba(5,5,6,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--bord); }
.marque { font: 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--texte-2); display: flex; align-items: center; gap: 10px; }
.marque b { color: var(--texte); }
.point { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.barre-droite { display: flex; gap: 8px; align-items: center; }
.pastille { font: 12px var(--mono); color: var(--accent); border: 1px solid var(--accent); border-radius: 99px; padding: 3px 10px; background: none; }
.pastille.alerte { background: var(--accent); color: #fff; }

.nav { position: fixed; top: var(--barre); left: 0; bottom: 0; width: var(--nav); padding: 18px 12px; border-right: 1px solid var(--bord); display: flex; flex-direction: column; gap: 4px; z-index: 5; background: var(--fond); }
.nav button { background: none; border: 0; border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; color: var(--texte-2); text-align: left; position: relative; }
.nav button:hover { background: var(--surface); color: var(--texte); }
.nav button.actif { background: var(--surface-2); color: var(--texte); }
.nav button.actif .ico { color: var(--accent); }
.nav .ico { width: 20px; text-align: center; font-size: 17px; }
.badge { font-style: normal; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: auto; }

.principal { margin-left: var(--nav); padding: 34px 32px 80px; }
.vue { max-width: 820px; margin: 0 auto; }
.entete-vue { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.titre-section { margin: 26px 0 12px; font-size: 17px; }

/* ---------- Composer ---------- */
.composer { background: var(--surface); border: 1px solid var(--bord); border-radius: 18px; padding: 18px; display: grid; gap: 12px; margin-bottom: 14px; }
.composer:focus-within { border-color: var(--accent); }
.titre-composer { font-weight: 600; font-size: 17px; }
#consigne { background: transparent; border: 0; padding: 0; min-height: 84px; font-size: 16px; }
.composer-bas { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.options-lien { padding-left: 0; }
.options-panneau { border-top: 1px solid var(--bord); padding-top: 12px; display: grid; gap: 12px; }
.option-ligne, .choix-ligne { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.option-lab { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); min-width: 76px; }
.choix { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.note-prive { color: var(--attente); font-size: 13px; margin: 0; }
.segment { display: inline-flex; border: 1px solid var(--bord-fort); border-radius: 10px; overflow: hidden; }
.segment button { background: none; border: 0; padding: 6px 13px; font-size: 14px; color: var(--texte-2); white-space: nowrap; }
.segment button + button { border-left: 1px solid var(--bord-fort); }
.segment button[aria-checked="true"] { background: var(--accent-doux); color: var(--accent); }
.segment button:disabled { opacity: .35; }
.bascule { display: inline-flex; gap: 7px; align-items: center; font-size: 14px; color: var(--texte-2); cursor: pointer; }
.bascule input { accent-color: var(--accent); width: 16px; height: 16px; }
.bascule input:disabled + span { opacity: .4; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.suggestion { background: none; border: 1px dashed var(--bord-fort); border-radius: 99px; padding: 6px 14px; font-size: 13px; color: var(--texte-2); text-align: left; }
.suggestion:hover { border-color: var(--accent); color: var(--texte); }

/* ---------- Blocs et listes ---------- */
.bloc { margin-bottom: 26px; }
.bloc-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.liste { display: flex; flex-direction: column; gap: 8px; }
.vide { color: var(--texte-3); padding: 18px 0; text-align: center; margin: 0; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--r); padding: 13px 15px; text-align: left; width: 100%; display: grid; gap: 6px; }
.carte:hover { border-color: var(--bord-fort); }
.carte.selection { border-color: var(--accent); }
.ligne1 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.ligne2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.carte .consigne { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.type-mini { font: 11px var(--mono); color: var(--texte-3); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--texte-2); background: var(--surface-2); border-radius: 99px; padding: 2px 10px 2px 8px; white-space: nowrap; }
.puce { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.statut { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.statut.terminee, .statut.executee { color: var(--ok); } .statut.en-cours { color: var(--accent); } .statut.en-attente { color: var(--attente); }
.statut.erreur, .statut.arretee, .statut.interrompue, .statut.refusee, .statut.invalide, .statut.echec { color: var(--ko); }
.statut.a-valider { color: var(--accent); }
.statut.en-cours::before { content: "● "; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.onglets-internes { display: inline-flex; background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.onglets-internes button { background: none; border: 0; border-radius: 9px; padding: 6px 16px; color: var(--texte-2); }
.onglets-internes button.actif { background: var(--surface-2); color: var(--texte); }
.filtres { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filtre { background: none; border: 1px solid var(--bord); border-radius: 99px; padding: 4px 12px; font-size: 13px; color: var(--texte-3); }
.filtre.actif { border-color: var(--accent); color: var(--accent); }
.fichier { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; padding: 10px 13px; text-align: left; width: 100%; }
.fichier:hover { border-color: var(--bord-fort); }
.fichier-g { display: flex; gap: 8px; align-items: center; min-width: 0; flex-wrap: wrap; }
.fichier .p { font: 13px var(--mono); overflow-wrap: anywhere; }

/* ---------- À valider, automatisations, idées ---------- */
.prop, .auto, .modele { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.prop.a-valider { border-color: var(--accent); }
.auto.inactive { opacity: .55; }
.tete { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.type { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--texte-3); display: block; margin-bottom: 2px; }
.pourquoi { color: var(--texte-2); font-size: 14px; margin: 0; }
.prop label { display: grid; gap: 5px; font-size: 12px; color: var(--texte-3); }
.prop input, .prop textarea { width: 100%; }
.prop textarea { min-height: 100px; font-family: var(--sans); }
.prop input:disabled, .prop textarea:disabled { opacity: .7; }
.note { font-size: 14px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note.ok { color: var(--ok); } .note.ko { color: var(--ko); }
.grille-modeles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.modele { align-content: start; }
.interrupteur { position: relative; width: 44px; height: 26px; flex: none; }
.interrupteur input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.interrupteur span { position: absolute; inset: 0; background: var(--bord-fort); border-radius: 99px; transition: background .15s; }
.interrupteur span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.interrupteur input:checked + span { background: var(--ok); }
.interrupteur input:checked + span::after { transform: translateX(18px); }

/* ---------- Équipe ---------- */
.chef { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--accent); border-radius: 16px; padding: 16px; }
.poste-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-doux); color: var(--accent); display: grid; place-items: center; flex: none; font-size: 18px; }
.poste-role { font-size: 14px; color: var(--texte-2); margin: 4px 0 0; }
.postes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.poste { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.poste .poste-role { font-size: 13px; color: var(--texte-3); margin: 0; }
.exemple { background: none; border: 1px dashed var(--bord-fort); border-radius: 10px; padding: 7px 10px; text-align: left; font-size: 13px; color: var(--texte-2); }
.exemple:hover { border-color: var(--accent); color: var(--texte); }
.repli { margin-top: 28px; border-top: 1px solid var(--bord); padding-top: 18px; }
.repli summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.repli summary::-webkit-details-marker { display: none; }
.repli summary h2::before { content: "▸ "; color: var(--texte-3); }
.repli[open] summary h2::before { content: "▾ "; }
.repli[open] summary { margin-bottom: 14px; }
.grand { min-height: 280px; font-family: var(--mono); font-size: 13px; line-height: 1.6; margin-bottom: 10px; }
.reglages { display: grid; gap: 14px; }
.champ-court { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; color: var(--texte-2); }
.champ-court input { width: 76px; }

/* ---------- Détail d'une mission (panneau) ---------- */
.detail { position: fixed; top: var(--barre); right: 0; bottom: 0; width: min(520px, 100vw); background: var(--fond); border-left: 1px solid var(--bord);
  z-index: 7; display: flex; flex-direction: column; box-shadow: -24px 0 48px rgba(0,0,0,.55); }
.detail-tete { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--bord); }
.espace-flex { flex: 1; }
.fermer { font-size: 18px; }
.detail-corps { overflow-y: auto; padding: 4px 20px 60px; }
.detail-consigne { font-size: 16px; margin: 0 0 6px; white-space: pre-wrap; }
.reponse { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 14px 16px; }
#detail-livrables { display: grid; gap: 8px; }
#detail-livrables .principal-btn { justify-self: start; margin-top: 6px; }
.retour { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.retour input { flex: 1; min-width: 150px; }
.pouce { background: none; border: 1px solid var(--bord-fort); border-radius: 10px; padding: 5px 11px; font-size: 17px; filter: grayscale(1); opacity: .55; }
.pouce.actif { filter: none; opacity: 1; border-color: var(--accent); }
#suite-consigne { margin-bottom: 8px; }
.repli-fil { margin-top: 26px; }
.repli-fil summary { cursor: pointer; color: var(--texte-3); font-size: 13px; }
.fil { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fil li { display: grid; gap: 1px; font-size: 13px; }
.fil .qui { font: 11px var(--mono); color: var(--texte-3); }
.fil .quoi { color: var(--texte-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.fil li.texte .quoi { color: var(--texte); }
.fil li.refus .quoi, .fil li.erreur .quoi { color: var(--ko); }
.fil li.outil .quoi { font-family: var(--mono); font-size: 12px; }
.fil li[data-agent="Gemini"] .qui { color: #7aa7ff; }
.fil li[data-agent="QG"] .qui { color: var(--accent); }

.md { overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { font-size: 15px; margin: 14px 0 6px; }
.md h2:first-child, .md h3:first-child, .md p:first-child { margin-top: 0; }
.md p { margin: 0 0 10px; }
.md ul { margin: 0 0 10px; padding-left: 20px; }
.md code { font: 12px var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: 10px; overflow-x: auto; font: 12px var(--mono); white-space: pre; }
.md .vide { text-align: left; padding: 0; }

/* ---------- Dialogues ---------- */
dialog { background: var(--surface); color: var(--texte); border: 1px solid var(--bord-fort); border-radius: 16px; width: min(760px, calc(100vw - 24px)); max-height: 90vh; padding: 0; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.dialog-tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--bord); position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog > .md { padding: 16px 22px 24px; }
#apercu-titre { font: 13px var(--mono); overflow-wrap: anywhere; }
.formulaire-corps { padding: 16px 20px; display: grid; gap: 14px; }
.formulaire label { display: grid; gap: 5px; font-size: 14px; color: var(--texte-2); }
.formulaire label.bascule { display: inline-flex; }
.formulaire fieldset { border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; display: grid; gap: 12px; }
.formulaire legend { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); padding: 0 6px; }
.repli-petit summary { cursor: pointer; color: var(--texte-2); font-size: 14px; }
.repli-petit[open] { display: grid; gap: 12px; }
.ligne { display: flex; gap: 12px; flex-wrap: wrap; }
.ligne > label { flex: 1; min-width: 140px; }
.jours { display: flex; gap: 6px; flex-wrap: wrap; }
.jour { position: relative; }
.jour input { position: absolute; opacity: 0; }
.jour span { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--bord-fort); color: var(--texte-2); cursor: pointer; }
.jour input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.dialog-pied { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--bord); position: sticky; bottom: 0; background: var(--surface); }

/* ---------- Mobile : barre d'onglets en bas ---------- */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .barre { padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(var(--barre) + env(safe-area-inset-top)); }
  .nav { top: auto; right: 0; width: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--bord); background: rgba(5,5,6,.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .nav button { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; align-items: center; }
  .nav button.actif { background: none; color: var(--accent); }
  .nav .ico { font-size: 20px; }
  .badge { position: absolute; top: 2px; left: 55%; margin: 0; }
  .principal { margin-left: 0; padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .detail { top: 0; width: 100vw; padding-top: env(safe-area-inset-top); border-left: 0; }
  .composer { padding: 16px; }
  .composer-actions { width: 100%; justify-content: space-between; }
  .composer-actions .principal-btn { flex: 1; }
  .option-lab { min-width: 100%; }
}

/* ---------- Connexion (QG hébergé) ---------- */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.connexion { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; padding: 24px; display: grid; gap: 14px; }
.connexion label { display: grid; gap: 6px; font-size: 13px; color: var(--texte-2); }
.connexion input { width: 100%; font-size: 16px; }
.connexion .marque { justify-content: center; margin-bottom: 6px; }
