/* researchhelpdesk — base styles */
:root {
  --umcg-blue: #0052A3;
  --umcg-blue-dark: #003D7A;
  --umcg-blue-light: #E6EEF7;
  --accent: #F59E0B;
  --accent-dark: #B45309;
  --text: #111827;
  --text-muted: #5A6178;
  --border: #E2E6EF;
  --bg: #F7F8FB;
  --card-bg: #FFFFFF;
  --error: #DC2626;
  --success: #059669;
  --warning: #D97706;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--umcg-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.9rem; }

/* ────────── Topbar ────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-size: 1.15rem; font-weight: 700;
  color: var(--umcg-blue);
}
.brand-accent { color: var(--accent-dark); }
.brand-sub {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 2px;
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--umcg-blue-light);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}
.user-chip img {
  width: 28px; height: 28px; border-radius: 50%;
}
.chip-link {
  background: transparent; border: 1px solid var(--umcg-blue);
  color: var(--umcg-blue);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.chip-link:hover { background: var(--umcg-blue); color: white; text-decoration: none; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chip-lang {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

/* ────────── Auth screens ────────── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 24px;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.auth-logo { margin-bottom: 16px; }
.auth-card h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
  color: var(--text);
}
.auth-card h2 {
  font-size: 1.3rem;
  margin: 0 0 12px;
}
.auth-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 24px;
}
.auth-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.auth-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--umcg-blue-light);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.auth-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.google-signin-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 16px;
}
.signin-loading {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 12px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-form {
  display: flex; flex-direction: column; gap: 10px;
}
.auth-form input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  width: 100%;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--umcg-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 163, 0.1);
}

/* ────────── Buttons ────────── */
.btn-primary {
  background: var(--umcg-blue);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--umcg-blue-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 12px;
}
.btn-ghost:hover { background: var(--bg); }

.btn-link {
  background: transparent; border: none;
  color: var(--umcg-blue);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--umcg-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ────────── Main app ────────── */
#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px 40px;
}

.disclaimer-banner {
  background: #FEF3C7;
  color: #78350F;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: none;
  padding: 12px 18px;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--umcg-blue);
  border-bottom-color: var(--umcg-blue);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Mobile: compactere tabs */
@media (max-width: 640px) {
  .tabs {
    gap: 0;
    margin-bottom: 14px;
  }
  .tab {
    padding: 10px 10px;
    font-size: 0.85rem;
    flex: 1;
    text-align: center;
    min-width: 0;
  }
}
@media (max-width: 380px) {
  .tab {
    padding: 10px 6px;
    font-size: 0.78rem;
  }
}

/* ────────── Filters ────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.filter {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.85rem;
}
.filter span { color: var(--text-muted); font-weight: 500; }
.filter select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.9rem;
  min-width: 200px;
}

/* ────────── Chat ────────── */
.chat-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-messages {
  min-height: 400px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 20px;
}

.welcome-card {
  text-align: center;
  padding: 20px;
}
.welcome-card h3 {
  color: var(--umcg-blue);
  margin: 0 0 12px;
}
.example-questions {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.example-q {
  background: var(--umcg-blue-light);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: all 0.15s;
}
.example-q:hover {
  background: var(--umcg-blue);
  color: white;
  border-color: var(--umcg-blue);
}

.welcome-card { text-align: left; max-width: 760px; margin: 0 auto; }
.welcome-card > h3 { text-align: center; }
.welcome-card > p { text-align: center; color: var(--text-muted); margin: 4px 0 18px; }

.ex-group { margin-top: 14px; }
.ex-group:first-of-type { margin-top: 0; }
.ex-group-h {
  margin: 6px 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--umcg-blue-dark);
  text-transform: none;
  letter-spacing: 0;
}
.ex-group .example-questions { margin: 0; gap: 6px; }

.ex-more {
  margin-top: 18px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.ex-more > summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--umcg-blue);
  list-style: none;
  padding: 6px 4px;
  text-align: center;
}
.ex-more > summary::-webkit-details-marker { display: none; }
.ex-more > summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s;
}
.ex-more[open] > summary::before { content: '▾ '; }
.ex-more > summary:hover { text-decoration: underline; }
.ex-more[open] { padding-bottom: 8px; }

