/* Evidence Companion - Academic Research Interface */
/* Inspired by Our World in Data, Distill.pub, eLife */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Academic Palette -- derived from category spectrum */
    --primary: #3a7d7e;       /* teal (from spectrum center) */
    --primary-dark: #2d6364;
    --primary-light: #4b9d9e;
    --secondary: #0f172a;
    --accent: #5b8c5a;        /* sage green */

    /* Category spectrum (Gegenstand → Perspektive) */
    --cat-ai-lit: #5b8c5a;
    --cat-gen-ki: #3a7d7e;
    --cat-prompt: #4b7bab;
    --cat-ki-sonst: #7c6fae;
    --cat-soz-arb: #b0546e;
    --cat-bias: #c2694e;
    --cat-gender: #d4943a;
    --cat-divers: #8a7542;
    --cat-femin: #a24b7a;
    --cat-fairness: #6a8e4e;

        /* Semantic Colors */
    --success: #5b8c5a;      /* sage green -- from spectrum */
    --warning: #d4943a;       /* amber -- from spectrum */
    --danger: #b0546e;        /* dusty rose -- from spectrum */
    --info: #4b7bab;          /* steel blue -- from spectrum */

    /* Decision Colors */
    --decision-include: #5b8c5a;
    --decision-exclude: #6b7280;
    --decision-unclear: #d4943a;

    /* Neutrals */
    --gray-50: #fafaf9;
    --gray-100: #f5f5f4;
    --gray-200: #e7e5e4;
    --gray-300: #d6d3d1;
    --gray-400: #a8a29e;
    --gray-500: #78716c;
    --gray-600: #57534e;
    --gray-700: #44403c;
    --gray-800: #292524;
    --gray-900: #1c1917;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-display: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Typography Scale (larger base for readability) */
    --text-xs: 0.75rem;        /* 12px */
    --text-sm: 0.8125rem;      /* 13px */
    --text-base: 0.875rem;     /* 14px */
    --text-md: 0.9375rem;      /* 15px */
    --text-body: 1rem;         /* 16px */
    --text-lg: 1.0625rem;      /* 17px */
    --text-xl: 1.125rem;       /* 18px */
    --text-2xl: 1.25rem;       /* 20px */
    --text-3xl: 1.5rem;        /* 24px */
    --text-4xl: 1.75rem;       /* 28px */

    /* Spacing Scale */
    --space-xs: 0.25rem;       /* 4px */
    --space-sm: 0.5rem;        /* 8px */
    --space-md: 0.75rem;       /* 12px */
    --space-lg: 1rem;          /* 16px */
    --space-xl: 1.5rem;        /* 24px */
    --space-2xl: 2rem;         /* 32px */

    /* Spacing Aliases (used in benchmark styles) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;

    /* Border Radius Scale */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius: 6px;

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition-base: all 0.2s ease;
    --transition-slow: all 0.3s ease;

    /* Focus Ring */
    --focus-ring: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Rich Tooltips (JS-driven, HTML content) */
.has-tip {
    cursor: help;
}

.rich-tooltip {
    position: absolute;
    z-index: 1000;
    background: var(--gray-900);
    color: var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 0.875rem 1rem;
    max-width: 320px;
    min-width: 200px;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    line-height: 1.5;
    pointer-events: none;
    animation: tipFadeIn 0.15s ease;
}

@keyframes tipFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.tip-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: white;
    margin-bottom: 0.375rem;
}

.tip-text {
    color: var(--gray-300);
    margin-bottom: 0.375rem;
}

.tip-muted {
    color: var(--gray-500);
    font-style: italic;
}

.tip-section {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin: 0.5rem 0 0.25rem;
}

/* Mini bar charts in tooltips */
.tip-bar-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.2rem;
}

.tip-bar-label {
    font-size: 0.625rem;
    color: var(--gray-400);
    min-width: 70px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tip-bar {
    flex: 1;
    height: 6px;
    background: var(--gray-700);
    border-radius: 3px;
    overflow: hidden;
}

.tip-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}

.tip-bar-val {
    font-size: 0.625rem;
    color: var(--gray-400);
    min-width: 24px;
    text-align: right;
}

/* Stat grid in tooltips */
.tip-grid {
    display: flex;
    gap: 0.75rem;
    margin: 0.375rem 0;
}

.tip-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tip-stat-val {
    font-size: var(--text-lg);
    font-weight: 700;
    color: white;
    line-height: 1;
}

