/* Backoffice Altibot : système de design « Velok » (voir design.md à la racine). */

/* --- Jetons, mode clair (§2 à §4) ------------------------------------------ */
:root {
  color-scheme: light;
  --primary: #22b956; --primary-hover: #1fa74d; --primary-active: #1b9445; --primary-text: #ffffff;
  --primary-soft: rgba(34, 185, 86, .1); --primary-badge: rgba(34, 185, 86, .18);
  --primary-subtle: #d3f1dd; --primary-emphasis: #0e4a22; --link-hover: #1d9d49;
  --secondary: #5d7186; --secondary-soft: rgba(93, 113, 134, .1);
  /* Particularité Velok : « success » est bleu. */
  --success: #1989df; --success-badge: rgba(25, 137, 223, .18);
  --danger: #f95c5c; --danger-soft: rgba(249, 92, 92, .1); --danger-badge: rgba(249, 92, 92, .18);
  --danger-subtle: #fedede; --danger-emphasis: #642525;
  --warning-subtle: #fdf3db; --warning-emphasis: #624f1f;

  --bg: #f7f8f9; --card: #ffffff; --tertiary: #f8f9fa; --light: #eef2f7;
  --text: #020202; --heading: #313b5e; --strong: #28303c; --muted: #5d7186; --link: #8486a7;
  --border: #eaedf1; --input-border: #d8dfe7; --input-focus: #b0b0bb;
  --chart: #22b956; --chart-grid: #f1f3fa;

  --nav-bg: #ffffff; --nav-text: #5a5b70; --nav-hover-bg: #f3f1fa;
  --topbar-bg: #ffffff; --topbar-text: #707793; --search-bg: #f3f6f9;

  --nav-width: 250px; --topbar-height: 70px;
  --radius-sm: .25rem; --radius: .5rem;
  --shadow: 0 3px 4px 0 rgba(0, 0, 0, .03);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Alias utilisés par les blocs d'action et les états. */
  --ok: #157f3b; --ok-bg: #d3f1dd; --ko: #c93636; --ko-bg: #fedede; --dev: #8a6414; --dev-bg: #fdf3db;
}

/* --- Mode sombre (§2.5), activé par le bouton de la barre du haut ---------- */
[data-bs-theme="dark"] {
  color-scheme: dark;
  --primary-subtle: #14392a; --primary-emphasis: #a7e3bb; --link-hover: #7ad59a;
  --success: #5eaceb;
  --danger-subtle: #46272b; --danger-emphasis: #fdbebe;
  --warning-subtle: #433a22; --warning-emphasis: #fbe8b8;
  --bg: #22282e; --card: #282f36; --tertiary: #2f3943; --light: #2f3943;
  --text: #aab8c5; --heading: #aab8c5; --strong: #dee2e6; --muted: #8391a2; --link: #afb9cf;
  --border: #2f3944; --input-border: #3a4551; --input-focus: #4a5663;
  --chart-grid: #333d47;
  --nav-bg: #282f36; --nav-text: #a0aabf; --nav-hover-bg: #2f3943;
  --topbar-bg: #282f36; --topbar-text: #a0aabf; --search-bg: #2f3943;
  --ok: #7ad59a; --ok-bg: #14392a; --ko: #fb9d9d; --ko-bg: #46272b; --dev: #f6c54d; --dev-bg: #433a22;
}

