/* IMOFFICE v1.4 — design « Présentation Copilot » : blanc dominant, cartes structurées. */
:root {
  --accent: #2564eb;
  --accent-dark: #1b4fc7;
  --accent-soft: #eaf1fe;
  --text: #1f2329;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f4f5f7;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.05);
  --word: #2b579a;
  --excel: #217346;
  --powerpoint: #c43e1c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "Segoe UI Variable", -apple-system, Roboto, Arial, sans-serif;
  font-size: 13px; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #ccd2da; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- en-tête ---------- */
header {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line);
  flex: 0 0 auto; z-index: 5;
}
.brandline { display: flex; align-items: center; gap: 8px; }
.brand {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, #9b5cf6 0%, #2564eb 100%);
  box-shadow: 0 1px 3px rgba(37, 100, 235, 0.35);
}
header .title { font-size: 14px; font-weight: 650; letter-spacing: 0.2px; }
.host {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 8px; border-radius: 20px; margin-left: auto;
}
.tag-word { background: #e6edf7; color: var(--word); }
.tag-excel { background: #e3f0e8; color: var(--excel); }
.tag-powerpoint { background: #fae9e4; color: var(--powerpoint); }
.demo {
  font-size: 10.5px; font-weight: 600; background: #fdf0d5; color: #92600a;
  padding: 2px 8px; border-radius: 20px;
}
.adv {
  font-size: 10.5px; font-weight: 600; background: #e6edf7; color: var(--word);
  padding: 2px 8px; border-radius: 20px;
}
/* v1.7 — identité de l'utilisateur connecté (nom · rôle) */
.who {
  font-size: 10.5px; font-weight: 650; padding: 2px 8px; border-radius: 20px;
  background: #eef1f6; color: #33415c; white-space: nowrap; max-width: 190px;
  overflow: hidden; text-overflow: ellipsis;
}
.who.role-admin { background: #ece5fd; color: #5b32d6; }
.who.role-user { background: #e3f0e8; color: var(--excel); }
.who.role-reader { background: #f1f2f4; color: #5c6673; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c0c7d0; flex: 0 0 auto; }
.dot.ok { background: #2ea043; box-shadow: 0 0 0 2px #d9f2e0; }
.dot.bad { background: #d92d20; box-shadow: 0 0 0 2px #fbe3e1; }

/* ---------- v1.8 : sélecteur de service (en-tête) ---------- */
.svc-row { display: flex; flex-direction: column; gap: 4px; }
.svc-label {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.svc-wrap { position: relative; display: block; }
select.svc {
  width: 100%; font: inherit; font-size: 12.5px; font-weight: 600; color: #22314f;
  background: #f6f8fb; border: 1px solid #d3d8e0; border-radius: 8px;
  padding: 6px 28px 6px 10px; outline: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
select.svc:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 100, 235, 0.14); background: #fff; }
.svc-wrap::after {
  content: ""; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid #667085; border-bottom: 2px solid #667085;
  transform: rotate(45deg); pointer-events: none;
}

/* ---------- zones ---------- */
main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin: auto 14px; max-width: 420px; width: 100%;
}
.card h1 { font-size: 17px; margin-bottom: 8px; }
.card p { color: var(--muted); line-height: 1.45; margin-bottom: 12px; }
.err { color: #d92d20; font-size: 12.5px; margin-top: 8px; }

/* ---------- fil de discussion ---------- */
.thread {
  flex: 1 1 auto; overflow-y: auto; padding: 14px 12px 10px;
  display: flex; flex-direction: column; gap: 12px;
}
.bubble { max-width: 100%; display: flex; flex-direction: column; }
.bubble.user { align-items: flex-end; }
.bubble.assistant { align-items: stretch; }

.bubble-body { line-height: 1.5; overflow-wrap: break-word; white-space: pre-wrap; }
.bubble.user .bubble-body {
  background: var(--accent); color: #fff; padding: 8px 13px;
  border-radius: 14px 14px 4px 14px; max-width: 86%; font-size: 13px;
  box-shadow: 0 1px 2px rgba(37, 100, 235, 0.2);
}
.bubble.assistant {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 13px 12px;
}
.bubble-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #9b5cf6, #2564eb); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.bubble-who { font-size: 12.5px; font-weight: 650; }
.bubble-where { font-size: 10.5px; color: var(--muted); background: var(--bg); padding: 1px 7px; border-radius: 10px; }
.bubble.pending .bubble-body { color: var(--muted); }

/* ---------- markdown léger dans les réponses ---------- */
.bubble-body h3, .bubble-body h4, .bubble-body h5 {
  font-size: 13px; font-weight: 700; margin: 10px 0 4px; line-height: 1.3;
}
.bubble-body h3:first-child, .bubble-body h4:first-child { margin-top: 0; }
.bubble-body h3 { color: #111; }
.bubble-body h4 { color: var(--accent-dark); text-transform: uppercase; font-size: 11px; letter-spacing: 0.3px; }
.bubble-body p { margin: 4px 0; }
.bubble-body ul, .bubble-body ol { margin: 4px 0 4px 2px; padding-left: 18px; }
.bubble-body li { margin: 2.5px 0; }
.bubble-body li::marker { color: var(--accent); }
.bubble-body b, .bubble-body strong { font-weight: 650; }
.bubble-body code {
  font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 11.5px;
  background: #eef1f6; border: 1px solid #e2e6ee; border-radius: 5px; padding: 0 4px;
}
.bubble-body blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 6px 10px; border-radius: 0 8px 8px 0; margin: 6px 0; color: #33415c;
}
.bubble-body hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }

/* ---------- actions sous une réponse ---------- */
.bubble-actions {
  display: flex; gap: 6px; margin-top: 9px; padding-top: 8px;
  border-top: 1px dashed var(--line); flex-wrap: wrap;
}
.bubble-actions .ghost { background: #fff; }

/* ---------- carte post-outil (modifications appliquées) ---------- */
.actioncard {
  margin-top: 9px; background: #f0f7ff; border: 1px solid #cfe3ff;
  border-radius: 10px; padding: 9px 11px;
}
.ac-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ac-check {
  width: 17px; height: 17px; border-radius: 50%; background: #2ea043; color: #fff;
  font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.ac-sub { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.ac-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.ac-chip {
  font-family: Consolas, Menlo, monospace; font-size: 10.5px; color: #24456e;
  background: #fff; border: 1px solid #d5e5fb; border-radius: 6px; padding: 1px 6px;
}
.ac-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

/* carte de validation finale (v1.8.4) : liste des modifications + valider/annuler */
.ac-items { margin-top: 7px; display: flex; flex-direction: column; gap: 3px; }
.ac-item { display: flex; gap: 6px; font-size: 12px; line-height: 1.35; color: #21395a; }
.ac-num { color: #6b8cae; font-weight: 700; }
.ac-what { flex: 1; }
.ac-question { margin-top: 9px; font-size: 12.5px; font-weight: 600; color: #21395a; }
.ac-etat { margin-right: auto; align-self: center; text-align: left; font-size: 11px; color: var(--muted); }
.ac-off { opacity: 0.45; cursor: not-allowed; }

/* ---------- barre de validation (agentBar) ---------- */
.agentbar {
  flex: 0 0 auto; margin: 0 12px 10px; background: #fffdf4;
  border: 1px solid #f1e2b1; border-radius: var(--radius); padding: 10px 12px;
  box-shadow: var(--shadow); max-height: 45vh; overflow-y: auto;
}
.agentbar.pulse { animation: abPulse 1.1s ease-in-out 3; }
@keyframes abPulse {
  0%, 100% { border-color: #f1e2b1; }
  50% { border-color: #f5b52e; box-shadow: 0 0 0 4px rgba(245, 181, 46, 0.28); }
}
.ab-title { font-size: 13px; font-weight: 650; margin-bottom: 7px; }
.ab-list { display: flex; flex-direction: column; gap: 6px; }
.ab-item {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  background: #fff; border: 1px solid #f3e8c8; border-radius: 8px; padding: 6px 9px;
}
.ab-name { font-family: Consolas, Menlo, monospace; font-size: 11px; color: #7a5b00; background: #fdf6e0; padding: 1px 5px; border-radius: 5px; }
.ab-desc { font-size: 12px; color: #5c5340; flex: 1 1 160px; }
.ab-args {
  flex-basis: 100%; font-family: Consolas, Menlo, monospace; font-size: 10.5px; color: #8a7350;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ab-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.ab-note { font-size: 11.5px; color: var(--muted); }
.ab-actions { display: flex; gap: 6px; }

/* ---------- suggestions rapides (accueil) ---------- */
.welcome-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; color: var(--accent-dark); background: var(--accent-soft);
  border: 1px solid #cfe0fb; border-radius: 16px; padding: 4px 11px; cursor: pointer;
}
.chip:hover { background: #d9e6fd; }

/* ---------- composeur ---------- */
.composer {
  flex: 0 0 auto; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px;
}
.composer textarea {
  width: 100%; resize: vertical; border: 1px solid #d3d8e0; border-radius: 9px;
  padding: 8px 10px; font: inherit; font-size: 13px; color: var(--text); outline: none;
  background: #fff; line-height: 1.4; min-height: 74px;
}
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 100, 235, 0.14); }

/* v1.8 : case unique « base de discussion = la sélection » */
.checkline {
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.checkline input { width: 15px; height: 15px; margin-top: 1px; flex: 0 0 auto; cursor: pointer; accent-color: var(--accent); }
.checkline .txt { font-size: 12.5px; color: #3b4252; line-height: 1.35; }
.checkline.on .txt { font-weight: 600; color: var(--accent-dark); }
.checkline input:disabled + .txt { color: #98a2b3; }

.row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.note {
  font-size: 11.5px; color: #1a7f37; background: #e6f6ec; border: 1px solid #bfe6cd;
  padding: 3px 9px; border-radius: 12px; margin-left: auto;
}

/* ---------- boutons ---------- */
button {
  font: inherit; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  padding: 6px 12px; font-size: 12.5px; transition: background 0.12s, border-color 0.12s;
}
button:disabled { opacity: 0.55; cursor: default; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.ghost { background: #fff; border-color: #d3d8e0; color: #3b4252; }
.ghost:hover:not(:disabled) { background: #f2f4f7; border-color: #b9c1cc; }
.small { padding: 3px 10px; font-size: 12px; border-radius: 7px; }
.block { width: 100%; }

/* ---------- v1.9 : compteur du jour ---------- */
.usage {
  display: flex; flex-direction: column; gap: 4px;
  border-top: 1px solid var(--line); padding-top: 8px;
}
.usage-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.usage-txt { font-size: 11px; color: var(--muted); }
.usage-pct { font-size: 11px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.usage-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.usage-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.usage-fill.warn { background: #e8a33d; }
.usage-fill.stop { background: #c0392b; }
.usage-offer {
  margin-top: 6px; padding: 8px 10px; border-radius: 9px;
  background: #fff6e5; border: 1px solid #f0c987;
}
.usage-offer-txt { font-size: 11.5px; color: #7a4a09; line-height: 1.4; margin-bottom: 7px; }
.usage-offer-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.usage-offer .primary.small { background: #b9741a; border-color: #b9741a; }

/* ---------- pied de page ---------- */
footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; background: #fff; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--muted);
}
footer a { color: var(--accent); text-decoration: none; }

/* =====================================================================
   v1.13 — LA CONVERSATION D'ABORD (demande de Tawo'o, 23/09/2026)
   L'en-tête passe de 5 lignes à 2, les options partent dans le menu ☰, et le
   fil de discussion occupe tout l'espace restant (plus de 60 % du volet).
   ===================================================================== */
header { gap: 4px; padding: 7px 10px 0; position: relative; }
.brandline { gap: 6px; }
.menubtn {
  margin-left: auto; padding: 2px 9px; font-size: 15px; line-height: 1.2;
  background: #fff; border-color: #d3d8e0; color: #33415c; border-radius: 8px;
}
.menubtn:hover { background: #f2f4f7; }
.menubtn.open { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.usage { border-top: 0; padding: 2px 0 5px; gap: 2px; }
.usage-txt, .usage-pct { font-size: 10.5px; }
.usage-bar { height: 3px; }
.usage-offer { margin: 5px 0 3px; padding: 7px 9px; }
.usage-offer-txt { font-size: 11px; margin-bottom: 6px; }

/* menu ☰ : ce qui n'a pas besoin d'être visible en permanence */
.menu {
  position: absolute; top: 100%; right: 8px; left: 8px; z-index: 40;
  display: flex; flex-direction: column; gap: 7px; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.18);
  max-height: 78vh; overflow-y: auto;
}
.menu-item {
  text-align: left; font-weight: 600; background: #f7f9fc; border-color: #e2e6ee;
  padding: 8px 11px;
}
.menu-item:hover:not(:disabled) { background: var(--accent-soft); border-color: #cfe0fb; }
.menu .svc-row { gap: 3px; }
.menu .diag { border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fbfcfd; }
.menu .diag summary { font-size: 12px; font-weight: 600; cursor: pointer; }
.menu-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); padding-top: 7px;
  font-size: 10.5px; color: var(--muted);
}
.menu-foot a { color: var(--accent); text-decoration: none; }

/* la conversation prend la place restante */
.thread { padding: 10px 10px 8px; gap: 10px; }
.composer { padding: 8px 10px 10px; gap: 6px; }
.composer textarea { min-height: 52px; padding: 7px 9px; }
.checkline.inline { flex-direction: row; align-items: center; gap: 6px; }
.checkline.inline .txt { font-size: 11.5px; }
.composer .row .note { font-size: 11px; padding: 2px 8px; }
