* { box-sizing: border-box; }
:root {
  --bg: #f7f7f8;
  --bg-panel: #fff;
  --bg-hover: #f5f5f7;
  --bg-muted: #fafafa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #1a1a1a;
  --text-muted: #666;
  --text-faint: #999;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --note-bg: #fffdf5;
  --note-border: #fde68a;
  --note-text: #92400e;
  --danger: #b91c1c;
  --code-bg: #f1f1f4;
  --pre-bg: #2a2a33;
  --pre-text: #eaeaea;
}
[data-theme="dark"] {
  --bg: #0f0f12;
  --bg-panel: #18181b;
  --bg-hover: #27272a;
  --bg-muted: #1f1f23;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --note-bg: #2a2410;
  --note-border: #78350f;
  --note-text: #fcd34d;
  --danger: #f87171;
  --code-bg: #27272a;
  --pre-bg: #0a0a0c;
  --pre-text: #e4e4e7;
}
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); }

body { display: flex; height: 100vh; overflow: hidden; }

aside#sidebar {
  width: 380px;
  min-width: 300px;
  max-width: 500px;
  background: #fff;
  border-right: 1px solid #e4e4e7;
  display: flex;
  flex-direction: column;
  resize: horizontal;
  overflow: auto;
}
aside header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid #e4e4e7;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}
aside h1 { font-size: 14px; margin: 0 0 8px; font-weight: 600; letter-spacing: 0.2px; color: #444; }
.filters { display: flex; flex-direction: column; gap: 6px; }
.filters input, .filters select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}
.counter { font-size: 11px; color: #666; margin-top: 6px; }

ul#qlist { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
ul#qlist li {
  padding: 8px 14px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.35;
}
ul#qlist li:hover { background: #f5f5f7; }
ul#qlist li.active { background: #e8eef9; }
ul#qlist li .num { color: #888; min-width: 46px; font-variant-numeric: tabular-nums; font-size: 11.5px; }
ul#qlist li .query { flex: 1; color: #1a1a1a; }
ul#qlist li .badges { display: flex; gap: 3px; flex-wrap: wrap; align-items: flex-start; }
.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
  white-space: nowrap;
}
.badge.note { background: #fff3cd; color: #795200; }
.badge.reviewed { background: #d1fae5; color: #065f46; }
.badge.flagged { background: #fee2e2; color: #991b1b; }
.badge.followup { background: #dbeafe; color: #1e40af; }
.badge.tier-simple { background: #f1f5f9; color: #475569; }
.badge.tier-complex { background: #ede9fe; color: #5b21b6; }
.badge.tier-deep { background: #fce7f3; color: #9d174d; }

main#detail {
  flex: 1;
  overflow-y: auto;
  padding: 32px 48px 80px;
  background: #f7f7f8;
}
.placeholder { color: #999; padding: 60px 0; text-align: center; }

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e4e4e7;
}
.detail-header h1 {
  font-size: 22px;
  line-height: 1.3;
  margin: 0;
  flex: 1;
}
.detail-meta { color: #666; font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.detail-meta span { white-space: nowrap; }

.content {
  background: #fff;
  padding: 28px 34px;
  border-radius: 6px;
  border: 1px solid #e4e4e7;
  line-height: 1.55;
  font-size: 14.5px;
}
.content h1, .content h2, .content h3, .content h4 { line-height: 1.3; }
.content h1 { font-size: 20px; margin-top: 26px; }
.content h2 { font-size: 17px; margin-top: 24px; color: #333; border-bottom: 1px solid #eee; padding-bottom: 3px; }
.content h3 { font-size: 15px; margin-top: 18px; color: #444; }
.content h4 { font-size: 14px; margin-top: 14px; color: #555; }
.content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13.5px; }
.content th, .content td { border: 1px solid #e4e4e7; padding: 5px 8px; text-align: left; vertical-align: top; }
.content th { background: #f9f9fb; font-weight: 600; }
.content blockquote { border-left: 3px solid #d4d4d8; padding: 2px 12px; color: #555; margin: 10px 0; background: #fafafa; }
.content code { background: #f1f1f4; padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.content pre { background: #2a2a33; color: #eaeaea; padding: 12px; border-radius: 4px; overflow-x: auto; font-size: 13px; }
.content pre code { background: transparent; color: inherit; padding: 0; }
.content a { color: #2563eb; text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content a.external::after {
  content: "↗";
  font-size: 0.85em;
  margin-left: 2px;
  color: #999;
}

/* Source pills */
.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.55;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  white-space: normal;
  max-width: 100%;
  vertical-align: baseline;
  margin: 0 2px;
}
.pill.pill-link { text-decoration: none; cursor: pointer; }
.pill.pill-link:hover { background: #dbe3ff; text-decoration: none; }
.pill.pill-fisconetplus { background: #fef3c7; color: #78350f; border-color: #fde68a; }
.pill.pill-fisconetplus:hover { background: #fde68a; }
.pill.pill-fisconetplus_orphan {
  background: #fef3c7;
  color: #a16207;
  border-color: #fde68a;
  border-style: dashed;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: not-allowed;
  opacity: 0.75;
}
.pill.pill-vlabel { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.pill.pill-codex { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }

/* Distinct background for the three canonical source sections */
.content h2:where(
  [id*="doctrine"],
  [id*="corpus"],
  [id*="bronnen"],
  [id*="audit"]
) {
  margin-top: 32px;
}
.content h2 + p,
.content h2 + ul,
.content h2 + ol { margin-top: 8px; }

/* Highlight source lists */
.content ol > li, .content ul > li { margin: 4px 0; }
.content h2[id*="ronnen"] ~ ol,
.content h2[id*="octrine"] ~ ul,
.content h2[id*="orpus"] ~ ol {
  /* no global style — let markdown flow naturally */
}

/* Zie ook callout (the marker we inject) */
.content p:has-text("(Zie ook:") { color: #555; font-style: italic; }

/* Right-hand TOC */
.layout-with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .layout-with-toc { grid-template-columns: 1fr; } .toc { display: none; } }
.toc {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  font-size: 12px;
  padding: 12px 8px 12px 12px;
  border-left: 2px solid #e4e4e7;
  color: #666;
}
.toc h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #888; }
.toc a { display: block; color: #555; text-decoration: none; padding: 3px 0; line-height: 1.35; border-left: 2px solid transparent; padding-left: 8px; margin-left: -10px; }
.toc a:hover { color: #2563eb; border-left-color: #c7d2fe; }
.toc a.level-3 { padding-left: 20px; margin-left: -22px; font-size: 11.5px; color: #777; }
.toc a.active { color: #1d4ed8; border-left-color: #2563eb; font-weight: 500; }

/* note panel */
.note-panel {
  margin-top: 20px;
  background: #fffdf5;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 16px 20px;
}
.note-panel h3 { margin: 0 0 10px; font-size: 14px; color: #92400e; }
.note-panel textarea {
  width: 100%;
  min-height: 140px;
  font-family: inherit;
  font-size: 14px;
  padding: 10px;
  border: 1px solid #e5d89c;
  border-radius: 4px;
  background: #fffef9;
  resize: vertical;
  line-height: 1.5;
}
.note-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.note-actions button {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #d4d4d8;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.note-actions button:hover { background: #f5f5f7; }
.note-actions button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.note-actions button.primary:hover { background: #1d4ed8; }
.note-actions button.danger { color: #b91c1c; border-color: #fecaca; }
.note-actions button.danger:hover { background: #fef2f2; }
.note-actions select { padding: 6px 8px; border: 1px solid #d4d4d8; border-radius: 4px; font-size: 13px; }
.note-status { color: #666; font-size: 12px; }
.note-status.saved { color: #059669; }
.note-updated { color: #999; font-size: 11px; }

/* shortcuts hint */
.shortcuts { color: #999; font-size: 11px; margin-top: 24px; text-align: center; }
kbd {
  display: inline-block;
  padding: 1px 5px;
  background: #f1f1f4;
  border: 1px solid #d4d4d8;
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

/* external answer badge in sidebar */
.badge.answers { background: #e0e7ff; color: #3730a3; font-variant-numeric: tabular-nums; }

/* External answers section */
.external-answers { margin-top: 24px; }
.ea-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.ea-header h3 { margin: 0; font-size: 15px; color: #333; }
.ea-count { background: #e0e7ff; color: #3730a3; padding: 1px 7px; border-radius: 10px; font-size: 11px; margin-left: 4px; vertical-align: middle; }
.ea-actions { display: flex; gap: 8px; }
.ea-actions button {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #d4d4d8;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.ea-actions button:hover { background: #f5f5f7; }
.ea-actions button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.ea-actions button.primary:hover { background: #1d4ed8; }
.ea-empty { color: #999; font-size: 13px; padding: 14px 16px; background: #fafafa; border: 1px dashed #e4e4e7; border-radius: 6px; }

.ea-list { display: flex; flex-direction: column; gap: 10px; }
.ea-card {
  border: 1px solid #e4e4e7;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
}
.ea-card summary {
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fafafb;
  border-bottom: 1px solid transparent;
  user-select: none;
}
.ea-card[open] summary { border-bottom-color: #e4e4e7; }
.ea-card summary::-webkit-details-marker { display: none; }
.ea-card summary::before {
  content: "▸";
  font-size: 11px;
  color: #888;
  margin-right: 2px;
  transition: transform 0.15s;
}
.ea-card[open] summary::before { transform: rotate(90deg); }
.ea-provider-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.4px;
}
.ea-badge-chatgpt { background: #d1fae5; color: #065f46; }
.ea-badge-gemini { background: #fee2e2; color: #9a3412; }
.ea-badge-claude { background: #fef3c7; color: #78350f; }
.ea-badge-perplexity { background: #cffafe; color: #155e75; }
.ea-badge-deepseek { background: #ede9fe; color: #5b21b6; }
.ea-badge-grok { background: #e5e7eb; color: #374151; }
.ea-badge-copilot { background: #dbeafe; color: #1e40af; }
.ea-badge-other { background: #f3f4f6; color: #4b5563; }
.ea-label { font-weight: 500; font-size: 14px; flex: 1; color: #1a1a1a; }
.ea-file { font-size: 11px; color: #666; }
.ea-date { font-size: 11px; color: #999; font-variant-numeric: tabular-nums; }
.ea-delete {
  border: none; background: transparent; color: #999; font-size: 18px; cursor: pointer; padding: 0 4px; border-radius: 3px;
}
.ea-delete:hover { color: #dc2626; background: #fee2e2; }
.ea-content {
  padding: 18px 24px;
  font-size: 14px;
  line-height: 1.55;
}
.ea-content h1 { font-size: 18px; margin: 14px 0 8px; }
.ea-content h2 { font-size: 15.5px; margin: 12px 0 6px; }
.ea-content h3 { font-size: 14px; margin: 10px 0 4px; }
.ea-content table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.ea-content th, .ea-content td { border: 1px solid #e4e4e7; padding: 4px 7px; }
.ea-content th { background: #f9f9fb; }
.ea-content pre { background: #2a2a33; color: #eaeaea; padding: 10px; border-radius: 4px; overflow-x: auto; font-size: 12.5px; }

/* Modal */
#ea-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.ea-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}
.ea-modal {
  position: relative;
  background: #fff;
  border-radius: 8px;
  width: min(720px, 92vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.ea-modal header { padding: 14px 20px; border-bottom: 1px solid #e4e4e7; display: flex; justify-content: space-between; align-items: center; }
.ea-modal header h3 { margin: 0; font-size: 16px; }
.ea-modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #666; padding: 0 6px; }
.ea-modal-close:hover { color: #000; }
.ea-modal-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.ea-modal-body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; }
.ea-modal-body input[type="text"], .ea-modal-body select, .ea-modal-body textarea {
  padding: 7px 9px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: inherit;
}
.ea-modal-body textarea { min-height: 250px; resize: vertical; line-height: 1.5; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.ea-tabs { display: flex; border-bottom: 1px solid #e4e4e7; margin-top: 4px; }
.ea-tab {
  padding: 8px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ea-tab.active { color: #2563eb; border-bottom-color: #2563eb; }
.ea-pane.hidden { display: none; }
.ea-hint { font-size: 12px; color: #888; margin: 6px 0 0; }
.ea-modal footer {
  padding: 12px 20px;
  border-top: 1px solid #e4e4e7;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.ea-modal footer button {
  padding: 7px 14px;
  border: 1px solid #d4d4d8;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.ea-modal footer button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.ea-modal footer button:disabled { opacity: 0.5; }

/* Toast */
#flash-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: #f1f5f9;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none;
  z-index: 200;
  max-width: 560px;
}
#flash-toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }

/* nav buttons */
.nav-buttons { display: flex; gap: 8px; }
.nav-buttons button {
  padding: 6px 10px;
  border: 1px solid #d4d4d8;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.nav-buttons button:hover { background: #f5f5f7; }
.nav-buttons button:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-buttons button.active { background: #1e40af; color: #fff; border-color: #1e40af; }

/* ==== Layout tweaks for new header controls ==== */
.sb-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sb-tools { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  border: 1px solid var(--border-strong); background: var(--bg-panel); color: var(--text-muted);
  border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; padding: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.search-wrap { display: flex; gap: 4px; }
.search-wrap input { flex: 1; }
.search-wrap select { min-width: 92px; font-size: 12px; }
.filter-row { display: flex; gap: 4px; }
.filter-row select { flex: 1; }

/* Snippet + hit badges in sidebar */
ul#qlist li .query-wrap { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
ul#qlist li .snippet {
  font-size: 11.5px; color: var(--text-muted); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hit-labels { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.hit { font-size: 9.5px; background: #e0f2fe; color: #075985; padding: 0 4px; border-radius: 2px; font-weight: 500; }

/* ==== Side-by-side comparison ==== */
.cmp-wrap { margin-top: 6px; }
.cmp-columns { display: grid; gap: 14px; align-items: start; }
.cmp-wrap[data-cols="1"] .cmp-columns { grid-template-columns: 1fr; }
.cmp-wrap[data-cols="2"] .cmp-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cmp-wrap[data-cols="3"] .cmp-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cmp-wrap[data-cols="4"] .cmp-columns,
.cmp-wrap[data-cols="5"] .cmp-columns,
.cmp-wrap[data-cols="6"] .cmp-columns {
  grid-auto-flow: column; grid-auto-columns: minmax(360px, 1fr); overflow-x: auto; padding-bottom: 12px;
}
.cmp-column {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 6px;
  min-width: 320px; display: flex; flex-direction: column; max-height: calc(100vh - 180px);
}
.cmp-column-header {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-muted); position: sticky; top: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 3px;
}
.cmp-column-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.cmp-column-meta { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cmp-column-body {
  padding: 16px 18px; overflow-y: auto; font-size: 13px; line-height: 1.55;
}
.cmp-column-body h1, .cmp-column-body h2 { font-size: 14.5px; margin: 14px 0 6px; line-height: 1.3; }
.cmp-column-body h3 { font-size: 13px; margin: 10px 0 4px; }
.cmp-column-body table { font-size: 12px; }
.cmp-column-body table th, .cmp-column-body table td { padding: 3px 5px; border: 1px solid var(--border); }
.cmp-column-body ul, .cmp-column-body ol { padding-left: 20px; }
.cmp-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 3px; letter-spacing: 0.4px;
}
.cmp-golden { background: #fef3c7; color: #78350f; }
.cmp-label { font-weight: 500; color: var(--text); }

/* ==== Claude diff card ==== */
.diff-card {
  margin-top: 16px; background: #f0f9ff; border: 1px solid #93c5fd; border-radius: 6px; overflow: hidden;
}
.diff-card summary {
  padding: 10px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  background: #dbeafe; list-style: none;
}
.diff-card summary::-webkit-details-marker { display: none; }
.diff-badge { font-size: 11px; font-weight: 600; color: #1e40af; background: #bfdbfe; padding: 2px 8px; border-radius: 3px; }
.diff-meta { flex: 1; font-size: 11.5px; color: var(--text-muted); }
.diff-body { padding: 18px 24px; font-size: 14px; line-height: 1.6; }
.diff-body h2 { font-size: 15px; margin: 14px 0 6px; color: var(--text); }
.diff-body h3 { font-size: 13.5px; margin: 10px 0 4px; }

/* ==== Keyboard help overlay ==== */
#kbd-help { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; }
.kbd-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.kbd-panel {
  position: relative; background: var(--bg-panel); color: var(--text);
  border-radius: 8px; width: 420px; padding: 0; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.kbd-panel header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.kbd-panel h3 { margin: 0; font-size: 15px; }
.kbd-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.kbd-panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kbd-panel td { padding: 7px 18px; border-bottom: 1px solid var(--border); }
.kbd-panel tr:last-child td { border-bottom: none; }
.kbd-panel td:first-child { width: 120px; }

/* ==== Dark-mode overrides ==== */
[data-theme="dark"] aside#sidebar { background: var(--bg-panel); border-right-color: var(--border); }
[data-theme="dark"] aside header { background: var(--bg-panel); border-bottom-color: var(--border); }
[data-theme="dark"] aside h1 { color: var(--text-muted); }
[data-theme="dark"] .filters input,
[data-theme="dark"] .filters select { background: var(--bg-muted); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .counter { color: var(--text-muted); }
[data-theme="dark"] ul#qlist li { border-bottom-color: var(--border); }
[data-theme="dark"] ul#qlist li:hover { background: var(--bg-hover); }
[data-theme="dark"] ul#qlist li.active { background: #1e3a8a; }
[data-theme="dark"] ul#qlist li .num { color: var(--text-faint); }
[data-theme="dark"] ul#qlist li .query { color: var(--text); }
[data-theme="dark"] main#detail { background: var(--bg); }
[data-theme="dark"] .detail-header { border-bottom-color: var(--border); }
[data-theme="dark"] .detail-meta { color: var(--text-muted); }
[data-theme="dark"] .content { background: var(--bg-panel); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .content h2 { color: var(--text); border-bottom-color: var(--border); }
[data-theme="dark"] .content h3, [data-theme="dark"] .content h4 { color: var(--text); }
[data-theme="dark"] .content th, [data-theme="dark"] .content td { border-color: var(--border); }
[data-theme="dark"] .content th { background: var(--bg-muted); }
[data-theme="dark"] .content code { background: var(--code-bg); color: var(--text); }
[data-theme="dark"] .content pre { background: var(--pre-bg); color: var(--pre-text); }
[data-theme="dark"] .content blockquote { background: var(--bg-muted); color: var(--text-muted); border-left-color: var(--border-strong); }
[data-theme="dark"] .content a { color: var(--accent); }
[data-theme="dark"] .note-panel { background: var(--note-bg); border-color: var(--note-border); }
[data-theme="dark"] .note-panel h3 { color: var(--note-text); }
[data-theme="dark"] .note-panel textarea { background: var(--bg-muted); color: var(--text); border-color: var(--border-strong); }
[data-theme="dark"] .note-actions button { background: var(--bg-panel); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .note-actions button:hover { background: var(--bg-hover); }
[data-theme="dark"] .toc { border-left-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .toc a { color: var(--text-muted); }
[data-theme="dark"] .ea-card { background: var(--bg-panel); border-color: var(--border); }
[data-theme="dark"] .ea-card summary { background: var(--bg-muted); }
[data-theme="dark"] .ea-card[open] summary { border-bottom-color: var(--border); }
[data-theme="dark"] .ea-label, [data-theme="dark"] .ea-content { color: var(--text); }
[data-theme="dark"] .ea-empty { background: var(--bg-muted); border-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .ea-header h3 { color: var(--text); }
[data-theme="dark"] .ea-actions button { background: var(--bg-panel); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .ea-actions button:hover { background: var(--bg-hover); }
[data-theme="dark"] .ea-modal { background: var(--bg-panel); }
[data-theme="dark"] .ea-modal header, [data-theme="dark"] .ea-modal footer { border-color: var(--border); }
[data-theme="dark"] .ea-modal-body input,
[data-theme="dark"] .ea-modal-body select,
[data-theme="dark"] .ea-modal-body textarea { background: var(--bg-muted); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .pill { background: #1e3a5f; color: #dbeafe; border-color: #1e40af; }
[data-theme="dark"] .pill-fisconetplus { background: #422006; color: #fed7aa; border-color: #78350f; }
[data-theme="dark"] .pill-fisconetplus_orphan {
  background: #422006;
  color: #d6a96b;
  border-color: #78350f;
  border-style: dashed;
}
[data-theme="dark"] .pill-vlabel { background: #14532d; color: #bbf7d0; border-color: #166534; }
[data-theme="dark"] kbd { background: var(--bg-muted); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .shortcuts { color: var(--text-faint); }
[data-theme="dark"] .hit { background: #164e63; color: #a5f3fc; }
[data-theme="dark"] .cmp-golden { background: #422006; color: #fed7aa; }
[data-theme="dark"] .diff-card { background: #0c2540; border-color: #1e40af; }
[data-theme="dark"] .diff-card summary { background: #1e3a8a; }
[data-theme="dark"] .diff-badge { background: #1e40af; color: #dbeafe; }

/* ── Auth overlay ─────────────────────────────────────────────────────────── */
#auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
}
.auth-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 2.5rem;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.auth-modal h2 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  color: var(--text);
}
.auth-modal input[type="password"] {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.auth-modal input[type="password"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.auth-error {
  color: #dc2626;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: 0;
}
[data-theme="dark"] .auth-modal { background: var(--bg); border-color: var(--border-strong); }
