:root {
  --navy:   #1a2d4a;
  --cyan:   #00b5c8;
  --light:  #e0f7fa;
  --white:  #ffffff;
  --border: rgba(0,181,200,0.25);
  --muted:  #6b7a8d;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(26,45,74,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-image, url('/branding/bg.jpg')) center center / cover no-repeat fixed;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(26, 45, 74, 0.45);
  z-index: 0;
}
.chat-window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  /* Hoogte gebaseerd op de viewport zodat alle content (welkomstkaart +
     pré-examen-notice + tabs + formulier + hervat-banner + telefoonkaart)
     normaal gesproken zonder scrollen past. Op zeer grote schermen kapt
     max-height het af zodat het niet absurd hoog wordt. */
  height: calc(100vh - 40px);
  max-height: 960px;
  min-height: 520px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =============================================
   WELKOMSTSCHERM
============================================= */
#welcomeScreen {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 22px 22px;
  background: var(--light);
  overflow-y: auto;
  min-height: 0;
}
#welcomeScreen.hidden { display: none; }

.welcome-inner { display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 100%; max-width: 460px; text-align: center; }
.welcome-logo { width: 64px; height: 64px; border-radius: 50%; background: var(--navy); display: flex; align-items: center; justify-content: center; color: var(--cyan); font-size: 18px; font-weight: 700; flex-shrink: 0; align-self: center; }
.welcome-inner h2 { color: var(--navy); font-size: 19px; line-height: 1.3; }
.welcome-inner p { color: var(--muted); font-size: 13px; line-height: 1.55; }

/* Welkom-tabs */
.welcome-tabs {
  display: flex;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 3px;
  gap: 2px;
  align-self: center;
  width: 100%;
  max-width: 360px;
  flex-shrink: 0;
}
.welcome-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  border-radius: 18px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.welcome-tab:hover { color: var(--navy); }
.welcome-tab.active {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 1px 4px rgba(26,45,74,0.18);
}
.welcome-tab svg { flex-shrink: 0; }

/* Tab-panes */
.welcome-pane { display: none; flex-direction: column; gap: 14px; width: 100%; }
.welcome-pane.active { display: flex; }
#welcomePaneChat { align-items: center; }
#welcomePaneChat .welcome-form { width: 100%; }
#welcomePaneKb { text-align: left; }
.welcome-kb-intro { text-align: center; margin: 4px 0 6px; }
.welcome-kb-intro h3 { color: var(--navy); font-size: 16px; margin-bottom: 4px; }
.welcome-kb-intro p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.welcome-form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.welcome-form input, .welcome-form select { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--navy); background: var(--white); outline: none; }
.welcome-form input:focus, .welcome-form select:focus { border-color: var(--cyan); }
.start-btn { background: var(--navy); color: var(--white); border: none; border-radius: 8px; padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.start-btn:hover { background: #253f6a; }

/* Kennisbank op welkomstscherm */
.welcome-kb-searchwrap { position: relative; display: flex; align-items: center; background: var(--white); border: 1px solid var(--border); border-radius: 24px; padding: 0 14px; gap: 8px; box-shadow: 0 2px 8px rgba(26,45,74,0.04); }
.welcome-kb-searchwrap:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,181,200,0.12); }
.welcome-kb-ico { color: var(--muted); flex-shrink: 0; }
#welcomeKbSearch { flex: 1; border: none; background: transparent; outline: none; padding: 12px 4px; font-size: 14px; color: var(--navy); font-family: inherit; }
#welcomeKbSearch::placeholder { color: var(--muted); }
.welcome-kb-clear { background: transparent; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 6px; line-height: 1; }
.welcome-kb-clear:hover { color: var(--navy); }

/* Live-resultaten dropdown */
.welcome-kb-results { display: none; background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: 0 4px 16px rgba(26,45,74,0.08); text-align: left; }
.welcome-kb-results.visible { display: block; }
.welcome-kb-result { padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background 0.12s; }
.welcome-kb-result:hover { background: var(--light); }
.welcome-kb-result + .welcome-kb-result { margin-top: 2px; }
.welcome-kb-result .ttl { color: var(--navy); font-size: 13.5px; font-weight: 500; }
.welcome-kb-result .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.45; }
.welcome-kb-result .badge { display: inline-block; font-size: 10px; padding: 1px 6px; background: var(--light); color: var(--navy); border-radius: 8px; margin-top: 4px; }
.welcome-kb-noresult { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* Categorie-cards */
.welcome-kb-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.welcome-kb-cats .cat-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; text-align: left; transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s; }
.welcome-kb-cats .cat-card:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(26,45,74,0.08); border-color: var(--cyan); }
.welcome-kb-cats .cat-card .ico { font-size: 18px; line-height: 1; margin-bottom: 4px; }
.welcome-kb-cats .cat-card .name { color: var(--navy); font-size: 13px; font-weight: 600; }
.welcome-kb-cats .cat-card .count { color: var(--cyan); font-size: 10.5px; margin-top: 2px; font-weight: 500; }