/* --- Base et typographie (§3) ---------------------------------------------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 .8125rem/1.5 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
/* Dans le contenu courant, les liens restent repérables sans survol. */
main td a, main p a, .doc a { color: var(--link-hover); font-weight: 500; }
code, pre { font-family: var(--mono); font-size: .75rem; }
pre { background: var(--tertiary); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; }
h1, h2, h3, h4 { color: var(--heading); font-weight: 500; line-height: 1.1; margin: 0 0 10px; }
h1 { font-size: 1.125rem; font-weight: 600; margin-bottom: 1.25rem; }
h2 { font-size: .9375rem; }
h3 { font-size: .875rem; margin-top: 20px; }
h4 { font-size: .8125rem; }
small, .small { font-size: .75rem; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.ko { color: var(--ko); }
.icon { width: 1em; height: 1em; flex: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- Structure (§5) --------------------------------------------------------- */
.main-nav { position: fixed; inset: 0 auto 0 0; width: var(--nav-width); z-index: 1005; display: flex; flex-direction: column; background: var(--nav-bg); border-right: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .2s; }
.logo-box { height: var(--topbar-height); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 1.25rem; border-bottom: 1px solid var(--border); color: var(--heading); font-size: 1.125rem; font-weight: 700; }
.logo-box:hover { color: var(--heading); }
.logo-mark { width: 30px; height: 30px; border-radius: var(--radius); background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 17px; }
.menu { flex: 1; overflow-y: auto; padding: .75rem 0 1.25rem; scrollbar-width: thin; }
.menu ul { list-style: none; margin: 0; padding: 0 10px; }
.menu-title { padding: 14px 15px 6px; font-size: .6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.menu-link { position: relative; display: flex; align-items: center; gap: 12px; margin: 2px 0; padding: 10px 15px; border-radius: 6px; font-size: .875rem; color: var(--nav-text); }
.menu-link .nav-icon { width: 18px; height: 18px; fill: currentColor; fill-opacity: .2; }
.menu-link:hover { background: var(--nav-hover-bg); color: var(--primary); }
.menu-link[aria-current="page"] { color: var(--primary); font-weight: 500; }
.menu-link[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 3px 3px 0; background: var(--primary); }

.topbar { position: sticky; top: 0; z-index: 999; height: var(--topbar-height); display: flex; align-items: center; gap: 12px; padding: 0 28px; margin-left: var(--nav-width); background: var(--topbar-bg); box-shadow: var(--shadow); }
.app-search { position: relative; flex: 0 1 280px; margin: 0; }
.app-search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--topbar-text); }
.topbar .app-search input[type="search"] { width: 100%; height: 38px; border: 0; border-radius: 30px; padding: 0 16px 0 40px; background: var(--search-bg); }
.topbar-items { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--topbar-text); font-size: 21px; cursor: pointer; }
.topbar-button:hover { color: var(--primary); background: var(--primary-soft); }
.menu-toggle { display: none; }
.profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--primary-badge); color: var(--primary); font-weight: 600; font-size: .875rem; }
.who { display: flex; flex-direction: column; line-height: 1.25; }
.who strong { color: var(--heading); font-weight: 500; }
.who small { color: var(--muted); }
.logout { margin: 0; }
.devbar { background: var(--dev-bg); color: var(--dev); font-size: .6875rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm); white-space: nowrap; }

.page-container { margin-left: var(--nav-width); min-height: calc(100vh - var(--topbar-height)); display: flex; flex-direction: column; }
main.page { flex: 1; width: 100%; min-width: 0; padding: 32px 40px 0; }
.footer { height: 60px; flex: none; display: flex; align-items: center; padding: 0 40px; color: var(--link); }
.backdrop { display: none; }

@media (max-width: 1140px) {
  .main-nav { transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  .nav-open .main-nav { transform: none; visibility: visible; transition: transform .2s; }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 1004; background: rgba(20, 26, 33, .45); }
  .topbar, .page-container { margin-left: 0; }
  .menu-toggle { display: grid; }
}
@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 6px; }
  .app-search, .topbar .devbar, .who { display: none; }
  .topbar-items { gap: 6px; }
  main.page { padding: 20px 16px 0; }
  .footer { padding: 0 16px; }
}

