/* ─── Chat-assistent rechtsonder ──────────────────────────────────────
   Het design van de AlexWeb-assistent. Daar zijn het Tailwind-klassen; dit
   project heeft geen build-stap, dus staan ze hier uitgeschreven, met dezelfde
   maten en de slate-kleuren van Tailwind. De klassennamen in de commentaren
   (bg-slate-900, text-[10px], …) zijn die van het origineel, zodat je beide
   naast elkaar kan leggen.

   Het lichte thema is een exacte kopie. Het donkere thema van dit dashboard
   krijgt dezelfde opbouw met donkere tinten — anders staat er een wit venster
   op een zwart scherm.

   Hoort bij views/partials/chat.ejs en public/js/chat.js. */

.chat-root {
  --c-bg: #fff;
  --c-50: #f8fafc; --c-100: #f1f5f9; --c-200: #e2e8f0; --c-300: #cbd5e1;
  --c-400: #94a3b8; --c-500: #64748b; --c-600: #475569; --c-700: #334155;
  --c-800: #1e293b; --c-900: #0f172a;
  --c-head: #0f172a;         /* bg-slate-900 */
  --c-user: #0f172a;
  --c-bot: #f1f5f9;          /* bg-slate-100 */
  --c-bot-text: #1e293b;
  --c-strong: #0f172a;
  --c-code: rgba(226, 232, 240, 0.7);
  --c-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--c-800);
}
[data-theme="dark"] .chat-root {
  --c-bg: #161b22;
  --c-50: #1c2128; --c-100: #22272e; --c-200: #30363d; --c-300: #444c56;
  --c-400: #768390; --c-500: #8b949e; --c-600: #adbac7; --c-700: #cdd9e5;
  --c-800: #e6edf3; --c-900: #f0f6fc;
  --c-head: #0d1117;
  --c-user: #2d333b;
  --c-bot: #22272e;
  --c-bot-text: #e6edf3;
  --c-strong: #fff;
  --c-code: rgba(99, 110, 123, 0.4);
  --c-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}
.chat-root *, .chat-root *::before, .chat-root *::after { box-sizing: border-box; }
/* :where() houdt dit op specificiteit 0, zodat de lettergroottes per knop
   hieronder winnen. */
:where(.chat-root) :where(button) { font-family: inherit; line-height: inherit; }
.chat-root [hidden] { display: none !important; }

/* Icoonmaten: h-3 … h-6 */
.chat-i3  { width: 0.75rem;  height: 0.75rem;  flex: none; }
.chat-i35 { width: 0.875rem; height: 0.875rem; flex: none; }
.chat-i4  { width: 1rem;     height: 1rem;     flex: none; }
.chat-i6  { width: 1.5rem;   height: 1.5rem;   flex: none; }
.tabular  { font-variant-numeric: tabular-nums; }

/* ── De knop (dicht) ──────────────────────────────────────────────────
   fixed bottom-4 right-4 z-50 h-12 w-12 rounded-full bg-slate-900 text-white
   shadow-lg transition hover:bg-slate-700 */
.chat-fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 500;
  width: 3rem; height: 3rem; border-radius: 9999px; border: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0f172a; color: #fff; cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-fab:hover { background: #334155; }