.tip-stat-lbl {
    font-size: 0.5625rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
    text-align: center;
}

/* Pipeline visualization in tooltip */
.tip-pipeline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin: 0.375rem 0;
}

.tip-step {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: var(--gray-700);
    border-radius: 3px;
    color: var(--gray-300);
    white-space: nowrap;
}

.tip-step small {
    color: var(--gray-500);
}

.tip-step-hl {
    background: var(--primary-dark);
    color: white;
    font-weight: 600;
}

.tip-arrow {
    font-size: 0.5rem;
    color: var(--gray-600);
}

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

body {
    font-family: var(--font-body);
    background: #ffffff;
    color: var(--gray-900);
    line-height: 1.6;
    font-size: var(--text-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Base Components (Reusable)
   ======================================== */

/* ========================================
   Layout & Structure
   ======================================== */

/* Header - Clean Academic with Navigation */
header {
    background: white;
    color: var(--gray-900);
    padding: 1.25rem 0 0;
    border-bottom: none;
}

/* Category spectrum bar under header */
header::after {
    content: '';
    display: block;
    height: 4px;
    margin-top: 1rem;
    background: linear-gradient(
        to right,
        var(--cat-ai-lit),
        var(--cat-gen-ki),
        var(--cat-prompt),
        var(--cat-ki-sonst),
        var(--cat-soz-arb),
        var(--cat-bias),
        var(--cat-gender),
        var(--cat-divers),
        var(--cat-femin),
        var(--cat-fairness)
    );
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.brand-link {
    text-decoration: none;
    color: inherit;
}

.brand-link:hover h1 {
    color: var(--primary);
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.375rem;
}

.nav-link {
    font-size: var(--text-sm);
    color: var(--gray-500);
    text-decoration: none;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.nav-link-active {
    color: var(--gray-900);
    font-weight: 600;
}

.nav-link-ext {
    color: var(--gray-400);
    padding: 0.375rem 0.5rem;
}

.nav-link-ext:hover {
    color: var(--primary);
}

/* View buttons in header nav */
.nav-view-btn {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-500);
    background: transparent;
    border: none;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-view-btn:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.nav-view-btn.active {
    color: var(--gray-900);
    font-weight: 600;
    background: var(--gray-50);
}

.nav-view-korpus {
    color: var(--gray-400);
    font-size: var(--text-xs);
    margin-left: 0.25rem;
}

.nav-view-korpus.active {
    color: var(--gray-700);
}

.nav-sep {
    width: 1px;
    height: 1rem;
    background: var(--gray-200);
    margin: 0 0.25rem;
}

/* Subpage content (About, Help, Methoden) */
.page-content {
    max-width: 780px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.prose h2 {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    margin-bottom: 1rem;
}

.prose h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-top: 2rem;
    margin-bottom: 0.625rem;
    color: var(--gray-800);
}

.prose h3 i {
    color: var(--primary);
    margin-right: 0.4rem;
}

.prose p {
    margin-bottom: 0.875rem;
    color: var(--gray-700);
    line-height: 1.8;
}

.prose ul {
    padding-left: 1.25rem;
    margin-bottom: 0.875rem;
    color: var(--gray-700);
}

.prose li {
    margin-bottom: 0.375rem;
    line-height: 1.7;
}

.prose kbd {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: var(--text-sm);
    font-family: 'Courier New', monospace;
}

.prose a {
    color: var(--primary);
}

.help-shortcuts {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.help-shortcuts td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-md);
    color: var(--gray-700);
}

.help-shortcuts td:first-child {
    width: 120px;
    text-align: center;
}

/* Methoden page: pipeline flow + tables */
.pipeline-flow {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.pipeline-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.625rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    min-width: 100px;
    text-align: center;
    flex: 1;
}

.pipeline-num {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary);
}

.pipeline-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-top: 0.125rem;
}

.pipeline-detail {
    font-size: 0.65rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
    line-height: 1.3;
}

.pipeline-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.375rem;
    color: var(--gray-300);
    font-size: var(--text-sm);
}

.pipeline-loss {
    font-size: 0.6rem;
    color: var(--danger);
    font-weight: 600;
}

.methoden-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    margin: 0.75rem 0 1rem;
}

.methoden-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
}

.methoden-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: top;
}

