/* notes — base styling. Donker accent #0052A3 (huisstijl). */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #F6F7FA;
  --surface: #FFFFFF;
  --surface-2: #F0F2F6;
  --border: #DDE1E8;
  --text: #1A1F2E;
  --muted: #5A6178;
  --accent: #0052A3;
  --accent-soft: #E6EEF7;
  --danger: #DC2626;
  --warn: #F59E0B;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --radius: 8px;
  --sidebar-w: 280px;
}

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

body { overflow: hidden; }
body:has(.admin-shell) { overflow: auto; height: auto; }
body.sota-page { overflow: auto; height: auto; background: var(--bg); }

/* SotA full-page wizard */
.sota-page .sota-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.sota-page .sota-header h1 { font-size: 18px; margin: 0; flex: 1; color: var(--accent); }
.sota-page .back-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.sota-page .back-link:hover { color: var(--accent); }
.sota-shell {
  display: grid; grid-template-columns: 260px 1fr;
  gap: 24px; max-width: 1400px; margin: 0 auto; padding: 20px;
}
.sota-side {
  position: sticky; top: 70px;
  align-self: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px;
}
.sota-step {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px; border-radius: 6px; margin-bottom: 4px;
  opacity: 0.55; transition: opacity 0.15s;
}
.sota-step.active { opacity: 1; background: var(--accent-soft); }
.sota-step.done { opacity: 0.85; }
.sota-step.done .sota-step-num { background: var(--accent); color: white; }
.sota-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sota-step.active .sota-step-num { background: var(--accent); color: white; }
.sota-step-title { font-size: 13px; font-weight: 600; }
.sota-step-sub { font-size: 11px; color: var(--muted); }
.sota-side-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 18px 0 6px;
}
.sota-saved-list .muted.small { font-size: 11px; }
.sota-saved-ul { padding-left: 16px; font-size: 12px; }
.sota-saved-ul li { margin-bottom: 4px; }

.sota-main { display: flex; flex-direction: column; gap: 18px; }
.sota-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 22px;
}
.sota-card h2 { font-size: 18px; margin: 0 0 8px; }
.sota-card h3 { font-size: 14px; margin: 14px 0 6px; }
.field-block { display: block; margin: 12px 0; }
.field-block > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.sota-tag-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sota-tag-picker input[type=search] { width: 100%; padding: 6px 10px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; }
.sota-chip-pool { max-height: 200px; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; }
.sota-selected { padding: 8px 10px; background: var(--accent-soft); border-radius: 6px; font-size: 12px; margin-top: 8px; }
.sota-selected .tag { margin: 2px; }
#sota-match-count { margin-top: 6px; }
#sota-match-count.sota-match-warn { color: var(--danger); font-weight: 600; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sota-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.sota-actions .small { margin-left: auto; }
#sota-focus, #sota-followup { width: 100%; padding: 10px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; }
#sota-followup { resize: vertical; min-height: 60px; }
.sota-progress { text-align: center; padding: 30px; }
.sota-progress-spinner {
  width: 36px; height: 36px; border: 3px solid var(--surface-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sota-html-frame { padding: 0 !important; min-height: 0 !important; }
.sota-html-frame h3 { margin: 14px 0 6px; font-size: 14px; }
.sota-html-frame p { margin: 6px 0; line-height: 1.6; }
.soa-results-block { margin-top: 10px; padding: 10px; background: var(--surface-2); border-radius: 6px; }
.small { font-size: 11px; }

/* SotA pane-label (i / ii / iii) */
.sota-pane-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent, #4a5fb8);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 8px;
  margin-bottom: 8px;
}

/* Themes bar onder summary */
.sota-themes-bar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  line-height: 2;
}

