/* MJSummary — interface « graphite » : coque à barre latérale, un seul accent.
   Thème sombre par défaut ; [data-theme="light"] sur <html> pour le clair. */

@font-face { font-family: "Geist"; src: url("/static/vendor/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0F1115; --side: #0B0D10; --pane: #0C0E12;
  --surface: #161A20; --surface-2: #1C2129; --surface-3: #1F2630; --sunken: #11141A;
  --line: #1E232B; --line-2: #262C35;
  --text: #E8EAED; --text-2: #D6DAE0; --muted: #A3ABB7; --faint: #7C8594; --ghost: #5F6875;
  --accent: #2DD4BF; --accent-hi: #5EEAD4; --on-accent: #04201C;
  --accent-soft: rgba(45, 212, 191, 0.12); --accent-line: rgba(45, 212, 191, 0.42);
  --ok: #34D399; --warn: #F5A524; --err: #F87171; --low: #94A3B8;
  --warn-soft: rgba(245, 165, 36, 0.16); --err-soft: rgba(248, 113, 113, 0.16); --low-soft: rgba(148, 163, 184, 0.18);
  --doc-white: #F7F7F5;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* chasse fixe du système : la police web Geist Mono restait en échec de
     chargement, y compris en production */
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
  --radius: 12px; --side-w: 264px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F7F7F5; --side: #EFEFEC; --pane: #FFFFFF;
  --surface: #FFFFFF; --surface-2: #EDEDEA; --surface-3: #E6EBEF; --sunken: #F1F1EE;
  --line: #E3E3DF; --line-2: #D6D6D1;
  --text: #15181D; --text-2: #2A2F37; --muted: #555D69; --faint: #6B7280; --ghost: #8B929C;
  --accent: #0F766E; --accent-hi: #0D9488; --on-accent: #FFFFFF;
  --accent-soft: rgba(15, 118, 110, 0.09); --accent-line: rgba(15, 118, 110, 0.4);
  --ok: #059669; --warn: #B45309; --err: #DC2626; --low: #64748B;
  --warn-soft: rgba(217, 119, 6, 0.14); --err-soft: rgba(220, 38, 38, 0.11); --low-soft: rgba(100, 116, 139, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.ic { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; } .ic.lg { width: 19px; height: 19px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.spacer { flex-grow: 1; }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--accent);
  border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- boutons ---- */
.btn { height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  background: none; border: 1px solid var(--line-2); border-radius: 10px; color: var(--text);
  font-size: 13px; transition: background .15s, border-color .15s, color .15s; text-decoration: none; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.big { height: 46px; padding: 0 22px; border-radius: 12px; font-size: 15px; gap: 10px; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, transparent); }
.btn.quiet { border-color: transparent; color: var(--faint); }
.btn.quiet:hover { color: var(--text); background: var(--surface-2); }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 8px; color: var(--faint); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---- pastilles de choix ---- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-2); color: var(--muted); font-size: 13px;
  transition: background .15s, border-color .15s, color .15s; }
.pill:hover { border-color: var(--faint); color: var(--text); }
.pill[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
:root[data-theme="light"] .pill[aria-pressed="true"] { color: var(--accent); }
.pill .ic.check { display: none; width: 13px; height: 13px; stroke-width: 2.6; }
.pills.multi .pill[aria-pressed="true"] .ic.check { display: block; }
.pill .count { font-family: var(--mono); font-size: 11.5px; opacity: .75; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---- écran de connexion ---- */
#auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 16px; padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; letter-spacing: -.02em; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.auth-card h2 { font-size: 20px; margin: 22px 0 4px; letter-spacing: -.01em; }
.auth-card .lead { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.field-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); margin: 14px 0 6px; }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--line-2); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--accent-line); }
.auth-card .btn.primary { width: 100%; justify-content: center; height: 42px; margin-top: 20px; }
#auth-error { display: none; margin-top: 14px; font-size: 13px; color: var(--err); }
#auth-switch { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }
#auth-switch a { cursor: pointer; text-decoration: none; }

/* ---- coque ---- */
.shell { display: flex; height: 100vh; overflow: hidden; }
#sidebar { width: var(--side-w); flex-shrink: 0; display: flex; flex-direction: column; background: var(--side);
  border-right: 1px solid var(--line); font-size: 14px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 12px 16px; }
