/* ─── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --clr-bg:             #faf9f7;   /* Claude warm cream */
  --clr-surface:        #ffffff;
  --clr-border:         #e7e5e4;   /* warm gray */
  --clr-primary:        #1c1917;   /* Claude dark warm brown */
  --clr-primary-hover:  #292524;
  --clr-accent:         #d97757;
  --clr-accent-hover:   #c4623e;
  --clr-text:           #1c1917;
  --clr-muted:          #78716c;   /* warm muted */
  --clr-user-bg:        #f5ede3;   /* warm tan bubble */
  --clr-user-fg:        #1c1917;   /* dark text on tan */
  --clr-error:          #b91c1c;
  --clr-warn-bg:        #fef9ec;
  --clr-warn-border:    #e2c97a;
  --clr-sidebar:        #e8e6dc;
  --clr-sidebar-text:   #1c1917;   /* dark text */
  --clr-sidebar-muted:  #78716c;   /* warm muted */
  --clr-sidebar-hover:  rgba(0,0,0,.04);
  --clr-sidebar-active: rgba(217,119,87,.15);
  --radius-sm:          8px;
  --radius-md:          16px;
  --radius-lg:          24px;
  --shadow-input:       0 2px 8px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.07);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--clr-text);
  background: var(--clr-bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── Login scherm ──────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--clr-sidebar);
}

.login-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--clr-primary);
  line-height: 1.3;
}

.login-logo p {
  font-size: 0.875rem;
  color: var(--clr-muted);
  margin-top: 0.4rem;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--clr-text);
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--clr-text);
  background: var(--clr-surface);
  transition: border-color .15s;
  appearance: none;
}

.form-group input:focus {
  outline: none;
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(217,119,87,.18);
}

.btn-primary {
  width: 100%;
  padding: 0.75rem;
  background: var(--clr-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  margin-top: 0.5rem;
}

.btn-primary:hover { background: var(--clr-accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

#login-error {
  display: none;
  background: #fef2f2;
  color: var(--clr-error);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ─── App layout ────────────────────────────────────────────────────── */
#app {
  display: none;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--clr-sidebar);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

/* Mobile: sidebar as fixed overlay */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    z-index: 200;
    transform: translateX(-260px);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
}

.sidebar-top {
  padding: 1rem 0.75rem 0.75rem;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.25rem;
  margin-bottom: 1rem;
}

.brand-icon {
  width: 32px; height: 32px;
  background: var(--clr-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
  letter-spacing: .04em;
}

.brand-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--clr-sidebar-text);
  flex: 1;
  line-height: 1.3;
}

.btn-sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--clr-sidebar-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  line-height: 1;
  opacity: .7;
  border-radius: 4px;
}
.btn-sidebar-close:hover { opacity: 1; background: var(--clr-sidebar-hover); }

@media (max-width: 767px) {
  .btn-sidebar-close { display: block; }
}

.btn-sidebar-new-chat {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--clr-sidebar-hover);
  color: var(--clr-primary);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.btn-sidebar-new-chat:hover { background: var(--clr-sidebar-active); }

/* Sidebar conversation list */
.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.15) transparent;
}

.sidebar-empty {
  font-size: 0.8rem;
  color: var(--clr-sidebar-muted);
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.conv-item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 0.1rem;
  transition: background .1s;
}
.conv-item:hover { background: var(--clr-sidebar-hover); }
.conv-item.active { background: var(--clr-sidebar-active); }

.conv-item-info { flex: 1; min-width: 0; }

.conv-title {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--clr-sidebar-text);
}

