:root {
  --bg: #ffffff;
  --bg2: #f5f5f4;
  --t1: #1c1c1c;
  --t2: #6b6b6b;
  --line: #e5e5e5;
  --accent: #1c1c1c;
  --accent-fg: #ffffff;
  --error: #c0392b;
  --surface: #ffffff;
  --surface-border: #e6e6e4;
  --surface-shadow: 0 2px 6px rgb(0 0 0 / .05), 0 10px 32px rgb(0 0 0 / .09);
  --thumb: #ffffff; /* curseur des choix segmentés */
  --table-head: color-mix(in srgb, var(--t1) 7%, var(--bg2));
  --table-stripe: color-mix(in srgb, var(--bg) 55%, var(--bg2));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616;
    --bg2: #212121;
    --t1: #ececec;
    --t2: #9a9a9a;
    --line: #2e2e2e;
    --accent: #ececec;
    --accent-fg: #161616;
    --surface: #222222;
    --surface-border: rgb(255 255 255 / .1);
    --surface-shadow: 0 10px 32px rgb(0 0 0 / .45);
    --thumb: #3a3a3a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161616;
  --bg2: #212121;
  --t1: #ececec;
  --t2: #9a9a9a;
  --line: #2e2e2e;
  --accent: #ececec;
  --accent-fg: #161616;
  --surface: #222222;
  --surface-border: rgb(255 255 255 / .1);
  --surface-shadow: 0 10px 32px rgb(0 0 0 / .45);
  --thumb: #3a3a3a;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--t1);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
[hidden] { display: none !important; }
h1, h2 { margin: 0 0 4px; font-weight: 600; }
.muted { color: var(--t2); margin: 0; font-size: 14px; }
.error { color: var(--error); margin: 0; font-size: 14px; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--accent);
  color: var(--accent-fg);
}
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--bg2); color: var(--t1); }
button.link { background: none; color: var(--t2); padding: 4px 0; text-align: left; }
button.link:hover { color: var(--t1); }

input, textarea, select {
  font: inherit;
  color: var(--t1);
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--t2); }
label { display: grid; gap: 4px; font-size: 14px; color: var(--t2); }

.card { display: grid; gap: 14px; width: min(380px, 100%); }
.row { display: flex; gap: 8px; justify-content: flex-end; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-weight: 500; color: var(--t2); padding: 0 8px 6px 0; }
table.users td { padding: 6px 8px 6px 0; vertical-align: middle; }
table.users td.email { color: var(--t2); overflow-wrap: anywhere; }
table.users select { padding: 5px 8px; width: auto; }
table.users td:last-child { text-align: right; }
table.users button.link { padding: 0; }

/* Identité de l'entreprise */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 2px 2px 4px; }
.brand-logo { max-height: 28px; max-width: 140px; width: auto; height: auto; object-fit: contain; }
.brand-name { max-width: 100%; }
.brand-name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-auth { gap: 12px; padding: 0; }
.brand-auth .brand-logo { max-height: 40px; max-width: 160px; }
.brand-auth .brand-name { font-size: 24px; white-space: normal; }
.hint { margin-top: 0 !important; font-size: 13px; }
.logo-edit { display: flex; gap: 14px; align-items: center; }
.logo-preview {
  width: 120px;
  height: 72px;
  border-radius: 10px;
  background: var(--bg2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-actions { display: grid; gap: 6px; justify-items: start; }

.switch { display: flex; align-items: center; gap: 10px; color: var(--t1); cursor: pointer; width: fit-content; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--line);
  flex-shrink: 0;
  transition: background .15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--t2); outline-offset: 2px; }


.connector-list { display: grid; gap: 10px; }
.connector { background: var(--bg2); border-radius: 10px; padding: 14px; display: grid; gap: 14px; }
.connector-head { display: flex; align-items: center; gap: 12px; }
.connector-head > div { flex: 1; min-width: 0; }
.connector-head .muted { margin: 2px 0 0 !important; font-size: 13px; }
.connector-form input, .connector button.secondary { background: var(--bg); }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; color: var(--t2); background: var(--bg); white-space: nowrap; }
.pill.on { background: var(--accent); color: var(--accent-fg); }
.row .link { margin-right: auto; }