@media (max-width: 768px) {
    .pipeline-flow { flex-direction: column; }
    .pipeline-arrow { transform: rotate(90deg); padding: 0.25rem 0; }
}

/* (info-modal removed -- about/help are now separate pages) */

/* Cite styles (used by about.html) */
.info-cite {
    border-left: 3px solid var(--primary);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    background: var(--gray-50);
    font-size: var(--text-md);
    font-style: italic;
    color: var(--gray-600);
}

.info-cite em {
    font-style: normal;
}

/* Footer */
.site-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-400);
    font-size: var(--text-sm);
}

.footer-links {
    margin-top: 0.5rem;
}

.footer-links a {
    color: var(--primary);
}

h1 {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.01em;
    color: var(--gray-900);
    line-height: 1.3;
}

.subtitle {
    font-size: var(--text-body);
    font-weight: 400;
    color: var(--gray-500);
    font-style: italic;
}

.header-authors {
    font-size: var(--text-md);
    color: var(--gray-600);
    margin-top: var(--space-xs);
}

/* Stats as compact row inside header, below nav */
.header-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 0.375rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--gray-200);
}

.stat-item {
    font-size: var(--text-xs);
    color: var(--gray-400);
}

.stat-item strong {
    color: var(--gray-500);
    font-weight: 600;
}

.stat-sep {
    width: 1px;
    height: 0.625rem;
    background: var(--gray-300);
    opacity: 0.5;
}

/* Main Content */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

/* View content visibility */
.view-content {
    display: none;
}

.view-content.active {
    display: block;
}

/* Sections */
.content-section {
    margin-bottom: 2rem;
}

.section-heading {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.section-description {
    font-size: var(--text-md);
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    max-width: 48rem;
    line-height: 1.6;
}

/* Export Button */
.export-button {
    padding: 0.5rem 1rem;
    background: white;
    color: var(--primary);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.export-button:hover {
    background: var(--gray-50);
    border-color: var(--primary);
}

.export-button i {
    font-size: 0.875em;
}

/* Export Button */

/* Search & Filters */
.search-filters {
    background: white;
    padding: 1.25rem 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 1rem;
    border: none;
    border-bottom: 1px solid var(--gray-200);
}

.search-box {
    width: 100%;
    padding: 0.875rem 0.875rem 0.875rem 2.75rem;
    font-size: var(--text-body);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    transition: var(--transition-fast);
    font-family: var(--font-body);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2378716c'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.875rem center;
    background-size: 1.125rem;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.filter-label {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.filter-select {
    padding: var(--space-md) 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    background: white;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--gray-400);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* Papers Table */
.papers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-md);
}

.papers-table thead th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
    user-select: none;
}

.papers-table thead th.sortable {
    cursor: pointer;
}

.papers-table thead th.sortable:hover {
    color: var(--primary);
}

.papers-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.papers-table tbody tr:hover {
    background: var(--gray-50);
}

.papers-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    color: var(--gray-700);
}

.papers-table .col-title {
    font-weight: 500;
    color: var(--gray-900);
    max-width: 360px;
}