.side-new { margin: 0 12px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); color: var(--text);
  font-weight: 500; text-align: left; }
.side-new:hover { border-color: var(--faint); }
.kbd { font-family: var(--mono); font-size: 11px; color: var(--faint); border: 1px solid var(--line-2);
  border-radius: 5px; padding: 0 5px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 8px;
  background: none; border: 0; color: var(--muted); text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.side-search { margin: 8px 12px 4px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); color: var(--faint); }
.side-search input { flex-grow: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13px; }
#recents { flex-grow: 1; overflow-y: auto; padding: 6px 12px 12px; }
.rec-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ghost);
  padding: 12px 12px 6px; }
.rec-item { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 6px 0 12px; border-radius: 8px;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.rec-item:hover { background: var(--surface); color: var(--text); }
.rec-item.active { background: var(--surface); color: var(--text); }
.rec-item .ic { width: 14px; height: 14px; color: var(--faint); }
.rec-title { flex-grow: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.rec-del { width: 26px; height: 26px; display: none; align-items: center; justify-content: center; background: none;
  border: 0; border-radius: 6px; color: var(--faint); flex-shrink: 0; }
.rec-item:hover .rec-del { display: inline-flex; }
.rec-del:hover { color: var(--err); background: var(--surface-2); }
.rec-empty { color: var(--faint); font-size: 13px; padding: 10px 12px; }
.side-foot { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.status-pill { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--sunken);
  font-size: 12px; color: var(--muted); cursor: default; }
#st-model { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#side-close { display: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--err); } .dot.busy { background: var(--warn); }
.user-row { display: flex; align-items: center; gap: 6px; padding: 0 2px 0 4px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; text-transform: uppercase; }

#main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.mobile-bar { display: none; }
#error { display: none; margin: 12px 24px 0; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  color: var(--err); background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 40%, transparent); }
.view { flex-grow: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- vue Nouveau ---- */
#view-new { overflow-y: auto; }
.new-wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 48px 32px 40px; display: flex; flex-direction: column; gap: 24px; }
.new-head span { font-size: 13px; color: var(--faint); }
.new-head h1 { margin: 4px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
#drop { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 34px 20px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#drop:hover, #drop.hover { border-color: var(--accent-line); background: var(--accent-soft); }
#drop strong { color: var(--text); font-weight: 600; font-size: 16px; }
#drop .ic { width: 26px; height: 26px; color: var(--faint); }
.drop-formats { font-size: 13px; color: var(--faint); }
.file-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line-2); }
.file-badge { width: 44px; height: 52px; border-radius: 8px; background: var(--surface-3); display: flex; align-items: flex-end;
  justify-content: center; padding-bottom: 7px; font-family: var(--mono); font-size: 10px; font-weight: 500; color: #7DD3FC; flex-shrink: 0; }
:root[data-theme="light"] .file-badge { color: #0369A1; }
.file-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 13px; color: var(--muted); }
.paste-link { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); font-size: 13.5px; }
#text { width: 100%; min-height: 140px; padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line-2); outline: none; resize: vertical; line-height: 1.5; }
#text:focus { border-color: var(--accent-line); }
.actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.action-card { text-align: left; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-2); transition: border-color .15s, background .15s; }
.action-card:hover { border-color: var(--faint); }
.action-card[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.action-top { display: flex; align-items: center; gap: 10px; }
.action-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--muted);
  display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.action-card[aria-pressed="true"] .action-icon { background: var(--accent); color: var(--on-accent); }
.action-name { font-weight: 600; font-size: 16px; }
.action-time { margin-left: auto; font-size: 12px; color: var(--faint); }
.action-desc { font-size: 13.5px; color: var(--muted); }
.options { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 14px; background: var(--sunken);
  border: 1px solid var(--line); }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.opt-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); width: 130px; flex-shrink: 0; }
.opt-row .input { flex: 1 1 320px; min-width: 0; }
.opt-hint { font-size: 12.5px; color: var(--faint); flex-basis: 100%; padding-left: 148px; margin-top: -6px; }
.options details { font-size: 13px; color: var(--muted); }
.options summary { cursor: pointer; }
.options details .opt-row { margin-top: 14px; }
.launch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
#launch-hint { font-size: 13px; color: var(--faint); }

/* ---- vues résultat ---- */
.res-head { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 10px; padding: 12px 24px;
  border-bottom: 1px solid var(--line); min-height: 61px; }
