/* MonAssocie.AI — interface façon Gemini : claire, aérée, accent dégradé. Light + dark. */
:root {
  --bg: #ffffff;
  --surface: #f0f4f9;
  --surface-2: #e9eef6;
  --elevated: #ffffff;
  --ink: #1f1f1f;
  --muted: #5f6368;
  --border: #dadce0;
  --border-soft: #e8eaed;
  --accent: #1a73e8;
  --accent-ink: #0b57d0;
  --grad: linear-gradient(90deg, #4285f4 0%, #9b72cb 50%, #d96570 100%);
  --grad-soft: linear-gradient(90deg, rgba(66, 133, 244, 0.12), rgba(155, 114, 203, 0.12), rgba(217, 101, 112, 0.12));
  --danger: #d93025;
  --warn-bg: #fef7e0;
  --warn-ink: #8a5a00;
  --radius: 24px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: "Google Sans", "Product Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #1b1c1d;
    --surface: #27292b;
    --surface-2: #303234;
    --elevated: #242628;
    --ink: #e3e3e3;
    --muted: #9aa0a6;
    --border: #3c4043;
    --border-soft: #333638;
    --accent: #8ab4f8;
    --accent-ink: #a8c7fa;
    --warn-bg: #3a3320;
    --warn-ink: #f6d08a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  }
}
:root[data-theme="dark"] {
  --bg: #1b1c1d;
  --surface: #27292b;
  --surface-2: #303234;
  --elevated: #242628;
  --ink: #e3e3e3;
  --muted: #9aa0a6;
  --border: #3c4043;
  --border-soft: #333638;
  --accent: #8ab4f8;
  --accent-ink: #a8c7fa;
  --warn-bg: #3a3320;
  --warn-ink: #f6d08a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
button { font-family: inherit; }
::selection { background: rgba(66, 133, 244, 0.22); }

/* ── Barre du haut ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; gap: 8px; flex: none;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.brand .logo {
  font-size: 18px; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-name { letter-spacing: 0.2px; }
.controls { display: flex; align-items: center; gap: 2px; }
/* Anciens boutons (automatisations, compte, réglages) : remplacés par le menu du profil, gardés pour leurs actions. */
.topbar .legacy-btn { display: none !important; }
.profile-wrap { position: relative; margin-left: 4px; }
.profile-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: none; background: var(--surface); color: var(--muted); cursor: pointer; overflow: hidden;
}
.profile-btn:hover { box-shadow: 0 0 0 3px var(--surface-2); }
.profile-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-btn .avatar-initial { font: 600 14px/1 system-ui, sans-serif; color: #fff; }
.profile-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px;
  background: var(--bg, #fff); border: 1px solid var(--surface-2); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.16);
}
.profile-menu .pm-email { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--surface-2); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu .pm-email:empty { display: none; }
.profile-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.profile-menu button:hover { background: var(--surface); }
#model {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); color: var(--ink);
  border: none; border-radius: 999px;
  padding: 6px 28px 6px 12px; font-size: 12.5px; max-width: 150px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  text-overflow: ellipsis; margin-right: 4px;
}
#model:hover { background-color: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn.toggle.active { color: var(--accent-ink); background: var(--grad-soft); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.topbar .icon-btn svg { width: 22px; height: 22px; }

/* ── Historique ────────────────────────────────────────────────────────────── */
.history-panel {
  position: absolute; inset: 56px 8px auto 8px; z-index: 30; max-height: 70vh; overflow: auto;
  background: var(--elevated); border: 1px solid var(--border-soft); border-radius: 16px; box-shadow: var(--shadow);
}
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.history-title { font-weight: 600; }
.history-list { padding: 6px; }

/* Projet de la conversation en cours, sous la barre du haut. */
.project-bar { flex: none; padding: 0 12px 6px; }
.project-bar button { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 12.5px; cursor: pointer; }
.project-bar button:hover { border-color: var(--border); }
.project-bar svg { flex: none; color: var(--muted); }
.project-bar-label { color: var(--muted); flex: none; }
.project-bar-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Historique : tiroir latéral (projets + conversations) ─────────────────── */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.32); opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 41; width: min(340px, 88vw);
  display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--border-soft);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12); transform: translateX(-102%); transition: transform 0.2s ease; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 4px 16px; flex: none; }
.drawer-title { font-weight: 600; font-size: 15px; }
.drawer-actions { display: grid; gap: 2px; padding: 4px 8px 8px; flex: none; border-bottom: 1px solid var(--border-soft); }
.drawer-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; border-radius: 8px; background: transparent; color: var(--ink); font-size: 13.5px; text-align: left; cursor: pointer; }
.drawer-btn:hover { background: var(--surface); }
.drawer-btn svg { color: var(--muted); flex: none; }
.drawer-search { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 0 10px; height: 34px; border-radius: 8px; background: var(--surface); color: var(--muted); }
.drawer-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 13px; }
.drawer-list { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.drawer-list::-webkit-scrollbar { width: 8px; }
.drawer-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.h-section { padding: 14px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 8px; }
.h-section.drop { background: var(--surface); outline: 1px dashed var(--accent); }
.history-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 13px; }