.papers-table .col-author {
    font-size: var(--text-sm);
    color: var(--gray-500);
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.papers-table .col-year {
    font-size: var(--text-sm);
    color: var(--gray-400);
    text-align: center;
    width: 50px;
}

.papers-table .col-dec {
    text-align: center;
    width: 70px;
}

.papers-table .col-status {
    text-align: center;
    width: 80px;
}

.papers-table .col-cats {
    width: 110px;
}

/* Decision cells (compact) */
.dec-cell {
    font-size: var(--text-xs);
    font-weight: 600;
}
.dec-cell--include { color: var(--success); }
.dec-cell--exclude { color: var(--gray-400); }
.dec-cell--none { color: var(--gray-300); }

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill--agree { background: #ecfdf5; color: #065f46; }
.status-pill--diverge { background: #fef2f2; color: #991b1b; }
.status-pill--llmonly { background: var(--gray-100); color: var(--gray-400); }

/* Color-coded category dots in table */
.cat-labels {
    display: flex;
    gap: 3px;
    align-items: center;
}

.cat-dot-color {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    cursor: help;
    transition: transform 0.1s;
}

.cat-dot-color:hover {
    transform: scale(1.4);
}

/* Separator between Technik and Sozial dots */
.cat-dot-sep {
    display: inline-block;
    width: 4px;
    flex-shrink: 0;
}

/* Color dot in category chips (filter bar) */
.chip-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Group labels in category filter */
.chip-group-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.25rem;
}

.chip-group-sep {
    display: inline-block;
    width: 1px;
    height: 1.25rem;
    background: var(--gray-300);
    margin: 0 0.5rem;
    vertical-align: middle;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
}

.page-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-600);
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-ellipsis {
    padding: 0 0.25rem;
    color: var(--gray-400);
}

.decision-badge {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* (decision-include/exclude/unclear classes removed -- JS uses inline styles) */

/* (relevance bars, dimension pills, paper-title removed -- unused) */

/* Results Row (counter + exports) */
.results-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.75rem 0;
    padding: 0.5rem 0;
}

.results-counter {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.results-counter strong {
    color: var(--gray-700);
    font-weight: 600;
}

.export-buttons {
    display: flex;
    gap: 0.375rem;
}

/* (dashboard grid, chart containers, old graph viz removed -- replaced by Wissensnetz) */

/* Detail Panel (slide-in from right) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
}

.modal-content {
    position: absolute;
    top: 0;
    right: 0;
    width: min(480px, 45vw);
    height: 100%;
    background: white;
    overflow-y: auto;
    border-left: 1px solid var(--gray-200);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.25s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: start;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    gap: 1rem;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    font-size: var(--text-2xl);
}

.modal-author {
    color: var(--gray-500);
    margin-top: 0.25rem;
    font-size: var(--text-md);
}

.modal-close {
    background: var(--gray-100);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 1.125rem;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
    padding: 0;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.modal-body {
    padding: 1.5rem 2rem 2rem;
}

/* Panel-open state (desktop): table adapts, no blocking overlay */
@media (min-width: 769px) {
    body.panel-open .modal-overlay {
        background: transparent;
        pointer-events: none;
    }

    body.panel-open .papers-table .col-year,
    body.panel-open .papers-table .col-status,
    body.panel-open .papers-table .col-cats {
        display: none;
    }

    body.panel-open .papers-table .col-title {
        max-width: 260px;
    }

    body.panel-open .papers-table .col-author {
        max-width: 120px;
    }

    body.panel-open .search-filters,
    body.panel-open .results-counter,
    body.panel-open .category-filter-row {
        margin-right: 0;
    }
}

/* Active row highlight */
.papers-table tbody tr.row--active {
    background: var(--gray-100);
}

.papers-table tbody tr.row--active:hover {
    background: var(--gray-100);
}

/* Detail modal tabs */
.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.25rem;
}

.detail-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition-fast);
}

.detail-tab:hover {
    color: var(--gray-700);
}

.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Knowledge document sections */
.kd-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.kd-section:last-of-type {
    border-bottom: none;
}

.kd-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.375rem;
}

.kd-section p {
    font-size: var(--text-md);
    color: var(--gray-700);
    line-height: 1.7;
}

.kd-kernbefund p {
    font-size: var(--text-lg);
    color: var(--gray-900);
    font-weight: 500;
    line-height: 1.6;
}

.kd-empty {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
}