/* --- Connexion (§7, authentification) --------------------------------------- */
body.auth > .devbar { text-align: center; border-radius: 0; }
main.center { min-height: 90vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 440px; padding: 40px 36px; }
.login h1 { font-size: 1.25rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login h1 + p { text-align: center; margin: 0 0 24px; }
.card.login input:not([type="checkbox"]) { padding: .625rem 1.25rem; font-size: .875rem; border-radius: var(--radius); }
.login .btn:not(.btn-ghost) { width: 100%; justify-content: center; }

/* --- Cartes (§6.1) ----------------------------------------------------------- */
.card { background: var(--card); border: 0; border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; min-width: 0; overflow-x: auto; }
/* Un titre en tête de carte fait office d'en-tête, séparé par des pointillés. */
.card > h2:first-child, .card > .editor-head:first-child { margin: -1.25rem -1.25rem 1.25rem; padding: .9375rem 1.25rem; border-bottom: 1px dashed var(--border); }
.card > .editor-head:first-child h2 { margin: 0; }
.card > :last-child { margin-bottom: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.grid > .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 8px; position: relative; }
.stat .label { color: var(--heading); font-size: .9375rem; font-weight: 500; padding-right: 40px; }
.stat > strong { font-size: 1.125rem; font-weight: 700; color: var(--strong); }
.stat > strong.ko { color: var(--ko); }
.stat > strong.ok { color: var(--ok); }
.stat-icon { position: absolute; right: 1.25rem; top: 1.25rem; font-size: 32px; color: var(--primary); }
.kpis { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.kpis .stat > strong:not(.ko) { color: var(--strong); }
.kpis .stat:nth-child(odd) > strong:not(.ko) { color: var(--primary); }
.charts { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); align-items: start; }

/* --- Formulaires (§6.4) : pas de halo, la bordure fonce au focus ------------ */
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: .4rem; font-size: .8125rem; font-weight: 500; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea.field { padding: .5rem 1rem; border: 1px solid var(--input-border); border-radius: var(--radius-sm); background-color: var(--card); max-width: 100%; transition: border-color .15s ease-in-out; }
input:focus, select:focus, textarea:focus { border-color: var(--input-focus); }
input:not([type="checkbox"]):not([type="radio"]):focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--input-focus); }
input[type="checkbox"], input[type="radio"] { width: 1.112em; height: 1.112em; margin: 0; flex: none; accent-color: var(--primary); }
textarea.field { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px 20px; }
.form-grid label small { color: var(--muted); font-weight: 400; }
fieldset { border: 1px dashed var(--input-border); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 1.25rem; min-width: 0; }
legend { font-size: .9375rem; font-weight: 500; color: var(--heading); padding: 0 6px; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-label { flex-direction: row; align-items: center; gap: 6px; }
.inline { margin: 0 0 10px; }
.period { margin-bottom: 8px; }

/* --- Boutons (§6.2) --------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 400 .8125rem/1.5 var(--font); padding: .5rem 1rem; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-text); cursor: pointer; text-decoration: none; transition: background-color .15s ease-in-out, color .15s ease-in-out, border-color .15s ease-in-out; }
main a.btn, .btn:hover { color: var(--primary-text); font-weight: 400; }
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:active { background: var(--primary-active); }
.btn:disabled { opacity: .65; cursor: default; }
/* Bouton secondaire : variante « soft ». */
.btn-ghost, main a.btn-ghost { background: var(--secondary-soft); border-color: transparent; color: var(--muted); padding: .348rem .9375rem; font-size: .75rem; }
.btn-ghost:hover, main a.btn-ghost:hover { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.btn-ghost:disabled:hover { background: var(--secondary-soft); border-color: transparent; color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: var(--ko); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-dev { width: 100%; justify-content: center; background: transparent; border-color: var(--dev); color: var(--dev); font-weight: 600; }
.btn-dev:hover { background: var(--dev-bg); border-color: var(--dev); color: var(--dev); }
.small-btn { margin-top: 10px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.devlogin { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); text-align: center; }
.secret { font-size: 1rem; letter-spacing: 1px; text-align: center; user-select: all; white-space: pre-wrap; }

/* --- Alertes (§6.9), sans bordure ------------------------------------------- */
.alert, .info, .errors, .alert-line { margin: 0 0 1.25rem; padding: .75rem 1.25rem; border: 0; border-radius: var(--radius); }
.alert, .errors, .alert-line.ko { background: var(--danger-subtle); color: var(--danger-emphasis); }
.info { background: var(--primary-subtle); color: var(--primary-emphasis); }
.alert-line.warn { background: var(--warning-subtle); color: var(--warning-emphasis); }
.errors { padding-left: 2.25rem; }
.alerts { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 8px; }
.alerts .alert-line { margin: 0; }

/* --- Tables (§6.5) et pagination ------------------------------------------- */
table { width: 100%; border-collapse: collapse; margin: 12px 0; }
th, td { text-align: left; padding: .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { background: var(--light); color: var(--strong); font-size: .75rem; font-weight: 600; text-transform: uppercase; border: 0; padding-top: .6rem; padding-bottom: .6rem; }
tbody th { color: var(--muted); font-weight: 500; }
tbody tr:hover { background: rgba(0, 0, 0, .02); }
tr.off td { opacity: .55; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* --- Badges et étiquettes (§6.3) -------------------------------------------- */
.badge, .tag { display: inline-block; font-size: .6875rem; font-weight: 600; line-height: 1.4; padding: 3px 7px; border-radius: 4px; }
.badge { background: var(--secondary-soft); color: var(--muted); }
.badge.ok { background: var(--success-badge); color: var(--success); }
.badge.ko { background: var(--danger-badge); color: var(--ko); }
.tag { background: var(--primary-badge); color: var(--link-hover); }
.badges { display: flex; gap: 6px; }

/* --- Onglets (§6.8) ---------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--input-border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: .5rem 1rem; color: var(--link); border: 1px solid transparent; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--primary); background: var(--card); border-color: var(--input-border) var(--input-border) var(--card); font-weight: 500; }

/* --- Rapports du jeu de test ------------------------------------------------ */
details.q { border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0; padding: 10px 14px; }
details.q summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.q[open] summary { color: var(--primary); }
.qid { color: var(--muted); font-size: .75rem; min-width: 32px; }
.qtext { flex: 1; min-width: 200px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.col { background: var(--tertiary); border-radius: var(--radius-sm); padding: 12px; }
.reply { background: var(--card); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; }
.checks { list-style: none; padding: 0; margin: 8px 0; font-size: .75rem; }

/* --- Bac à sable et conversations (§7, chat) : message envoyé en vert ------- */
.sandbox { max-width: 900px; }
.sb-toolbar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.sb-model { flex: 1; min-width: 220px; }
.sb-check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.sb-notice { font-size: .75rem; color: var(--muted); margin: 4px 0 8px; }
.sb-log { height: 55vh; min-height: 300px; overflow-y: auto; background: var(--tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; max-width: 85%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble strong { font-weight: 700; }
.msg.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 0; }
.msg.bot .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 0; box-shadow: var(--shadow); }
.msg.bot .bubble a { color: var(--link-hover); font-weight: 600; }
.msg.error .bubble { background: var(--ko-bg); color: var(--ko); }
.msg.typing .bubble { color: var(--muted); }
.action { margin-top: 6px; padding: 10px 12px; border: 1px dashed var(--primary); border-radius: var(--radius); background: var(--card); }
.action p { margin: 4px 0 0; }
.meta { font-size: .6875rem; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.sys, .sys-line { align-self: center; font-size: .75rem; color: var(--dev); margin: 0; }
.sb-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.sb-suggest button, .blk-chip { font: 400 .75rem/1.5 var(--font); padding: 5px 12px; border-radius: 50rem; border: 1px solid transparent; background: var(--primary-soft); color: var(--link-hover); cursor: pointer; }
.sb-suggest button:hover, .blk-chip:hover { background: var(--primary); color: #fff; }
.sb-form { display: flex; gap: 8px; align-items: flex-end; }
.sb-form textarea { flex: 1; min-width: 0; padding: .5rem 1rem; border: 1px solid var(--input-border); border-radius: var(--radius-sm); background: var(--card); resize: vertical; }

.thread { display: flex; flex-direction: column; gap: 14px; }
.thread .msg { max-width: 80%; }
.thread .msg.bot .bubble { background: var(--tertiary); }
.thread .msg.user .meta { text-align: right; }
.gap summary { cursor: pointer; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.gap form { margin-top: 6px; }

/* --- Blocs d'action (blocks.js) --------------------------------------------- */
.blk { margin-top: 6px; padding: 12px; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius); background: var(--card); display: flex; flex-direction: column; gap: 6px; max-width: 360px; }
.blk-title { font-size: .875rem; color: var(--heading); }
.blk-text, .blk-doc { margin: 0; font-size: .8125rem; }
.blk-doc { font-weight: 600; }
.blk-form { display: flex; flex-direction: column; gap: 8px; }
.blk-field { display: flex; flex-direction: column; gap: 2px; }
.blk-field label { font-size: .75rem; color: var(--muted); }
.blk-consent { flex-direction: row; align-items: flex-start; gap: 6px; font-size: .75rem; font-weight: 400; }
.blk-consent input { margin-top: 2px; }
.blk-button { align-self: flex-start; font: 500 .8125rem/1.5 var(--font); padding: .5rem 1rem; border-radius: var(--radius-sm); border: 0; background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; }
main .blk-button, .blk-button:hover { color: #fff; }
.blk-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.blk-confirm { margin: 0; color: var(--ok); }
.blk-error { margin: 0; color: var(--ko); }
.blk-answers { display: flex; gap: 6px; margin-top: 6px; }

/* --- Bibliothèque des actions ----------------------------------------------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.lib-card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lib-card.off { opacity: .6; }
.lib-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-head strong { flex: 1; color: var(--heading); font-size: .9375rem; font-weight: 500; }
.state { font-size: .75rem; }
.lib-card p { margin: 0; }
.markers { display: flex; flex-wrap: wrap; gap: 4px; }
.markers code, .test-line code { background: var(--light); padding: 1px 6px; border-radius: 4px; }
.preview { background: var(--tertiary); border-radius: var(--radius-sm); padding: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips button { font-family: var(--mono); font-size: .75rem; padding: 4px 8px; border-radius: var(--radius-sm); border: 0; background: var(--secondary-soft); color: var(--text); cursor: pointer; }
.chips button:hover { background: var(--primary-soft); color: var(--link-hover); }
.test-result { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.test-line { margin: 0; }

/* --- Éditeurs ---------------------------------------------------------------- */
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.status { font-size: .75rem; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--dev); }
.status.ko { color: var(--ko); }
.editor { display: flex; border: 1px solid var(--input-border); border-radius: var(--radius-sm); overflow: hidden; background: var(--tertiary); height: 60vh; min-height: 320px; }
.gutter { margin: 0; padding: 10px 8px; min-width: 44px; text-align: right; color: var(--muted); background: var(--card); border: 0; border-right: 1px solid var(--border); overflow: hidden; user-select: none; border-radius: 0; line-height: 20px; }
.code { font-family: var(--mono); font-size: .75rem; line-height: 20px; tab-size: 2; }
.editor .code { flex: 1; min-width: 0; border: 0; margin: 0; padding: 10px 12px; resize: none; background: var(--tertiary); outline: none; white-space: pre; overflow: auto; }
.small-code, .md-editor { width: 100%; padding: 10px 12px; border: 1px solid var(--input-border); border-radius: var(--radius-sm); background: var(--tertiary); resize: vertical; }
.small-code { margin-bottom: 8px; }
.md-editor { white-space: pre-wrap; }
.editor-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.prompt-preview { margin-top: 12px; }
.prompt-preview summary { cursor: pointer; }
.prompt-preview pre { white-space: pre-wrap; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.md-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; max-height: 560px; overflow: auto; background: var(--card); }
.md-preview h4 { margin: 12px 0 4px; }
.diff { white-space: pre-wrap; max-height: 520px; overflow: auto; }
.diff-add { display: block; background: var(--ok-bg); color: var(--ok); }
.diff-del { display: block; background: var(--ko-bg); color: var(--ko); text-decoration: line-through; }
.diff-same { display: block; color: var(--muted); }
.diff-skip { display: block; color: var(--muted); text-align: center; }

/* --- Graphiques (§2.7) ------------------------------------------------------ */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--chart); }
.chart .bar:hover { opacity: .75; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.hbars { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; }
.hbar-track { background: var(--light); border-radius: var(--radius); height: 12px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--chart); border-radius: var(--radius); }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Installation ------------------------------------------------------------ */
.snippet { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.snippet pre { flex: 1; margin: 0; white-space: pre-wrap; word-break: break-all; }
.doc { max-width: 900px; line-height: 1.65; }
.doc h1 { font-size: 1.125rem; }
.doc h2 { margin-top: 28px; }
.doc h3 { margin-top: 18px; }
.doc pre { white-space: pre-wrap; }
.doc code { background: var(--light); padding: 1px 5px; border-radius: 4px; }
.doc pre code { background: none; padding: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Sélecteur de couleur : sans marge intérieure, pour que la teinte reste visible. */
.card input[type="color"] { width: 64px; height: 36px; padding: 3px; cursor: pointer; }
/* Détail d'une conversation : les retours à la ligne viennent déjà des <br>. */
.thread .bubble { white-space: normal; }

/* Un graphique seul sur toute la largeur ne doit pas grandir sans limite. */
.chart { max-height: 280px; }