.conv-meta {
  font-size: 0.7rem;
  color: var(--clr-sidebar-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item-actions {
  display: flex;
  gap: 0.1rem;
  flex-shrink: 0;
  align-self: center;
  opacity: 0;
  transition: opacity .15s;
}
.conv-item:hover .conv-item-actions { opacity: 1; }

.btn-delete-conv, .btn-share-conv, .btn-unshare-conv {
  background: none;
  border: none;
  color: var(--clr-sidebar-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.2rem;
  border-radius: 4px;
  line-height: 1;
}
.btn-delete-conv:hover  { color: #dc2626; }
.btn-share-conv:hover   { color: var(--clr-accent); }
.btn-unshare-conv:hover { color: #dc2626; }

.conv-section-header {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clr-sidebar-muted);
  padding: 0.75rem 0.55rem 0.3rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--clr-border);
}

/* Sidebar footer: user + logout */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.82rem;
  color: var(--clr-sidebar-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sidebar-logout {
  background: none;
  border: 1px solid var(--clr-border);
  color: var(--clr-sidebar-muted);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-sidebar-logout:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

/* ─── Admin kostenlimiet toggle ─────────────────────────────────────── */
.admin-cost-panel {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}
.admin-cost-label {
  font-size: 0.78rem;
  color: var(--clr-sidebar-muted);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-knob {
  position: absolute;
  inset: 0;
  background: var(--clr-border);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-knob::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-knob { background: var(--clr-accent); }
.toggle-switch input:checked + .toggle-knob::before { transform: translateX(16px); }

/* ─── Sidebar overlay (mobile) ──────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150;
}
.sidebar-overlay.active { display: block; }

@media (min-width: 768px) {
  .sidebar-overlay { display: none !important; }
}

/* ─── Chat column ───────────────────────────────────────────────────── */
.chat-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--clr-bg);
}

/* Mobile top bar (hamburger) */
.mobile-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .mobile-bar { display: flex; }
}

.mobile-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-primary);
}

.btn-sidebar-toggle {
  background: none;
  border: none;
  color: var(--clr-text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  line-height: 1;
}
.btn-sidebar-toggle:hover { background: var(--clr-border); }

/* ─── Chat area ─────────────────────────────────────────────────────── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

/* ─── Messages ──────────────────────────────────────────────────────── */
.message {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 1.75rem;
}

/* User: right-aligned pill bubble */
.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.user .message-bubble {
  background: var(--clr-user-bg);
  color: var(--clr-user-fg);
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 6px;
  max-width: 75%;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Assistant: icon badge + plain text */
.message.assistant {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.msg-icon {
  width: 30px; height: 30px;
  background: var(--clr-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
  letter-spacing: .04em;
}

.message.assistant .message-bubble {
  flex: 1;
  min-width: 0;          /* kritisch: laat flex-child krimpen zodat overflow-x werkt */
  line-height: 1.75;
  font-size: 15px;
  color: var(--clr-text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* System messages */
.message.system .message-bubble {
  background: var(--clr-warn-bg);
  border: 1px solid var(--clr-warn-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

/* ─── Suggestion box ────────────────────────────────────────────────── */
.suggestion-box {
  background: var(--clr-warn-bg);
  border: 1px solid var(--clr-warn-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto 1.75rem;
}

.suggestion-box .summary {
  font-size: 0.9rem;
  color: var(--clr-muted);
  margin-bottom: 0.75rem;
}

.suggestion-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.suggestion-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  color: var(--clr-primary);
  cursor: pointer;
  transition: all .15s;
  min-height: 44px;
  line-height: 1.4;
}

.suggestion-btn:hover {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

/* ─── Bronverwijzingen ──────────────────────────────────────────────── */
.sources-block {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--clr-border);
  font-size: 0.8rem;
  color: var(--clr-muted);
}

.sources-block ul { list-style: none; margin-top: 0.3rem; }
.sources-block li::before { content: '📄 '; }

/* ─── Markdown opmaak ───────────────────────────────────────────────── */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
}

.message-bubble p { margin-bottom: 0.5rem; }
.message-bubble ul, .message-bubble ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.message-bubble li { margin-bottom: 0.25rem; }

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin: 0.6rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
}

.table-wrapper table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

.table-wrapper th, .table-wrapper td {
  border: 1px solid var(--clr-border);
  padding: 0.4rem 0.75rem;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  vertical-align: top;
  font-size: 0.875rem;
}

.table-wrapper th {
  background: var(--clr-bg);
  font-weight: 600;
  white-space: nowrap;
}

.table-wrapper tr:nth-child(even) td { background: rgba(0,0,0,.018); }

@media (max-width: 767px) {
  .table-wrapper th, .table-wrapper td {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }
  .table-wrapper th {
    white-space: normal;  /* laat headers ook wrappen op smal scherm */
  }
}

.message-bubble pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  background: rgba(0,0,0,.04);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  font-size: 0.85em;
  line-height: 1.5;
}

.message-bubble pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

.message-bubble code {
  background: rgba(0,0,0,.05);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.875em;
}

/* ─── Vervolgvragen ─────────────────────────────────────────────────── */
.follow-up-questions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--clr-border);
}

.follow-up-label {
  font-size: 0.8rem;
  color: var(--clr-muted);
  margin-bottom: 0.4rem;
}

.follow-up-btn {
  display: inline-block;
  margin: 0.2rem 0.2rem 0.2rem 0;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid var(--clr-border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--clr-primary);
  cursor: pointer;
  transition: all .15s;
  min-height: 36px;
  line-height: 1.4;
  text-align: left;
}

.follow-up-btn:hover {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

/* ─── Loading indicator (three dots) ───────────────────────────────── */
.loading-msg {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.loading-bubble {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 6px;
}

.dot-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot-typing span {
  display: block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--clr-muted);
  opacity: .5;
  animation: dot-pulse .9s ease-in-out infinite;
}

.dot-typing span:nth-child(2) { animation-delay: .15s; }
.dot-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes dot-pulse {
  0%, 100% { opacity: .35; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.15); }
}

.loading-text {
  font-size: 0.875rem;
  color: var(--clr-muted);
}

/* ─── Welkomstbericht ───────────────────────────────────────────────── */
.welcome-msg {
  text-align: center;
  color: var(--clr-muted);
  padding: 4rem 1rem 2rem;
  max-width: 480px;
  margin: auto;
}

.welcome-msg h2 {
  font-size: 1.3rem;
  color: var(--clr-text);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.welcome-msg p {
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ─── Input area ────────────────────────────────────────────────────── */
.input-area {
  flex-shrink: 0;
  padding: 0.5rem 1.25rem 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
  max-width: 800px;
  width: 100%;
  align-self: center;
}

/* Workspace pills row above composer */
.composer-workspace {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.composer-workspace::-webkit-scrollbar { display: none; }

.workspace-pills {
  display: flex;
  gap: 0.3rem;
  min-width: max-content;
}

.ws-pill {
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--clr-border);
  background: var(--clr-surface);
  color: var(--clr-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  min-height: 28px;
  display: flex;
  align-items: center;
}

.ws-pill:hover {
  border-color: var(--clr-accent);
  color: var(--clr-accent);
}

.ws-pill.active {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
  color: #fff;
}

.workspace-label {
  font-size: 0.72rem;
  color: var(--clr-muted);
  white-space: nowrap;
  flex-shrink: 0;
  display: none;
}

/* Pill-shaped composer box */
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-input);
  padding: 0.5rem 0.5rem 0.5rem 1.1rem;
}

.composer-box textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--clr-text);
  background: transparent;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  padding: 0.3rem 0;
}

.composer-box textarea::placeholder { color: var(--clr-muted); }

.btn-send {
  background: var(--clr-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 32px; height: 32px;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-send:hover { background: var(--clr-accent-hover); }
.btn-send:disabled {
  background: var(--clr-border);
  color: var(--clr-muted);
  cursor: not-allowed;
}

/* ─── Mode toggles ──────────────────────────────────────────────────── */
.controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.controls-row::-webkit-scrollbar { display: none; }

.toggle-group {
  display: flex;
  border: 1px solid var(--clr-border);
  border-radius: 999px;
  overflow: hidden;
}

.toggle-pill {
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-family: inherit;
  border: none;
  background: var(--clr-surface);
  color: var(--clr-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.toggle-pill.active {
  background: var(--clr-accent);
  color: #fff;
}

.toggle-pill.disabled,
.toggle-pill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.extended-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: var(--clr-muted);
  cursor: pointer;
  user-select: none;
}

.extended-label input[type="checkbox"] { cursor: pointer; }
.extended-label.disabled { opacity: 0.4; cursor: not-allowed; }
.extended-label.disabled input { cursor: not-allowed; pointer-events: none; }

/* ─── Status steps ──────────────────────────────────────────────────── */
.status-steps {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--clr-muted);
  padding-left: 2.5rem;
}

/* ─── Answer metadata ───────────────────────────────────────────────── */
.answer-meta {
  font-size: 0.75rem;
  color: var(--clr-muted);
  margin-top: 0.5rem;
  cursor: pointer;
}

.answer-meta summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.answer-meta summary::before { content: '▸'; font-size: 0.7rem; }
.answer-meta[open] summary::before { content: '▾'; }
.answer-meta-content { padding: 0.3rem 0 0 0.8rem; }

/* ─── Continuation block ────────────────────────────────────────────── */
.continue-block {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--clr-warn-border);
  border-radius: var(--radius-md);
  background: var(--clr-warn-bg);
  padding: 1rem;
  font-size: 0.875rem;
}

.continue-block p { margin: 0.3rem 0; color: var(--clr-text); }
.continue-block .continue-reason { color: var(--clr-muted); font-size: 0.82rem; }

.continue-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.btn-continue {
  background: var(--clr-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}

.btn-continue:hover { background: var(--clr-accent-hover); }
.btn-continue:disabled { background: var(--clr-border); cursor: not-allowed; }

.btn-stop {
  background: transparent;
  color: var(--clr-muted);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.btn-stop:hover { border-color: var(--clr-text); color: var(--clr-text); }

/* ─── Cost warning ──────────────────────────────────────────────────── */
.cost-warning-msg {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 0.75rem;
  padding: 0.5rem 1rem;
  background: #fef3cd;
  border: 1px solid #f0c050;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #7c5a00;
  text-align: center;
}

/* ─── Toast notificatie ─────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e2330;
  color: #fff;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-size: 0.875rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  display: none;
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
}

/* ─── Fallback warning banner ───────────────────────────────────────── */
/* ─── Help knop ─────────────────────────────────────────────────────── */
.btn-help {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--clr-border);
  background: var(--clr-surface);
  color: var(--clr-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
  line-height: 1;
}
.btn-help:hover {
  border-color: var(--clr-accent);
  color: var(--clr-accent);
}
/* Desktop: zichtbaar in controls-row; mobiel: verborgen */
.btn-help-desktop { display: flex; }
@media (max-width: 767px) {
  .btn-help-desktop { display: none; }
  /* In de mobile-bar staat hij altijd rechts */
  .mobile-bar .btn-help { margin-left: auto; }
}

/* ─── Help modal ────────────────────────────────────────────────────── */
.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.help-modal[hidden] { display: none; }

.help-modal-inner {
  background: var(--clr-bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.help-modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin: 0;
}
.help-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--clr-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}
.help-modal-close:hover { color: var(--clr-primary); }

.help-modal-body {
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.help-section {
  margin-bottom: 1.5rem;
}
.help-section:last-child { margin-bottom: 0; }
.help-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.help-section p {
  font-size: 0.84rem;
  color: var(--clr-text);
  line-height: 1.55;
  margin: 0 0 0.4rem;
}
.help-note {
  font-size: 0.78rem;
  color: var(--clr-muted);
  background: var(--clr-surface);
  border-left: 3px solid var(--clr-accent);
  padding: 0.4rem 0.65rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.help-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 480px) {
  .help-grid, .help-grid-3 { grid-template-columns: 1fr; }
}

.help-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
}
.help-card-default {
  border-color: var(--clr-accent);
}
.help-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.help-badge {
  font-size: 0.68rem;
  font-weight: 500;
  background: var(--clr-accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  text-transform: lowercase;
}
.help-card p {
  font-size: 0.78rem;
  color: var(--clr-muted);
  line-height: 1.5;
  margin: 0;
}

.help-section-cost {}
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}
.help-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  background: var(--clr-surface);
  color: var(--clr-muted);
  border-bottom: 1px solid var(--clr-border);
  font-weight: 600;
}
.help-table td {
  padding: 0.35rem 0.5rem;
  color: var(--clr-text);
  border-bottom: 1px solid var(--clr-border);
}
.help-table tr:last-child td { border-bottom: none; }

#fallback-banner {
  width: 100%;
  padding: 0.6rem 1.25rem;
  background: var(--clr-warn-bg);
  border-bottom: 1px solid var(--clr-warn-border);
  font-size: 0.82rem;
  color: #7c5a00;
  text-align: center;
  flex-shrink: 0;
}