.access { display: grid; gap: 8px; }
.radio, .check { display: flex; align-items: center; gap: 10px; color: var(--t1); cursor: pointer; width: fit-content; }
.radio input, .check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.picker { display: grid; gap: 6px; margin-left: 26px; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.picker-title { font-size: 12px; color: var(--t2); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.picker-title:first-child { margin-top: 0; }
.connector-form .check span, .picker .check span { font-size: 14px; }
.check.covered { color: var(--t2); cursor: default; }
.check.covered input { opacity: .5; }
.check .via { font-size: 12px; color: var(--t2); }

/* Connexion */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; }

/* Application */
.app { display: grid; grid-template-columns: 260px 1fr; height: 100%; }
.sidebar {
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  min-height: 0;
}
#conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#conv-list li {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--t2);
}
#conv-list li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#conv-list li:hover, #conv-list li.active { background: var(--bg); color: var(--t1); }
#conv-list li button { background: none; color: var(--t2); padding: 0 4px; visibility: hidden; }
#conv-list li:hover button { visibility: visible; }
/* Compte, en bas de la barre latérale : ouvre les paramètres. Le trait de séparation reste fixe,
   seule la carte du compte s'éclaire au survol. */
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  background: none;
  color: var(--t1);
  text-align: left;
  transition: background .15s;
}
.account:hover, .account:focus-visible { background: var(--bg); }
.avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}
.account-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.account-name, .account-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name { font-size: 14px; font-weight: 600; }
.account-role { font-size: 12px; color: var(--t2); }

.chat { display: flex; flex-direction: column; min-height: 0; }
/* Occupe la place du fil quand il est vide : centré entre le haut et la zone de saisie. */
.empty {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  padding: 16px;
  pointer-events: none;
}
.empty-title { font-size: 28px; font-weight: 600; margin: 0; }
.empty-text { margin: 0; color: var(--t2); font-size: 16px; }
.notice { margin: 14px auto 0; color: var(--t2); font-size: 14px; }
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px 56px; /* air entre le dernier message et la zone de saisie */
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { max-width: 760px; width: 100%; margin: 0 auto; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { background: var(--bg2); border-radius: 12px; padding: 10px 14px; width: auto; margin-right: max(0px, calc((100% - 760px) / 2)); align-self: flex-end; max-width: min(760px, 85%); }
.msg.error { color: var(--error); }
.msg pre { background: var(--bg2); border-radius: 8px; padding: 10px; overflow-x: auto; white-space: pre; }
.msg code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* Réflexion et outils : blocs sans cadre, chevron, voile qui balaye le libellé pendant l'activité. */
.activity { max-width: 760px; width: 100%; margin: 0 auto; color: var(--t2); font-size: 14px; }
.activity summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
}
.activity summary::-webkit-details-marker { display: none; }
.activity summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
  transition: transform .15s;
  flex-shrink: 0;
}
.activity[open] summary::before { transform: translateY(-4px) rotate(45deg); }
.activity summary:hover { color: var(--t1); }
.activity-label { flex-shrink: 0; position: relative; overflow: hidden; }
.tool-icon { flex-shrink: 0; display: inline-flex; align-self: center; margin-right: -2px; }
.tool-icon svg { width: 15px; height: 15px; display: block; }
.activity-detail {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.activity.live .activity-label::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--bg) 50%, transparent);
  opacity: .7;
  transform: translateX(-100%);
  animation: sweep 1.6s ease-in-out infinite;
}
@keyframes sweep { to { transform: translateX(100%); } }
.activity.waiting summary, .activity.locked summary { cursor: default; }
.activity.waiting summary::before, .activity.locked summary::before { display: none; }
.activity.locked summary:hover { color: inherit; }
.activity-body { margin: 8px 0 4px 14px; display: grid; gap: 8px; }
.thinking .activity-body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; max-height: 360px; overflow-y: auto; }
.activity pre { background: var(--bg2); border-radius: 8px; padding: 10px; overflow-x: auto; max-height: 320px; font-size: 13px; margin: 0; }
.tool-input { color: var(--t2); }