.detail-section {
    margin-bottom: var(--space-2xl);
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
    color: var(--gray-900);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* (dimension rows and star ratings removed -- unused) */

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.loading-spinner {
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: var(--text-3xl);
    }

    .papers-table {
        font-size: var(--text-sm);
    }

    .papers-table .col-author,
    .papers-table .col-year,
    .papers-table .col-cats {
        display: none;
    }

    .papers-table .col-title {
        max-width: 200px;
    }

    .modal-content {
        width: 100vw;
        border-left: none;
    }

    .modal-header,
    .modal-body {
        padding: 1rem;
    }

    .filters-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* (related papers UI removed -- replaced by Wissensnetz cross-view) */

/* ==========================================================================
   KATEGORIEN-EXPLORER
   ========================================================================== */

.spektrum-intro {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.spektrum-groups {
    display: flex;
    justify-content: space-between;
    padding: 0 0.25rem;
    margin-bottom: 0.25rem;
}

.spektrum-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
}

.spektrum-cards {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #5b8c5a, #3a7d7e, #4b7bab, #7c6fae, #b0546e, #c2694e, #d4943a, #8a7542, #a24b7a, #6a8e4e);
    background-size: 100% 3px;
    background-repeat: no-repeat;
    background-position: top;
    padding-top: 3px;
}

.kategorie-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.25rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-right: none;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.kategorie-card:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.kategorie-card:last-child {
    border-right: 1px solid var(--gray-200);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.kategorie-card:hover {
    background: var(--gray-50);
}

.kategorie-card.active {
    background: var(--gray-50);
    border-bottom: 3px solid var(--cat-color, var(--gray-500));
    z-index: 1;
}

.kcard-color {
    width: 100%;
    height: 3px;
    border-radius: 2px;
    opacity: 0.6;
}

.kategorie-card.active .kcard-color {
    opacity: 1;
}

.kcard-name {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--gray-600);
    text-align: center;
    line-height: 1.2;
}

.kategorie-card.active .kcard-name {
    font-weight: 700;
    color: var(--gray-900);
}

.kcard-diff {
    font-size: 0.6rem;
    font-weight: 600;
}

.kcard-diff.llm-more { color: #4b7bab; }
.kcard-diff.human-more { color: #d4943a; }
.kcard-diff.neutral { color: var(--gray-400); }

@media (max-width: 900px) {
    .spektrum-cards {
        flex-wrap: wrap;
    }
    .kategorie-card {
        flex: 0 0 calc(20% - 0px);
        border-right: 1px solid var(--gray-200);
        border-radius: 0;
    }
}

/* Detail panel */
.kategorie-detail {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.kdetail-header {
    border-left: 4px solid var(--gray-400);
    padding-left: 1rem;
    margin-bottom: 1.25rem;
}

.kdetail-header h3 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    margin: 0;
}

.kdetail-group {
    font-size: var(--text-xs);
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.125rem;
}

/* Rate comparison bars */
.kdetail-rates {
    margin-bottom: 1.25rem;
}

.kdetail-rate-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.kdetail-rate-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    width: 90px;
    text-align: right;
    flex-shrink: 0;
}

.kdetail-rate-track {
    flex: 1;
    height: 20px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.kdetail-rate-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.kdetail-rate-value {
    font-size: var(--text-lg);
    font-weight: 700;
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.kdetail-diff-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-top: 0.375rem;
    padding-left: calc(90px + 0.75rem);
}

/* Detail sections */
.kdetail-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-100);
}

.kdetail-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.kdetail-count {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 0.25rem;
}

/* Paper cards in detail */
.kdetail-papers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kdetail-paper {
    padding: 0.625rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.kdetail-paper:hover {
    background: var(--gray-100);
}

.kdetail-paper-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.kdetail-paper-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kdetail-paper-author {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.kdetail-verdict {
    font-size: var(--text-xs);
    font-weight: 600;
}

.kdetail-reasoning {
    font-size: var(--text-xs);
    color: var(--gray-600);
    line-height: 1.5;
    margin-top: 0.375rem;
    padding-left: 0.625rem;
    border-left: 2px solid var(--gray-200);
}

.kdetail-expand-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: none;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition-fast);
}

.kdetail-expand-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.kdetail-more {
    font-size: var(--text-xs);
    color: var(--gray-400);
    padding: 0.25rem 0;
}

/* Concept tags */
.kdetail-concepts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.kdetail-concept {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: var(--text-xs);
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.kdetail-concept:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.kdetail-concept-count {
    font-size: 0.6rem;
    color: var(--gray-400);
}

/* ==========================================================================
   SHARED BADGE STYLES (used by Kategorien, Wissensnetz, Korpus)
   ========================================================================== */

/* (Benchmark/Dashboard styles removed -- replaced by Kategorien-Explorer) */
/* Pattern badges (used in Kategorien + Wissensnetz) */
.pattern-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

.pattern-badge-semantic { background: #dbeafe; color: #1e40af; }
.pattern-badge-keyword { background: #fef3c7; color: #92400e; }
.pattern-badge-implicit { background: #f3f4f6; color: #4b5563; }

/* Severity badges (used in Korpus detail) */
.severity-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.severity-high { background: #fee2e2; color: #991b1b; }
.severity-medium { background: #fef3c7; color: #92400e; }
.severity-low { background: #ecfdf5; color: #065f46; }

/* ==========================================================================
   CATEGORY CHIPS (Papers filter)
   ========================================================================== */

.category-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
}

.category-chip {
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    transition: all 0.15s;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.category-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-chip.active {
    background: var(--gray-800);
    color: white;
    border-color: var(--gray-800);
}

/* Decision badges (used in disagreements table) */
.badge-llm-include  { background: #d1fae5; color: #065f46; }
.badge-llm-exclude  { background: #f3f4f6; color: #374151; }
.badge-human-include { background: #dbeafe; color: #1e40af; }
.badge-human-exclude { background: #fef9c3; color: #713f12; }

/* ==========================================================================
   MODAL UPDATES (assessment sections)
   ========================================================================== */

.modal-assessment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

@media (max-width: 700px) {
    .modal-assessment-grid { grid-template-columns: 1fr; }
}

.assessment-panel {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
}

.assessment-panel h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin-bottom: var(--space-1);
}

.assessment-decision {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.category-grid-10 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    margin-top: 0.5rem;
}

.cat-grid-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    padding: 2px 0;
}

.cat-grid-item.active {
    color: var(--primary);
    font-weight: 600;
}

.cat-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    /* color set inline via JS using spectrum colors */
}

/* (benchmark-panel and confidence removed -- replaced by divergence/agreement panels) */

/* Empty state */
.empty-state {
    padding: 2rem;
    color: var(--gray-400);
    text-align: center;
}

/* Divergence row highlight */
.row--diverge {
    background: rgba(220, 38, 38, 0.02);
}

.row--diverge:hover {
    background: rgba(220, 38, 38, 0.05) !important;
}

/* Sort arrow */
.sort-arrow {
    font-size: 0.6rem;
    color: var(--primary);
}

/* Detail panel links */
.detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.25rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
}

.detail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--primary);
    font-size: var(--text-sm);
    text-decoration: none;
}

.detail-link:hover { text-decoration: underline; }

.detail-text {
    line-height: 1.7;
    color: var(--gray-700);
    font-size: var(--text-md);
}

/* Assessment grid in detail panel */
.assessment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.75rem;
}

@media (max-width: 600px) {
    .assessment-grid { grid-template-columns: 1fr; }
}

.panel-header {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.assessment-panel--empty {
    opacity: 0.65;
}

.empty-note {
    color: var(--gray-500);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.reasoning-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.reasoning-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-400);
}

.reasoning-text {
    margin-top: 0.25rem;
    font-size: var(--text-sm);
    color: var(--gray-500);
    font-style: italic;
    line-height: 1.5;
}

/* Detail panel navigation */
.detail-nav {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.detail-nav-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.detail-nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Divergence/Agreement panels in detail */
.divergence-panel {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.divergence-type {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.affected-cats {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.agreement-panel {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: #065f46;
}

/* ==========================================================================
   WISSENSNETZ (Concept Graph)
   ========================================================================== */

/* Legend dots/rings (used in toolbar) */
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-ring {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px dashed var(--danger);
    display: inline-block;
}

.graph-reset-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition-fast);
}

.graph-reset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.graph-toggle-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    color: var(--gray-600);
    transition: var(--transition-fast);
}

.graph-toggle-btn:hover {
    border-color: var(--warning);
    color: var(--warning);
}

.graph-toggle-btn.active {
    background: var(--warning);
    border-color: var(--warning);
    color: white;
}

/* Graph + Detail side by side (always visible sidebar) */
.graph-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
}

.graph-main {
    display: flex;
    flex-direction: column;
}

.graph-toolbar {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: var(--radius-sm) 0 0 0;
}

.graph-search-compact {
    padding: 0.3rem 0.625rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-family: var(--font-body);
    width: 180px;
    transition: var(--transition-fast);
    background: var(--gray-50);
}

.graph-search-compact:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    width: 260px;
}

.toolbar-sep {
    width: 1px;
    height: 18px;
    background: var(--gray-200);
    margin: 0 0.25rem;
}

.toolbar-legend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.toolbar-spacer {
    flex: 1;
}

.graph-container {
    width: 100%;
    min-height: 500px;
    height: calc(100vh - 290px);
    border: 1px solid var(--gray-200);
    border-radius: 0 0 0 var(--radius-sm);
    background: white;
    position: relative;
    overflow: hidden;
}

.graph-container svg {
    width: 100%;
    height: 100%;
}

/* Tooltip */
.graph-tooltip {
    position: absolute;
    background: var(--gray-900);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    pointer-events: none;
    z-index: 50;
    max-width: 250px;
    line-height: 1.4;
}

/* Detail panel (right side, always visible) */
.graph-detail {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    overflow-y: auto;
    height: calc(100vh - 240px);
}

.graph-detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    font-size: 1.5rem;
    color: var(--gray-300);
    margin-bottom: 0.75rem;
}

.placeholder-text {
    font-size: var(--text-sm);
    color: var(--gray-400);
    font-weight: 500;
}

.placeholder-hint {
    font-size: var(--text-xs);
    color: var(--gray-300);
    margin-top: 0.375rem;
}

.graph-detail-inner {
    padding: 1.25rem;
    position: relative;
}

.graph-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--gray-100);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
}

.graph-detail-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.graph-detail h3 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    padding-right: 2rem;
}