@media (max-width: 640px) {
  .welcome-card { padding: 14px; }
  .ex-group-h { font-size: 0.8rem; }
  .example-q { font-size: 0.85rem; padding: 9px 12px; }
}

.message {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}
.message.user {
  background: var(--umcg-blue-light);
  margin-left: 40px;
}
.message.assistant {
  background: white;
  border: 1px solid var(--border);
  margin-right: 40px;
}
.message-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: white;
}
.chat-input textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  max-height: 320px;
}
.chat-input textarea:focus {
  outline: none;
  border-color: var(--umcg-blue);
}
.btn-send {
  background: var(--umcg-blue);
  color: white;
  border: none;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 700;
}
.btn-send:hover { background: var(--umcg-blue-dark); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.btn-clear-history {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
}
.btn-clear-history:hover { color: #c0392b; border-color: #c0392b; background: #fdecea; }

/* ────────── Kennisbank loading skeleton ────────── */
.kb-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
}
.kb-skeleton-row {
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #eef1f5 0%, #f7f8fa 50%, #eef1f5 100%);
  background-size: 200% 100%;
  animation: kb-shimmer 1.4s linear infinite;
}
@keyframes kb-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ────────── Thinking panel (entertaining wait) ────────── */
.rh-thinking {
  padding: 8px 4px;
}
.rh-think-progress {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.rh-step {
  position: relative;
  z-index: 2;
  text-align: center;
  opacity: 0.35;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.rh-step.active {
  opacity: 1;
  transform: translateY(-2px);
}
.rh-step.done {
  opacity: 0.7;
}
.rh-step-ic {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 4px;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.rh-step.active .rh-step-ic {
  border-color: var(--umcg-blue);
  background: var(--umcg-blue-light);
  animation: rh-pulse 1.5s ease-in-out infinite;
}
.rh-step.done .rh-step-ic {
  border-color: var(--success);
  background: #D1FAE5;
}
.rh-step-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.2;
}
.rh-step.active .rh-step-lbl {
  color: var(--umcg-blue);
  font-weight: 600;
}
.rh-step-line {
  position: absolute;
  top: 18px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: var(--border);
  z-index: 1;
}
.rh-step-line-fill {
  height: 100%;
  width: 0;
  background: var(--umcg-blue);
  transition: width 1s ease;
}
@keyframes rh-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 82, 163, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(0, 82, 163, 0); }
}

.rh-tip {
  background: var(--umcg-blue-light);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--umcg-blue-dark);
  line-height: 1.5;
  transition: opacity 0.2s ease;
  border-left: 3px solid var(--umcg-blue);
}