/* Artikel-view (vervangt welcomeMain wanneer artikel geopend) */
.welcome-article { width: 100%; max-width: 560px; background: var(--white); border-radius: 12px; padding: 18px; box-shadow: 0 4px 20px rgba(26,45,74,0.08); display: flex; flex-direction: column; gap: 14px; }
.welcome-article-bar { display: flex; align-items: center; }
.welcome-article-back { background: transparent; border: 1px solid var(--border); color: var(--navy); border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-family: inherit; }
.welcome-article-back:hover { background: var(--light); }

.welcome-article-body { text-align: left; color: var(--navy); }
.welcome-article-body .crumb { font-size: 11px; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 6px; }
.welcome-article-body h1 { font-size: 19px; margin: 0 0 6px; }
.welcome-article-body .meta { color: var(--muted); font-size: 11.5px; margin-bottom: 12px; }
.welcome-article-body .body { font-size: 14px; line-height: 1.6; }
.welcome-article-body .body h2 { font-size: 16px; margin: 14px 0 6px; color: var(--navy); }
.welcome-article-body .body h3, .welcome-article-body .body h4 { font-size: 14px; margin: 10px 0 4px; color: var(--navy); }
.welcome-article-body .body p { margin: 8px 0; }
.welcome-article-body .body ul, .welcome-article-body .body ol { margin: 8px 0; padding-left: 22px; }
.welcome-article-body .body li { margin: 3px 0; }
.welcome-article-body .body a { color: var(--cyan); text-decoration: underline; }
.welcome-article-body .body code { background: #f5f5f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.welcome-article-cta { padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.welcome-article-cta-text { font-size: 13px; color: var(--muted); }
.welcome-article-cta-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.welcome-article-cta-actions .start-btn { padding: 8px 14px; font-size: 13px; }

/* =============================================
   CHAT UI
   flex-keten: chat-window > chatUI > tab-pane > messages
   Elke laag heeft min-height:0 zodat overflow werkt
============================================= */
#chatUI {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#chatUI.visible { display: flex; }

/* Header */
.chat-header { background: var(--navy); padding: 14px 20px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.agent-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--cyan); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--navy); flex-shrink: 0; overflow: hidden; }
.agent-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Multi-agent: stack van overlappende avatars in de header. */
.agent-avatar-stack { display: inline-flex; flex-shrink: 0; }
.agent-avatar-stack .agent-avatar { width: 36px; height: 36px; }
.agent-avatar-stack .stack-item { margin-left: -10px; border: 2px solid var(--navy); }
.agent-avatar-stack .stack-item:first-child { margin-left: 0; }
.agent-avatar-stack .stack-item.overflow { background: rgba(255,255,255,0.2); color: white; font-size: 11px; }

/* Sender-label boven een agent-bubble (alleen bij multi-agent gesprekken). */
.msg-sender { font-size: 11px; font-weight: 600; color: var(--cyan); margin-bottom: 3px; padding-left: 4px; }
.agent-info { flex: 1; }
.agent-info .name { color: white; font-size: 14px; font-weight: 600; }
.agent-info .status { color: rgba(255,255,255,0.65); font-size: 12px; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.status-dot.waiting { background: #f59e0b; }
.header-btn { width: 32px; height: 32px; background: rgba(255,255,255,0.1); border: none; border-radius: 8px; color: rgba(255,255,255,0.8); cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
.header-btn:hover { background: rgba(255,255,255,0.2); }

/* Bel-icoon visuele states */
.notif-toggle.notif-on { background: rgba(0,181,200,0.85); color: white; }
.notif-toggle.notif-on:hover { background: rgba(0,181,200,1); }
.notif-toggle.notif-off::after,
.notif-toggle.notif-blocked::after {
  content: ''; position: absolute; left: 6px; right: 6px; top: 50%;
  height: 1.5px; background: currentColor; transform: rotate(-45deg); opacity: 0.85;
}
.notif-toggle.notif-blocked { color: rgba(255,255,255,0.4); }

/* Telefoon-knop in chat-header (linkt direct naar tel:) */
.phone-header-btn {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
}
.phone-header-btn:hover { background: rgba(255,255,255,0.22); color: white; }

/* Helpdesk-telefoon kaart op welkomstscherm */
.phone-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--navy);
  transition: border-color 0.15s, transform 0.15s;
}
.phone-card:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}
.phone-card-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: white;
  color: var(--cyan);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.phone-card-text { flex: 1; min-width: 0; text-align: left; }