.history-item, .h-folder-head { position: relative; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 4px 0 10px; border-radius: 8px; cursor: pointer; }
.history-item:hover, .h-folder-head:hover { background: var(--surface); }
.history-item.current { background: var(--surface-2); }
.history-item .h-main { flex: 1; min-width: 0; padding: 7px 0; }
.history-item .h-title, .h-folder-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.history-item .h-sub { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-unsynced { color: #b45309; }
.h-folder-head { gap: 8px; }
.h-folder-head > svg { color: var(--muted); flex: none; }
.h-folder-name { flex: 1; min-width: 0; font-weight: 500; }
.h-chevron { flex: none; color: var(--muted); transition: transform 0.15s; }
.h-folder.open > .h-folder-head .h-chevron { transform: rotate(90deg); }
.h-folder-body { display: none; margin: 1px 0 4px 17px; padding-left: 8px; border-left: 1px solid var(--border-soft); }
.h-folder.open > .h-folder-body { display: block; }
.h-new-chat { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0 10px; border: none; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; text-align: left; cursor: pointer; }
.h-new-chat:hover { background: var(--surface); color: var(--ink); }
.h-new-chat svg { flex: none; }
.h-folder-empty { padding: 6px 10px; color: var(--muted); font-size: 12.5px; }
.h-folder-head.drop { background: var(--surface); outline: 1px dashed var(--accent); }
.h-count { color: var(--muted); font-size: 12px; flex: none; }
.h-actions { display: flex; gap: 0; flex: none; opacity: 0.55; transition: opacity 0.1s; }
.history-item:hover .h-actions, .h-folder-head:hover .h-actions, .h-actions.active { opacity: 1; }
@media (hover: none) { .h-actions { opacity: 1; } }
.h-act { display: grid; place-items: center; width: 30px; height: 30px; border: none; border-radius: 6px; background: transparent; color: var(--ink); opacity: 0.7; cursor: pointer; }
.h-act:hover { opacity: 1; }
.h-act:hover { background: var(--surface-2); color: var(--ink); }

.h-menu { position: fixed; z-index: 60; min-width: 200px; max-width: 280px; max-height: 60vh; overflow-y: auto; padding: 4px; background: var(--elevated); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18); }
.h-menu-label { padding: 6px 10px 2px; font-size: 11.5px; color: var(--muted); }
.h-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: 6px; background: none; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer; }
.h-menu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-menu button svg { flex: none; color: var(--muted); }
.h-menu button.current { font-weight: 600; background: var(--surface); }
.h-menu button.current svg { color: var(--accent, #1a73e8); }
.h-menu button:hover:not(:disabled) { background: var(--surface); }
.h-menu button:disabled { color: var(--muted); cursor: default; }
.h-menu button.danger, .h-menu button.danger svg { color: var(--danger); }
.h-menu hr { margin: 4px 6px; border: none; border-top: 1px solid var(--border-soft); }

/* ── Fil de messages ───────────────────────────────────────────────────────── */
.messages { flex: 1; overflow-y: auto; padding: 8px 14px 20px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.row { display: flex; margin: 14px 0; animation: rise 0.18s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.row.user { justify-content: flex-end; }
.row.user .bubble {
  background: var(--surface); color: var(--ink);
  padding: 10px 15px; border-radius: 20px 20px 6px 20px; max-width: 86%;
  white-space: pre-wrap; word-wrap: break-word;
}
.row.assistant { gap: 10px; align-items: flex-start; }
.row.assistant .avatar {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; color: #fff; background: var(--grad); margin-top: 2px;
}
.row.assistant .bubble { flex: 1; min-width: 0; padding-top: 1px; }
.row.error .bubble {
  background: color-mix(in srgb, var(--danger) 10%, var(--bg)); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  padding: 10px 14px; border-radius: 14px; max-width: 92%;
}
.bubble.thinking.dots::after {
  content: "●●●"; letter-spacing: 2px; color: var(--muted);
  animation: blink 1.2s infinite; font-size: 10px;
}
@keyframes blink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Markdown dans les réponses */
.bubble p { margin: 0 0 10px; }
.bubble > :last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3 { margin: 16px 0 8px; line-height: 1.3; font-weight: 600; }
.bubble h1 { font-size: 19px; } .bubble h2 { font-size: 17px; } .bubble h3 { font-size: 15px; }
.bubble ul, .bubble ol { margin: 8px 0; padding-left: 22px; }
.bubble li { margin: 4px 0; }
.bubble a { color: var(--accent-ink); text-decoration: none; }
.bubble a:hover { text-decoration: underline; }
.bubble code { background: var(--surface); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; font-family: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace; }
.bubble pre { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 14px; overflow-x: auto; margin: 10px 0; position: relative; }
.bubble pre code { background: none; padding: 0; font-size: 12.5px; }
.bubble table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.bubble th, .bubble td { border: 1px solid var(--border-soft); padding: 7px 10px; text-align: left; }
.bubble th { background: var(--surface); font-weight: 600; }
.bubble blockquote { border-left: 3px solid var(--border); margin: 8px 0; padding: 2px 14px; color: var(--muted); }
.bubble hr { border: none; border-top: 1px solid var(--border-soft); margin: 14px 0; }
.md-img { max-width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; margin: 8px 0; cursor: zoom-in; display: block; }
/* Filet de sécurité : AUCUN média du fil (image, svg, canvas, embed) ne peut remplir/bloquer le panneau. */
.messages img, .messages svg, .messages canvas, .messages video, .messages embed, .messages object, .messages iframe {
  max-height: 420px; max-width: 100%; object-fit: contain;
}
.copy-btn { position: absolute; top: 6px; right: 6px; font-size: 11px; padding: 3px 8px; border-radius: 7px; border: 1px solid var(--border-soft); background: var(--elevated); color: var(--muted); cursor: pointer; }

/* Réflexion (thinking) */
.reasoning { margin: 6px 0 10px; }
.reasoning summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; }
.reasoning summary::-webkit-details-marker { display: none; }
.reasoning-body { margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--border-soft); color: var(--muted); font-size: 12.5px; white-space: pre-wrap; }
.model-wait { color: var(--muted); font-size: 12px; }
.reasoning-flow { margin: 6px 0 8px; }

/* Groupe « traitement » repliable */
.activity { margin: 10px 0; border: 1px solid var(--border-soft); border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--surface) 55%, var(--bg)); }
.activity > summary, .activity-summary { cursor: pointer; padding: 9px 14px; font-size: 12.5px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
.activity > summary::-webkit-details-marker { display: none; }
.activity-summary::before { content: "✦"; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.activity-body { padding: 4px 12px 10px; }
/* Mode debug (option) : puces techniques masquées par défaut, visibles avec body.debug. */
body:not(.debug) .tool.debug, body:not(.debug) .activity.debug-only, body:not(.debug) .sum-debug, body.debug .sum-user { display: none; }
.activity[open] .activity-summary, .activity.done .activity-summary { opacity: 0.8; }

/* Puces d'action (chips) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 4px 4px 0 0; padding: 5px 11px; border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 12px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 600; }

/* Captures / images affichées */
.shot { margin: 8px 0; }
.shot img, .img-wrap img { max-width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border-soft); cursor: zoom-in; }
.shot-cap, .img-cap { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ── Cartes (confirmation, connexion, téléchargement, Drive) ──────────────────── */
.confirm, .download, .drive-card, .connect-card {
  margin: 10px 0; padding: 12px 14px; border-radius: 16px;
  background: var(--elevated); border: 1px solid var(--border-soft); box-shadow: var(--shadow);
}
.confirm { background: var(--warn-bg); border-color: transparent; }
.confirm.google-access { background: var(--grad-soft); }
.confirm.done { opacity: 0.7; background: var(--surface); }
.confirm-desc { font-size: 13px; color: var(--warn-ink); margin-bottom: 10px; }
.confirm.google-access .confirm-desc { color: var(--ink); }
.confirm.done .confirm-desc { color: var(--muted); }
.confirm-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.confirm-btns button { padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: pointer; border: 1px solid transparent; }
.confirm-btns button:disabled { opacity: 0.5; cursor: default; }
.btn-ok { background: var(--accent); color: #fff; }
.btn-ok:hover:not(:disabled) { filter: brightness(1.05); }
.btn-always { background: transparent; border-color: var(--accent); color: var(--accent-ink); }
.btn-always:hover:not(:disabled) { background: var(--grad-soft); }
.btn-no { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-no:hover:not(:disabled) { background: var(--surface); }

.connect { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 18px auto; max-width: 320px; }
.btn-connect, #google-connect {
  padding: 11px 20px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
}
.btn-connect:hover, #google-connect:hover { filter: brightness(1.05); }
.connect-status, .connect-desc { font-size: 12.5px; color: var(--muted); text-align: center; }
.gperm { margin-top: 6px; text-align: left; font-size: 12px; width: 100%; }
.gperm summary { cursor: pointer; color: var(--accent-ink); list-style: none; }
.gperm summary::-webkit-details-marker { display: none; }
.gperm p { margin: 6px 0; } .gperm ul { margin: 4px 0; padding-left: 18px; } .gperm li { margin: 3px 0; }
.gperm .muted { color: var(--muted); }

.download, .drive-card { display: block; }
.download { display: flex; align-items: center; gap: 10px; }
.dl-name, .drive-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.dl-size { color: var(--muted); font-size: 11.5px; flex: 1; }
.btn-dl { padding: 7px 14px; border-radius: 999px; background: var(--accent); color: #fff; text-decoration: none; font-size: 12.5px; font-weight: 500; }
.btn-dl:hover { filter: brightness(1.05); }
.drive-card .drive-head { display: flex; align-items: center; gap: 8px; }
.drive-thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; padding-bottom: 2px; }
.drive-thumbs img { height: 74px; border-radius: 8px; border: 1px solid var(--border-soft); cursor: pointer; flex: none; }

/* ── Média généré (audio / vidéo) ────────────────────────────────────────────── */
.media { margin: 8px 0; }
.media audio { width: 100%; display: block; }
.media video { width: 100%; max-height: 320px; border-radius: 12px; border: 1px solid var(--border-soft); background: #000; display: block; }
.media-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.media-cap { flex: 1; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Accueil ───────────────────────────────────────────────────────────────── */
.welcome { max-width: 640px; margin: 3vh auto 0; padding: 0 6px; text-align: left; }
.greeting { font-size: 30px; font-weight: 500; margin: 0 0 4px; line-height: 1.2; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
.greeting-sub { font-size: 18px; color: var(--muted); margin: 0 0 16px; font-weight: 400; }
/* Idées d'actions : 2 colonnes même sur téléphone (on voit d'un coup d'œil ce que l'on peut faire),
   regroupées par catégorie (puces au-dessus ; seule la catégorie choisie est affichée). */
.example-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.example-cat { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-soft); background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.example-cat:hover { background: var(--surface); }
.example-cat.active { background: var(--ink); border-color: var(--ink); color: var(--bg, #fff); }
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.examples .example.off { display: none; }
.example {
  display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 12px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: none; color: var(--ink); line-height: 1.3; min-width: 0;
  transition: background 0.12s, transform 0.08s;
}
.example:hover { background: var(--surface-2); }
.example:active { transform: scale(0.99); }
.ex-icon { font-size: 20px; line-height: 1; flex: none; }
.ex-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-label { font-size: 13.5px; font-weight: 600; }
.ex-sub { font-size: 12px; color: var(--muted); }
@media (max-width: 360px) { .example { flex-direction: column; gap: 6px; } }
.warn { margin-top: 16px; padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12.5px; }
.warn:empty { display: none; }

/* ── Socle (saisie) ────────────────────────────────────────────────────────── */
.dock { flex: none; padding: 6px 14px 8px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.attachment { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; background: var(--surface); border-radius: 14px; }
body.drop-target::after {
  content: ""; position: fixed; inset: 6px; z-index: 50; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
/* Bandeau « dossier de travail » : visible pendant la conversation tant que le dossier n'est pas choisi. */
.workdir-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--surface); font-size: 12.5px; color: var(--ink); }
.workdir-bar[hidden] { display: none; }
.workdir-text { flex: 1; line-height: 1.35; }
.workdir-choose { flex: none; padding: 7px 12px; border-radius: 999px; border: none; cursor: pointer; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 500; }
.workdir-close { flex: none; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 6px; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.att-chip {
  position: relative; display: flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden;
  padding: 5px 6px 5px 10px; background: var(--surface); border-radius: 12px; font-size: 12px;
}
.att-chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 5px; }
.att-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.att-chip-meta { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.att-chip.error { color: var(--danger); }
.att-chip-remove { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 12px; }
.att-chip-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width .2s; }
.attachment img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.att-label { flex: 1; font-size: 12.5px; color: var(--muted); }
.att-remove { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.queued { margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.queued:empty { display: none; }
.queued .q-item { font-size: 12px; color: var(--muted); background: var(--surface); border-radius: 10px; padding: 6px 12px; }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin-bottom: 8px; background: var(--surface); border-radius: 14px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 12.5px; }
.rec-meter { flex: 1; height: 4px; background: var(--border-soft); border-radius: 2px; overflow: hidden; }
.rec-level { display: block; height: 100%; width: 0; background: var(--accent); }
.rec-hint { font-size: 11.5px; color: var(--muted); }
.rec-stop { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: #fff; background: var(--danger); border: none; border-radius: 10px; cursor: pointer; }
.rec-stop:hover { filter: brightness(1.08); }

/* Mode conversation vocale : la barre d'état prend l'accent dégradé ; en phase « je réponds »
   le point passe au bleu (plus de rouge « enregistrement »). */
body.voice-mode .rec-bar {
  background: var(--grad-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
body.voice-mode .rec-hint { color: var(--accent-ink); font-weight: 600; }
.rec-bar.speaking .rec-dot { background: var(--accent); animation: blink 1.4s infinite; }
#voice.active { color: var(--accent-ink); background: var(--grad-soft); }
#voice.active svg { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.composer {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid transparent; border-radius: 26px; padding: 8px 8px 8px 16px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.composer:focus-within { background: var(--elevated); border-color: var(--border); box-shadow: var(--shadow); }
#input {
  width: 100%; border: none; background: transparent; resize: none; color: var(--ink);
  font-family: inherit; font-size: 14.5px; line-height: 1.5; padding: 7px 0 2px; max-height: 180px; outline: none;
}
#input::placeholder { color: var(--muted); }
.composer-tools { display: flex; align-items: center; justify-content: space-between; }
.tools-left, .tools-right { display: flex; align-items: center; gap: 2px; }
.composer .icon-btn { width: 36px; height: 36px; }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center;
  background: var(--grad); color: #fff; transition: filter 0.12s, transform 0.08s, opacity 0.12s;
}
.send-btn:hover { filter: brightness(1.06); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.send-btn.stopping { background: var(--ink); color: #fff; }
.dock-foot { text-align: center; font-size: 11px; color: var(--muted); padding: 7px 0 2px; }

/* Divers injectés */
.img-wrap { margin: 8px 0; }
figure { margin: 8px 0; }

/* ── Webapp autonome (téléphone / navigateur sans extension) ─────────────────────────────────── */
body.standalone #screenshot, body.standalone #select, body.standalone #vision { display: none !important; }
body.standalone #connect .gperm { display: none; } /* autorisations Google : propres à l'extension */
body.standalone { height: 100dvh; box-sizing: border-box; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
/* Barre d'accueil iPhone (~34 px) : la petite mention du bas peut s'y loger, pas de bande vide dessous. */
body.standalone .dock { padding-bottom: max(4px, calc(env(safe-area-inset-bottom) - 20px)); }
body.standalone .messages, body.standalone .dock { box-sizing: border-box; width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; }
@media (pointer: coarse) {
  /* iOS zoome sur un champ < 16px ; cibles tactiles plus larges. */
  body.standalone textarea, body.standalone select { font-size: 16px; }
  body.standalone .icon-btn { min-width: 40px; min-height: 40px; }
}

/* ── Appareils du compte (appairage, commandes à distance) ───────────────────────────────────── */
.devices-body { padding: 4px 4px 10px; display: grid; gap: 14px; }
.dev-sec { display: grid; gap: 8px; }
.dev-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dev-account { font-weight: 600; word-break: break-all; }
.dev-btn { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13.5px; cursor: pointer; justify-self: start; }
.dev-btn:disabled { opacity: .6; cursor: default; }
.dev-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 18px; padding: 14px; }
.dev-card .dev-btn { background: var(--bg); }
.dev-btn.dev-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; justify-self: stretch; padding: 11px 16px; font-size: 14.5px; }
.dev-btn.dev-primary:active { transform: scale(.98); }
.dev-pair { display: grid; justify-items: center; gap: 8px; padding-top: 4px; }
.dev-pair:empty { display: none; }
.dev-qr { width: min(170px, 55vw); aspect-ratio: 1; background: #fff; border-radius: 16px; padding: 10px; box-sizing: border-box; box-shadow: 0 2px 14px rgba(0, 0, 0, .12); transition: opacity .2s, filter .2s; }
.dev-qr svg { width: 100%; height: 100%; display: block; }
.dev-pair.expired .dev-qr { opacity: .25; filter: blur(2px); }
.dev-qr-box { position: relative; display: grid; place-items: center; }
.dev-qr.dev-qr-swap { opacity: .4; }
.dev-qr-reload { display: none; position: absolute; border: 0; border-radius: 999px; padding: 10px 16px; background: var(--accent); color: var(--bg); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .2); }
.dev-pair.expired .dev-qr-reload { display: block; }
.dev-code { font: 600 22px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; user-select: all; }
.dev-wait { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.dev-timer { color: var(--muted); font-variant-numeric: tabular-nums; }
.dev-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: dev-spin .8s linear infinite; }
@keyframes dev-spin { to { transform: rotate(360deg); } }
.dev-steps { margin: 2px 0 0; padding-left: 20px; font-size: 13px; color: var(--muted); display: grid; gap: 3px; justify-self: stretch; }
.dev-center { text-align: center; }
.dev-ok-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #1e8e3e; color: #fff; font-size: 30px; font-weight: 700; animation: dev-pop .3s ease-out; }
@keyframes dev-pop { from { transform: scale(.5); opacity: 0; } }
.dev-ok { font-weight: 600; text-align: center; }
.dev-or { text-align: center; font-size: 12px; color: var(--muted); }
.dev-err:empty { display: none; }
.dev-err { color: var(--danger); }
.dev-more > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.dev-more[open] > summary { margin-bottom: 8px; }
.dev-opts { display: grid; gap: 10px; }
.dev-title { font-weight: 600; font-size: 15px; }
.dev-card.dev-center { justify-items: center; }
.dev-pair .dev-note { text-align: center; margin: 0; }
.dev-codeline { font-size: 13px; color: var(--muted); }
.dev-codeline .dev-code { font-size: 14px; color: var(--ink); letter-spacing: .1em; }
.login-scan { margin-top: 2px; }

/* Scanner de QR code plein écran */
.qrs { position: fixed; inset: 0; z-index: 3000; background: #000; color: #fff; overflow: hidden; animation: qrs-in .18s ease-out; }
.qrs.closing { opacity: 0; transition: opacity .18s; }
@keyframes qrs-in { from { opacity: 0; } }
.qrs-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.qrs.live .qrs-video { opacity: 1; }
.qrs-frame { position: absolute; left: 50%; top: 44%; width: min(68vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 22px; box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .55); transition: box-shadow .2s, transform .25s; }
.qrs-c { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; transition: border-color .2s; }
.qrs-c.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 22px; }
.qrs-c.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 22px; }
.qrs-c.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 22px; }
.qrs-c.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 22px; }
.qrs-line { position: absolute; left: 10%; right: 10%; top: 10%; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, #8ab4f8, transparent); box-shadow: 0 0 12px #8ab4f8; animation: qrs-scan 2.2s ease-in-out infinite alternate; opacity: 0; }
.qrs.live .qrs-line { opacity: 1; }
@keyframes qrs-scan { to { top: 90%; } }
.qrs.found .qrs-c { border-color: #34a853; }
.qrs.found .qrs-frame { transform: translate(-50%, -50%) scale(.96); }
.qrs.found .qrs-line { display: none; }
.qrs-top { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; right: 14px; display: flex; justify-content: space-between; }
.qrs-round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 18px; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.qrs-round.on { background: #fff; color: #000; }
.qrs-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 24px max(24px, env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .65) 35%); }
.qrs-title { font-size: 19px; font-weight: 600; }
.qrs-hint { font-size: 14px; opacity: .85; max-width: 340px; }
.qrs-status { font-size: 13.5px; color: #fdd663; min-height: 1em; max-width: 340px; }
.qrs-status:empty { display: none; }
.qrs.qrs-error .qrs-status { color: #fff; background: rgba(217, 48, 37, .85); padding: 10px 14px; border-radius: 12px; }
.qrs.qrs-error .qrs-line { display: none; }
.qrs-manual, .qrs-retry { margin-top: 6px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .12); color: #fff; border-radius: 999px; padding: 11px 20px; font: inherit; font-size: 14.5px; cursor: pointer; }
.qrs-retry { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
.dev-claim { display: flex; gap: 6px; }
.dev-claim input { flex: 1; min-width: 0; border: 1px solid var(--border); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; text-transform: uppercase; }
.dev-toggle { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.dev-toggle input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.dev-list { display: grid; gap: 6px; }
.dev-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--border-soft); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 10px 12px; font: inherit; cursor: pointer; }
.dev-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.dev-item:disabled { opacity: .55; cursor: default; }
.dev-name { font-weight: 500; }
.dev-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.remote-bar { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 0 2px; font-size: 12px; color: var(--accent-ink); }
.dock.remote-on .dock-foot { display: none; }
.remote-x { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 14px; padding: 2px 6px; }
.file-card .btn-dl { border: none; cursor: pointer; font: inherit; }
.file-card .btn-dl:disabled { opacity: .6; cursor: default; }
/* Écran étroit (téléphone, panneau réduit) : 4 icônes + sélecteur de modèle doivent tenir sur une ligne. */
@media (max-width: 440px) {
  .topbar { gap: 6px; }
  .brand { min-width: 0; }
  .controls { min-width: 0; flex-shrink: 1; }
  #model { min-width: 0; max-width: 34vw; }
  .topbar .icon-btn { width: 34px; height: 34px; min-width: 34px; }
}

/* ── Fenêtre de connexion (ouverte à l'envoi d'un message sans compte) ──────────────────────── */
.login-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.45); overflow-y: auto; }
.login-card { position: relative; width: 100%; max-width: 380px; box-sizing: border-box; display: grid; gap: 12px; justify-items: center; text-align: center; padding: 26px 20px 18px; border-radius: 24px; background: var(--bg); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
.login-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: none; border-radius: 50%; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; }
.login-close:hover { background: var(--surface); }
.login-logo { font-size: 34px; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-title { margin: 0; font-size: 22px; font-weight: 600; }
.login-sub { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.login-google { width: 100%; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--elevated); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; }
.login-google:disabled { opacity: .6; cursor: default; }
.login-pair { width: 100%; display: grid; gap: 8px; text-align: left; }
.login-or { text-align: center; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.login-pair .dev-claim input { font-size: 16px; }
.login-help { margin: 0; font-size: 13px; color: var(--muted); }
.login-status { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--muted); }

/* Message envoyé pendant que l'agent travaille (lu à sa prochaine étape) */
.row.user.steer-pending .bubble { opacity: .75; border: 1px dashed var(--border); }
.steer-tag { font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 3px; }
.row.user:has(.steer-tag) { flex-direction: column; align-items: flex-end; }

/* Pièces jointes d'un message utilisateur : étiquettes sous le texte (gardées dans l'historique). */
.msg-att { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg-att-chip {
  font-size: 11.5px; line-height: 1.5; padding: 1px 8px; border-radius: 999px; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, currentColor 12%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

/* Réglages intégrés de la webapp (PWA) : compte + préférences, sans la page d'options de l'extension. */
.web-settings-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.36); display: flex; align-items: flex-end; justify-content: center; }
.web-settings {
  width: min(480px, 100%); max-height: 85dvh; overflow-y: auto; box-sizing: border-box;
  background: var(--bg); color: var(--ink); border-radius: 18px 18px 0 0; padding: 14px 18px max(18px, env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
}
@media (min-width: 600px) { .web-settings-backdrop { align-items: center; } .web-settings { border-radius: 18px; } }
.web-settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.web-settings-head h2 { font-size: 17px; margin: 0; }
.web-settings section { padding: 12px 0; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 10px; }
.web-settings-who { font-size: 14px; color: var(--muted, var(--ink)); overflow-wrap: anywhere; }
.web-settings-signout { align-self: flex-start; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: #d93025; font: inherit; font-weight: 600; cursor: pointer; }
.web-settings-signin { align-self: flex-start; padding: 9px 18px; border-radius: 999px; border: 0; background: var(--grad, #1a73e8); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.web-settings-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.web-settings-check input { width: 18px; height: 18px; }
.web-settings-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.web-settings-instr { font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); resize: vertical; }

/* « MonAssocie » cliquable : recharge l'interface (dernière version). */
.topbar .brand[role="button"] { cursor: pointer; border-radius: 10px; }
.topbar .brand[role="button"]:hover { opacity: 0.8; }
.topbar .brand[role="button"]:focus-visible { outline: 2px solid var(--accent, #1a73e8); outline-offset: 2px; }

/* Permissions (réglages) : regroupées par fournisseur, un interrupteur par permission. */
.web-settings-perms, .web-settings-adv, .perm-back { align-self: flex-start; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.perm-back { margin: 4px 0 10px; font-weight: 500; }
.perm-view { display: flex; flex-direction: column; gap: 14px; }
.perm-intro { margin: 0; font-size: 13px; color: var(--muted, var(--ink)); }
.perm-group { border: 1px solid var(--border-soft); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.perm-provider { font-size: 14px; margin: 2px 0 4px; }
.perm-note { margin: 0; font-size: 12.5px; color: var(--muted, var(--ink)); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border-soft); cursor: pointer; }
.perm-row:first-of-type { border-top: 0; }
.perm-text { display: flex; flex-direction: column; min-width: 0; }
.perm-label { font-size: 14px; }
.perm-sub { font-size: 12px; color: var(--muted, var(--ink)); overflow-wrap: anywhere; }
.perm-switch { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 40px; height: 24px; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
.perm-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.perm-switch:checked { background: var(--accent, #1a73e8); }
.perm-switch:checked::after { transform: translateX(16px); }
.perm-switch:disabled { opacity: 0.5; }
.perm-switch:focus-visible { outline: 2px solid var(--accent, #1a73e8); outline-offset: 2px; }
.perm-link { font-size: 12.5px; color: var(--accent, #1a73e8); margin-top: 6px; }

/* Historique : « Voir plus » sous les 5 conversations les plus récentes d'un dossier. */
.h-more { display: block; margin: 2px 0 6px 28px; padding: 5px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--accent, #1a73e8); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.h-more:hover { background: var(--surface); }

/* Diagrammes Mermaid : dessinés dans la bulle, code accessible par « Code ». */
.mermaid-view { padding: 12px; overflow-x: auto; text-align: center; background: var(--bg); color: var(--muted); font-size: 12.5px; }
.mermaid-view svg { max-width: 100%; height: auto; }
/* Diagramme SVG du modèle : rendu en <img> (isolé du thème de la page) -> fond clair de repli pour
   rester lisible en mode sombre si le SVG n'a pas son propre fond. Le skill demande au modèle d'inclure
   un fond + des contrastes lisibles. */
.svg-block { padding: 0; }
.svg-view { display: block; width: 100%; max-height: 520px; object-fit: contain; padding: 12px;
  background: #fff; border-radius: 0 0 12px 12px; }
.mermaid-zoom { margin-left: auto; margin-right: 4px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; opacity: 0.8; }
.mermaid-zoom:hover { opacity: 1; }
.mermaid-toggle { margin-right: 6px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; opacity: 0.8; }
.mermaid-toggle:hover { opacity: 1; }
.mermaid-note { padding: 6px 12px 10px; font-size: 12px; color: var(--muted); }

/* Diagramme en plein écran : zoom (boutons, molette, pincement) et déplacement. */
.mermaid-full { position: fixed; inset: 0; z-index: 2000; background: var(--bg); display: flex; flex-direction: column; }
.mermaid-full-stage { flex: 1; overflow: hidden; touch-action: none; cursor: grab; position: relative; }
.mermaid-full-stage:active { cursor: grabbing; }
.mermaid-full-canvas { position: absolute; inset: 0; padding: 24px; box-sizing: border-box; transform-origin: 0 0; }
.mermaid-full-canvas svg { width: 100%; height: 100%; max-width: none !important; }
.mermaid-full-bar { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
.mermaid-full-bar button { min-width: 44px; height: 40px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.mermaid-full-bar button:hover { background: var(--bg); }

/* Réponses cliquables sous les questions de l'agent (bloc « choix », voir choices.ts) */
.choices { margin: 10px 0 4px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.ch-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.ch-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.choice, .ch-default, .ch-send, .ch-auto {
  font: inherit; font-size: 13px; border-radius: 999px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--elevated); color: var(--ink);
}
.choice:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.choice.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.ch-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-send { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ch-send:disabled { opacity: .45; cursor: default; }
.ch-default { color: var(--muted); }
.choices.done { opacity: .55; }
.choices.done .choice:not(.selected), .choices.done .ch-default, .choices.done .ch-auto { display: none; }
.ch-auto { font-weight: 600; color: #7b4dff; border-color: rgba(123, 77, 255, .35); }
.choices button:disabled { cursor: default; }
.ch-hint { font-weight: 400; opacity: .8; }
.ch-free-row { display: flex; gap: 6px; margin-top: 8px; }
.ch-free { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--elevated); color: var(--ink); }
.ch-free:focus { outline: none; border-color: var(--accent); }
.ch-free-send { font: inherit; font-size: 13px; border-radius: 10px; padding: 0 12px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; }
/* Raccourcis « Choisis pour moi / Va jusqu'au bout » : de simples liens */
.ch-links { display: inline-flex; flex-wrap: wrap; gap: 2px 14px; margin-right: auto; }
.choices .ch-links .ch-default, .choices .ch-links .ch-auto { border: 0; background: none; padding: 2px 0; border-radius: 0; font-size: 12.5px; white-space: nowrap; font-weight: 500; color: var(--muted); }
.choices .ch-links .ch-default:hover, .choices .ch-links .ch-auto:hover { color: var(--accent-ink); text-decoration: underline; }
.choices.done .ch-links { display: none; }

/* Formulaire par étapes : onglets classiques, réponses en liste (radio / cases), un seul bouton principal */
.ch-form { border: 1px solid var(--border); border-radius: 12px; padding: 0 14px 12px; background: var(--elevated); }
.ch-tabs { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.ch-tabs::-webkit-scrollbar { display: none; }
.ch-tab { flex: none; position: relative; font: inherit; font-size: 13px; padding: 10px 0 9px; border: 0; border-radius: 0; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ch-tab:hover { color: var(--ink); }
.ch-tab.current { color: var(--accent-ink); font-weight: 600; }
.ch-tab.current::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.ch-tab.answered::before { content: "✓ "; color: var(--accent-ink); font-weight: 600; }
.ch-tab.partial::before { content: "• "; color: var(--accent-ink); }
.ch-tab-send { margin-left: auto; }
/* Onglets qui débordent : défilement horizontal, fondu + flèches ‹ › sur le côté encore caché */
.ch-tabs-wrap { position: relative; min-width: 0; }
.ch-arrow { position: absolute; top: 0; bottom: 1px; z-index: 2; width: 34px; border: 0; padding: 0; font: inherit; font-size: 20px; line-height: 1; color: var(--ink); cursor: pointer; }
.ch-arrow[hidden] { display: none; }
.ch-arrow-l { left: 0; text-align: left; background: linear-gradient(to right, var(--elevated) 55%, transparent); }
.ch-arrow-r { right: 0; text-align: right; background: linear-gradient(to left, var(--elevated) 55%, transparent); }
.ch-arrow:hover { color: var(--accent-ink); }
.ch-body { padding: 14px 0 6px; }
.ch-step { display: grid; gap: 18px; }
.ch-step[hidden] { display: none; }
.ch-review { gap: 0; }
:is(.ch-form, .ask-dock) .ch-label { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
:is(.ch-form, .ask-dock) .ch-opts { display: grid; gap: 2px; }
:is(.ch-form, .ask-dock) .choice {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; font-size: 13.5px;
  padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer;
}
:is(.ch-form, .ask-dock) .choice::before { content: ""; flex: none; width: 16px; height: 16px; box-sizing: border-box; border: 1.5px solid var(--muted); border-radius: 50%; }
:is(.ch-form, .ask-dock) [data-multi] .choice::before { border-radius: 4px; }
:is(.ch-form, .ask-dock) .choice:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
:is(.ch-form, .ask-dock) .choice.selected { background: none; color: var(--ink); font-weight: 600; }
:is(.ch-form, .ask-dock) .choice.selected::before { border: 5px solid var(--accent); }
:is(.ch-form, .ask-dock) [data-multi] .choice.selected::before { border: 0; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
:is(.ch-form, .ask-dock) .ch-free-row { margin: 4px 0 0 34px; }
:is(.ch-form, .ask-dock) .ch-q:not(:has(.choice)) .ch-free-row { margin-left: 0; }
:is(.ch-form, .ask-dock) .ch-free { border-radius: 8px; padding: 6px 10px; background: transparent; }
.ch-rev { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 10px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.ch-rev:last-child { border-bottom: 0; }
.ch-rev span:first-child { color: var(--muted); }
.ch-rev.empty span:last-child { color: var(--muted); font-style: italic; }
.ch-nav { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ch-nav [hidden] { display: none; }
.ch-prev { font: inherit; font-size: 13px; border: 0; background: none; color: var(--muted); padding: 7px 8px; cursor: pointer; }
.ch-prev:hover { color: var(--ink); }
.ch-next, .ch-form .ch-send { font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; border-radius: 8px; padding: 7px 16px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.ch-summary { white-space: pre-line; font-size: 13px; color: var(--muted); padding-top: 12px; }
.choices.ch-form.done { opacity: 1; }
.choices.ch-form.done > :not(.ch-summary) { display: none; }

/* Interrupteur « Autonome » (barre de saisie) */
.auto-chip {
  font: inherit; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--muted); white-space: nowrap;
}
.auto-chip.active { background: var(--grad); border-color: transparent; color: #fff; }

/* Choix de la voix de lecture (paramètres du panneau) */
.web-settings-voice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 10px; font-size: 14px; }
.voice-opt { font: inherit; font-size: 13px; border: 1px solid var(--border); background: var(--elevated); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.voice-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Réglages en onglets (Compte / Profil / Voix / Permissions) */
.web-settings-tabs { display: flex; gap: 4px; padding: 4px; margin: 4px 0 12px; background: var(--surface); border-radius: 999px; }
.web-settings-tabs button { flex: 1; font: inherit; font-size: 13px; font-weight: 500; border: 0; background: transparent;
  color: var(--muted); padding: 7px 6px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.web-settings-tabs button.active { background: var(--elevated); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.web-settings-hint { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin: 2px 0 6px; line-height: 1.4; }
.web-settings-label > span { font-weight: 600; }
.web-settings-listen { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--accent); color: var(--accent-ink);
  background: transparent; border-radius: 999px; padding: 6px 14px; cursor: pointer; margin: 2px 0 12px; }
.web-settings:has(.web-settings-tabs) { height: min(84vh, 680px); overflow-y: auto; } /* hauteur fixe : pas de saut entre onglets */

/* Limite d'utilisation atteinte (au lieu de l'erreur brute du proxy) */
.row.quota .quota-card { background: var(--warn-bg); color: var(--ink); border: 1px solid rgba(138, 90, 0, .25); border-radius: 16px; padding: 14px 16px; max-width: 92%; }
.quota-title { font-weight: 700; color: var(--warn-ink); margin-bottom: 4px; }
.quota-card p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.45; }
.quota-btn { font: inherit; font-size: 13px; font-weight: 600; border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer; background: var(--accent); color: #fff; }
.quota-btn:disabled { background: transparent; color: var(--ok-ink, #137333); border: 1px solid currentColor; cursor: default; }

/* Raccourcis (écran d'accueil + fenêtre des [variables]) */
.shortcuts-row { margin: 4px 0 14px; display: grid; gap: 8px; }
.shortcuts-row[hidden] { display: none; }
.sc-row-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-chip:hover { border-color: var(--accent); }
.sc-ic { flex: none; }
.sc-modal-back { position: fixed; inset: 0; z-index: 1500; background: rgba(0, 0, 0, .4); display: grid; place-items: center; padding: 16px; }
.sc-modal { width: min(420px, 100%); background: var(--elevated); color: var(--ink); border-radius: 18px; padding: 18px; display: grid; gap: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.sc-modal-h { font-weight: 600; font-size: 16px; }
.sc-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.sc-field input { border: 1px solid var(--border); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 15px; }
.sc-modal-btns { display: flex; justify-content: flex-end; gap: 8px; }
.sc-modal-btns .dev-primary { justify-self: auto; }

/* Panneau Automatisations */
.auto-list { display: grid; gap: 6px; }
.auto-item { display: flex; align-items: flex-start; gap: 4px; border: 1px solid var(--border-soft); background: var(--bg); border-radius: 14px; padding: 6px; }
.auto-item.off { opacity: .6; }
.auto-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; padding: 4px 6px; cursor: pointer; }
div.auto-main { cursor: default; }
.auto-title { font-weight: 500; overflow-wrap: anywhere; }
.auto-sub { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.auto-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.auto-x:hover { background: var(--surface); color: var(--ink); }
.auto-x:disabled { opacity: .4; }
.auto-last { font-size: 12px; color: var(--muted); margin-top: 2px; }
.auto-last summary { cursor: pointer; }
.auto-last p { margin: 4px 0 0; white-space: pre-wrap; }
.auto-form { display: grid; gap: 8px; }
.auto-form input, .auto-form textarea, .auto-form select { border: 1px solid var(--border); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; min-width: 0; }
.auto-form textarea { resize: vertical; }
.auto-row { display: flex; flex-wrap: wrap; gap: 6px; }
.auto-row > [hidden] { display: none; }

/* Mon compte : abonnement et consommation */
.bill-cur { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bill-plan { font-size: 18px; font-weight: 600; }
.bill-price { color: var(--muted); font-size: 13px; }
.bill-use { font-size: 13px; }
.bill-bar { height: 8px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.bill-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s; }
.bill-fill.warm { background: #f9ab00; }
.bill-fill.hot { background: var(--danger); }
.bill-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 4px; }
.bill-card { display: grid; align-content: start; gap: 6px; border: 1px solid var(--border-soft); background: var(--bg); border-radius: 14px; padding: 12px; }
.bill-card.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bill-card-h { font-weight: 600; }
.bill-card-p { font-size: 13px; color: var(--muted); }
.bill-feat { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); display: grid; gap: 2px; }
.bill-tag { font-size: 12px; font-weight: 600; color: var(--accent); }
.bill-card .dev-primary { font-size: 13.5px; padding: 8px 12px; }
.quota-up { margin-left: 8px; background: transparent; }
.auto-runlist { display: grid; gap: 4px; margin-top: 6px; }
.auto-run { display: grid; gap: 2px; text-align: left; border: 1px solid var(--border-soft); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 6px 8px; font: inherit; cursor: pointer; }
.auto-run:hover { border-color: var(--accent); }
.auto-run-h { font-size: 12.5px; font-weight: 500; }

/* Commande à distance : écran de l'ordinateur vu depuis le téléphone (dernière capture). */
.remote-screen { display: block; max-width: 100%; max-height: 40vh; margin: 6px 0 10px; border: 1px solid var(--border-soft); border-radius: 12px; object-fit: contain; cursor: zoom-in; background: var(--surface); }
.remote-screen[hidden] { display: none; }
.remote-screen.zoom { position: fixed; inset: 0; z-index: 1000; max-width: none; max-height: none; width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; background: rgba(0, 0, 0, .9); cursor: zoom-out; }

/* Outil ask_user : formulaire ancré au-dessus de la zone de saisie (voir choices.ts askForm) */
.ask-dock { margin: 0 12px 8px; max-height: min(62vh, 560px); overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--elevated); box-shadow: 0 8px 28px rgba(0, 0, 0, .14); animation: ask-in .18s ease-out; }
.ask-dock[hidden] { display: none; }
@keyframes ask-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ask-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 10px 0 14px; background: var(--elevated); }
.ask-title { flex: 1; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.ask-later { font: inherit; font-size: 14px; line-height: 1; color: var(--muted); background: none; border: 0; cursor: pointer; width: 28px; height: 28px; border-radius: 8px; }
.ask-later:hover { color: var(--ink); background: var(--surface); }
.ask-dock .choices { margin: 0; }
.ask-dock .ch-form { border: 0; border-radius: 0; background: transparent; padding: 0 14px 12px; }
.ask-dock .choices[data-n="1"] { padding: 8px 14px 12px; }
.ask-dock .ch-tabs-wrap { position: sticky; top: 38px; z-index: 1; background: var(--elevated); }
/* Carte « formulaire en attente » dans la conversation : rouvre le formulaire */
.ask-card { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--elevated); font-size: 13px; color: var(--ink); }
.ask-card span { flex: 1; min-width: 0; }
.ask-card button { flex: none; font: inherit; font-size: 13px; font-weight: 600; border-radius: 8px; padding: 6px 14px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; }


.privacy-action { display: block; width: 100%; border: 1px solid #bbb; border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.privacy-action:disabled { cursor: default; opacity: .5; }
.privacy-action:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* A pending Store update is visible without interrupting work or discarding files. */
#extension-update-notice { flex-shrink: 0; padding: 10px 14px; font-size: 12px; line-height: 1.45; background: #fff3cd; color: #493500; border-bottom: 1px solid #dcc887; }

/* Mathematical layout uses native MathML, including stacked fractions. */
.md-math { font-size: 1.08em; }
.md-math-display { display: block; overflow-x: auto; max-width: 100%; padding: .65em .2em; margin: .4em 0; }
.md-math math { font-family: 'Cambria Math', 'STIX Two Math', math; }

/* Automatisations : une vue à la fois, formulaires lisibles en panneau étroit. */
#automations-body { gap: 18px; }
.auto-intro { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.auto-tabs { display: flex; border-bottom: 1px solid var(--border); gap: 4px; }
.auto-tab { flex: 1; padding: 11px 5px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.auto-tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.auto-tab:hover { background: var(--surface); }
.auto-section { display: grid; gap: 14px; padding: 0; border: 0; background: none; }
.auto-section > .dev-h { font-size: 18px; font-weight: 600; margin: 2px 0 0; }
.auto-section > .dev-note { margin: -6px 0 0; }
.auto-section > .dev-btn { justify-self: start; }
.auto-content { min-width: 0; }
.auto-list { gap: 12px; }
.auto-item { display: grid; padding: 12px; gap: 10px; border-radius: 12px; }
.auto-main { padding: 0; gap: 5px; }
.auto-title { font-size: 14px; font-weight: 600; }
.auto-sub { line-height: 1.5; -webkit-line-clamp: 4; }
.auto-item-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.auto-x { width: auto; min-height: 32px; height: auto; border-radius: 7px; padding: 5px 8px; font-size: 12px; }
.auto-delete:hover { color: var(--danger); }
.auto-form { padding: 16px; gap: 17px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; min-width: 0; }
.auto-form-title { margin: 0; font-size: 16px; font-weight: 600; }
.auto-field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.auto-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.auto-hint { font-size: 12px; line-height: 1.45; color: var(--muted); margin: 0; }
.auto-field input, .auto-field textarea, .auto-field select { width: 100%; min-height: 42px; padding: 10px; background: var(--bg); }
.auto-form :is(input, select, textarea):focus-visible, .auto-tab:focus-visible, .auto-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auto-grid, .auto-conditions { display: grid; gap: 14px; min-width: 0; }
.auto-preview { margin: 0; padding: 11px 12px; border-left: 3px solid var(--accent); background: var(--bg); color: var(--ink); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.auto-consent { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.auto-consent input { width: 16px; min-height: 16px; height: 16px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.auto-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.auto-form .dev-err:empty { display: none; }
.auto-form .dev-primary { background: var(--accent); color: var(--bg); }
@media (min-width: 560px) { .auto-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.auto-backdrop { position: fixed; inset: 0; z-index: 1099; background: rgb(0 0 0 / 35%); animation: auto-backdrop-in .18s ease-out; }
#automations-panel { position: fixed; inset: auto 0 0; width: 100%; max-height: 92dvh; margin: 0; z-index: 1100; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-soft); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -8px 40px rgb(0 0 0 / 14%); animation: auto-sheet-in .24s cubic-bezier(.2,.8,.2,1); }
#automations-panel::before { content: ""; flex: none; width: 32px; height: 4px; margin: 9px auto 0; border-radius: 4px; background: var(--border); }
#automations-panel > .history-head { flex: none; padding: 8px 18px 12px; }
#automations-body { overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px max(20px, env(safe-area-inset-bottom)); }
@keyframes auto-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes auto-backdrop-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #automations-panel, .auto-backdrop { animation: none; } }
#automations-panel:focus { outline: none; }
.auto-section > .dev-h { text-transform: none; letter-spacing: normal; color: var(--ink); }

/* ── Suggestions, missions, journal, équipe ─────────────────────────────────────────────────────── */
.suggest-card { max-width: 420px; align-items: stretch; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px; padding: 14px; }
.suggest-card .connect-desc { font-weight: 500; }
.suggest-quote { color: var(--muted); font-style: italic; font-size: 13px; overflow-wrap: anywhere; }
.suggest-select { width: 100%; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--elevated); color: var(--ink); }
.suggest-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.suggest-alt { background: none; border: 1px solid var(--border); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.suggest-alt:hover { background: var(--surface-2); }
.mission-sectors { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.mission-sector { border: 1px solid var(--border); background: none; color: var(--ink); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.mission-sector[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.mission-list { display: grid; gap: 10px; }
/* Audit du quotidien (onglet Automatisations › Audit) */
.audit-body { display: grid; gap: 10px; }
.audit-status { margin: 0; font-weight: 600; }
.audit-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.audit-actions { display: grid; gap: 8px; }
.audit-actions .dev-btn:not(.dev-primary) { justify-self: stretch; }
.mission-card { border: 1px solid var(--border-soft); border-radius: 14px; padding: 12px; display: grid; gap: 6px; background: var(--surface); }
.mission-card .auto-sub { white-space: normal; }
.mission-needs { margin: 0; font-size: 12px; color: var(--muted); }
.journal-list { display: grid; gap: 10px; }
.journal-day { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: capitalize; margin-top: 8px; }
.journal-item { border: 1px solid var(--border-soft); border-radius: 14px; padding: 12px; display: grid; gap: 6px; }
.journal-item.off { opacity: .75; }
.journal-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.journal-badge { background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.journal-summary { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.journal-shot { max-width: 100%; border-radius: 10px; border: 1px solid var(--border-soft); max-height: 140px; object-fit: cover; object-position: top; cursor: zoom-in; }
.journal-shot.zoom { max-height: none; cursor: zoom-out; }
.journal-actions summary { cursor: pointer; font-size: 13px; }
.journal-actions ol { margin: 6px 0 0; padding-left: 20px; font-size: 12px; display: grid; gap: 2px; }
.journal-risky { color: #b3261e; }
.team-invite { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.team-link { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.team-link input { flex: 1 1 200px; min-width: 0; }
.devices-body .auto-form input, .devices-body .auto-form textarea, .devices-body .auto-form select { width: 100%; box-sizing: border-box; }
.devices-body select { padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--elevated); color: var(--ink); font: inherit; font-size: 13px; }
.devices-body .dev-note:empty { display: none; }
.team-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ── Graphiques et encadrés des réponses (lib/charts.ts, ```chart) ──────────────────────────────
   Palette catégorielle validée (daltonisme, contraste) sur les fonds clair #fff et sombre #1b1c1d ;
   l'ordre des couleurs fait partie de la validation : ne pas le changer. */
:root {
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948;
  --good: #137333; --bad: #c5221f;
}
:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
    --good: #81c995; --bad: #f28b82;
  }
}
:root[data-theme="dark"] {
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --good: #81c995; --bad: #f28b82;
}
.chart { margin: 12px 0; padding: 14px 14px 10px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--bg); }
.chart-pending { color: var(--muted); font-size: 13px; }
.chart-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.chart-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
.chart-svg text { font-size: 11.5px; }
.chart-tick { fill: var(--muted); }
.chart-label { fill: var(--ink); }
.chart-value { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-center { fill: var(--ink); font-size: 18px !important; font-weight: 600; }
.chart-grid { stroke: var(--border-soft); stroke-width: 1; fill: none; }
.chart-base { stroke: var(--border); }
.chart-mark { transition: opacity .12s; }
.chart-slice { stroke: var(--bg); stroke-width: 2; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: .14; }
.chart-dot { stroke: var(--bg); stroke-width: 2; }
.chart-hit { fill: transparent; cursor: default; }
.chart-radar { fill-opacity: .14; stroke-width: 2; stroke-linejoin: round; }
.chart:hover .chart-mark:not(:hover) { opacity: .75; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink); margin-bottom: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-data { margin-top: 6px; font-size: 12.5px; }
.chart-data summary { cursor: pointer; color: var(--muted); width: max-content; }
.chart-data table { margin-top: 6px; }
.chart-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.chart-kpi { background: var(--surface); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.chart-kpi-label { color: var(--muted); font-size: 12.5px; }
.chart-kpi-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.chart-kpi-delta { font-size: 12.5px; color: var(--muted); }
.chart-kpi-delta.up { color: var(--good); }
.chart-kpi-delta.down { color: var(--bad); }
.chart-kpi-note { color: var(--muted); font-size: 12px; }
.chart-tooltip { position: fixed; z-index: 9999; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 5px 9px; border-radius: 8px; box-shadow: var(--shadow); max-width: 260px; }
.callout { margin: 10px 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface); }
.callout-head { font-weight: 600; }
.callout-body { margin-top: 4px; }
.callout-body > :first-child { margin-top: 0; }
.callout-tip { background: var(--grad-soft); }
.callout-success { border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.callout-warning { background: var(--warn-bg); border-color: transparent; }
.callout-warning .callout-head { color: var(--warn-ink); }
.callout-danger { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.callout-danger .callout-head { color: var(--bad); }