/* PubMed-strategieën */
.sota-pubmed-results { margin-top: 12px; }
.sota-pubmed-strategy {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent, #4a5fb8);
  border-radius: 0 6px 6px 0;
}
.sota-pubmed-strategy-hdr { font-size: 13px; margin-bottom: 4px; }
.sota-pubmed-strategy-hdr code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}
.soa-pubmed-list { list-style: none; padding: 0; margin: 8px 0 0; }
.soa-pubmed-list li {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  line-height: 1.45;
}
.soa-pubmed-list li:first-child { border-top: none; }
.soa-pubmed-list a { color: var(--accent, #4a5fb8); text-decoration: none; }
.soa-pubmed-list a:hover { text-decoration: underline; }
.soa-pubmed-save { margin-left: 8px; }

/* Chat */
.sota-chat-log {
  max-height: 420px;
  overflow-y: auto;
  margin: 12px 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}
.sota-chat-log:empty::before {
  content: "No conversation yet. Ask a question below.";
  display: block;
  padding: 18px;
  color: var(--muted, #888);
  font-size: 12px;
  text-align: center;
}
.sota-chat-msg {
  padding: 10px 12px;
  margin: 6px;
  border-radius: 6px;
  font-size: 13.5px;
  line-height: 1.55;
}
.sota-chat-user {
  background: var(--surface);
  border: 1px solid var(--border);
  margin-left: 24px;
}
.sota-chat-assistant {
  background: rgba(74, 95, 184, 0.06);
  border: 1px solid rgba(74, 95, 184, 0.25);
  margin-right: 24px;
}
.sota-chat-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted, #888);
  margin-bottom: 4px;
}
.sota-chat-body p:first-child { margin-top: 0; }
.sota-chat-body p:last-child { margin-bottom: 0; }
.sota-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.sota-chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 50px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
}
.sota-chat-form button { align-self: stretch; }

/* PubMed-citation in chat-replies */
.soa-pmidref {
  color: var(--accent, #4a5fb8);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
  .sota-shell { grid-template-columns: 1fr; }
  .sota-side { position: relative; top: 0; }
  .sota-tag-picker { grid-template-columns: 1fr; }
  .sota-chat-user, .sota-chat-assistant { margin-left: 6px; margin-right: 6px; }
  .sota-chat-form { flex-direction: column; }
  .sota-chat-form button { width: 100%; }
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
.app.sidebar-collapsed { grid-template-columns: 0 1fr; }
.app.sidebar-collapsed .sidebar { display: none; }
#sidebar-toggle { margin-right: 4px; }

/* ─────────── Sidebar ─────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 4px;
}
.sidebar-head h1 {
  margin: 0; font-size: 18px; color: var(--accent); letter-spacing: -0.3px;
}
.user-info {
  display: flex; align-items: center; gap: 6px;
}
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border);
}
.user-name {
  font-size: 12px; color: var(--muted);
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.filter-section { display: flex; flex-direction: column; gap: 4px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); padding: 4px 6px; gap: 6px;
}
.section-head span:first-child { font-weight: 600; }

.nav-item {
  display: flex; justify-content: space-between; align-items: center;
  background: transparent; border: 0;
  padding: 7px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13px;
  text-align: left; width: 100%;
  color: var(--text);
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.count {
  background: var(--surface-2); color: var(--muted);
  padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.nav-item.active .count { background: var(--accent); color: white; }

/* Tree */
.tree { display: flex; flex-direction: column; gap: 2px; }
.tree-node .tree-head {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 6px;
  cursor: pointer; user-select: none;
  border-left: 3px solid var(--accent);
  font-weight: 500;
}
.tree-node .tree-head:hover { background: var(--surface-2); }
.tree-node .tree-head.active { background: var(--accent-soft); color: var(--accent); }
.tree-name { flex: 1; }
.caret { color: var(--muted); display: inline-block; transition: transform 0.15s; width: 12px; font-size: 10px; }
.tree-node.open .caret { transform: rotate(90deg); }
.tree-children { display: none; padding-left: 18px; flex-direction: column; gap: 1px; margin-top: 2px; }
.tree-node.open .tree-children { display: flex; }
.tree-leaf {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px; border-radius: 5px;
  cursor: pointer; font-size: 13px; color: var(--muted);
}
.tree-leaf:hover { background: var(--surface-2); }
.tree-leaf.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree-leaf .tree-name { flex: 1; }

.filter-search {
  flex: 1; min-width: 0;
  padding: 3px 8px; font-size: 11px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface);
}

/* Chips */
/* Geen interne scroll op chip-list — de sidebar zelf heeft al overflow-y auto.
 * Zo zie je alle people/keyword-tags zonder dubbele scrollbar. */
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px; }
.chip-toggle {
  margin-top: 6px; padding: 3px 8px;
  background: transparent; border: 1px dashed var(--border);
  color: var(--muted); border-radius: 6px;
  font-size: 11px; cursor: pointer; font-family: inherit;
}
.chip-toggle:hover { background: var(--surface-2); color: var(--text); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: 12px;
  padding: 3px 9px; font-size: 12px;
  cursor: pointer; color: var(--text);
  font-family: inherit;
}
.chip:hover { background: #E5E8EE; }
.chip.active { background: var(--accent); color: white; }
.chip.active .count { background: rgba(255,255,255,0.25); color: white; }
.chip .x { margin-left: 3px; font-weight: bold; opacity: 0.7; }
.chip.clear-all { background: var(--surface); border-color: var(--border); color: var(--muted); }

.date-range {
  display: flex; gap: 6px; align-items: center;
}
.date-range input {
  flex: 1; padding: 4px 6px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface);
}

/* ─────────── Main ─────────── */
.main {
  display: flex; flex-direction: column;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.search-wrap {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 2px 4px 2px 10px;
}
.search-wrap:focus-within { background: white; outline: 2px solid var(--accent-soft); }
#search-in {
  background: transparent; border: 0; border-right: 1px solid var(--border);
  padding: 4px 6px; font-size: 12px;
  color: var(--muted); cursor: pointer;
  font-family: inherit;
  appearance: none; -webkit-appearance: none;
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235A6178' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}
#search-in:hover { color: var(--text); }
#q {
  flex: 1;
  padding: 7px 10px;
  border: 0; outline: 0;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
}
#sort {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); font-size: 13px;
  cursor: pointer;
}