.phone-card-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.phone-card-number {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.phone-card-hours {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.phone-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}
.phone-card-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94A3B8;
  flex-shrink: 0;
}
.phone-card-status.open {
  color: #15803D;
}
.phone-card-status.open::before {
  background: #16A34A;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.18);
}
.phone-card-status.closed {
  color: #B91C1C;
}
.phone-card-status.closed::before {
  background: #DC2626;
}

/* Kleine gekleurde indicator op de telefoon-knop in de chat-header */
.phone-header-btn { position: relative; }
.phone-header-btn.phone-status-open::after,
.phone-header-btn.phone-status-closed::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--navy);
  background: #16A34A;
}
.phone-header-btn.phone-status-closed::after {
  background: #DC2626;
}

/* Scherm-delen banner */
.share-banner { background: var(--light); border-bottom: 1px solid var(--border); padding: 7px 20px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--navy); flex-shrink: 0; }
.share-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); flex-shrink: 0; }
.share-banner button { background: var(--cyan); color: var(--navy); border: none; border-radius: 5px; padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer; }
.share-banner.hidden { display: none; }

/* Sessie-gesloten banner — direct onder de header, prominent in cyan zodat
   de bezoeker direct ziet dat hij/zij een nieuw gesprek kan starten. Werkt
   op alle tabs (chat / kennisbank / scherm delen). */
.session-closed-banner { background: var(--cyan); color: white; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 500; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,181,200,0.25); }
.session-closed-banner .scb-text { flex: 1; }
.session-closed-banner .scb-btn { background: white; color: var(--navy); border: none; border-radius: 6px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.session-closed-banner .scb-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.session-closed-banner .scb-btn:active { transform: translateY(0); }

/* === Pré-examen-melding: belangrijke checks voor de bezoeker begint === */
.exam-notice {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fffbeb;                 /* zachte amber/honingtint */
  border: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  box-shadow: 0 1px 3px rgba(245,158,11,0.08);
  /* Breek uit de 460px welcome-inner zodat lange bullet-regels op desktop
     niet wrappen. Op smallere viewports valt de banner gracieus terug naar
     volle parent-breedte (zie media query onderaan deze regel). */
  margin-left: -110px;
  margin-right: -110px;
}
@media (max-width: 780px) {
  .exam-notice { margin-left: 0; margin-right: 0; }
}
.exam-notice-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  background: #f59e0b; color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.exam-notice-body { flex: 1; min-width: 0; }
.exam-notice-title {
  display: block; font-size: 13px; font-weight: 700;
  color: #78350f;                      /* dieper amber voor contrast */
  margin-bottom: 6px;
}
.exam-notice-list {
  margin: 0; padding-left: 18px;
  font-size: 12.5px; line-height: 1.55;
  color: #5b3a07;
}
.exam-notice-list li { margin-bottom: 3px; }
.exam-notice-list li:last-child { margin-bottom: 0; }
.exam-notice-list a {
  color: var(--cyan); font-weight: 600; text-decoration: none;
  border-bottom: 1px solid rgba(0,181,200,0.3);
}
.exam-notice-list a:hover { border-bottom-color: var(--cyan); }
.exam-notice-list code {
  background: rgba(120,53,15,0.1);
  padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: #78350f;
}

/* === Hervat-banner: card binnen welkomstkaart bij teruggevonden token === */
.resume-banner {
  background: white;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  text-align: left;
  box-shadow: 0 1px 3px rgba(26,45,74,0.05);
}
.resume-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.resume-banner-text strong { font-size: 13px; font-weight: 600; color: var(--navy); }
.resume-banner-since { font-size: 11px; color: var(--muted); }
.resume-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
.resume-banner-actions button {
  border: none; border-radius: 6px; padding: 7px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
.resume-banner-actions button:disabled { opacity: 0.5; cursor: default; }
.resume-btn-primary { background: var(--cyan); color: white; }
.resume-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,181,200,0.3); }
.resume-btn-ghost   { background: transparent; color: var(--muted); border: 1px solid #d6dbe2 !important; }
.resume-btn-ghost:hover:not(:disabled) { color: var(--navy); border-color: var(--muted) !important; }
@media (max-width: 480px) {
  .resume-banner { flex-direction: column; align-items: stretch; }
  .resume-banner-actions { justify-content: flex-end; }
}

/* Tabs */
.chat-tabs { display: flex; border-bottom: 1px solid rgba(0,0,0,0.08); flex-shrink: 0; }
.chat-tab { padding: 10px 18px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; user-select: none; }
.chat-tab:hover { color: var(--navy); }
.chat-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); font-weight: 500; }