.chat-fab:focus-visible { outline: 2px solid #94a3b8; outline-offset: 2px; }
[data-theme="dark"] .chat-fab { background: #2d333b; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .chat-fab:hover { background: #444c56; }

/* ── Het venster ──────────────────────────────────────────────────────
   fixed bottom-4 right-4 z-50 flex flex-col overflow-hidden rounded-xl border
   border-slate-200 bg-white shadow-2xl

   Het venster groeit mee met het gesprek: na 2 vragen twee keer zo groot, na
   5 vragen drie keer. "Twee keer zo groot" is oppervlak — breedte en hoogte
   gaan maal √2 — want beide letterlijk verdubbelen past op geen scherm. De
   tekst schaalt rustiger mee (1,25× en 1,4×). chat.js zet enkel --chat-scale
   en --chat-font-scale; onder 1024px blijft alles op de beginmaat. */
.chat-window {
  --chat-w: 26rem;
  --chat-h: 34rem;
  --chat-font: 0.875rem;
  --chat-scale: 1;
  --chat-font-scale: 1;

  position: fixed; right: 1rem; bottom: 1rem; z-index: 500;
  display: flex; flex-direction: column; overflow: hidden;
  width: min(var(--chat-w), calc(100vw - 2rem));
  height: min(var(--chat-h), calc(100dvh - 2rem));
  border-radius: 0.875rem; border: 1px solid var(--c-200);
  background: var(--c-bg); box-shadow: var(--c-shadow);
  line-height: 1.5;
}
.chat-window .chat-scroll,
.chat-window .chat-input { font-size: var(--chat-font); }

@media (min-width: 1024px) {
  .chat-window {
    width: min(calc(var(--chat-w) * var(--chat-scale)), calc(100vw - 2rem));
    height: min(calc(var(--chat-h) * var(--chat-scale)), calc(100dvh - 2rem));
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1), height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .chat-window .chat-scroll,
  .chat-window .chat-input {
    font-size: calc(var(--chat-font) * var(--chat-font-scale));
    transition: font-size 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* Kop: flex items-center justify-between border-b border-slate-200 bg-slate-900 px-3 py-2 text-white */
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--c-200);
  background: var(--c-head); color: #fff;
}
.chat-head-left, .chat-head-right { display: flex; align-items: center; gap: 0.375rem; }
.chat-head-right { gap: 0.625rem; }
.chat-head-title { font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; }
.chat-head-btn {
  display: flex; align-items: center; background: none; border: 0; padding: 0; cursor: pointer;
  color: #94a3b8; transition: color 0.15s;           /* text-slate-400 hover:text-white */
}
.chat-head-btn:hover, .chat-head-btn.is-close { color: #fff; }

/* Gesprek: chat-scroll flex-1 space-y-2 overflow-y-auto p-3 */
.chat-scroll {
  flex: 1; min-height: 0; overflow-y: auto; padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.chat-empty { margin: 0; color: #94a3b8; }

/* ml-auto max-w-[85%] rounded-lg bg-slate-900 px-3 py-2 text-white */
.chat-bubble-user {
  margin-left: auto; max-width: 85%; border-radius: 0.625rem;
  background: var(--c-user); color: #fff; padding: 0.5rem 0.75rem;
  overflow-wrap: break-word;
}
.chat-assistant { display: flex; flex-direction: column; gap: 0.375rem; }
/* trace-answer mr-auto max-w-[85%] break-words rounded-lg bg-slate-100 px-3 py-2 text-slate-800 */
.chat-bubble-bot {
  margin-right: auto; max-width: 85%; border-radius: 0.625rem;
  background: var(--c-bot); color: var(--c-bot-text); padding: 0.5rem 0.75rem;
  overflow-wrap: break-word;
}
.chat-bubble-wait {
  margin-right: auto; border-radius: 0.625rem; background: var(--c-bot);
  color: #94a3b8; padding: 0.5rem 0.75rem;
}

/* Invoer: flex items-center gap-2 border-t border-slate-200 p-2 */
.chat-inputrow {
  display: flex; align-items: center; gap: 0.5rem; margin: 0;
  padding: 0.5rem; border-top: 1px solid var(--c-200);
}
/* min-w-0 flex-1 rounded-md border border-slate-200 px-3 py-2 outline-none focus:border-slate-400 */
.chat-input {
  flex: 1; min-width: 0; font-family: inherit; line-height: 1.5;
  border: 1px solid var(--c-200); border-radius: 0.5rem; padding: 0.5rem 0.75rem;
  background: var(--c-bg); color: var(--c-900); outline: none;
}
.chat-input::placeholder { color: var(--c-400); }
.chat-input:focus { border-color: var(--c-400); }
/* flex w-9 shrink-0 self-stretch items-center justify-center rounded-md bg-slate-900 text-white disabled:opacity-40 */
.chat-send {
  width: 2.25rem; flex: none; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 0.5rem; background: var(--c-user); color: #fff; cursor: pointer;
}
.chat-send:disabled { opacity: 0.4; cursor: default; }

/* ── Markdown in het antwoord ─────────────────────────────────────── */
.md > * + * { margin-top: 0.5rem; }                   /* space-y-2 */
.md p { margin: 0; }
.md-heading, .md-strong { font-weight: 600; color: var(--c-strong); }
.md-em { font-style: italic; }
.md-code {
  border-radius: 0.25rem; background: var(--c-code); padding: 0.125rem 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em;
}
.md-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.md-ul, .md-ol { margin: 0; padding-left: 1.25rem; }  /* ml-5 */
.md-ul { list-style: disc; }
.md-ol { list-style: decimal; }
.md-ul li + li, .md-ol li + li { margin-top: 0.25rem; }
.md-ul li::marker, .md-ol li::marker { color: #94a3b8; }

/* ── De tijdlijn ──────────────────────────────────────────────────────
   Elke stap komt binnen zodra hij écht gebeurt, dus de vertraging tussen de
   stappen is de echte wachttijd — geen verzonnen stagger. */
.tr-box {
  margin-right: auto; width: 100%; border-radius: 0.625rem;
  border: 1px solid var(--c-200); background: color-mix(in srgb, var(--c-bg) 70%, transparent);
  padding: 0.5rem;
}
.tr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.tr-head-label, .tr-detail-label {
  margin: 0; font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.025em; color: #94a3b8;
}
.tr-collapse { background: none; border: 0; padding: 0; cursor: pointer; font-size: 10px; color: #94a3b8; transition: color 0.15s; }
.tr-collapse:hover { color: var(--c-600); }
.tr-list { position: relative; list-style: none; margin: 0; padding: 0; }
.tr-li { position: relative; padding-left: 1.75rem; }

/* absolute left-[9px] top-6 w-px */
.tr-rail { position: absolute; left: 9px; top: 1.5rem; bottom: 0; width: 1px; }
.tr-rail.is-last { bottom: auto; height: 1rem; }
.tr-rail.trace-rail { background: var(--c-200); }

/* absolute left-0 top-1 h-[18px] w-[18px] rounded-full ring-1 */
.tr-dot {
  position: absolute; left: 0; top: 0.25rem; width: 18px; height: 18px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
}
.tr-dot-icon { width: 10px; height: 10px; }
.tr-dot.tone-prepare { background: #f1f5f9; color: #475569; box-shadow: 0 0 0 1px #e2e8f0; }
.tr-dot.tone-llm     { background: #ede9fe; color: #7c3aed; box-shadow: 0 0 0 1px #ddd6fe; }
.tr-dot.tone-tool    { background: #ccfbf1; color: #0f766e; box-shadow: 0 0 0 1px #99f6e4; }
.tr-dot.tone-answer  { background: #d1fae5; color: #047857; box-shadow: 0 0 0 1px #a7f3d0; }
.tr-dot.tone-error   { background: #fee2e2; color: #dc2626; box-shadow: 0 0 0 1px #fecaca; }

.tr-body { padding-bottom: 0.75rem; }
.tr-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.tr-title {
  display: flex; align-items: center; gap: 0.25rem; min-width: 0; text-align: left;
  background: none; border: 0; padding: 0; font-size: 0.75rem; line-height: 1rem; font-weight: 500;
}
.tr-title:disabled { cursor: default; opacity: 1; }
.tr-title.has-detail { cursor: pointer; }
.tr-title.has-detail:hover .tr-title-text { text-decoration: underline; }
.tr-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-title.tone-prepare { color: #334155; }
.tr-title.tone-llm     { color: #4c1d95; }
.tr-title.tone-tool    { color: #134e4a; }
.tr-title.tone-answer  { color: #064e3b; }
.tr-title.tone-error   { color: #7f1d1d; }
.tr-chev { width: 0.75rem; height: 0.75rem; flex: none; transition: transform 0.15s; }
.tr-chev.is-open { transform: rotate(90deg); }
.tr-ms { flex: none; font-size: 10px; color: #94a3b8; }
.tr-sub { margin: 0.125rem 0 0; font-size: 11px; line-height: 1.375; color: var(--c-500); }

.tr-subs { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.tr-subs > li + li { margin-top: 0.125rem; }
.tr-subli { display: flex; align-items: baseline; gap: 0.375rem; font-size: 10px; color: #94a3b8; }
.tr-sub-corner { color: var(--c-300); }
.tr-sub-label { flex: none; }
.tr-sub-label.is-failed { color: #ef4444; }
.tr-sub-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-sub-ms { flex: none; font-variant-numeric: tabular-nums; }

.tr-details { margin-top: 0.375rem; }
.tr-details > * + * { margin-top: 0.375rem; }
.tr-pre {
  margin: 0.125rem 0 0; max-height: 10rem; overflow: auto; border-radius: 0.25rem;
  border: 1px solid var(--c-200); background: var(--c-50); padding: 0.375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.625;
  color: var(--c-600); white-space: pre-wrap; overflow-wrap: break-word;
}

/* Nadenken: het denkblok van de lopende ronde. Violet, zoals de Gemini-stap
   zelf. Vaste hoogte met de nieuwste tekst onderaan, en een vervaging bovenaan
   zodat het leest als een stroom en niet als een afgekapt blok. */
.tr-think {
  margin-top: 0.375rem; border-radius: 0.375rem; border: 1px solid #ddd6fe; background: #f5f3ff;
  padding: 0.375rem 0.5rem;
}
.tr-think-label {
  display: flex; align-items: center; gap: 0.25rem; margin: 0;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em; color: #7c3aed;
}
.tr-think-scroll {
  margin-top: 0.125rem; max-height: 5.25rem; overflow: hidden;
}
.tr-think-scroll.is-overflow {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.25rem);
  mask-image: linear-gradient(to bottom, transparent 0, #000 1.25rem);
}
.tr-think-text {
  margin: 0; font-size: 11px; line-height: 1.5; color: #5b21b6; white-space: pre-wrap; overflow-wrap: break-word;
}
/* Lichtje dat door "Denkt na…" schuift, zolang er gedacht wordt. */
.tr-think-shimmer {
  background: linear-gradient(90deg, #7c3aed 0%, #c4b5fd 50%, #7c3aed 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: tr-shimmer 1.6s linear infinite;
}
@keyframes tr-shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
.tr-think-head { margin: 0.125rem 0 0; font-size: 11px; line-height: 1.375; font-style: italic; color: #7c3aed; }
.tr-pre.is-prose { font-family: inherit; font-size: 11px; }
[data-theme="dark"] .tr-think { border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.1); }
[data-theme="dark"] .tr-think-label { color: #c4b5fd; }
[data-theme="dark"] .tr-think-text, [data-theme="dark"] .tr-think-head { color: #c4b5fd; }

/* Ingeklapt: mr-auto flex items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2 py-1 text-[10px] text-slate-500 */
.tr-pill {
  margin-right: auto; display: flex; align-items: center; gap: 0.375rem;
  border-radius: 9999px; border: 1px solid var(--c-200); background: var(--c-bg);
  padding: 0.25rem 0.5rem; font-size: 10px; line-height: 1rem; color: var(--c-500); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.tr-pill:hover { border-color: var(--c-300); color: var(--c-700); }
.tr-pill-sep { color: var(--c-300); }

[data-theme="dark"] .tr-dot.tone-prepare { background: #2d333b; color: #adbac7; box-shadow: 0 0 0 1px #444c56; }
[data-theme="dark"] .tr-dot.tone-llm     { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4); }
[data-theme="dark"] .tr-dot.tone-tool    { background: rgba(20, 184, 166, 0.18); color: #5eead4; box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.4); }
[data-theme="dark"] .tr-dot.tone-answer  { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4); }
[data-theme="dark"] .tr-dot.tone-error   { background: rgba(239, 68, 68, 0.18); color: #fca5a5; box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.4); }
[data-theme="dark"] .tr-title.tone-prepare { color: #cdd9e5; }
[data-theme="dark"] .tr-title.tone-llm     { color: #c4b5fd; }
[data-theme="dark"] .tr-title.tone-tool    { color: #5eead4; }
[data-theme="dark"] .tr-title.tone-answer  { color: #6ee7b7; }
[data-theme="dark"] .tr-title.tone-error   { color: #fca5a5; }

/* ── Animaties (letterlijk uit AlexWeb globals.css) ───────────────── */
@keyframes trace-step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.trace-step { animation: trace-step-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }

@keyframes trace-pulse {
  0%   { box-shadow: 0 0 0 0 rgb(15 23 42 / 0.35); }
  70%  { box-shadow: 0 0 0 7px rgb(15 23 42 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(15 23 42 / 0); }
}
.trace-active { animation: trace-pulse 1.6s ease-out infinite; }

@keyframes trace-rail-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.trace-rail { transform-origin: top; animation: trace-rail-grow 0.35s ease forwards; }

@keyframes trace-rail-flow { from { background-position-y: 0; } to { background-position-y: 16px; } }
.trace-rail-live {
  background-image: linear-gradient(180deg, rgb(15 23 42 / 0.55) 45%, transparent 45%);
  background-size: 100% 16px;
  animation: trace-rail-flow 0.7s linear infinite;
}
[data-theme="dark"] .trace-rail-live { background-image: linear-gradient(180deg, rgb(230 237 243 / 0.5) 45%, transparent 45%); }
[data-theme="dark"] .trace-active { animation-name: trace-pulse-dark; }
@keyframes trace-pulse-dark {
  0%   { box-shadow: 0 0 0 0 rgb(230 237 243 / 0.35); }
  70%  { box-shadow: 0 0 0 7px rgb(230 237 243 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(230 237 243 / 0); }
}

@keyframes trace-pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.trace-pop { animation: trace-pop 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

@keyframes trace-answer-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.trace-answer { animation: trace-answer-in 0.35s ease forwards; opacity: 0; }

/* React laat een element staan, dus speelt een animatie één keer. chat.js
   tekent opnieuw; wat al getoond werd, krijgt .is-seen en vliegt niet opnieuw in. */
.chat-root .is-seen { animation: none; opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .trace-step, .trace-pop, .trace-answer, .trace-rail { animation-duration: 0.01ms; opacity: 1; }
  .trace-active, .trace-rail-live, .tr-think-shimmer { animation: none; }
  .tr-think-shimmer { color: #7c3aed; }
  .chat-window, .chat-window .chat-scroll, .chat-window .chat-input { transition: none; }
}

/* ── ⓘ De uitleg ──────────────────────────────────────────────────────
   fixed inset-0 z-[60] flex items-center justify-center bg-black/50 p-4 backdrop-blur-sm */
.ci-overlay {
  position: fixed; inset: 0; z-index: 600; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); padding: 1rem;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  line-height: 1.5;
}
.ci-detail-overlay { z-index: 700; }
.ci-modal {
  display: flex; flex-direction: column; overflow: hidden;
  width: 80vw; height: 80vh; border-radius: 1.125rem; background: var(--c-bg); box-shadow: var(--c-shadow);
}
@media (max-width: 640px) { .ci-modal { width: 100%; height: 90vh; } }

.ci-i3 { width: 0.75rem; height: 0.75rem; flex: none; }
.ci-i35 { width: 0.875rem; height: 0.875rem; flex: none; }
.ci-i4 { width: 1rem; height: 1rem; flex: none; }
.ci-i5 { width: 1.25rem; height: 1.25rem; flex: none; }
.ci-i6 { width: 1.5rem; height: 1.5rem; flex: none; }
.ci-fuchsia { color: #f0abfc; }
.ci-mt2 { margin-top: 0.5rem !important; }
.ci-mt4 { margin-top: 1rem; }

/* flex items-center gap-3 border-b border-slate-100 bg-slate-900 px-6 py-4 text-white */
.ci-head {
  display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.5rem;
  background: var(--c-head); color: #fff; border-bottom: 1px solid var(--c-100);
}
.ci-head-icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 0.875rem;
  background: rgba(255, 255, 255, 0.1); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.ci-head-text { min-width: 0; }
.ci-head h2, .ci-detail-head h3 { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.25; }
.ci-head p { margin: 0.125rem 0 0; font-size: 0.75rem; color: #cbd5e1; }
.ci-head-close {
  margin-left: auto; flex: none; display: flex; border: 0; background: none; cursor: pointer;
  border-radius: 0.5rem; padding: 0.375rem; color: #cbd5e1; transition: background-color 0.15s, color 0.15s;
}
.ci-head-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.ci-body { overflow-y: auto; padding: 1.25rem 1.5rem; }
.ci-intro {
  max-width: 48rem; margin: 0 auto 1.25rem; border-radius: 0.875rem;
  border: 1px solid var(--c-200); background: var(--c-50); padding: 1rem;
}
.ci-p { margin: 0; font-size: 0.875rem; line-height: 1.625; color: var(--c-600); }
.ci-p b { color: var(--c-800); }
.ci-hint { display: flex; align-items: center; gap: 0.375rem; margin: 0.5rem 0 0; font-size: 0.75rem; color: #94a3b8; }
.ci-overlay code {
  display: inline-flex; align-items: center; border-radius: 0.5rem; background: #1e293b;
  padding: 0.125rem 0.375rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: #f1f5f9;
}

.ci-diagram { max-width: 32rem; margin: 0 auto; }

/* De tonen van de vakken — zoals TONES in ChatInfoModal.tsx */
.tone-slate   { --t-border: #cbd5e1; --t-bg: #f8fafc; --t-text: #1e293b; --t-icon: #475569; }
.tone-amber   { --t-border: #fcd34d; --t-bg: #fffbeb; --t-text: #78350f; --t-icon: #d97706; }
.tone-teal    { --t-border: #5eead4; --t-bg: #f0fdfa; --t-text: #134e4a; --t-icon: #0d9488; }
.tone-fuchsia { --t-border: #f0abfc; --t-bg: #fdf4ff; --t-text: #701a75; --t-icon: #c026d3; }
.tone-emerald { --t-border: #6ee7b7; --t-bg: #ecfdf5; --t-text: #064e3b; --t-icon: #059669; }
.tone-violet  { --t-border: #c4b5fd; --t-bg: #f5f3ff; --t-text: #4c1d95; --t-icon: #7c3aed; }
.tone-red     { --t-border: #fca5a5; --t-bg: #fef2f2; --t-text: #7f1d1d; --t-icon: #dc2626; }
.tone-blue    { --t-border: #93c5fd; --t-bg: #eff6ff; --t-text: #1e3a8a; --t-icon: #2563eb; }
.tone-rose    { --t-border: #fda4af; --t-bg: #fff1f2; --t-text: #881337; --t-icon: #e11d48; }
[data-theme="dark"] .ci-overlay [class*="tone-"] { --t-bg: color-mix(in srgb, var(--t-icon) 12%, #161b22); --t-text: color-mix(in srgb, var(--t-border) 85%, #fff); }

/* group relative w-full rounded-xl border-2 p-3 text-left shadow-sm transition-all hover:-translate-y-0.5 hover:shadow-md */
.ci-box {
  position: relative; width: 100%; display: flex; align-items: center; gap: 0.625rem;
  border-radius: 0.875rem; border: 2px solid var(--t-border); background: var(--t-bg);
  padding: 0.75rem; text-align: left; cursor: pointer;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.ci-box:hover { transform: translateY(-0.125rem); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); }
.ci-box:focus-visible { outline: 2px solid var(--t-border); outline-offset: 2px; }
.ci-box-icon, .ci-detail-icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 2rem; height: 2rem; border-radius: 0.625rem; background: #fff; color: var(--t-icon);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .ci-box-icon, [data-theme="dark"] .ci-detail-icon { background: #0d1117; }
.ci-box-text { min-width: 0; display: block; }
.ci-box-title { display: block; overflow-wrap: break-word; font-size: 0.875rem; font-weight: 700; line-height: 1.25; color: var(--t-text); }
.ci-box-role { display: block; margin-top: 0.125rem; font-size: 0.75rem; line-height: 1.375; color: var(--c-500); }
.ci-box-info { margin-left: auto; width: 1rem; height: 1rem; flex: none; color: #94a3b8; transition: color 0.15s; }
.ci-box:hover .ci-box-info { color: var(--c-600); }

/* flex flex-col items-center py-1 */
.ci-down { display: flex; flex-direction: column; align-items: center; padding: 0.25rem 0; text-align: center; }
.ci-down span { margin-bottom: 0.125rem; font-size: 10px; font-weight: 500; color: #94a3b8; }
.ci-down-icon { width: 1rem; height: 1rem; color: var(--c-300); }

/* rounded-2xl border-2 border-dashed border-fuchsia-300 bg-fuchsia-50/50 p-3 */
.ci-loop { border-radius: 1.125rem; border: 2px dashed #f0abfc; background: rgba(253, 244, 255, 0.5); padding: 0.75rem; margin-top: 0.75rem; }
[data-theme="dark"] .ci-loop { background: rgba(192, 38, 211, 0.06); }
.ci-loop-badge-wrap { display: flex; justify-content: center; margin: -1.5rem 0 0.5rem; }
.ci-loop-badge {
  display: inline-flex; align-items: center; gap: 0.375rem; max-width: 100%;
  border-radius: 9999px; background: #c026d3; color: #fff; padding: 0.125rem 0.625rem;
  font-size: 10px; font-weight: 700; line-height: 1.375; text-transform: uppercase; letter-spacing: 0.05em;
  text-align: center; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
/* rounded-xl border border-dashed border-slate-300 bg-white/80 p-2.5 */
.ci-tools { border-radius: 0.875rem; border: 1px dashed var(--c-300); background: color-mix(in srgb, var(--c-bg) 80%, transparent); padding: 0.625rem; }
.ci-tools-head { margin: 0 0 0.125rem; text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #94a3b8; }
.ci-tools-sub { margin: 0 0 0.5rem; text-align: center; font-size: 10px; line-height: 1.375; color: #94a3b8; }
.ci-grid { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
@media (min-width: 640px) { .ci-grid { grid-template-columns: 1fr 1fr; } }
.ci-grid .ci-box-title { font-size: 0.8125rem; }

/* mt-2 flex items-center gap-2 rounded-xl border border-fuchsia-200 bg-white/80 px-3 py-2 */
.ci-loopback {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem;
  border-radius: 0.875rem; border: 1px solid #f5d0fe; background: color-mix(in srgb, var(--c-bg) 80%, transparent);
  padding: 0.5rem 0.75rem;
}
.ci-loopback > span { min-width: 0; }
.ci-loopback-up { color: #d946ef; animation: ci-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes ci-pulse { 50% { opacity: 0.5; } }
.ci-loopback-l { display: block; font-size: 11px; font-weight: 600; line-height: 1.375; color: #a21caf; }
.ci-loopback-s { display: block; margin-top: 0.125rem; font-size: 10px; line-height: 1.375; color: rgba(217, 70, 239, 0.8); }
.ci-loopback-r { margin-left: auto; color: #e879f9; }

.ci-footer { max-width: 32rem; margin: 1.5rem auto 0; text-align: center; font-size: 11px; line-height: 1.625; color: #94a3b8; }

/* Detail: max-h-[80vh] w-full max-w-lg rounded-2xl bg-white shadow-2xl */
.ci-detail {
  display: flex; flex-direction: column; overflow: hidden;
  width: 100%; max-width: 32rem; max-height: 80vh; border-radius: 1.125rem;
  background: var(--c-bg); box-shadow: var(--c-shadow);
}
.ci-detail-head {
  display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem;
  background: var(--t-bg); border-bottom: 1px solid var(--t-border);
}
.ci-detail-head .ci-detail-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.875rem; }
.ci-detail-head h3 { color: var(--t-text); }
.ci-detail-head p { margin: 0.125rem 0 0; font-size: 0.75rem; line-height: 1.375; color: var(--c-500); }
.ci-detail-close {
  margin-left: auto; flex: none; display: flex; border: 0; background: none; cursor: pointer;
  border-radius: 0.5rem; padding: 0.375rem; color: #94a3b8; transition: background-color 0.15s, color 0.15s;
}
.ci-detail-close:hover { background: rgba(255, 255, 255, 0.6); color: #334155; }
.ci-detail-body { overflow-y: auto; padding: 1rem 1.25rem; }
.ci-detail-foot { border-top: 1px solid var(--c-100); padding: 0.625rem 1.25rem; }
.ci-detail-foot button { border: 0; background: none; padding: 0; cursor: pointer; font-size: 0.75rem; font-weight: 500; color: #94a3b8; transition: color 0.15s; }
.ci-detail-foot button:hover { color: var(--c-700); }

.ci-section + .ci-section { margin-top: 1rem; }
.ci-section-t { margin: 0 0 0.375rem; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #94a3b8; }
.ci-steps, .ci-facts { list-style: none; margin: 0; padding: 0; }
.ci-steps li { display: flex; align-items: flex-start; gap: 0.625rem; }
.ci-steps li + li { margin-top: 0.5rem; }
.ci-step-n {
  margin-top: 0.125rem; flex: none; width: 1.25rem; height: 1.25rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: #1e293b; color: #fff; font-size: 10px; font-weight: 700;
}
.ci-step-l { display: block; font-size: 0.875rem; font-weight: 600; line-height: 1.25; color: var(--c-800); }
.ci-step-s { display: block; margin-top: 0.125rem; font-size: 0.75rem; line-height: 1.375; color: var(--c-500); }
.ci-facts li { display: flex; gap: 0.5rem; font-size: 0.875rem; color: var(--c-600); }
.ci-facts li + li { margin-top: 0.375rem; }
.ci-fact-dot { margin-top: 0.5rem; flex: none; width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: var(--c-300); }
.ci-fact-k { font-weight: 600; color: var(--c-800); }
.ci-callout {
  display: flex; align-items: flex-start; gap: 0.625rem; border-radius: 0.875rem;
  border: 1px solid var(--t-border); background: var(--t-bg); padding: 0.75rem;
  font-size: 0.75rem; line-height: 1.625; color: var(--t-text);
}
.ci-callout-icon { margin-top: 0.125rem; width: 1rem; height: 1rem; flex: none; color: var(--t-icon); }

/* Bij het afdrukken van een dashboard hoort de chat er niet bij. */
@media print { .chat-root { display: none; } }

/* ── Full-screen ──────────────────────────────────────────────────────
   Hetzelfde venster, over het hele scherm: gesprek in een gecentreerde kolom,
   rechts de voorbeeldvragen per sector. Onder de ci-uitleg (z-index 600), zodat
   ⓘ er gewoon bovenop opent. chat.js zet .is-full en .is-empty. */
.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-ex, .chat-back { display: none; }

.chat-window.is-full {
  inset: 0; z-index: 550; width: 100vw; height: 100dvh;
  border: 0; border-radius: 0; box-shadow: none; transition: none;
}
.chat-window.is-full .chat-scroll,
.chat-window.is-full .chat-input { font-size: 0.9375rem; transition: none; }
.chat-window.is-full .chat-head { padding: 0.75rem 1.25rem; }
.chat-window.is-full .chat-full-btn,
.chat-window.is-full .is-close { display: none; }
/* De pagina eronder scrolt niet mee. */
html.chat-full-open, html.chat-full-open body { overflow: hidden; }

/* ← Terug naar dashboards */
.chat-window.is-full .chat-back {
  display: inline-flex; align-items: center; gap: 0.375rem; margin-right: 0.75rem;
  padding: 0.3rem 0.625rem 0.3rem 0.5rem; border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0; font-size: 0.8125rem; cursor: pointer; transition: background-color 0.15s;
}
.chat-window.is-full .chat-back:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.chat-window.is-full .chat-back:focus-visible { outline: 2px solid #94a3b8; outline-offset: 2px; }

/* Gesprek in een kolom van max. 48rem, de scrollbalk blijft aan de rand. */
.chat-window.is-full .chat-scroll {
  padding: 1.5rem max(1.25rem, calc((100% - 48rem) / 2));
  gap: 0.75rem;
}
.chat-window.is-full .chat-inputrow {
  padding: 0.875rem max(1.25rem, calc((100% - 48rem) / 2)) 1.25rem;
}
.chat-window.is-full .chat-input { padding: 0.75rem 1rem; border-radius: 0.75rem; }
.chat-window.is-full .chat-send { width: 2.75rem; border-radius: 0.75rem; }
.chat-window.is-full .chat-bubble-user,
.chat-window.is-full .chat-bubble-bot { padding: 0.625rem 0.875rem; }
.chat-window.is-full .chat-empty { margin: auto 0; text-align: center; font-size: 1rem; }

/* De voorbeeldvragen */
.chat-window.is-full .chat-ex {
  display: flex; flex-direction: column; flex: none; width: 24rem;
  overflow-y: auto; padding: 1.5rem 1.25rem;
  border-left: 1px solid var(--c-200); background: var(--c-50);
}
.chat-ex-title {
  display: flex; align-items: center; gap: 0.5rem; margin: 0;
  font-size: 0.9375rem; font-weight: 600; color: var(--c-900);
}
.chat-ex-title svg { color: #c026d3; }
.chat-ex-sub { margin: 0.25rem 0 1rem; font-size: 0.8125rem; color: var(--c-500); }
.chat-ex-sectors { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1rem; }
.chat-ex-sector {
  border: 1px solid var(--c-200); background: var(--c-bg); color: var(--c-600);
  border-radius: 9999px; padding: 0.25rem 0.625rem; font-size: 0.75rem; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.chat-ex-sector:hover { border-color: var(--c-400); color: var(--c-900); }
.chat-ex-sector.is-active { background: var(--c-user); border-color: var(--c-user); color: #fff; }
.chat-ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-ex-q {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem;
  padding: 0.625rem 0.75rem; border-radius: 0.625rem;
  border: 1px solid var(--c-200); background: var(--c-bg); color: var(--c-800);
  font-size: 0.875rem; line-height: 1.4;
  transition: border-color 0.15s, transform 0.15s;
}
.chat-ex-q:hover { border-color: var(--c-400); transform: translateY(-1px); }
.chat-ex-q:focus-visible { outline: 2px solid var(--c-400); outline-offset: 1px; }
.chat-ex-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.6875rem; font-weight: 500; color: var(--c-500);
  border-radius: 9999px; padding: 0.0625rem 0.5rem; background: var(--c-100);
}
.chat-ex-badge.is-can { color: #047857; background: #d1fae5; }
[data-theme="dark"] .chat-ex-badge.is-can { color: #6ee7b7; background: rgba(16, 185, 129, 0.15); }

/* Smal scherm: geen zijkolom. De vragen staan onder elkaar zolang het gesprek
   leeg is, daarna maken ze plaats voor het gesprek. */
@media (max-width: 900px) {
  .chat-window.is-full .chat-body { flex-direction: column-reverse; }
  .chat-window.is-full .chat-ex { width: auto; border-left: 0; border-bottom: 1px solid var(--c-200); flex: 1; }
  .chat-window.is-full:not(.is-empty) .chat-ex { display: none; }
  .chat-window.is-full.is-empty .chat-main { flex: none; }
  .chat-window.is-full.is-empty .chat-scroll { display: none; }
  .chat-window.is-full .chat-back span { display: none; }
}

/* Snelknop full-screen, links van de ronde knop. */
.chat-fab-full {
  position: fixed; right: 4.5rem; bottom: 1.375rem; z-index: 500;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--c-200); background: var(--c-bg); color: var(--c-700);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: background-color 0.15s, color 0.15s;
}
.chat-fab-full:hover { background: var(--c-100); color: var(--c-900); }
.chat-fab-full:focus-visible { outline: 2px solid #94a3b8; outline-offset: 2px; }

/* ── Doorgeven aan Bob (chat.js → handoff) ────────────────────────────
   Onder het antwoord "ik geef het door aan Bob": een knop om Bob opnieuw te
   openen. De helm zelf wenkt even (change-request.css: .cr-fab.is-called). */
.chat-handoff-btn {
  margin: 0.375rem auto 0 0; display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.3125rem 0.75rem 0.3125rem 0.5rem; border-radius: 9999px; cursor: pointer;
  border: 1px solid #f59e0b; background: rgba(245, 158, 11, 0.12); color: var(--c-bot-text);
  font: inherit; font-size: 0.8125rem; font-weight: 600;
}
.chat-handoff-btn:hover { background: rgba(245, 158, 11, 0.22); }
.chat-handoff-btn:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
.chat-handoff-helm { font-size: 1rem; line-height: 1; }

/* Laadicoontje voor wie de stappen niet ziet (alles behalve de DecisionFlow-login) */
.chat-loading { display: inline-flex; align-items: center; gap: 0.5rem; }
.chat-spinner {
  width: 0.9rem; height: 0.9rem; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: chat-spin 0.8s linear infinite;
}
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-spinner { animation-duration: 2s; } }
