:root {
  --bg: #0d1512;
  --panel: #14201b;
  --panel-2: #1b2c24;
  --line: #294237;
  --text: #e8f1ec;
  --muted: #8fae9f;
  --accent: #22c55e;
  --accent-2: #4ade80;
  --danger: #f87171;
  --bot: #1b2c24;
  --user: #1f6b45;
  --radius: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #17362a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* Topbar — alleen nog voor de beheerpagina (beheer.html); de chat-pagina heeft
   geen header meer.  --------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
  background: rgba(15,20,32,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .8rem; }
.logo {
  font-size: 1.6rem; color: var(--accent);
  background: var(--panel-2); width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
}
.topbar h1 { font-size: 1.05rem; margin: 0; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .78rem; }

.tabs { display: flex; gap: .4rem; background: var(--panel); padding: .3rem; border-radius: 12px; border: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: .5rem .9rem; border-radius: 9px; font-size: .9rem; font-weight: 600;
}
.tab.active { background: var(--panel-2); color: var(--text); }

/* Panels ---------------------------------------------------------------- */
.tabpanel { display: none; max-width: 860px; margin: 0 auto; padding: 1.5rem; }
.tabpanel.active { display: block; }
.hidden { display: none !important; }

/* Buttons --------------------------------------------------------------- */
button.primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: .6rem 1.1rem; font-weight: 600; cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }
button.primary.big { padding: .8rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }
button.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem 1rem; cursor: pointer;
}
button.ghost:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Formulier-elementen (chat-invoer en beheer) --------------------------- */
select, input, textarea {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: .6rem .7rem; font: inherit; flex: 1;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); }
.hint { color: var(--muted); font-size: .82rem; }
.hint code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; }

/* Chat shell ------------------------------------------------------------ */
/* Zonder topbar is de enige verticale ruimte naast de chat de padding van
   .tabpanel (2 × 1.5rem), dus vult de shell de rest van het scherm. */
.chat-shell { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 3rem); }
.chat-log { flex: 1; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .8rem; }

.msg { max-width: 78%; padding: .7rem .9rem; border-radius: 14px; line-height: 1.4; white-space: pre-wrap; animation: pop .18s ease; }
.msg.bot { background: var(--bot); border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: var(--user); border-bottom-right-radius: 4px; align-self: flex-end; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: .8rem; text-align: center; max-width: 100%; }
.msg .help { color: var(--muted); font-size: .8rem; margin-top: .3rem; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Result card ----------------------------------------------------------- */
.result-card { align-self: stretch; max-width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.result-value { font-size: 1.8rem; font-weight: 800; color: var(--accent-2); }
.result-band { margin-top: .2rem; font-size: .85rem; color: var(--muted); }
.result-note { margin-top: .5rem; font-size: .85rem; color: var(--accent); font-weight: 600; }
.breakdown { margin-top: .7rem; border-top: 1px solid var(--line); }
.brow { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.brow .amt { font-variant-numeric: tabular-nums; }
.brow .amt.neg { color: var(--danger); }
.brow .amt.pos { color: var(--accent-2); }
.brow.base { font-weight: 700; }

/* Chat input ------------------------------------------------------------ */
.chat-input { border-top: 1px solid var(--line); padding: 1rem; min-height: 64px; background: var(--panel); }
.options { display: flex; flex-wrap: wrap; gap: .5rem; }
.opt-btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: .5rem .95rem; cursor: pointer; font-weight: 600; }
.opt-btn:hover { border-color: var(--accent); background: #24304e; }
.opt-btn .val { color: var(--muted); font-weight: 400; font-size: .78rem; margin-left: .35rem; }
.text-row { display: flex; gap: .5rem; }
.text-row input { flex: 1; }

.chat-footer { display: flex; align-items: center; justify-content: space-between; padding: .5rem 1rem; border-top: 1px solid var(--line); background: var(--panel); }
.status { color: var(--muted); font-size: .8rem; }
.status.err { color: var(--danger); }

/* Editor ---------------------------------------------------------------- */
.editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .6rem; }
.editor-head h2 { margin: 0 0 .2rem; }
.editor-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.editor-msg { min-height: 1.2rem; font-size: .85rem; margin: .2rem 0 1rem; }
.editor-msg.ok { color: var(--accent-2); }
.editor-msg.err { color: var(--danger); }

.question-list { display: flex; flex-direction: column; gap: .7rem; }
.qcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.qcard.dragging { opacity: .4; }
.qcard.dragover { border-color: var(--accent); }
.qcard-head { display: flex; align-items: center; gap: .6rem; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; user-select: none; }
.qcard-head .field { font-weight: 700; }
.qcard-head .badge { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.qcard-head .spacer { flex: 1; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; }
.icon-btn:hover { color: var(--danger); }
.qcard-body { margin-top: .7rem; display: grid; gap: .55rem; }
.qcard-body label { font-size: .78rem; color: var(--muted); display: block; margin-bottom: .2rem; }
.qcard-body .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.qcard-body input, .qcard-body select, .qcard-body textarea { width: 100%; }
.options-editor { border: 1px dashed var(--line); border-radius: 10px; padding: .6rem; }
.opt-line { display: flex; gap: .4rem; margin-bottom: .4rem; align-items: center; }
.opt-line input { flex: 1; }
.opt-line .icon-btn { flex: 0; }
.add-opt { font-size: .8rem; }
.collapsed .qcard-body { display: none; }

.src-note { margin-top: .6rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .5rem; }