/* Tab-inhoud */
.tab-pane { display: none; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.tab-pane.active { display: flex; }

/* Berichtenlijst — enige scrollende element */
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; background: var(--white); display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }

/* Berichten */
.msg-row { display: flex; gap: 8px; align-items: flex-end; }
.msg-row.user { flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--cyan); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.msg-row.user .msg-avatar { background: var(--cyan); color: var(--navy); }
.bubble-wrap { display: flex; flex-direction: column; max-width: 72%; }
.msg-row.user .bubble-wrap { align-items: flex-end; }
.bubble { padding: 10px 14px; font-size: 14px; line-height: 1.55; border-radius: 4px 14px 14px 14px; background: #1a2d4a; color: white; word-break: break-word; }
.msg-row.user .bubble { background: #00b5c8; color: white; border-radius: 14px 4px 14px 14px; }
.bubble.system { background: rgba(0,181,200,0.08); color: var(--muted); font-size: 12px; text-align: center; border-radius: 8px; align-self: center; max-width: 90%; border: 1px solid var(--border); }
.bubble-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.msg-edited { font-style: italic; opacity: 0.85; }

/* Bewerk-knop bij eigen visitor-berichten — verschijnt alleen bij hover */
.msg-edit-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 50%;
  width: 24px; height: 24px; cursor: pointer;
  font-size: 11px; line-height: 1;
  display: none; align-items: center; justify-content: center;
  align-self: center;
  transition: background 0.15s, color 0.15s;
}
.msg-row.user:hover .msg-edit-btn { display: inline-flex; }
.msg-edit-btn:hover { background: var(--cyan); border-color: var(--cyan); color: white; }
/* Op touch-devices is :hover onbruikbaar — knop dan altijd zichtbaar (klein). */
@media (hover: none) {
  .msg-row.user .msg-edit-btn { display: inline-flex; opacity: 0.6; }
}

/* Inline-edit textarea in een bubble */
.bubble-edit-ta {
  width: 100%; min-width: 200px;
  background: rgba(255,255,255,0.15); color: white;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 6px;
  padding: 6px 8px; font-size: 14px; font-family: inherit; line-height: 1.4;
  resize: vertical; outline: none;
}
.bubble-edit-ta:focus { border-color: white; }
.bubble-edit-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.bubble-edit-actions button {
  border: none; border-radius: 5px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.bubble-edit-cancel { background: rgba(255,255,255,0.2); color: white; }
.bubble-edit-cancel:hover { background: rgba(255,255,255,0.3); }
.bubble-edit-save { background: white; color: var(--cyan); }
.bubble-edit-save:hover { background: var(--light); }

/* Typing indicator */
.typing-indicator { display: flex; gap: 8px; align-items: flex-end; }
.typing-indicator .bubble { display: flex; gap: 4px; padding: 12px 16px; }
.typing-indicator .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.6); animation: bounce 1.2s infinite; }
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }

/* Agent-typt-indicator */
.agent-typing { display: flex; align-items: center; gap: 6px; padding: 2px 16px; font-size: 12px; color: var(--muted); height: 20px; opacity: 0; transition: opacity 0.2s; flex-shrink: 0; }
.agent-typing.visible { opacity: 1; }
.agent-typing .dots { display: inline-flex; gap: 3px; }
.agent-typing .dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); animation: atyp 1.2s infinite; }
.agent-typing .dots span:nth-child(2) { animation-delay: 0.15s; }
.agent-typing .dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes atyp { 0%,60%,100% { transform: translateY(0); opacity: 0.4 } 30% { transform: translateY(-3px); opacity: 1 } }

/* Quick replies — altijd zichtbaar */
.quick-replies { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 20px; background: var(--white); border-top: 1px solid var(--border); flex-shrink: 0; }
.qr-btn { font-size: 12px; padding: 5px 14px; border-radius: 20px; border: 1px solid var(--cyan); color: var(--navy); background: var(--white); cursor: pointer; }
.qr-btn:hover { background: var(--light); }