.res-title { display: flex; flex-direction: column; flex-grow: 1; min-width: 200px; }
.res-title h1 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-title span { font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; z-index: 20; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; font-size: 13.5px; }
.menu button:hover { background: var(--surface-2); }
.menu button small { display: block; color: var(--faint); font-size: 12px; }
.stepper { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 24px;
  border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.stepper:empty { display: none; }
.stage { display: inline-flex; align-items: center; gap: 7px; }
.stage .icon { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.stage.done .icon { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.stage.stopped .icon { background: var(--err-soft); color: var(--err); }
.stage.active { color: var(--text); font-weight: 500; }
.stage .icon .ic { width: 10px; height: 10px; stroke-width: 3.2; }
.stage .icon .spinner { width: 12px; height: 12px; }
.split { flex-grow: 1; min-height: 0; display: flex; }
.pane-main { flex: 3 1 480px; min-width: 0; overflow-y: auto; padding: 28px 40px 40px; }
.pane-side { flex: 2 1 380px; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--pane); }
.pane-side.wide { flex: 3 1 440px; }
.pane-head { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  font-size: 13px; min-height: 49px; }
.pane-head strong { font-weight: 600; }
.pane-body { flex-grow: 1; overflow-y: auto; padding: 20px 26px; font-size: 13.5px; line-height: 1.75; color: var(--muted);
  white-space: pre-wrap; word-break: break-word; }
.src-par { margin-bottom: 12px; }
.pane-body mark.src-hit { background: var(--accent-soft); color: var(--text); border-radius: 3px; box-shadow: inset 0 -2px 0 var(--accent); }
.infos { font-size: 13px; color: var(--faint); margin-bottom: 14px; }
.infos:empty { display: none; }

/* résumé */
#summary { max-width: 70ch; color: var(--text-2); font-size: 15.5px; line-height: 1.7; }
#summary h1, #summary h2, #summary h3 { color: var(--text); font-size: 17px; margin: 18px 0 8px; letter-spacing: -.01em; }
#summary p { margin: 0 0 14px; }
#summary ul { padding-left: 22px; margin: 0 0 14px; } #summary li { margin: 4px 0; }
#summary strong { color: var(--text); }
.trace { max-width: 70ch; margin-top: 26px; border-top: 1px solid var(--line); padding-top: 6px; font-size: 14px; }
.trace details { padding: 8px 0; }
.trace summary { cursor: pointer; color: var(--muted); }
.trace .body { margin-top: 8px; padding: 12px 14px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line);
  color: var(--muted); white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; }
.empty-pane { color: var(--faint); font-size: 14px; padding: 40px 0; text-align: center; white-space: normal; }

/* analyse */
.pane-list { flex: 2 1 400px; min-width: 0; overflow-y: auto; padding: 14px 16px 30px; display: flex; flex-direction: column; gap: 10px; }
.rfilters { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 24px; border-bottom: 1px solid var(--line); }
.rfilters:empty { display: none; }
.rfsep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
#rstats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--faint); padding: 2px 4px 6px; }
#rstats strong { color: var(--text); font-weight: 600; }
#rstats:empty { display: none; }
.rcard { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, background .15s; }
.rcard:hover { border-color: var(--line-2); }
.rcard.focus { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.rcard.hidden { display: none; }
.rcard.rej { cursor: default; opacity: .8; border-style: dashed; }
.rcard.st-rejetee { opacity: .55; }
.rcard.st-rejetee blockquote, .rcard.st-rejetee .constat { text-decoration: line-through; }
.rcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--low); }
.sev-haute { --sev: var(--err); --sev-soft: var(--err-soft); }
.sev-moyenne { --sev: var(--warn); --sev-soft: var(--warn-soft); }
.sev-basse { --sev: var(--low); --sev-soft: var(--low-soft); }
.rcard .sev-dot { background: var(--sev); }
.rtype { font-weight: 600; color: var(--sev); }
.rsev { color: var(--faint); }
.tag { padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; }
.tag.st-acceptee { color: var(--accent-hi); background: var(--accent-soft); }
:root[data-theme="light"] .tag.st-acceptee { color: var(--accent); }
.tag.st-traitee { color: var(--ok); }
.rcard-head .num { margin-left: auto; font-family: var(--mono); color: var(--ghost); }
.rcard blockquote { margin: 0; font-size: 13.5px; color: var(--muted); font-style: italic; }
/* flèches dessinées (masques SVG) : la police Geist n'a pas ces glyphes */
.arrow-before::before, .rcard blockquote.liee::before, .rcard .sugg::before {
  content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px;
  background: currentColor; -webkit-mask: var(--arrow) center / contain no-repeat; mask: var(--arrow) center / contain no-repeat; }