@media (max-width: 600px) {
  .rh-think-progress { grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .rh-step-ic { width: 32px; height: 32px; font-size: 1.2rem; }
  .rh-step-lbl { font-size: 0.6rem; }
  .rh-step-line { top: 16px; }
}

/* Feedback widget */
.fb-btn {
  background: white;
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
}
.fb-btn:hover { background: var(--umcg-blue-light); border-color: var(--umcg-blue); }
.fb-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Sources/citations in messages */
.sources {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.source-tag {
  display: inline-block;
  background: var(--umcg-blue-light);
  color: var(--umcg-blue-dark);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  margin: 2px 4px 2px 0;
}
.source-tag.priority-high {
  background: #FEF3C7;
  color: var(--accent-dark);
  font-weight: 600;
}

/* ────────── Decision trees ────────── */
.trees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.tree-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.tree-card h3 {
  margin: 0 0 8px;
  color: var(--umcg-blue);
}
.tree-card p {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}
.tree-card button { width: 100%; }

.tree-wizard {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.tree-wizard h2 {
  margin: 12px 0 16px;
  color: var(--umcg-blue);
}
.tree-flow {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.tree-question {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 16px;
}
.tree-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tree-option {
  background: white;
  border: 2px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
}
.tree-option:hover {
  border-color: var(--umcg-blue);
  background: var(--umcg-blue-light);
}

.tree-result {
  padding: 20px;
  border-radius: var(--radius-sm);
  background: var(--umcg-blue-light);
  border-left: 4px solid var(--umcg-blue);
}
.tree-result.conclusion-success {
  background: #D1FAE5;
  border-left-color: var(--success);
}
.tree-result.conclusion-warning {
  background: #FEF3C7;
  border-left-color: var(--warning);
}
.tree-result.conclusion-info {
  background: var(--umcg-blue-light);
  border-left-color: var(--umcg-blue);
}
.tree-result h3 { margin-top: 0; }
.tree-result .actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tree-diagram {
  background: white;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tree-diagram .diagram-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tree-diagram .diagram-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.tree-diagram .diagram-btn:hover {
  background: var(--umcg-blue-light);
  border-color: var(--umcg-blue);
}
.tree-diagram .diagram-pan-wrap {
  overflow: auto;
  max-height: 480px;
  cursor: zoom-in;
  position: relative;
  background: #FAFBFD;
  border-radius: 6px;
}
.tree-diagram .mermaid { text-align: center; min-width: 100%; }
.tree-diagram svg {
  max-width: none !important;
  transition: transform 0.15s ease-out;
  transform-origin: top left;
}
.tree-diagram .nodeLabel { font-size: 12px !important; line-height: 1.3; }
.tree-diagram .edgeLabel {
  font-size: 10px !important;
  background: rgba(255,255,255,0.85) !important;
  padding: 1px 4px !important;
}

/* Fullscreen overlay */
.diagram-fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  flex-direction: column;
}
.diagram-fs-bar {
  background: white;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--umcg-blue);
  gap: 12px;
  flex-wrap: wrap;
}
.diagram-fs-bar .diagram-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 13px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}
.diagram-fs-bar .diagram-btn:hover { background: var(--umcg-blue-light); }
.diagram-fs-title {
  font-weight: 700;
  color: var(--umcg-blue);
  font-size: 0.95rem;
}
.diagram-fs-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px;
}
.diagram-fs-stage svg {
  cursor: grab;
  transition: transform 0.15s ease-out;
  user-select: none;
  max-width: none !important;
  max-height: none !important;
  transform-origin: center top;
}
.diagram-fs-stage svg:active { cursor: grabbing; }

.tree-path {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.tree-path-step {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 10px;
  font-size: 0.8rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  color: var(--umcg-blue);
  transition: all 0.12s;
}
.tree-path-step:hover {
  background: var(--umcg-blue);
  color: white;
  border-color: var(--umcg-blue);
}
.tree-path-step + .tree-path-step::before {
  content: '→';
  color: var(--text-muted);
  margin-right: 8px;
  margin-left: -4px;
}

/* Staleness badges in bronnen-tabel */
.stale-red { color: var(--error); font-weight: 600; }
.stale-orange { color: var(--warning); }

/* Print-stylesheet voor beslisboom-conclusie */
@media print {
  .topbar, .tabs, .disclaimer-banner, .feedback-row, .chat-input,
  .tree-card, .trees-grid, #tree-back, #tree-restart, #tree-ask-claude,
  #tree-diagram-details, .fb-btn, .tree-options { display: none !important; }
  body, .tree-wizard { background: white !important; }
  .tree-wizard { padding: 0 !important; border: none !important; box-shadow: none !important; }
  .tree-result { page-break-inside: avoid; border-left: 4px solid #0052A3; padding: 14px; }
  a { color: black !important; text-decoration: underline; }
}

/* ────────── Kennisbank ────────── */
.kb-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  .kb-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 400px) {
  .kb-stats { grid-template-columns: repeat(2, 1fr); }
}
.kb-stat {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.kb-stat-v {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--umcg-blue);
  line-height: 1;
}
.kb-stat-l {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.kb-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,40,100,0.05);
}
.kb-card-t {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--umcg-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 6px;
}
.kb-ic {
  width: 22px; height: 22px;
  background: var(--umcg-blue-light);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
}

/* Pipeline */
.kb-pipe {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.kb-stp {
  flex: 1; min-width: 120px;
  text-align: center;
  position: relative;
}
.kb-stp-i {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin: 0 auto 6px;
  color: white;
  background: var(--umcg-blue);
}
.kb-stp:nth-child(2) .kb-stp-i { background: #00838F; }
.kb-stp:nth-child(3) .kb-stp-i { background: #5C6BC0; }
.kb-stp:nth-child(4) .kb-stp-i { background: #7B1FA2; }
.kb-stp:nth-child(5) .kb-stp-i { background: var(--success); }
.kb-stp-t { font-size: 0.75rem; font-weight: 700; }
.kb-stp-d { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.kb-arr {
  position: absolute;
  top: 12px;
  right: -4px;
  font-size: 0.7rem;
  color: #ccd;
}
@media (max-width: 700px) {
  .kb-arr { display: none; }
}

/* Source table */
.kb-src-wrap { overflow-x: auto; }
.kb-src-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.kb-src-tbl th {
  background: var(--bg);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  font-weight: 700;
}
.kb-src-tbl td {
  padding: 8px 10px;
  border-top: 1px solid #f0f2f7;
}
.kb-src-tbl tr.row-toggle { cursor: pointer; }
.kb-src-tbl tr.row-toggle:hover { background: #FAFBFD; }
.kb-src-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.kb-src-name { font-weight: 700; font-size: 0.85rem; }
.kb-num {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--umcg-blue);
}
.kb-bar {
  height: 6px;
  border-radius: 3px;
  background: #EEF1F6;
  overflow: hidden;
  min-width: 60px;
}
.kb-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--success);
}
.kb-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-block;
}
.kb-badge.ok { background: #D1FAE5; color: var(--success); }
.kb-badge.empty { background: #FEF3C7; color: var(--accent-dark); }
.kb-badge.skipped { background: #FEE2E2; color: var(--error); }

/* Zenya boxes */
.kb-zenya-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 700px) {
  .kb-zenya-grid { grid-template-columns: 1fr; }
}
.kb-zenya-box {
  border-radius: 10px;
  padding: 14px 16px;
}
.kb-zenya-l {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 2px;
  opacity: 0.85;
}
.kb-zenya-v {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}
.kb-zenya-s {
  font-size: 0.7rem;
  margin-top: 4px;
  opacity: 0.9;
}

/* Decision trees grid */
.kb-tree-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.kb-tree-item {
  background: var(--umcg-blue-light);
  color: var(--umcg-blue-dark);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Sample titles flyout */
.kb-titles-row td {
  background: #FAFBFD;
  padding: 0 !important;
}
.kb-titles-list {
  padding: 10px 16px;
  max-height: 280px;
  overflow-y: auto;
  columns: 2;
  column-gap: 16px;
}
@media (max-width: 700px) {
  .kb-titles-list { columns: 1; }
}
.kb-titles-list .ti {
  font-size: 0.75rem;
  padding: 2px 0;
  break-inside: avoid;
  color: var(--text);
}
.kb-titles-list .ti .folder {
  color: var(--text-muted);
  font-size: 0.65rem;
}

/* ────────── Contacts & Library ────────── */
.contacts-search { margin-bottom: 16px; }
.contacts-search input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.contacts-list, .library-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.contact-card, .source-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.contact-card h4 { margin: 0 0 4px; color: var(--umcg-blue); }
.contact-card .role { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 8px; }
.contact-card .expertise { font-size: 0.85rem; }

/* ────────── Footer ────────── */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .brand-sub { display: none; }
  #app { padding: 12px 16px 40px; }
  .auth-card { padding: 28px 20px; }
  .message.user { margin-left: 16px; }
  .message.assistant { margin-right: 16px; }
}