.active-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-content: start;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.05s;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow);
}
.note-card:hover {
  box-shadow: 0 4px 12px rgba(0,82,163,0.10);
  border-color: var(--accent);
}
.note-card header { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.note-title {
  margin: 0; font-size: 15px; font-weight: 600;
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--muted); flex-shrink: 0;
  white-space: nowrap;
}
.note-summary {
  margin: 0; font-size: 13px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}
.note-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted);
}
.tag-kw { background: var(--accent-soft); color: var(--accent); }
.tag-person { background: #FFF4E5; color: #B45309; }
.tag.clickable { cursor: pointer; transition: filter 0.1s; }
.tag.clickable:hover { filter: brightness(0.92); outline: 1px solid currentColor; }
.note-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--surface-2);
  padding-top: 6px; margin-top: auto;
}

.empty {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty h2 { color: var(--text); margin-bottom: 8px; }

/* ── Illustrations (spot art on empty states, features + login hero) ── */
.empty-illus { display: block; width: min(260px, 62%); height: auto; margin: 0 auto 14px; border-radius: 16px; }
.news-empty .empty-illus { width: min(240px, 60%); }
.spot-illus { display: block; width: 150px; max-width: 42%; height: auto; margin: 0 auto 12px; border-radius: 12px; }
.login-hero { display: block; width: 100%; height: auto; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.28); }

#load-more-wrap { padding: 16px; text-align: center; }