.rcard .sugg::before { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E"); }
.rcard blockquote.liee::before { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='m7 8-4 4 4 4'/%3E%3Cpath d='m17 8 4 4-4 4'/%3E%3C/svg%3E"); }
.rcard .constat { margin: 0; color: var(--text); }
.rcard .sugg { margin: 0; font-size: 13.5px; color: var(--accent-hi); }
:root[data-theme="light"] .rcard .sugg { color: var(--accent); }

.rtriage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--faint); }
.rtriage .btn { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.rtriage .btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--faint); }
.redit { display: grid; gap: 6px; margin-top: 4px; }
.redit textarea { width: 100%; min-height: 56px; padding: 8px 10px; border-radius: 8px; background: var(--bg);
  border: 1px solid var(--line-2); outline: none; resize: vertical; font-size: 14px; }
.redit .row { display: flex; gap: 6px; }
.redit select { height: 30px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-2); padding: 0 8px; font-size: 12.5px; }
#rrejected summary { cursor: pointer; color: var(--faint); font-size: 13px; padding: 6px 4px; }
#rrejected-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.rempty { color: var(--faint); padding: 30px 4px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; }
#rdoc { color: var(--muted); }
#rdoc mark { color: var(--text); border-radius: 3px; padding: 1px 2px; cursor: pointer; background: var(--sev-soft);
  box-shadow: inset 0 -2px 0 var(--sev); }
#rdoc mark.flash { box-shadow: inset 0 -2px 0 var(--sev), 0 0 0 1.5px var(--sev); background: color-mix(in srgb, var(--sev) 30%, transparent); }

/* présentation */
.deck-body { flex-grow: 1; overflow-y: auto; padding: 22px 24px 40px; }
#dstats { font-size: 13px; color: var(--faint); margin-bottom: 14px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.dslide { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; background: var(--surface);
  display: flex; flex-direction: column; gap: 7px; font-size: 13px; aspect-ratio: auto; min-height: 170px; }
.dslide .dtype { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-family: var(--mono); }
.dslide .dtitle { font-weight: 600; font-size: 15px; color: var(--text); letter-spacing: -.01em; }
.dslide ul { margin: 0; padding-left: 18px; color: var(--text-2); } .dslide li { margin: 2px 0; }
.dslide table { border-collapse: collapse; width: 100%; font-size: 12px; }
.dslide td, .dslide th { border: 1px solid var(--line-2); padding: 3px 6px; text-align: left; }
.dslide .dkpi { display: flex; gap: 8px; flex-wrap: wrap; }
.dslide .dkpi div { flex: 1; min-width: 80px; background: var(--accent-soft); border-radius: 8px; padding: 8px; text-align: center; }
.dslide .dkpi strong { display: block; font-size: 16px; color: var(--accent); }
.dslide .dcols { display: flex; gap: 10px; } .dslide .dcols > div { flex: 1; }
.dslide .dnotes { color: var(--faint); font-size: 12px; }
.dslide .dwarn { color: var(--err); font-size: 12px; }
.dslide.fallback { border-style: dashed; }
.dslide.planned { opacity: .6; border-style: dashed; }
.dslide details summary { cursor: pointer; }

