/* ============================================
   Syllabi Trawl - Clean, Focused Design
   Inspired by UDL principles: clarity, calm, purpose
   ============================================ */

/* Fonts are loaded via <link> in base.html (preconnect + display=swap) so the
   CSS no longer chains a render-blocking @import. The family choices live in
   the :root --font-display / --font-body tokens below. */

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

:root {
    /* Warm, approachable palette */
    --ink: #1a1a2e;
    --ink-light: #4a4a5a;
    --ink-muted: #6b7280;
    /* Faded text tokens — same hue as --ink-muted, declared so the per-call-site
       #6b7280 fallbacks are no longer needed. */
    --ink-faded: #6b7280;
    --faded: #6b7280;

    --paper: #fefdfb;
    --paper-warm: #f9f7f4;
    --paper-cool: #f4f6f8;

    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --accent-deep: #1d4ed8;

    --success: #059669;
    --success-soft: #d1fae5;

    --warning: #d97706;
    --warning-soft: #fef3c7;

    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --signal: #c0420e;

    /* Typography */
    --font-display: 'Source Serif 4', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Transitions */
    --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition-normal: 250ms var(--ease-out);
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Global Header
   ============================================ */

header.site-header {
    background: var(--ink);
    color: white;
    padding: var(--space-md) var(--space-xl);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* ============================================
   Main Layout
   ============================================ */

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl);
    width: 100%;
}

footer {
    background: var(--ink);
    color: rgba(255,255,255,0.7);
    padding: var(--space-md) var(--space-xl);
    text-align: center;
    font-size: 0.875rem;
}

/* ============================================
   Cards & Containers
   ============================================ */

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-deep);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--paper-warm);
    color: var(--ink);
    border: 1px solid rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background: var(--paper-cool);
    border-color: rgba(0,0,0,0.15);
}

/* ============================================
   Forms
   ============================================ */

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: var(--space-md);
    border-radius: 8px;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

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

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: rgba(0,0,0,0.02);
}

.panel-title h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

/* ============================================
   Other Pages - Basic Styles
   ============================================ */

/* Loading overlay */

/* Progress bar: animated by the SSE streamer (stream.js) as verdicts arrive.
   `[hidden]` is reasserted so the display:block below never overrides it. */