.graph-detail h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.detail-meta {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.detail-def {
    font-size: var(--text-sm);
    color: var(--gray-700);
    line-height: 1.6;
    padding: 0.5rem 0;
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
}

/* Papers list in detail */
.graph-papers-list {
    list-style: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.graph-paper-item {
    padding: 0.3rem 0;
    font-size: var(--text-xs);
    color: var(--gray-600);
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
    transition: color 0.1s;
}

.graph-paper-item:hover {
    color: var(--primary);
}

.graph-paper-item.paper-diverge {
    color: var(--danger);
}

.graph-paper-item.paper-diverge:hover {
    color: var(--danger);
    font-weight: 600;
}

.graph-paper-more {
    font-size: var(--text-xs);
    color: var(--gray-400);
    padding: 0.3rem 0;
}

/* Neighbor list */
.graph-neighbors-list {
    list-style: none;
    padding: 0;
}

.graph-neighbor-item {
    padding: 0.3rem 0;
    font-size: var(--text-sm);
    color: var(--primary);
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
}

.graph-neighbor-item:hover {
    font-weight: 600;
}

.neighbor-weight {
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-weight: 400;
}

@media (max-width: 768px) {
    .graph-wrapper {
        grid-template-columns: 1fr !important;
    }
    #view-wissensnetz,
    #view-wissensnetz .graph-wrapper {
        margin-left: 0;
        margin-right: 0;
    }
    .graph-container {
        height: 400px;
        min-height: 400px;
        border-radius: var(--radius-sm);
    }
    .graph-detail {
        height: auto;
        max-height: 300px;
        border-radius: var(--radius-sm);
        border-left: 1px solid var(--gray-200);
        margin-top: 0.5rem;
    }
}

/* ==========================================================================
   WISSENS-CHAT TAB
   ========================================================================== */

/* Wissensnetz: full-width, break out of main constraint */
#view-wissensnetz {
    max-width: none;
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 1rem;
}