/* ---- vue Discuter ---- */
.chat-head { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 20px 0 24px; height: 56px; border-bottom: 1px solid var(--line); }
.chat-head h1 { margin: 0; font-size: 15px; font-weight: 600; flex-grow: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#conv-origin { font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
#conv-thread { flex-grow: 1; overflow-y: auto; padding: 28px 24px 12px; }
.thread { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.conv-empty { max-width: 560px; margin: 12vh auto 0; text-align: center; color: var(--muted); }
.conv-empty h2 { color: var(--text); font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 8px; }
.conv-empty p { margin: 0 0 22px; font-size: 14.5px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.suggestion { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2);
  font-size: 13.5px; color: var(--text-2); transition: border-color .15s; text-align: left; }
.suggestion:hover { border-color: var(--faint); }
.suggestion small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.cmsg { display: flex; flex-direction: column; gap: 8px; }
.cmsg.user { align-items: flex-end; }
.cmsg.user .bubble { max-width: 78%; padding: 10px 16px; border-radius: 18px 18px 4px 18px; background: var(--surface-3);
  white-space: pre-wrap; word-break: break-word; }
.cmsg.assistant .bubble { color: var(--text-2); line-height: 1.65; word-break: break-word; }
.cmsg.pinned { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--sunken); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.cmsg.pinned .bubble { display: none; }
.cmsg.pinned .att-row { justify-content: flex-start; margin: 0; }
.pin-label { display: inline-flex; align-items: center; gap: 8px; }
.pin-label .ic { color: var(--accent); width: 16px; height: 16px; }
.cmsg.assistant.pinned { display: none; }
.cmsg .actions { display: flex; gap: 2px; margin-left: -8px; color: var(--faint); }
.cmsg.user .actions { margin-left: 0; }
.act { height: 30px; padding: 0 8px; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
  border-radius: 7px; color: var(--faint); font-size: 12.5px; transition: background .15s, color .15s; }
.act:hover { background: var(--surface-2); color: var(--text); }
.act:disabled { opacity: .4; cursor: default; }
.att-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.att-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 4px 10px; font-size: 12.5px;
  border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; border: 1px solid transparent; }
a.att-chip:hover { border-color: var(--line-2); }
.att-chip .ic { width: 14px; height: 14px; color: var(--muted); }
.att-chip.att-img { padding: 0; border-radius: 12px; background: none; border: 1px solid var(--line-2); }
.att-chip.att-img img { display: block; max-height: 140px; max-width: 240px; border-radius: 11px; }
.reasoning { align-self: flex-start; font-size: 13px; }
.reasoning > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 8px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); cursor: pointer; font-size: 12.5px; }
.reasoning > summary::-webkit-details-marker { display: none; }
.reasoning > summary .ic { width: 14px; height: 14px; }
.reasoning .md { margin-top: 8px; color: var(--faint); border-left: 2px solid var(--line-2); padding: 2px 0 2px 12px; }
.chat-note { font-size: 12.5px; color: var(--faint); text-align: center; }
.typing::after { content: ""; display: inline-block; width: 8px; height: 17px; margin-left: 3px; vertical-align: -3px;
  background: var(--accent); border-radius: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer-wrap { flex-shrink: 0; padding: 8px 24px 16px; }
.composer { max-width: 780px; margin: 0 auto; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2);
  padding: 10px 10px 10px 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.composer:focus-within { border-color: var(--faint); }
#conv-panel.drop-hover .composer { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#conv-atts { display: flex; flex-wrap: wrap; gap: 6px; }
#conv-atts .att-chip { border-radius: 10px; padding: 5px 6px 5px 10px; }
#conv-atts .att-chip.error { color: var(--err); }
.att-x { background: none; border: 0; color: var(--faint); font-size: 16px; line-height: 1; padding: 0 3px; }
.att-x:hover { color: var(--err); }
.att-x:disabled { opacity: .3; }
.att-prog { width: 54px; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; display: inline-block; }
.att-prog span { display: block; height: 4px; width: 35%; background: var(--accent); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
#conv-input { width: 100%; min-height: 26px; max-height: 240px; resize: none; background: none; border: 0; outline: none;
  font-size: 15px; line-height: 1.5; padding: 2px 0; }
.composer-bar { display: flex; align-items: center; gap: 6px; }
.tool-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: none;
  border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); }
.tool-btn:hover { color: var(--text); border-color: var(--faint); }
.think-btn { height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; background: none;
  border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); font-size: 13px; }
.think-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
:root[data-theme="light"] .think-btn[aria-pressed="true"] { color: var(--accent); }
#conv-quota { font-size: 12px; color: var(--ghost); }
.send-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent);
  border: 0; border-radius: 12px; color: var(--on-accent); transition: background .15s, opacity .15s; }
.send-btn:hover { background: var(--accent-hi); }
.send-btn:disabled { opacity: .35; cursor: default; }
.send-btn.stop { background: var(--text); color: var(--bg); }
.composer-note { text-align: center; font-size: 11.5px; color: var(--ghost); margin-top: 8px; }