/* Invoerbalk — altijd zichtbaar */
/* Beide knoppen op dezelfde grootte (38×38) voor symmetrie. align-items:center
   centreert ze t.o.v. de textarea — die heeft min-height gelijk aan de knoppen
   zodat de baseline niet verspringt zodra de tekstinhoud groeit. */
.input-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(0,0,0,0.08); background: var(--white); flex-shrink: 0; }
.attach-btn { width: 38px; height: 38px; border-radius: 50%; background: #f5f5f5; border: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: center; }
.attach-btn:hover { background: var(--light); }
.input-bar textarea { flex: 1; background: #f5f5f5; border: 1px solid rgba(0,0,0,0.1); border-radius: 20px; padding: 9px 16px; font-size: 14px; color: var(--navy); resize: none; outline: none; min-height: 38px; max-height: 120px; line-height: 1.4; font-family: inherit; }
.input-bar textarea:focus { border-color: var(--cyan); }
.input-bar textarea::placeholder { color: var(--muted); }
.send-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--cyan); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: center; }
.send-btn:hover { background: #009bac; }
.send-btn:disabled { opacity: 0.4; cursor: default; }

/* Scherm delen tab */
.screenshare-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; gap: 16px; background: var(--light); overflow-y: auto; }
.screenshare-area video { width: 100%; max-height: 300px; border-radius: 10px; border: 2px solid var(--cyan); background: #000; display: none; }
.screenshare-area video.active { display: block; }
.ss-placeholder { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.ss-icon { width: 64px; height: 64px; border-radius: 50%; background: white; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.ss-start-btn { background: var(--cyan); color: var(--navy); border: none; border-radius: 8px; padding: 10px 24px; font-size: 14px; font-weight: 600; cursor: pointer; }
.ss-stop-btn { background: transparent; color: #e53e3e; border: 1px solid #e53e3e; border-radius: 8px; padding: 8px 20px; font-size: 13px; cursor: pointer; display: none; }
.ss-stop-btn.visible { display: inline-flex; }

/* Kennisbank-tab (vervangt oude FAQ) */
.kb-area { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--light); overflow: hidden; }
.kb-toolbar { padding: 10px 14px; background: var(--white); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.kb-back { background: transparent; border: 1px solid var(--border); color: var(--navy); border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.kb-back:hover { background: var(--light); }
.kb-search-wrap { flex: 1; display: flex; align-items: center; background: #f5f5f5; border: 1px solid rgba(0,0,0,0.08); border-radius: 18px; padding: 0 10px; gap: 6px; }
.kb-search-wrap:focus-within { border-color: var(--cyan); background: var(--white); }
.kb-search-ico { color: var(--muted); flex-shrink: 0; }
#kbSearch { flex: 1; border: none; background: transparent; outline: none; padding: 8px 4px; font-size: 14px; color: var(--navy); font-family: inherit; }
#kbSearch::placeholder { color: var(--muted); }
.kb-clear { background: transparent; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 6px; line-height: 1; }
.kb-clear:hover { color: var(--navy); }

.kb-content { flex: 1; overflow-y: auto; padding: 14px; }
.kb-loading { color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
.kb-empty { color: var(--muted); font-size: 13px; padding: 30px 16px; text-align: center; line-height: 1.6; }
.kb-empty strong { color: var(--navy); display: block; margin-bottom: 4px; font-size: 14px; }

/* Categorie-cards op de "home"-view */
.kb-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.kb-cat-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; transition: transform 0.1s, box-shadow 0.15s; text-align: left; }
.kb-cat-card:hover { transform: translateY(-1px); box-shadow: 0 3px 12px rgba(26,45,74,0.08); border-color: var(--cyan); }
.kb-cat-card .ico { font-size: 22px; margin-bottom: 6px; line-height: 1; }
.kb-cat-card .name { color: var(--navy); font-size: 14px; font-weight: 600; }
.kb-cat-card .descr { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.kb-cat-card .count { color: var(--cyan); font-size: 11px; margin-top: 6px; font-weight: 500; }

/* Artikel-lijst (zoekresultaten + "in categorie") */
.kb-section-title { color: var(--navy); font-size: 13px; font-weight: 600; margin: 4px 4px 8px; }
.kb-article-list { display: flex; flex-direction: column; gap: 8px; }
.kb-article-row { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.kb-article-row:hover { border-color: var(--cyan); box-shadow: 0 2px 8px rgba(0,181,200,0.1); }
.kb-article-row .title { color: var(--navy); font-size: 14px; font-weight: 500; }
.kb-article-row .summary { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.5; }
.kb-article-row .badge { display: inline-block; font-size: 10px; padding: 1px 7px; background: var(--light); color: var(--navy); border-radius: 8px; margin-top: 6px; }

/* Artikel-detail */
.kb-article-view { background: var(--white); border-radius: 10px; padding: 18px 20px; border: 1px solid var(--border); }
.kb-article-view .crumb { font-size: 11px; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 6px; }
.kb-article-view h1 { color: var(--navy); font-size: 18px; margin: 0 0 6px; }
.kb-article-view .meta { color: var(--muted); font-size: 11px; margin-bottom: 14px; }
.kb-article-view .body { font-size: 14px; color: var(--navy); line-height: 1.65; }
.kb-article-view .body h2 { font-size: 16px; margin: 14px 0 6px; color: var(--navy); }
.kb-article-view .body h3, .kb-article-view .body h4 { font-size: 14px; margin: 10px 0 4px; color: var(--navy); }
.kb-article-view .body p { margin: 8px 0; }
.kb-article-view .body ul, .kb-article-view .body ol { margin: 8px 0; padding-left: 20px; }
.kb-article-view .body li { margin: 3px 0; }
.kb-article-view .body a { color: var(--cyan); text-decoration: underline; }
.kb-article-view .body code { background: #f5f5f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.kb-feedback { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kb-feedback .label { font-size: 12px; color: var(--muted); }
.kb-fb-btn { background: var(--white); border: 1px solid var(--border); color: var(--navy); border-radius: 16px; padding: 4px 12px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.kb-fb-btn:hover { background: var(--light); border-color: var(--cyan); }
.kb-fb-btn.active { background: var(--cyan); color: var(--white); border-color: var(--cyan); cursor: default; }
.kb-fb-thanks { font-size: 12px; color: var(--cyan); font-weight: 500; }

/* Inline suggesties boven de quick-replies tijdens typen */
.kb-suggestions { display: none; padding: 6px 14px 8px; background: linear-gradient(180deg, rgba(0,181,200,0.06), transparent); border-top: 1px solid rgba(0,181,200,0.15); flex-shrink: 0; }
.kb-suggestions.visible { display: block; }
.kb-sug-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.kb-sug-label .spark { color: var(--cyan); }
.kb-sug-list { display: flex; flex-direction: column; gap: 4px; }
.kb-sug-item { background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--navy); cursor: pointer; display: flex; gap: 6px; align-items: center; line-height: 1.4; }
.kb-sug-item:hover { border-color: var(--cyan); background: rgba(0,181,200,0.05); }
.kb-sug-item .arr { color: var(--cyan); margin-left: auto; flex-shrink: 0; }
.kb-sug-dismiss { background: transparent; border: none; color: var(--muted); font-size: 11px; cursor: pointer; padding: 2px 6px; margin-top: 2px; }
.kb-sug-dismiss:hover { color: var(--navy); }

/* Responsief */
@media (max-width: 600px) {
  body { padding: 0; align-items: stretch; }
  .chat-window { max-width: 100%; height: 100dvh; max-height: none; border-radius: 0; }
}

/* ---- block 2 (was further down in index.html) ---- */
.offline-overlay, .survey-overlay { position: fixed; inset: 0; background: rgba(26,45,74,0.55); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.offline-card, .survey-card { background: white; border-radius: 12px; padding: 24px; max-width: 420px; width: 100%; box-shadow: 0 4px 24px rgba(0,0,0,0.2); }
.offline-card h3, .survey-card h3 { color: var(--navy); margin-bottom: 8px; }
.offline-card input, .offline-card textarea, .survey-card textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  color: var(--navy); margin-bottom: 8px; outline: none; font-family: inherit; box-sizing: border-box;
}
.offline-card input:focus, .offline-card textarea:focus, .survey-card textarea:focus { border-color: var(--cyan); }
.stars { display: flex; gap: 6px; justify-content: center; font-size: 36px; cursor: pointer; user-select: none; margin: 14px 0; }
.stars span { color: #e5e7eb; transition: color 0.1s; }
.stars span.active { color: #fbbf24; }
/* Hover-preview: ster waar je over hangt + alle ervoor lichten op */
.stars:hover span { color: #fbbf24; }
.stars span:hover ~ span { color: #e5e7eb; }