/* Wissensnetz has no section heading -- content starts at toolbar */

/* Chat view gets more horizontal space */
#view-chat {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Chat window container -- self-contained, visually distinct */
.chat-window {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 260px);
    min-height: 500px;
    max-height: 800px;
    overflow: hidden;
    position: relative;
}

/* Subtle top accent (single pixel, primary color -- spectrum is in header) */
.chat-window::before {
    content: '';
    display: block;
    height: 2px;
    flex-shrink: 0;
    background: linear-gradient(
        to right,
        var(--gray-200),
        var(--primary),
        var(--gray-200)
    );
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* API key bar -- compact, top of window */
.chat-setup {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chat-key-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.chat-key-row label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
}

.chat-key-row input {
    flex: 1;
    max-width: 240px;
    min-width: 140px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-family: 'Courier New', monospace;
    background: white;
}

.chat-key-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.chat-key-help {
    font-size: var(--text-xs);
    color: var(--primary);
    white-space: nowrap;
    text-decoration: none;
}

.chat-key-help:hover {
    text-decoration: underline;
}

.chat-key-note {
    font-size: 0.6875rem;
    color: var(--gray-400);
}

.chat-key-note i {
    margin-right: 0.15rem;
}

/* Message area -- fills available space */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Welcome screen -- centered in message area */
.chat-welcome {
    text-align: center;
    margin: auto;
    padding: 2rem 1rem;
    color: var(--gray-500);
    max-width: 540px;
}

.chat-welcome-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.chat-suggestions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 640px;
}

.chat-suggestion {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
    font-family: var(--font-body);
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
    line-height: 1.4;
}

.chat-suggestion:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

/* Messages */
.chat-msg {
    display: flex;
}

.chat-msg-model {
    flex-direction: column;
    align-items: flex-start;
}

.chat-msg-user {
    justify-content: flex-end;
}

.chat-msg-user .chat-msg-content {
    background: var(--gray-800);
    color: var(--gray-100);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
    padding: 0.625rem 1rem;
    max-width: 75%;
    font-size: var(--text-md);
    line-height: 1.5;
}