/* Markdown des réponses */
.msg.assistant { white-space: normal; line-height: 1.6; }
.msg.assistant > :first-child { margin-top: 0; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant p, .msg.assistant ul, .msg.assistant ol, .msg.assistant blockquote, .msg.assistant .code, .msg.assistant .table { margin: 0 0 12px; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3, .msg.assistant h4 { margin: 20px 0 8px; line-height: 1.3; font-weight: 600; }
.msg.assistant h1 { font-size: 1.4em; }
.msg.assistant h2 { font-size: 1.25em; }
.msg.assistant h3 { font-size: 1.1em; }
.msg.assistant h4, .msg.assistant h5, .msg.assistant h6 { font-size: 1em; }
.msg.assistant ul, .msg.assistant ol { padding-left: 22px; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg.assistant blockquote { padding-left: 12px; color: var(--t2); box-shadow: inset 2px 0 0 var(--line); }
.msg.assistant hr { border: 0; height: 1px; background: var(--line); margin: 16px 0; }
.msg.assistant :not(pre) > code { background: var(--bg2); border-radius: 5px; padding: 1px 5px; font-size: .88em; }
.msg.assistant .code { position: relative; }
.msg.assistant .code pre { margin: 0; }
.code-lang { position: absolute; top: 6px; right: 10px; font-size: 11px; color: var(--t2); }
/* Tableaux : fond doux et lignes alternées plutôt que des bordures. */
.msg.assistant .table { overflow-x: auto; border-radius: 10px; background: var(--bg2); }
.msg.assistant table { border-collapse: collapse; font-size: 14px; width: 100%; }
.msg.assistant th { text-align: left; font-weight: 600; background: var(--table-head); }
.msg.assistant th, .msg.assistant td { padding: 9px 14px; vertical-align: top; }
.msg.assistant tbody tr:nth-child(even) { background: var(--table-stripe); }
.msg.stopped { color: var(--t2); font-size: 14px; }

/* Zone de saisie : une carte arrondie, le bouton d'envoi rond à l'intérieur. */
.composer {
  max-width: 792px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 14px;
}
/* Fichiers joints en haut, puis trombone, texte et bouton d'envoi sur une ligne ;
   les boutons restent calés en bas quand le message s'allonge. */
.composer-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  column-gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  padding: 7px;
  box-shadow: var(--surface-shadow);
  transition: border-color .2s;
}
.composer-box.dragging { border-color: var(--t2); border-style: dashed; }
.composer-box:focus-within { border-color: color-mix(in srgb, var(--t1) 22%, var(--surface-border)); }
.composer textarea {
  display: block;
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 200px;
  background: none;
  border: 0;
  /* Une ligne fait exactement la hauteur du bouton d'envoi (6 + 24 + 6 = 36 px) : centrage parfait. */
  padding: 6px 4px;
  font-size: 15.5px;
  line-height: 24px;
}
.composer textarea:focus { border: 0; }
.composer textarea::placeholder { color: var(--t2); }
/* Même espace au-dessus et au-dessous de l'aide (14 px), la ligne de texte comptant pour elle seule. */
.composer-hint { margin: 14px 0 0; text-align: center; font-size: 12px; line-height: 1; color: var(--t2); opacity: .8; }
#send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s;
}
#send:not(:disabled):active { transform: scale(.94); }

.attach {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: none;
  color: var(--t2);
  transition: background .15s, color .15s;
}
.attach:hover { background: var(--bg2); color: var(--t1); }
.attach svg { width: 20px; height: 20px; }

/* Pastilles des fichiers joints : dans la zone de saisie (retirables) et sous un message envoyé. */
.attachments { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 8px; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 6px 8px 6px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--t1) 7%, var(--surface));
  font-size: 13px;
  overflow: hidden;
}
.chip-text { display: grid; min-width: 0; line-height: 1.25; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-meta { font-size: 11.5px; color: var(--t2); }
.chip.error .chip-meta { color: var(--error); }
.chip-remove {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: none;
  color: var(--t2);
}
.chip-remove:hover { background: color-mix(in srgb, var(--t1) 10%, transparent); color: var(--t1); }
.chip-remove svg { width: 12px; height: 12px; }
.chip-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--t2); transition: width .15s; }
.msg.user .attachments { padding: 0; }
.msg.user .attachments:not(:last-child) { margin-bottom: 8px; }
.msg.user .chip { background: color-mix(in srgb, var(--t1) 7%, var(--bg)); }
#send:disabled { opacity: .25; }
#send svg { width: 18px; height: 18px; }
#send .icon-stop, #send.stop .icon-send { display: none; }
#send.stop .icon-stop { display: block; }