/* markdown complet (chats) */
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 10px; } .md li { margin: 3px 0; }
.md h1, .md h2, .md h3, .md h4 { font-size: 16px; color: var(--text); margin: 16px 0 8px; }
.md strong { color: var(--text); }
.md code { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
.md pre { position: relative; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  overflow-x: auto; margin: 0 0 10px; }
.md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.55; }
.md pre .copy-code { position: absolute; top: 6px; right: 6px; height: 26px; padding: 0 8px; font-size: 11.5px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; color: var(--muted); }
.md table { border-collapse: collapse; margin: 4px 0 12px; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line-2); padding: 6px 12px; text-align: left; }
.md th { background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.md blockquote { margin: 0 0 10px; padding: 2px 14px; border-left: 3px solid var(--line-2); color: var(--muted); }

/* ---- petits écrans ---- */
@media (max-width: 900px) {
  #sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  body.side-open #sidebar { transform: none; }
  #side-close { display: inline-flex; }
  .scrim { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); }
  body.side-open .scrim { display: block; }
  .mobile-bar { display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 8px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
  .mobile-bar .title { flex-grow: 1; text-align: center; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .new-wrap { padding: 24px 16px 32px; }
  .new-head h1 { font-size: 24px; }
  .actions-grid { grid-template-columns: 1fr; }
  .opt-label { width: 100%; }
  .opt-hint { padding-left: 0; }
  .split { flex-direction: column; overflow-y: auto; }
  .pane-main, .pane-list { flex: none; overflow: visible; padding: 20px 16px; }
  .pane-side { flex: none; border-left: 0; border-top: 1px solid var(--line); }
  .pane-side .pane-body { overflow: visible; }
  .res-head, .stepper, .rfilters { padding-left: 16px; padding-right: 16px; }
  .chat-head { display: none; }
  #conv-thread { padding: 18px 14px 10px; }
  .composer-wrap { padding: 6px 10px 12px; }
  .suggestions { grid-template-columns: 1fr; }
  /* barre de saisie : icônes seules (l'infobulle garde le libellé), sinon le
     bouton d'envoi sort de l'écran sur téléphone */
  .composer-bar .lbl { display: none; }
  .composer-bar .think-btn { width: 36px; padding: 0; justify-content: center; }
  .cmsg.user .bubble { max-width: 88%; }
}
@media (min-width: 901px) { .scrim { display: none; } }

/* ---- recherche web ---- */
.web-btn[data-state="on"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
:root[data-theme="light"] .web-btn[data-state="on"] { color: var(--accent); }
.web-btn[data-state="off"] { color: var(--ghost); }
.web-btn[data-state="off"] span { text-decoration: line-through; }
#conv-deep[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
:root[data-theme="light"] #conv-deep[aria-pressed="true"] { color: var(--accent); }
.think-btn:disabled { opacity: .4; cursor: default; }
.web-trace { align-self: flex-start; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--faint);
  padding: 8px 12px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); max-width: 100%; }
.web-trace .wt-head { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.web-trace .wt-head .ic { width: 14px; height: 14px; color: var(--accent); }
.web-trace .wt-queries { color: var(--text-2); }
.web-trace .wt-phase { display: flex; align-items: center; gap: 7px; }
.web-trace .wt-phase .spinner { width: 11px; height: 11px; }
.web-sources { display: flex; flex-direction: column; gap: 6px; }
.web-sources .ws-head { font-size: 11.5px; color: var(--ghost); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.web-sources .ws-list { display: flex; flex-wrap: wrap; gap: 6px; }
.src-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 320px; padding: 4px 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); font-size: 12.5px; text-decoration: none; }
.src-chip:hover { border-color: var(--accent-line); color: var(--text); }
.src-chip .n { font-family: var(--mono); color: var(--faint); font-size: 11.5px; }
.src-chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.src-chip .h { color: var(--faint); white-space: nowrap; }
.src-chip .snip { font-size: 10.5px; color: var(--faint); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 6px; }

/* ---- fenêtre de préférences ---- */
dialog#settings-dialog { padding: 0; border: 0; background: none; color: var(--text); max-width: 560px; width: calc(100% - 32px); }
dialog#settings-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 22px 24px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.dialog-lead { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
#instructions-input { width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2);
  outline: none; resize: vertical; line-height: 1.5; font-size: 14px; }
#instructions-input:focus { border-color: var(--accent-line); }
.dialog-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin: 6px 0 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