.chat-msg-model .chat-msg-content {
    background: transparent;
    padding: 0.5rem 0;
    max-width: 95%;
    font-size: var(--text-md);
    line-height: 1.7;
    color: var(--gray-800);
}

.chat-msg-model .chat-msg-content h3,
.chat-msg-model .chat-msg-content h4 {
    font-family: var(--font-display);
    margin: 0.875rem 0 0.375rem;
    color: var(--gray-900);
}

.chat-msg-model .chat-msg-content h3 { font-size: var(--text-body); }
.chat-msg-model .chat-msg-content h4 { font-size: var(--text-md); }

.chat-msg-model .chat-msg-content ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.chat-msg-model .chat-msg-content li {
    margin-bottom: 0.25rem;
}

.chat-msg-model .chat-msg-content code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.chat-msg-model .chat-msg-content p {
    margin: 0.5rem 0;
}

.chat-msg-model .chat-msg-content p:first-child {
    margin-top: 0;
}

.chat-msg-model .chat-msg-content strong {
    color: var(--gray-900);
}

.chat-typing {
    color: var(--gray-400);
    font-style: italic;
}

.chat-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.chat-error i {
    margin-right: 0.3rem;
}

/* Input area -- pinned to bottom of chat window */
.chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-100);
    background: white;
    flex-shrink: 0;
}

.chat-input-row textarea {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-family: var(--font-body);
    resize: none;
    line-height: 1.5;
    min-height: 42px;
    max-height: 120px;
    color: var(--gray-800);
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.chat-input-row textarea::placeholder {
    color: var(--gray-400);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--gray-800);
    border-color: var(--gray-800);
    color: white;
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .chat-window {
        height: calc(100vh - 240px);
        min-height: 360px;
        border-radius: var(--radius-md);
    }

    .chat-msg-user .chat-msg-content {
        max-width: 90%;
    }

    .chat-setup {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-key-row input {
        max-width: 100%;
    }

    .chat-suggestions {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

/* Inline citation links */
.cite-link {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.cite-link:hover {
    color: var(--primary-dark);
    border-bottom-style: solid;
}

/* Reference list below chat response */
.chat-references {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    width: 100%;
}

.chat-ref-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.chat-ref-label i {
    margin-right: 0.3rem;
}

.chat-ref-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    color: var(--gray-700);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.chat-ref-item:hover {
    background: white;
    color: var(--primary);
}

.chat-ref-item.ref-diverge {
    border-left: 3px solid var(--danger);
}

.chat-ref-item.ref-agree {
    border-left: 3px solid var(--success);
}

.chat-ref-item.ref-llmonly {
    border-left: 3px solid var(--gray-300);
}

.ref-num {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-400);
    min-width: 1.25rem;
    text-align: right;
    flex-shrink: 0;
}

.ref-body {
    flex: 1;
    min-width: 0;
}

.ref-author {
    font-weight: 600;
    color: var(--gray-600);
}

.ref-title {
    color: var(--gray-500);
    font-style: italic;
}

.ref-meta {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
    align-items: center;
}

.ref-decision {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-500);
}

.ref-status {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 6px;
}

.ref-status--ref-diverge { background: #fef2f2; color: #991b1b; }
.ref-status--ref-agree { background: #ecfdf5; color: #065f46; }
.ref-status--ref-llmonly { background: var(--gray-100); color: var(--gray-400); }

.ref-arrow {
    color: var(--gray-300);
    font-size: 0.625rem;
    transition: var(--transition-fast);
}

.chat-ref-item:hover .ref-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

@media (max-width: 768px) {
    .chat-messages {
        max-height: 50vh;
        min-height: 300px;
    }

    .chat-msg-user .chat-msg-content,
    .chat-msg-model .chat-msg-content {
        max-width: 95%;
    }

    .chat-key-row input {
        max-width: 100%;
    }

    .chat-suggestions {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

/* Print Styles */
@media print {
    .view-nav,
    .search-filters,
    .category-filter-row,
    .export-button,
    .modal,
    .graph-controls,
    .pagination,
    .header-links,
    .detail-nav {
        display: none !important;
    }
    body { font-size: 11pt; }
    main { max-width: 100%; padding: 0; }
    .papers-table { font-size: 9pt; }
    .view-content { display: block !important; }
}