/* Paramètres */
/* La fenêtre ne défile jamais elle-même (coins arrondis intacts) : seul le contenu défile. */
dialog.settings {
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--t1);
  box-shadow: var(--surface-shadow);
  width: min(820px, calc(100% - 32px));
  height: min(600px, calc(100% - 32px));
}
dialog::backdrop { background: rgb(0 0 0 / .5); backdrop-filter: blur(2px); }

/* Ouverture et fermeture en fondu, avec un léger zoom. */
dialog.settings, dialog.settings::backdrop {
  transition: opacity .2s ease, transform .2s cubic-bezier(.3, .7, .2, 1), overlay .2s allow-discrete, display .2s allow-discrete;
}
dialog.settings { opacity: 0; transform: translateY(8px) scale(.98); }
dialog.settings::backdrop { opacity: 0; }
dialog.settings[open] { opacity: 1; transform: none; }
dialog.settings[open]::backdrop { opacity: 1; }
@starting-style {
  dialog.settings[open] { opacity: 0; transform: translateY(8px) scale(.98); }
  dialog.settings[open]::backdrop { opacity: 0; }
}
.settings-layout { display: grid; grid-template-columns: 220px 1fr; height: 100%; min-height: 0; }
.settings-nav, .settings-body { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.settings-nav {
  background: var(--bg2);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav h2 { font-size: 16px; padding: 0 10px 12px; }
/* Version, en tout petit dans le coin inférieur droit de la fenêtre. */
.version { position: absolute; z-index: 2; right: 12px; bottom: 8px; font-size: 10.5px; color: var(--t2); opacity: .6; pointer-events: none; }
.settings-nav button {
  background: none;
  color: var(--t2);
  text-align: left;
  padding: 8px 10px;
}
.settings-nav button:hover { color: var(--t1); }
/* Catégories du menu : titre bien marqué, et une séparation nette avant « Administration ». */
.nav-group {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t1);
  padding: 6px 10px 6px;
}
.nav-group:first-of-type { padding-top: 0; }
.nav-group + button { margin-top: 2px; }
.nav-group.admin-group {
  margin-top: 18px;
  padding-top: 18px;
  background: linear-gradient(var(--line), var(--line)) top / 100% 1px no-repeat;
}
.settings-nav button.active { background: var(--bg); color: var(--t1); }
/* Bas du menu : déconnexion. */
.nav-foot {
  margin-top: auto;
  padding-top: 12px;
  display: grid;
  background: linear-gradient(var(--line), var(--line)) top / 100% 1px no-repeat;
}
.settings-nav button.logout:hover { color: var(--error); }
.settings-body { position: relative; padding: 28px 32px; }
.settings-body section { display: grid; gap: 16px; align-content: start; }
.settings-body h3 { margin: 0; font-size: 18px; font-weight: 600; }
.settings-body .muted { margin-top: -10px; }
/* Fixée au coin de la fenêtre, hors de la zone qui défile. */
.close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg); /* le texte qui défile passe derrière sans gêner la lecture */
  color: var(--t2);
}
.close svg { width: 18px; height: 18px; }
.close:hover { color: var(--t1); background: var(--bg2); }