.progress {
    height: 6px;
    background: var(--paper-elev, #e5e7eb);
    border-radius: 999px;
    overflow: hidden;
    margin: 0 0 var(--space-md);
}
.progress[hidden] { display: none; }
.progress__fill {
    height: 100%;
    width: 0%;
    background: var(--accent, #2563eb);
    border-radius: 999px;
    transition: width 0.12s linear;
}
.streaming-status__label {
    font-size: 0.9rem;
    color: var(--ink-faded);
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-md);
}

/* Instructions panel */

/* Help text */

/* Image review */

/* Rendered preview (export page) */

/* Tab navigation */

/* Responsive */
/* ============================================================
   Query page (extracted from pd/main.html, Phase 1 — no changes)
   ============================================================ */
    .pd-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: var(--space-lg);
    }

    .pd-header {
        margin-bottom: var(--space-xl);
    }

    .pd-header h2 {
        font-family: var(--font-display);
        font-size: 1.75rem;
        color: var(--ink);
        margin-bottom: var(--space-sm);
    }

    .pd-header p {
        color: var(--ink-muted);
    }

    /* Panels */
    .panel {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: var(--space-lg);
        margin-bottom: var(--space-lg);
    }

    .panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--space-md);
    }

    .panel-title {
        font-family: var(--font-display);
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--ink);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .panel-actions {
        display: flex;
        gap: var(--space-sm);
    }

    /* Interest Filter Chips */
    .interest-chips {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }

    /* Square multi-select checkboxes (Academic interest). The native checkbox
       is visible so the multi-choice affordance reads clearly. */
    .interest-chip {
        display: inline-flex;
        align-items: center;
        gap: var(--space-xs);
        padding: var(--space-xs) var(--space-sm);
        background: var(--paper-warm);
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        font-size: 0.85rem;
        cursor: pointer;
        transition: var(--transition-fast);
        user-select: none;
    }

    .interest-chip:hover {
        border-color: var(--accent);
        background: var(--accent-soft);
    }

    .interest-chip.selected {
        background: var(--accent-soft);
        border-color: var(--accent);
        font-weight: 600;
    }

    .interest-chip input {
        margin: 0;
        cursor: pointer;
    }

    .interest-count {
        color: var(--ink-muted);
        font-size: 0.78rem;
    }

    /* Zero-count interests stay dimmed so attention sticks to options with
       courses. They're only un-clickable at base scope (input disabled); once
       an interest is ticked they remain dimmed but tickable for OR-broadening. */
    .interest-chip--empty {
        opacity: 0.4;
    }
    .interest-chip--empty:has(input:disabled) {
        cursor: not-allowed;
    }
    .interest-chip--empty:has(input:disabled):hover {
        border-color: #e5e7eb;
        background: var(--paper-warm);
    }

    /* Square multi-select checkboxes for the Course type filter row. */
    .check-pill {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        cursor: pointer;
        user-select: none;
    }
    .check-pill input { margin: 0; cursor: pointer; }

    /* Course List */
    .course-search {
        display: flex;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }

    .course-search input {
        flex: 1;
        padding: var(--space-sm) var(--space-md);
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        font-size: 0.95rem;
    }

    .course-search input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-soft);
    }

    /* .course-list layout is defined in workspace.css (grid, max-height: 420px) */

    .course-item {
        display: flex;
        align-items: flex-start;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
        border-bottom: 1px solid #f3f4f6;
        cursor: pointer;
        transition: var(--transition-fast);
    }

    .course-item:last-child {
        border-bottom: none;
    }

    .course-item:hover {
        background: var(--paper-warm);
    }

    .course-item.selected {
        background: var(--accent-soft);
    }

    .course-item input[type="checkbox"] {
        margin-right: var(--space-sm);
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

    .course-name {
        flex: 1;
        min-width: 0;
        font-size: 0.95rem;
        overflow-wrap: anywhere;
    }

    .course-badges {
        display: flex;
        flex-wrap: wrap;
        flex-shrink: 0;
        gap: var(--space-xs);
    }

    .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: 500;
    }

    .badge-location {
        background: var(--paper-cool);
        color: var(--ink-muted);
    }

    /* Distinct campus pill colors: CPH blue, STO green (match the card
       left-border palette in .loc-cph / .loc-sto). */
    .badge-cph {
        background: #dbeafe;
        color: #1e40af;
    }

    .badge-sto {
        background: #d1fae5;
        color: #065f46;
    }

    .badge-core {
        background: var(--warning-soft);
        color: var(--warning);
    }

    .selection-summary {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-sm) var(--space-md);
        background: var(--paper-cool);
        border-radius: 8px;
        margin-top: var(--space-md);
        font-size: 0.9rem;
    }

    .selection-count {
        font-weight: 600;
        color: var(--accent);
    }

    /* Query Panel */
    .query-textarea {
        width: 100%;
        min-height: 100px;
        padding: var(--space-md);
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.95rem;
        resize: vertical;
        margin-bottom: var(--space-md);
    }

    .query-textarea:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-soft);
    }

    .query-options {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--space-md);
    }

    .format-selector {
        display: flex;
        gap: var(--space-lg);
    }

    .format-option {
        display: flex;
        align-items: flex-start;
        gap: var(--space-sm);
        cursor: pointer;
    }

    .format-option input {
        margin-top: 3px;
    }

    .format-label {
        font-weight: 500;
    }

    .format-desc {
        font-size: 0.8rem;
        color: var(--ink-muted);
    }

    .query-submit {
        display: flex;
        align-items: center;
        gap: var(--space-md);
    }

    /* Results Panel */
    .results-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--space-lg);
    }

    .results-summary {
        font-size: 0.9rem;
        color: var(--ink-muted);
    }

    .results-summary strong {
        color: var(--ink);
    }

    /* Paragraph Results */
    .result-card {
        background: var(--paper-warm);
        border-radius: 8px;
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    .result-card h4 {
        font-family: var(--font-display);
        font-size: 1rem;
        color: var(--ink);
        margin-bottom: var(--space-sm);
    }

    .result-card p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    /* Table Results */
    .results-table {
        width: 100%;
        border-collapse: collapse;
    }

    .results-table th,
    .results-table td {
        padding: var(--space-sm) var(--space-md);
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
    }

    .results-table th {
        background: var(--paper-cool);
        font-weight: 600;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .results-table tr:hover {
        background: var(--paper-warm);
    }

    

    

    /* Buttons */
    .btn {
        display: inline-flex;
        align-items: center;
        gap: var(--space-xs);
        padding: var(--space-sm) var(--space-md);
        border: none;
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.9rem;
        font-weight: 500;
        cursor: pointer;
        transition: var(--transition-fast);
    }

    .btn-primary {
        background: var(--accent);
        color: white;
    }

    .btn-primary:hover:not(:disabled) {
        background: var(--accent-deep);
    }

    .btn-primary:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .btn-secondary {
        background: var(--paper-cool);
        color: var(--ink);
        border: 1px solid #e5e7eb;
    }

    .btn-secondary:hover {
        background: #e5e7eb;
    }

    .btn-text {
        background: none;
        color: var(--accent);
        padding: var(--space-xs) var(--space-sm);
    }

    .btn-text:hover {
        text-decoration: underline;
    }

    /* Loading State */
    .loading {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-xl);
        color: var(--ink-muted);
    }

    .spinner {
        width: 24px;
        height: 24px;
        border: 3px solid #e5e7eb;
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        margin-right: var(--space-sm);
    }

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

    /* Empty/Error States */
    .empty-state {
        text-align: center;
        padding: var(--space-xl);
        color: var(--ink-muted);
    }

    .error-state {
        background: var(--danger-soft);
        color: var(--danger);
        padding: var(--space-md);
        border-radius: 8px;
    }

    /* Inline, non-blocking error anchored to a cell action (COULD 2.2). */
    .inline-error {
        margin-top: var(--space-sm);
        font-size: 0.8rem;
        padding: var(--space-xs) var(--space-sm);
    }

    /* Muted inline note for chip strips / selector areas (COULD 2.3). */
    .inline-note {
        color: var(--faded);
        font-size: 0.8rem;
        font-style: italic;
        padding: var(--space-xs) 0;
    }

    /* Service Unavailable */
    .service-unavailable {
        background: var(--warning-soft);
        border: 1px solid var(--warning);
        border-radius: 8px;
        padding: var(--space-lg);
        text-align: center;
    }

    .service-unavailable h3 {
        color: var(--warning);
        margin-bottom: var(--space-sm);
    }

    /* Hide results panel initially */
    #results-panel {
        display: none;
    }

    #results-panel.visible {
        display: block;
    }

    /* Follow-up suggestions */
    .followup-section {
        margin-top: var(--space-lg);
        padding-top: var(--space-lg);
        border-top: 1px solid #e5e7eb;
    }

    .followup-title {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--ink-muted);
        margin-bottom: var(--space-sm);
    }

    .followup-suggestions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }

    .followup-chip {
        display: inline-block;
        padding: var(--space-sm) var(--space-md);
        background: var(--accent-soft);
        border: 1px solid var(--accent);
        border-radius: 20px;
        font-size: 0.85rem;
        color: var(--accent-deep);
        cursor: pointer;
        transition: var(--transition-fast);
    }

    .followup-chip:hover {
        background: var(--accent);
        color: white;
    }

    .followup-custom {
        display: flex;
        gap: var(--space-sm);
        margin-top: var(--space-sm);
    }

    .followup-custom input {
        flex: 1;
        padding: var(--space-sm) var(--space-md);
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    .followup-options {
        display: flex;
        gap: var(--space-md);
        align-items: center;
        margin-bottom: var(--space-sm);
    }

    .followup-options label {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        font-size: 0.85rem;
        cursor: pointer;
    }

    /* Multi-column table */
    .query-column-header {
        font-size: 0.75rem;
        color: var(--ink-muted);
        display: block;
    }

    .results-table th.query-col {
        min-width: 180px;
        max-width: 300px;
        white-space: normal;
        word-wrap: break-word;
    }

    .results-table td.query-col {
        vertical-align: top;
    }

    

    

    .cell-answer {
        font-size: 0.85rem;
        color: var(--ink);
        margin-top: var(--space-xs);
        line-height: 1.5;
    }

    .cell-quote {
        font-size: 0.8rem;
        font-style: italic;
        color: var(--ink-light);
        margin-top: var(--space-xs);
        cursor: pointer;
    }

    .cell-quote:hover {
        color: var(--accent);
    }

    .expand-btn {
        display: inline-block;
        margin-left: 4px;
        color: var(--accent);
        cursor: pointer;
        font-style: normal;
        font-size: 0.75rem;
        opacity: 0.8;
    }

    .expand-btn:hover {
        opacity: 1;
        text-decoration: underline;
    }

    /* Cell action buttons */
    .cell-actions {
        display: flex;
        gap: var(--space-xs);
        margin-top: var(--space-xs);
    }

    .cell-action-btn {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 2px 6px;
        font-size: 0.7rem;
        border: 1px solid #e5e7eb;
        border-radius: 4px;
        background: white;
        cursor: pointer;
        color: var(--ink-muted);
        transition: var(--transition-fast);
    }

    .cell-action-btn:hover {
        background: var(--paper-warm);
        border-color: var(--accent);
        color: var(--accent);
    }

    .cell-action-btn.regenerating {
        opacity: 0.6;
        cursor: wait;
    }

    .cell-action-btn .icon {
        font-size: 0.8rem;
    }

    /* Quote modal */
    .quote-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
    }

    .quote-modal-content {
        background: white;
        border-radius: 12px;
        max-width: 700px;
        max-height: 80vh;
        overflow-y: auto;
        padding: var(--space-lg);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    }

    .quote-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: var(--space-md);
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: var(--space-sm);
    }

    .quote-modal-title {
        font-family: var(--font-display);
        font-size: 1.1rem;
        font-weight: 600;
    }

    .quote-modal-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--ink-muted);
        line-height: 1;
    }

    .quote-modal-close:hover {
        color: var(--ink);
    }

    .quote-modal-section-label {
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--accent-deep);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: var(--space-xs);
    }

    .quote-modal-quote {
        background: var(--paper-warm);
        border-left: 4px solid var(--accent);
        padding: var(--space-md);
        margin-bottom: var(--space-md);
        font-style: italic;
        line-height: 1.6;
    }

    .quote-modal-summary {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        line-height: 1.6;
    }

    .quote-modal-excerpt {
        margin-top: var(--space-md);
        padding: var(--space-md);
        background: var(--paper-cool);
        border-radius: 8px;
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .quote-modal-excerpt-title {
        font-weight: 600;
        font-size: 0.8rem;
        color: var(--ink-muted);
        margin-bottom: var(--space-sm);
        text-transform: uppercase;
    }

    /* Keyword highlighting in modal */
    .highlight-keyword {
        background: linear-gradient(180deg, transparent 60%, rgba(255, 213, 79, 0.5) 60%);
        padding: 0 2px;
        border-radius: 2px;
    }

    /* Grouped courses */
    .course-group {
        display: flex;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .group-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        background: var(--accent-soft);
        border: 1px solid var(--accent);
        border-radius: 4px;
        color: var(--accent-deep);
        font-size: 0.75rem;
        font-weight: 600;
        cursor: pointer;
        flex-shrink: 0;
        margin-top: 2px;
    }

    .group-toggle:hover {
        background: var(--accent);
        color: white;
    }

    .grouped-courses {
        display: none;
        margin-top: var(--space-xs);
        padding-left: var(--space-sm);
        border-left: 2px solid var(--accent-soft);
    }

    .grouped-courses.expanded {
        display: block;
    }

    .grouped-course-item {
        font-size: 0.85rem;
        color: var(--ink-muted);
        padding: 2px 0;
    }

    /* Sort controls */
    .sort-controls {
        display: flex;
        gap: var(--space-md);
        align-items: center;
        margin-bottom: var(--space-md);
    }

    .sort-controls label {
        font-size: 0.85rem;
        color: var(--ink-muted);
    }

    .sort-controls select {
        padding: var(--space-xs) var(--space-sm);
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        font-size: 0.85rem;
    }

    /* Tone selector */
    .tone-selector {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        margin-bottom: var(--space-md);
        padding: var(--space-sm) var(--space-md);
        background: var(--paper-cool);
        border-radius: 8px;
    }

    .tone-selector label {
        font-size: 0.85rem;
        color: var(--ink-muted);
        font-weight: 500;
    }

    .tone-selector select {
        padding: var(--space-xs) var(--space-sm);
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        font-size: 0.85rem;
        min-width: 180px;
    }

    .tone-description {
        font-size: 0.8rem;
        color: var(--ink-light);
        font-style: italic;
    }

    /* Previously asked questions */
    .previous-questions {
        margin-top: var(--space-md);
        padding: var(--space-md);
        background: var(--accent-soft);
        border-radius: 8px;
        border: 1px solid var(--accent);
    }

    .previous-questions-title {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--accent-deep);
        margin-bottom: var(--space-sm);
    }

    .previous-question-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-xs) var(--space-sm);
        background: white;
        border-radius: 6px;
        margin-bottom: var(--space-xs);
        cursor: pointer;
        transition: var(--transition-fast);
    }

    .previous-question-item:hover {
        background: var(--paper-warm);
    }

    .previous-question-text {
        font-size: 0.9rem;
        flex: 1;
    }

    .previous-question-meta {
        font-size: 0.75rem;
        color: var(--ink-muted);
    }

    /* Suggested questions */
    .suggested-questions {
        margin-bottom: var(--space-md);
    }

    .suggested-questions-title {
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--ink-muted);
        margin-bottom: var(--space-sm);
    }

    .suggested-questions-chips {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .suggested-chip {
        display: inline-block;
        padding: var(--space-xs) var(--space-sm);
        background: var(--paper-warm);
        border: 1px solid #e5e7eb;
        border-radius: 16px;
        font-size: 0.8rem;
        cursor: pointer;
        transition: var(--transition-fast);
    }

    .suggested-chip:hover {
        background: var(--accent-soft);
        border-color: var(--accent);
    }

    /* Cache indicator */
    .cache-indicator {
        display: inline-flex;
        align-items: center;
        gap: var(--space-xs);
        padding: var(--space-xs) var(--space-sm);
        background: var(--success-soft);
        color: var(--success);
        border-radius: 4px;
        font-size: 0.75rem;
        margin-left: var(--space-sm);
    }

/* --- Auth pages --- */
.auth-card {
  max-width: 380px; margin: 8vh auto; padding: 32px;
  border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.auth-title { margin: 0 0 4px; font-size: 1.4rem; }
.auth-subtitle { margin: 0 0 20px; color: var(--faded); }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 0.85rem; font-weight: 600; margin-top: 8px; }
.auth-form input {
  padding: 10px 12px; border: 1px solid var(--border, #d1d5db);
  border-radius: 8px; font-size: 1rem;
}
.auth-submit { margin-top: 16px; }
.auth-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem;
}
.auth-help { margin-top: 16px; color: var(--faded); font-size: 0.85rem; }

/* --- Header user menu --- */
.user-menu { position: relative; }
.user-menu summary {
  cursor: pointer; list-style: none; font-size: 0.9rem; color: var(--ink, #111827);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu__dropdown {
  position: absolute; right: 0; margin-top: 6px; background: #fff;
  border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); padding: 6px; min-width: 120px;
}
.user-menu__dropdown a { display: block; padding: 8px 10px; text-decoration: none; color: var(--ink, #111827); }

/* --- Dataset chips --- */
.dataset-chip {
  /* --dept is an optional per-department tint set inline on dept/program chips. */
  border: 1px solid var(--border, #d1d5db); background: var(--dept, #fff); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font-size: 0.9rem;
}
.dataset-chip.selected { background: var(--accent, #2563eb); color: #fff; border-color: var(--accent, #2563eb); }
.dataset-chip--program { font-size: 0.82rem; }
.dataset-chip--program .chip-count { margin-left: 4px; }
.chip-count { opacity: 0.7; font-size: 0.8em; margin-left: 4px; }
.dept-selected-count {
  margin-left: 6px; font-size: 0.72rem; font-weight: 600;
  color: var(--accent, #2563eb); white-space: nowrap;
}

/* --- Multi-select program checkboxes (Stage B) --- */
/* A flex display would otherwise beat the [hidden] attribute these toggle on. */
.program-stage[hidden], .dataset-selection[hidden] { display: none; }
.program-stage { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.program-stage #program-back { flex-basis: 100%; text-align: left; }
.program-check {
  /* --dept is an optional per-department tint set inline. */
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border, #d1d5db); background: var(--dept, #fff);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 0.85rem;
  user-select: none;
}
.program-check:has(input:checked) {
  border-color: var(--accent, #2563eb);
  box-shadow: inset 0 0 0 1px var(--accent, #2563eb);
  font-weight: 600;
}
.program-check input { margin: 0; cursor: pointer; }
.program-check--all { font-weight: 600; }

/* Selection summary bar for the multi-program picker. */
.dataset-selection {
  display: flex; align-items: center; gap: 12px; margin: 8px 0;
  font-size: 0.88rem; font-weight: 600;
}

/* Collapsed "browse by discipline" section */

/* --- Section filter (target syllabus sections) --- */
.section-filter { margin: 8px 0 4px; }
.section-filter > summary {
  cursor: pointer; font-size: 0.85rem; color: var(--faded);
  font-weight: 600; list-style: none; padding: 4px 0;
}
.section-filter > summary::-webkit-details-marker { display: none; }
.section-filter > summary::before { content: "▸ "; }
.section-filter[open] > summary::before { content: "▾ "; }
.section-filter__hint { font-weight: 400; }
.section-chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.section-chip { font-size: 0.85rem; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* --- Location (campus) colors: Copenhagen vs Stockholm --- */
   /* blue */
   /* green */
.course-item.loc-cph { border-left: 3px solid #93c5fd; }
.course-item.loc-stk { border-left: 3px solid #6ee7b7; }