/* ─────────── Buttons ─────────── */
.btn {
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: inherit;
  text-decoration: none; display: inline-block;
  transition: background 0.1s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.primary:hover { background: #003F7F; }

.icon-btn {
  background: transparent; border: 0;
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: #FEE2E2; color: var(--danger); }
.icon-btn.small { width: 22px; height: 22px; font-size: 14px; }
.icon-btn.active { color: var(--accent); }
.icon-btn.st-to-read { color: var(--accent); }
.icon-btn.st-read    { color: #16A34A; }
.icon-btn.st-discarded { color: #B91C1C; }
.icon-btn.st-none    { color: #B0B5BE; }
.card-status { margin-left: auto; }
.note-foot { display: flex; align-items: center; gap: 6px; }

/* ─────────── Detail panel ─────────── */
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: clamp(540px, 55vw, 880px);
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
  display: flex; flex-direction: column;
  z-index: 50;
}
.detail-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.detail-actions { display: flex; gap: 4px; }
.detail-body {
  flex: 1 1 auto; overflow-y: auto;
  padding: 16px 24px 24px;
  min-height: 0;  /* sta scroll in flex-child toe */
}
.detail-body h2 { margin: 0 0 6px; font-size: 20px; }
.detail-body .detail-meta { margin-bottom: 10px; padding-bottom: 8px; }
.detail-body .detail-summary { margin: 8px 0; padding: 8px 12px; }
.detail-body .detail-md { margin-top: 10px; }
.detail-body .detail-tags { margin-top: 12px; }
.detail-body .detail-tags h4 { margin-bottom: 4px; }
.detail-body h2 {
  margin: 0 0 8px; font-size: 22px; line-height: 1.3;
}
.detail-meta {
  font-size: 12px; color: var(--muted);
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--surface-2);
}
.detail-meta a { color: var(--accent); }
.detail-summary {
  font-size: 14px; color: var(--text);
  padding: 12px 14px; background: var(--accent-soft);
  border-radius: 6px; border-left: 3px solid var(--accent);
}
.detail-md {
  font-size: 14px; line-height: 1.6;
  margin-top: 16px;
}
.detail-md h1, .detail-md h2, .detail-md h3, .detail-md h4 { margin: 18px 0 8px; }
.detail-md p { margin: 8px 0; }
.detail-md pre {
  background: var(--surface-2); padding: 12px; border-radius: 6px;
  font-size: 12px; overflow-x: auto;
}
.detail-md code {
  background: var(--surface-2); padding: 1px 4px; border-radius: 3px;
  font-size: 12px;
}
.detail-md pre code { padding: 0; background: transparent; }
.detail-md a { color: var(--accent); }
.detail-md ul, .detail-md ol { padding-left: 22px; }
.detail-tags { margin-top: 20px; }
.detail-tags h4 { font-size: 11px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─────────── Modal ─────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%; max-width: clamp(640px, 70vw, 1000px);
  max-height: 92vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; }

.editor {
  padding: 20px;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 14px;
}
.editor label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.editor input, .editor textarea, .editor select {
  font-family: inherit; font-size: 14px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  width: 100%;
}
.editor textarea { resize: vertical; line-height: 1.5; }
/* Specifiek de korte velden niet onnodig opblazen — de paste-tekstarea krijgt apart min-height */
#paste-raw { min-height: 180px; }
.editor input:focus, .editor textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.editor .row { display: flex; gap: 12px; }
.editor .row .col { flex: 1; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  margin: 0 -20px -20px;
}

/* ─────────── Login ─────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, var(--accent) 0%, #003F7F 100%);
  overflow: auto;
}
.login-card {
  background: var(--surface);
  padding: 32px; border-radius: 12px;
  width: 100%; max-width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; color: var(--accent); }
.login-card .muted { color: var(--muted); font-size: 13px; margin: -8px 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px;
}
.login-card button {
  padding: 10px;
  background: var(--accent); color: white;
  border: 0; border-radius: 6px; cursor: pointer;
  font-size: 14px; font-weight: 600;
}
.login-card .err {
  background: #FEE2E2; color: var(--danger);
  padding: 8px 12px; border-radius: 6px;
  font-size: 13px;
}

.muted { color: var(--muted); font-weight: normal; }

/* ─────────── File uploads ─────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.file-drop {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 2px dashed var(--border); border-radius: 6px;
  background: var(--surface);
  transition: background 0.1s, border-color 0.1s;
}
.file-drop.dragover { border-color: var(--accent); background: var(--accent-soft); }
.attach-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 6px;
}
.attach-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px;
  font-size: 13px;
}
.attach-chip .ai { font-size: 16px; flex-shrink: 0; }
.attach-chip .an { flex: 1; min-width: 0; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .an:hover { color: var(--accent); text-decoration: underline; }
.attach-chip .as { font-size: 11px; flex-shrink: 0; }
.attach-chip .ad {
  color: var(--muted); text-decoration: none; font-size: 16px;
  padding: 0 4px;
}
.attach-chip .ad:hover { color: var(--accent); }
.attach-chip .ax {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-size: 16px; padding: 0 4px;
  line-height: 1; font-family: inherit;
}
.attach-chip .ax:hover { color: var(--danger); }
.attach-chip.uploading { color: var(--muted); font-style: italic; }
.attach-chip.err { background: #FEE2E2; color: var(--danger); border-color: #FCA5A5; }
.note-clip { font-size: 11px; color: var(--muted); margin-left: 4px; }

/* Status badges (reading list) */
.status-badge {
  display: inline-block;
  font-size: 10px; padding: 1px 6px;
  border-radius: 8px; margin-left: 6px;
  font-weight: 600; white-space: nowrap;
}
.st-to-read { background: #FEF3C7; color: #92400E; }
.st-read { background: #D1FAE5; color: #065F46; }
.st-discarded { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.st-clutter { background: #FEE2E2; color: #B91C1C; }
.status-nav .count { background: transparent; color: var(--muted); }
.admin-head .user-info { display: flex; align-items: center; gap: 8px; }
.admin-head .user-name { max-width: none; }

/* Person profile modal */
.person-meta { font-size: 13px; color: var(--muted); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--surface-2); }
.person-meta a { color: var(--accent); }
#person-modal h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 16px 0 6px; }
.person-notes { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.person-note { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.person-note:hover { background: var(--surface-2); border-color: var(--accent); }
.pn-head { font-size: 14px; }
.pn-sub { font-size: 11px; margin-top: 2px; }
.pn-sum { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.co-link { cursor: pointer; border: 0; font-family: inherit; }
.co-link:hover { background: var(--accent); color: white; }

.note-card { position: relative; }
.card-select { display: none !important; }  /* selectie nu via background, geen checkbox */
.note-card.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.note-card.dragging { opacity: 0.4; }
.tree-head.dragover, .tree-leaf.dragover {
  background: var(--accent-soft) !important;
  outline: 2px dashed var(--accent);
}

.bulk-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: white;
  padding: 8px 14px; border-radius: 30px;
  display: flex; gap: 6px; align-items: center;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
  z-index: 60;
  font-size: 13px;
}
.bulk-bar > span:first-child { padding: 0 8px; font-weight: 600; }
.bulk-bar .btn {
  background: rgba(255,255,255,0.1); color: white; border-color: transparent;
  padding: 6px 12px; font-size: 12px;
}
.bulk-bar .btn:hover { background: rgba(255,255,255,0.2); }
.bulk-bar .btn.danger:hover { background: var(--danger); }

/* Co-occurrence */
.cooc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cooc-list { display: flex; flex-direction: column; gap: 3px; }
.cooc-row {
  display: grid; grid-template-columns: 1fr 20px 1fr 40px;
  align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 4px;
  font-size: 13px; text-decoration: none; color: var(--text);
}
.cooc-row:hover { background: var(--surface-2); }
.cooc-row .cx { color: var(--muted); text-align: center; }
.cooc-row .cc { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.cooc-row .ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cooc-row .cp { font-weight: 500; }
@media (max-width: 720px) { .cooc-split { grid-template-columns: 1fr; } }

.admin-link {
  display: block; padding: 8px 10px; font-size: 12px;
  color: var(--muted); text-decoration: none; text-align: center;
  border: 1px dashed var(--border); border-radius: 6px;
}
.admin-link:hover { color: var(--accent); border-color: var(--accent); }

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text); font-weight: normal !important;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.checkbox-row input { display: none; }
.checkbox-row:hover { background: #E5E8EE; }
.checkbox-row:has(input:checked) {
  background: var(--accent); color: white;
  border-color: var(--accent);
}
.checkbox-row:has(input:checked)::before {
  content: '✓';
  font-weight: bold;
  font-size: 14px;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.checkbox-row:not(:has(input:checked))::before {
  content: '';
  width: 16px; height: 16px;
  border: 1.5px solid var(--muted); border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}

/* ─────────── Quill WYSIWYG ─────────── */
.quill-mount {
  background: var(--surface);
  border-radius: 6px;
  min-height: 240px;
  flex: 1;  /* gebruik beschikbare ruimte in de modal — geen vaste cap meer */
  display: flex; flex-direction: column;
}
.ql-toolbar.ql-snow {
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  background: var(--surface-2);
}
.ql-container.ql-snow {
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  font-family: inherit;
  font-size: 14px;
  min-height: 200px;
  flex: 1;
  overflow-y: auto;
}
.ql-editor {
  min-height: 200px;
  padding: 12px 14px;
  line-height: 1.55;
  font-family: inherit;
}
.ql-editor p { margin: 0 0 8px; }
.ql-editor h1, .ql-editor h2, .ql-editor h3 { margin: 14px 0 6px; }
.ql-editor ul, .ql-editor ol { padding-left: 22px; margin: 6px 0; }
.ql-editor blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 10px; color: var(--muted); margin: 8px 0;
}
.ql-editor pre.ql-syntax,
.ql-editor pre {
  background: var(--surface-2);
  padding: 10px 12px; border-radius: 6px;
  font-size: 12px;
}
.ql-snow .ql-tooltip {
  z-index: 110;  /* boven modal */
}

/* Detail-panel: gebruik Quill's TEKST-styling maar GEEN intern scroll-frame.
 * Quill's snow.css zet height:100% + overflow-y:auto op .ql-editor (bedoeld voor het editor-modal),
 * wat in de detail-view een tweede scroll-zone + verplichte 100%-hoogte zou geven (= onnodige whitespace).
 * Hier laten we de inhoud natuurlijk groeien en laten we .detail-body de enige scroll-zone zijn. */
.detail-md.ql-editor {
  padding: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
}

/* ─────────── Admin ─────────── */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.admin-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 16px;
}
.admin-head h1 { font-size: 24px; color: var(--accent); margin: 0; flex: 1; }
.back-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--accent); }
.admin-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.admin-tabs .tab {
  background: transparent; border: 0; padding: 10px 16px;
  font-size: 14px; font-family: inherit; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.admin-tabs .tab:hover { color: var(--text); }
.admin-tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.dedup-list { display: flex; flex-direction: column; gap: 14px; }
.dedup-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px;
}
.dedup-card.done { background: var(--accent-soft); }
.dedup-card .merged { color: var(--accent); font-weight: 600; }
.dedup-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.dedup-option {
  display: grid; grid-template-columns: 24px 1fr 200px 80px; gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 4px; cursor: pointer;
}
.dedup-option:hover { background: var(--surface-2); }
.dedup-option input:checked + .opt-name { font-weight: 700; }
.opt-count { font-size: 11px; color: var(--muted); text-align: right; }
.dedup-actions { display: flex; gap: 8px; justify-content: flex-end; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 24px;
}
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 18px; font-weight: 600; margin-top: 4px; }

.ingest-log { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-family: monospace; }
.log-row {
  display: grid; grid-template-columns: 150px 70px 60px 1fr; gap: 8px;
  padding: 4px 8px; border-bottom: 1px solid var(--surface-2);
}
.log-ok { background: rgba(0,128,0,0.04); }
.log-fail { background: #FEE2E2; color: var(--danger); }

.merge-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.people-tbl .pp-edit, .people-tbl .pp-del { margin-right: 2px; }
.people-tbl .pp-del.danger:not([disabled]):hover { background: var(--danger); color: white; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--surface-2); text-align: left; }
.tbl th { background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }

.filter-search.wide { width: 100%; max-width: 400px; padding: 7px 10px; font-size: 13px; margin-bottom: 12px; }

.soa-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin: 8px 0;
}
.soa-card-hdr { margin-bottom: 6px; }
.soa-card .btn-sm { margin: 4px 4px 0 0; font-size: 11px; padding: 4px 10px; }
.soa-card-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.soa-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.soa-tag-pill {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-muted, #666);
  font-size: 10px; font-weight: 500; letter-spacing: 0.02em;
}
.sota-tag-filter {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 12px;
}
.soa-combine-toggle {
  cursor: pointer; padding: 3px 10px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  font-family: inherit;
}
.soa-combine-toggle:hover { background: var(--accent); color: white; }
.sota-tag-filter .soa-tag-chip {
  cursor: pointer; padding: 3px 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11px; display: inline-flex; align-items: center; gap: 6px;
}
.sota-tag-filter .soa-tag-chip.active { background: var(--accent); color: white; border-color: var(--accent); }
.sota-tag-filter .soa-tag-chip .count { font-size: 10px; opacity: 0.7; }
.sota-tag-filter .soa-tag-clear {
  cursor: pointer; padding: 3px 10px; border-radius: 12px;
  background: transparent; border: 1px dashed var(--border);
  font-size: 11px; color: var(--text-muted, #666);
}
@keyframes sota-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
  50%      { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.35); }
}
#sota-refine.pulse { animation: sota-pulse 0.8s ease-in-out 3; }
.soa-noteref {
  display: inline-block; padding: 0 4px; border-radius: 3px;
  background: var(--accent-soft); color: var(--accent);
  text-decoration: none; font-size: 11px; font-weight: 600;
  vertical-align: middle;
}
.soa-noteref:hover { background: var(--accent); color: white; }
.soa-noteref-demo { background: var(--accent-soft); color: var(--accent); padding: 0 4px; border-radius: 3px; font-size: 11px; }
.soa-queries .btn-sm { display: inline-block; margin: 2px 4px 2px 0; font-size: 11px; }
.soa-pubmed-results { margin-top: 8px; }
.soa-pubmed-list { font-size: 12px; padding-left: 18px; }
.soa-pubmed-list li { margin-bottom: 6px; }
#soa-content h3 { margin: 16px 0 6px; font-size: 14px; }
.translate-progress { margin-top: 16px; }
.progress-bar {
  width: 100%; height: 10px; background: var(--surface-2);
  border-radius: 5px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  width: 0%; transition: width 0.3s;
}

/* Bulk-move popover */
.bulk-move-menu {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 8px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  min-width: 220px; max-height: 280px; overflow-y: auto;
  padding: 4px; z-index: 70;
}
.bulk-move-item {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 0;
  width: 100%; padding: 8px 10px; border-radius: 4px;
  font-size: 13px; text-align: left; cursor: pointer;
  font-family: inherit; color: var(--text);
}
.bulk-move-item:hover { background: var(--surface-2); }
.bulk-move-item.new { color: var(--accent); font-weight: 600; border-top: 1px solid var(--surface-2); margin-top: 2px; padding-top: 8px; }
.bulk-move-item.unfile { color: var(--muted); font-style: italic; }
.bulk-move-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─────────── Responsive ─────────── */
@media (max-width: 720px) {
  :root { --sidebar-w: 260px; }
  .app { grid-template-columns: 1fr; }
  /* Sidebar wordt slide-out drawer */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 80;
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
    display: flex;  /* override [hidden] niet — alleen via .sidebar-show */
  }
  .app.sidebar-show .sidebar { transform: translateX(0); }
  .app.sidebar-show::before {
    content: ''; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 79;
  }
  .detail-panel { width: 100%; }
  .notes-list { grid-template-columns: 1fr; padding: 12px; gap: 10px; }
  .topbar { padding: 8px 10px; flex-wrap: wrap; gap: 6px; }
  .search-wrap { width: 100%; max-width: none; order: 10; }
  #sort, #new-note-btn, #paste-btn { font-size: 12px; padding: 8px 10px; }
  .btn { min-height: 40px; }  /* touch target */
  .icon-btn { width: 40px; height: 40px; font-size: 16px; }
  .bulk-bar {
    bottom: 8px; left: 8px; right: 8px;
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px;
  }
  .bulk-bar .btn { flex: 1 1 auto; min-width: 0; }
  .bulk-move-menu { left: auto; right: 0; transform: none; min-width: 200px; }
  /* Modals full-screen op mobiel */
  .modal { padding: 0; }
  .modal-card {
    max-width: 100%; max-height: 100vh;
    height: 100vh; border-radius: 0;
  }
  .editor { padding: 14px; gap: 10px; }
  .editor .row { flex-direction: column; gap: 10px; }
  .quill-mount { min-height: 180px; max-height: 35vh; }
  .ql-toolbar.ql-snow { flex-wrap: wrap; }
  .modal-foot { position: sticky; bottom: 0; }
  /* Detail */
  .detail-body { padding: 16px 18px; }
  .detail-md { font-size: 15px; }
  .card-select { width: 22px; height: 22px; opacity: 1; }  /* altijd zichtbaar mobiel */
  /* Sidebar drawer trigger button */
  #mobile-filter-btn { display: inline-flex !important; }
  /* Admin overview */
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .admin-tabs .tab { white-space: nowrap; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
#mobile-filter-btn { display: none; }

/* ─────────── Bidirectional links ─────────── */
.wiki-link {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  text-decoration: none; font-weight: 500;
}
.wiki-link:hover { background: var(--accent); color: white; }
.wiki-link.unresolved { background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.wiki-suggest {
  position: fixed; z-index: 9000; min-width: 260px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-size: 13px; max-height: 260px; overflow-y: auto; padding: 4px;
}
.wiki-suggest .wiki-item { padding: 6px 10px; border-radius: 5px; cursor: pointer; }
.wiki-suggest .wiki-item:hover, .wiki-suggest .wiki-item.focused { background: var(--accent-soft); color: var(--accent); }
.wiki-suggest .wiki-empty { padding: 8px 10px; }
.backlink-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.backlink-item {
  display: block; padding: 6px 10px; border-radius: 6px;
  background: var(--surface-2); color: var(--text); text-decoration: none;
  font-size: 13px;
}
.backlink-item:hover { background: var(--accent-soft); color: var(--accent); }

/* ─────────── Saved searches ─────────── */
.saved-search-list { display: flex; flex-direction: column; gap: 4px; }
.saved-search-item {
  display: flex; align-items: center; gap: 4px;
}
.saved-search-item .saved-name {
  flex: 1; text-align: left; padding: 5px 8px;
  background: transparent; border: 0; border-radius: 5px;
  color: var(--text); font-family: inherit; cursor: pointer; font-size: 13px;
}
.saved-search-item .saved-name:hover { background: var(--accent-soft); color: var(--accent); }

/* ─────────── Daily triage card ─────────── */
.triage-card {
  margin: 8px 16px; padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--accent);
  border-radius: 10px;
}
.triage-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.triage-head strong { color: var(--accent); font-size: 14px; }
.triage-head .icon-btn { margin-left: auto; }
.triage-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.triage-pick {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; cursor: pointer;
}
.triage-pick:hover { border-color: var(--accent); }
.triage-pick-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.triage-pick-action { font-size: 12px; color: var(--accent); margin-top: 4px; }

/* ─────────── Styled dialogs (alert/confirm/prompt) ─────────── */
.ui-dialog-back {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(20, 25, 40, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: ui-fade 0.12s ease-out;
}
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
.ui-dialog {
  background: var(--surface); color: var(--text);
  border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  width: 100%; max-width: 420px; padding: 22px 24px;
  animation: ui-pop 0.14s ease-out;
}
@keyframes ui-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ui-dialog-title { margin: 0 0 10px; font-size: 16px; color: var(--accent); }
.ui-dialog-msg { font-size: 14px; line-height: 1.5; color: var(--text); margin-bottom: 14px; white-space: pre-wrap; }
.ui-dialog-warn .ui-dialog-title { color: var(--danger); }
.ui-dialog-field { display: block; margin-bottom: 12px; }
.ui-dialog-field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ui-dialog-field input, .ui-dialog-field textarea {
  width: 100%; padding: 8px 10px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.ui-dialog-field textarea { min-height: 70px; resize: vertical; }
.ui-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.ui-dialog-actions .btn { min-width: 80px; }

/* ─────────── SotA tag-pills as buttons (clickable filter) ─────────── */
button.soa-tag-pill {
  font-family: inherit; cursor: pointer;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
  transition: background 0.1s, color 0.1s;
}
button.soa-tag-pill:hover { background: var(--accent-soft); color: var(--accent); }

.soa-like.liked { background: var(--accent-soft); border-color: var(--accent); }
.sota-likes-bar {
  margin-top: 10px; padding: 8px 10px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.soa-noteref-unresolved {
  display: inline-block; padding: 0 4px;
  background: var(--surface-2); color: var(--muted);
  border-radius: 3px; font-size: 11px; opacity: 0.7;
  text-decoration: line-through;
}

/* ─────────── Q&A modal results ─────────── */
.qa-result { margin-top: 14px; font-size: 14px; line-height: 1.5; }
.qa-result .qa-meta { margin-bottom: 8px; }
.qa-result .qa-answer { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; border-left: 3px solid var(--accent); }
.qa-result .qa-answer p { margin: 6px 0; }
.qa-result .qa-missing { margin-top: 8px; color: var(--warn); }
.qa-result .qa-cited { margin-top: 10px; }

.conflict-card {
  background: var(--surface-2); border-left: 3px solid var(--warn);
  border-radius: 6px; padding: 10px 14px; margin: 10px 0;
}
.conflict-card.sev-high { border-left-color: var(--danger); }
.conflict-card.sev-medium { border-left-color: var(--warn); }
.conflict-card.sev-low { border-left-color: var(--muted); }
.conflict-hdr { margin-bottom: 6px; }

/* ─────────── Highlight popover (Phase 3) ─────────── */
.highlight-pop {
  position: absolute; z-index: 9500;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}
.highlight-pop .btn { font-size: 12px; padding: 5px 10px; }

/* ─────────── Toast ─────────── */
.ui-toast-host {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; z-index: 9999;
  pointer-events: none;
}
.ui-toast {
  background: rgba(28, 32, 50, 0.92); color: white;
  padding: 8px 14px; border-radius: 6px; font-size: 13px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.25);
  animation: ui-toast-in 0.16s ease-out;
  pointer-events: auto;
}
.ui-toast.out { animation: ui-toast-out 0.28s ease-in forwards; }
.ui-toast-success { background: rgba(22, 163, 74, 0.95); }
.ui-toast-error { background: rgba(185, 28, 28, 0.95); }
@keyframes ui-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes ui-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-4px); } }

/* ─────────── Error banner ─────────── */
.ui-err-banner {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 10001; background: #FEE2E2; border: 1px solid var(--danger);
  color: var(--danger); padding: 6px 14px; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.ui-err-banner button {
  background: transparent; border: 0; color: var(--danger); cursor: pointer;
  font-size: 14px; padding: 0 4px;
}

/* ─────────── Search match highlight ─────────── */
mark { background: #FEF9C3; color: inherit; padding: 0 2px; border-radius: 3px; }

/* ─────────── Saved-search live count ─────────── */
.saved-count { font-size: 10px; min-width: 18px; text-align: center; }

/* ─────────── Q&A history ─────────── */
.qa-history-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.qa-history-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px 10px; font-size: 11px;
  cursor: pointer; font-family: inherit; color: var(--text);
}
.qa-history-item:hover { background: var(--accent-soft); color: var(--accent); }

/* Duplicate-finder groups */
.dup-group { margin: 10px 0; padding: 10px 12px; background: var(--surface-2); border-left: 3px solid var(--warn); border-radius: 6px; }
.dup-group ul { margin: 6px 0 0 18px; font-size: 13px; }

/* Drag-reorder visual cues for notebooks */
.tree-node.dragging { opacity: 0.4; }
.tree-node.drop-above { box-shadow: inset 0 2px 0 0 var(--accent); }

/* Auto-link picker rows (real checkboxes, no YES/NO text) */
.autolink-list { display: flex; flex-direction: column; gap: 6px; }
.autolink-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer;
}
.autolink-row:hover { background: var(--surface-2); }
.autolink-row input[type=checkbox] { margin-top: 3px; flex-shrink: 0; }
.autolink-info { flex: 1; min-width: 0; }
.autolink-title { font-size: 13px; font-weight: 500; }
.autolink-reason { margin-top: 3px; }

/* Duplicate-finder rows w/ checkboxes + inline merge */
.dup-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.dup-list { display: flex; flex-direction: column; gap: 4px; }
.dup-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 13px;
}
.dup-row:hover { background: var(--surface); }
.dup-row a { font-weight: 600; flex-shrink: 0; }
.dup-row .dup-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─────────── Papertrail 2026-07: uniform topbar buttons + settings grid ─────────── */
.topbar .btn, .topbar a.btn {
  height: 34px; display: inline-flex; align-items: center; gap: 5px;
  padding: 0 12px; font-size: 13px; line-height: 1; white-space: nowrap;
}
.topbar .icon-btn {
  height: 34px; width: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.set-grid { max-width: 640px; display: flex; flex-direction: column; gap: 14px; }
.set-fld { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; }
.set-fld > span em { font-weight: 400; color: var(--muted); font-style: normal; }
.set-fld textarea, .set-fld input, .set-fld select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-weight: 400;
}
.set-row { display: flex; gap: 10px; flex-wrap: wrap; }
.set-row .set-fld { flex: 1; min-width: 150px; }
.trash-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.trash-row .t { flex: 1; min-width: 180px; }

/* Keyboard-shortcuts button pinned to the far right of the toolbar */
.topbar .kbd-help-btn { margin-left: auto; }
@media (max-width: 760px) { .topbar .kbd-help-btn { margin-left: auto; order: 9; } }

/* Trash (bin) view in the main pane */
.trash-view { max-width: 760px; margin: 0 auto; padding: 8px 16px 28px; }
.trash-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--border); padding-bottom: 8px; margin-bottom: 4px; }
.trash-view-head h2 { margin: 0; font-size: 18px; }
.trash-view-head p.small { margin: 3px 0 0; }
.trash-list { margin-top: 2px; }

/* Daily-digest online-source checkboxes (admin) */
.set-sources { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 12px; margin: 0; }
.set-sources legend { font-weight: 600; font-size: 13.5px; padding: 0 6px; }
.set-sources legend em { font-weight: 400; color: var(--muted); font-style: normal; }
.src-check { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 13.5px; font-weight: 400; cursor: pointer; }
.src-check input[type=checkbox] { margin-top: 3px; flex: none; width: auto; }
.src-check .sec-n { width: 58px; flex: none; margin-left: auto; align-self: center; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