/* Retour au menu des paramètres : mobile seulement. */
.back {
  display: none;
  align-items: center;
  gap: 2px;
  width: fit-content;
  margin: 0 0 14px -6px;
  padding: 6px 8px 6px 2px;
  background: none;
  color: var(--t2);
  font-size: 15px;
}
.back svg { width: 20px; height: 20px; }
.back:hover { color: var(--t1); }
@keyframes section-in { from { opacity: 0; transform: translateX(12px); } }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 8px; }
.field-label { font-size: 14px; color: var(--t1); font-weight: 500; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.status { margin: 0; font-size: 14px; color: var(--t2); }
.status.error { color: var(--error); }

/* Choix segmenté : un curseur unique glisse sous l'option active (--i : son rang, --n : le nombre d'options). */
.segmented {
  --gap: 2px;
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--gap);
  padding: 3px;
  border-radius: 10px;
  background: var(--bg2);
  width: fit-content;
}
.segmented::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px - (var(--n) - 1) * var(--gap)) / var(--n));
  border-radius: 8px;
  background: var(--thumb);
  box-shadow: 0 1px 3px rgb(0 0 0 / .12);
  transform: translateX(calc(var(--i) * (100% + var(--gap))));
  transition: transform .25s cubic-bezier(.3, .7, .2, 1);
}
.segmented button { position: relative; background: none; color: var(--t2); padding: 7px 16px; border-radius: 8px; transition: color .2s; }
.segmented button.active { color: var(--t1); }

/* Changement de thème : fondu de toute la page d'un seul bloc (View Transitions), sans faire
   transiter chaque élément un par un, ce qui provoquait un léger clignotement. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; animation-timing-function: ease; }
/* Le sélecteur de thème reste vivant pendant le fondu : son curseur glisse sans être dédoublé. */
#theme-choice { view-transition-name: theme-choice; }
::view-transition-old(theme-choice) { display: none; }
::view-transition-new(theme-choice) { animation: none; }
::view-transition-group(theme-choice) { animation: none; }

.info { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.info dt { color: var(--t2); }
.info dd { margin: 0; }

/* Barre du haut et menu burger : mobile seulement */
.topbar { display: none; }
.backdrop { display: none; }
.burger {
  background: none;
  width: 40px;
  height: 40px;
  padding: 10px;
  display: grid;
  align-content: center;
  gap: 4px;
}
.burger span { display: block; height: 2px; border-radius: 2px; background: var(--t1); }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .app.menu-open .sidebar { transform: none; }
  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgb(0 0 0 / .4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .app.menu-open .backdrop { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
  .topbar-title { font-size: 15px; }
  .messages { padding-top: 8px; }
  /* Paramètres en plein écran, sur deux niveaux : le menu, puis la section choisie. */
  dialog.settings { width: 100%; height: 100%; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { padding: 20px 12px 16px; }
  .settings-nav button { padding: 11px 10px; font-size: 15px; }
  .settings-nav button.active { background: none; color: var(--t2); }
  .settings-body { padding: 16px 16px 28px; }
  .settings:not(.section-open) .settings-body, .settings.section-open .settings-nav { display: none; }
  .settings.section-open .settings-body { animation: section-in .2s ease; }
  .back { display: inline-flex; }
  .grid2 { grid-template-columns: 1fr; }
  .composer-hint { display: none; }
  .composer { padding: 0 10px 10px; }
  table.users td.email, table.users th:nth-child(2) { display: none; }
}

/* Validation d'une action sensible demandée par l'IA */
.confirm { max-width: 760px; width: 100%; margin: 0 auto; background: var(--bg2); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.confirm dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.confirm dt { color: var(--t2); }
.confirm dd { margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto; }
.confirm p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, dialog::backdrop { transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Lien de téléchargement d'un fichier du dossier de travail, dans une réponse de l'IA. */
.file-link { font-weight: 500; }
.file-link::before { content: "↓ "; }
