/* ═══ Recall v2 — Full Stylesheet ═══ */

/* ─── SVG Icon System (lucide-style, matching BIOS nav bar) ─── */
.icon-svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Header logo — brain icon */
.header-logo .icon-svg {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

/* Big start-card icon */
.big-icon .icon-svg {
    width: 56px;
    height: 56px;
    color: var(--accent);
}

/* Nav grid icons */
.nav-icon .icon-svg {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

/* Empty state icons */
.empty-state .icon .icon-svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

/* File upload icon */
.file-upload-icon .icon-svg {
    width: 32px;
    height: 32px;
    color: var(--text-dim);
}

/* Due badge icon */
.due-badge .icon-svg {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
}

/* Leech tag icon */
.leech-tag .icon-svg {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
}

/* Result answer icons */
.result-answer .icon .icon-svg {
    width: 16px;
    height: 16px;
}

/* Correct/wrong inline icons (in tally bar, feedback, history) */
.quiz-tally .icon-svg,
.feedback-header .icon-svg,
.hist-icon .icon-svg {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

/* Choice check/x marks */
.choice-check .icon-svg,
.choice-x .icon-svg {
    width: 18px;
    height: 18px;
}

/* Feedback label icon */
.feedback-label .icon-svg {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
}

/* Buttons — inline icons */
.btn .icon-svg,
.btn-full .icon-svg {
    width: 18px;
    height: 18px;
    vertical-align: -4px;
    margin-right: 4px;
}

/* Icon-only buttons */
.icon-btn .icon-svg {
    width: 18px;
    height: 18px;
}

/* Category chevron */
.cat-chevron .icon-svg {
    width: 14px;
    height: 14px;
}

/* Ingest tab icons */
.ingest-tab .icon-svg {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
    margin-right: 4px;
}

/* Tally title icon */
.tally-title .icon-svg {
    width: 18px;
    height: 18px;
    vertical-align: -4px;
    margin-right: 4px;
}

/* Stat card — flame/trophy inline */
.stat-value .icon-svg {
    width: 16px;
    height: 16px;
    vertical-align: -2px;
}

/* Nav header icons */
.nav-header-title .icon-svg {
    width: 20px;
    height: 20px;
    vertical-align: -4px;
    margin-right: 6px;
}

:root {
    /* ═══ BIOS Apple White Design System ═══ */
    /* Sourced from /root/bios/web/src/lib/theme.ts (light palette) */

    --bg: #f5f5f7;                /* page background — Apple's signature warm gray */
    --bg-card: #ffffff;           /* card surface — pure white */
    --bg-card-hover: #fbfbfd;     /* card hover — barely-there gray */
    --bg-input: #f5f5f7;          /* input / recessed surface */

    --text: #1d1d1f;              /* primary text — near-black, Apple's canonical */
    --text-dim: #6e6e73;          /* secondary text */
    --text-muted: #86868b;        /* tertiary / labels */

    --accent: #0071e3;            /* Apple system blue */
    --accent-hover: #0077ed;      /* slightly darker on hover */
    --accent-dim: rgba(0, 113, 227, 0.10);

    --success: #34c759;           /* Apple system green */
    --success-dim: rgba(52, 199, 89, 0.12);
    --warn: #ff9500;              /* Apple system orange */
    --warn-dim: rgba(255, 149, 0, 0.12);
    --danger: #ff3b30;            /* Apple system red */
    --danger-dim: rgba(255, 59, 48, 0.10);
    --info: #5ac8fa;              /* Apple system teal */

    --border: #e5e5ea;            /* hairline borders */
    --border-hover: #d2d2d7;      /* stronger border on hover */

    --radius: 20px;               /* large cards — Apple's generous corners */
    --radius-sm: 14px;            /* medium elements */
    --radius-xs: 10px;            /* small elements */

    --shadow: 0 2px 16px rgba(0, 0, 0, 0.04);       /* soft, diffused */
    --shadow-soft: 0 4px 30px rgba(0, 0, 0, 0.05);  /* hero-level elevation */

    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --max-width: 580px;
    --transition: 0.2s ease;
}

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

html {
    background: var(--bg);
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

#app {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 14px 80px;
    min-height: 100vh;
}

/* ─── Pull-to-refresh ────────────────────────────────── */
.ptr-container {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 0;
    overflow: visible;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    justify-content: center;
}
.ptr-indicator {
    position: absolute;
    top: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    transform: translateY(-40px);
    transition: transform 0.2s ease;
}
.ptr-indicator.ptr-spin svg {
    animation: ptr-spin 0.8s linear infinite;
}
.ptr-indicator.ptr-ready {
    background: var(--accent, #6c5ce7);
}
.ptr-indicator.ptr-ready svg {
    color: #fff;
}
@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ─── Header ─────────────────────────────────────────── */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    font-size: 2rem;
    line-height: 1;
}

.header-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 12px;
}

.quiz-progress {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 600;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 16px;
    padding: 0 2px;
}

/* ─── Stats Bar ─────────────────────────────────────── */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.stat-card.grade-A .stat-value { color: var(--success); }
.stat-card.grade-B .stat-value { color: var(--info); }
.stat-card.grade-C .stat-value { color: var(--warn); }
.stat-card.grade-D .stat-value { color: var(--danger); }
.stat-card.grade-F .stat-value { color: var(--danger); }

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ─── Start Card ────────────────────────────────────── */

.start-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.big-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.start-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.start-card p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.due-badge {
    display: inline-block;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

/* ─── Nav Grid ──────────────────────────────────────── */

.nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.nav-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
    text-decoration: none;
}

.nav-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.8rem;
}

.nav-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.nav-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Buttons ────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    letter-spacing: -0.01em;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--bg-card);
    color: var(--accent);
    border: 1px solid var(--border-hover);
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-ghost:hover {
    color: var(--text);
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: 4px;
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.icon-btn.danger:hover {
    background: var(--danger-dim);
    border-color: var(--danger);
}

/* ─── Progress Bar ──────────────────────────────────── */

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ─── Question Card ─────────────────────────────────── */

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    scroll-margin-top: 60px;
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.category-tag {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.leech-tag {
    background: var(--danger-dim);
    color: var(--danger);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.question-number {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: auto;
}

.question-text {
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 16px;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    width: 100%;
}

.choice:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.choice.selected {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.choice.selected .choice-letter {
    background: var(--bg-input);
    color: var(--text);
}

.choice-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.choice-text {
    flex: 1;
}

/* ─── Submit Bar ────────────────────────────────────── */

.submit-bar {
    padding: 16px 0 24px;
}

/* ─── Results ───────────────────────────────────────── */

.results-header {
    text-align: center;
    padding: 28px 0 20px;
}

.results-score {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.results-score.perfect { color: var(--success); }
.results-score.good { color: var(--info); }
.results-score.okay { color: var(--warn); }
.results-score.poor { color: var(--danger); }

.results-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dim);
}

.result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 8px;
}

.result-item.correct {
    border-left: 3px solid var(--success);
}

.result-item.wrong {
    border-left: 3px solid var(--danger);
}

.result-question {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.result-answer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    margin-top: 4px;
}

.result-answer .icon {
    font-size: 0.9rem;
}

.result-answer .label {
    color: var(--text-muted);
    font-weight: 600;
}

.correct-text {
    color: var(--success);
}

.wrong-text {
    color: var(--danger);
}

/* ─── Tally Card ────────────────────────────────────── */

.tally-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--shadow);
}

.tally-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.tally-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.tally-stat {
    text-align: center;
}

.tally-stat .value {
    font-size: 1.4rem;
    font-weight: 800;
}

.tally-stat .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.tally-stat.grade .value { color: var(--accent); }
.tally-stat.streak .value { color: var(--danger); }
.tally-stat.best .value { color: var(--warn); }

/* ─── Action Bar ────────────────────────────────────── */

.action-bar {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 16px 0;
}

/* ─── Loading ───────────────────────────────────────── */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Empty State ──────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-dim);
    font-size: 0.88rem;
}

/* ─── Category Breakdown (Feature 1) ────────────────── */

.cat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cat-name {
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: capitalize;
}

.cat-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.cat-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.cat-stat {
    text-align: center;
}

.cat-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
}

.cat-stat-value.good { color: var(--success); }
.cat-stat-value.okay { color: var(--warn); }
.cat-stat-value.poor { color: var(--danger); }

.cat-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.cat-mastery-section {
    margin-top: 8px;
}

.cat-mastery-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 8px;
}

/* ─── Mastery Bar (Feature 2) ──────────────────────── */

.mastery-bar {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}

.mastery-seg {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--bg-input);
    transition: var(--transition);
}

.mastery-seg.filled {
    background: var(--accent);
}

.mastery-num {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: 4px;
}

/* ─── Mastery Distribution Bar ──────────────────────── */

.mastery-dist-bar {
    display: flex;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--bg-input);
    margin-bottom: 10px;
}

.mastery-dist-seg {
    height: 100%;
    transition: width 0.3s ease;
}

.mastery-dist-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.dist-leg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: var(--text-dim);
}

.dist-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ─── Category Badges ───────────────────────────────── */

.cat-badges {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.due-pill {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.leech-pill {
    background: var(--danger-dim);
    color: var(--danger);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.cat-quiz-btn {
    width: 100%;
    margin-top: 14px;
    padding: 10px 16px;
    font-size: 0.9rem;
}

/* ─── Heatmap / History (Feature 3) ─────────────────── */

.hist-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.hist-stats-bar-7 {
    grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 600px) {
    .hist-stats-bar-7 {
        grid-template-columns: repeat(7, 1fr);
    }
}

.hist-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    text-align: center;
    transition: var(--transition);
}

.hist-stat-card.highlight {
    border-color: var(--accent);
    background: rgba(0, 113, 227, 0.06);
}

.hist-stat-value {
    font-size: 1.15rem;
    font-weight: 800;
}

.hist-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* ─── Trend Chart ───────────────────────────────────── */

.trend-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.trend-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.trend-chart-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trend-chart-header h3 .icon-svg {
    width: 16px;
    height: 16px;
}

.trend-legend {
    display: flex;
    gap: 12px;
}

.trend-legend-item {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.trend-legend-dot.line {
    background: var(--accent);
    border-radius: 50%;
    width: 6px;
    height: 6px;
}

.trend-legend-dot.bar {
    background: rgba(0, 113, 227, 0.15);
}

.trend-chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.trend-chart-svg {
    width: 100%;
    min-width: 500px;
    height: auto;
}

.chart-grid-line {
    stroke: var(--border);
    stroke-width: 0.5;
    stroke-dasharray: 2,3;
}

.chart-axis-text {
    font-size: 9px;
    fill: var(--text-muted);
    font-family: var(--font);
}

.chart-dot {
    cursor: pointer;
    transition: r 0.15s;
}

.chart-dot:hover {
    r: 4;
}

/* ─── Timeline ──────────────────────────────────────── */

.timeline-container {
    margin-bottom: 16px;
}

.timeline-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-section-label .icon-svg {
    width: 14px;
    height: 14px;
}

.timeline-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    overflow: hidden;
    transition: var(--transition);
}

.timeline-day.expanded {
    border-color: var(--accent);
}

.timeline-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
}

.timeline-day-date {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.timeline-day-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.timeline-day-date-sep {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.timeline-day-month {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.timeline-day-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-day-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.timeline-day-acc {
    font-size: 0.8rem;
    font-weight: 800;
}

.timeline-day-acc.good {
    color: #22c55e;
}

.timeline-day-acc.mid {
    color: #f59e0b;
}

.timeline-day-acc.low {
    color: #ef4444;
}

.timeline-day-correct {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.timeline-day-chevron {
    display: flex;
    align-items: center;
    margin-left: 4px;
    color: var(--text-muted);
}

.timeline-day-chevron .icon-svg {
    width: 16px;
    height: 16px;
}

.timeline-day-items {
    padding: 0 14px 10px 14px;
    border-top: 1px solid var(--border);
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.timeline-item-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.timeline-item-icon .icon-svg {
    width: 16px;
    height: 16px;
}

.timeline-item.correct .timeline-item-icon {
    color: #22c55e;
}

.timeline-item.wrong .timeline-item-icon {
    color: #ef4444;
}

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

.timeline-item-question {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

.timeline-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-item-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.timeline-item-level {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

.timeline-load-more {
    width: 100%;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.timeline-load-more .icon-svg {
    width: 16px;
    height: 16px;
}

.timeline-end {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.timeline-end .icon-svg {
    width: 14px;
    height: 14px;
    color: #22c55e;
}

/* ─── Legacy History Detail (kept for compat) ───────── */

.hist-detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.hist-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hist-detail-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.hist-detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.hist-level {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.hist-icon {
    font-size: 0.85rem;
}

/* ─── Browse Items ──────────────────────────────────── */

.browse-actions {
    margin-bottom: 16px;
}

.browse-cat-section {
    margin-bottom: 16px;
}

.browse-cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.browse-cat-header:hover {
    background: var(--bg-card-hover);
}

.browse-cat-stats {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-left: auto;
}

.cat-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.browse-cat-items {
    margin-top: 6px;
}

.browse-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 6px;
}

.browse-item-main {
    flex: 1;
    cursor: pointer;
}

.browse-item-question {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 6px;
    line-height: 1.4;
}

.browse-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-acc {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.meta-acc.good {
    background: var(--success-dim);
    color: var(--success);
}

.meta-acc.poor {
    background: var(--danger-dim);
    color: var(--danger);
}

.meta-new {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-input);
    border-radius: 12px;
}

.meta-tries {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.browse-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ─── Edit Panel ────────────────────────────────────── */

.edit-panel {
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.edit-form .form-group {
    margin-bottom: 12px;
}

.edit-form label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.edit-form input,
.edit-form textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: var(--font);
    resize: vertical;
}

.edit-form input:focus,
.edit-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ─── Add Form (Feature 4) ──────────────────────────── */

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: var(--font);
    transition: var(--transition);
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* ─── Toast ─────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 1000;
    animation: toast-in 0.2s ease;
    box-shadow: var(--shadow);
    max-width: 90vw;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-info {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border-hover);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Responsive ────────────────────────────────────── */

@media (max-width: 400px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .hist-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .tally-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .nav-grid {
        grid-template-columns: 1fr;
    }
    .cat-stats-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .heat-cell {
        width: 10px;
        height: 10px;
    }
}

/* ─── Scrollbar ─────────────────────────────────────── */

::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Fade-in Animation ─────────────────────────────── */

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-card,
.cat-card,
.nav-card,
.result-item,
.browse-item {
    animation: fade-in 0.25s ease;
}

/* ═══ Single-Question Quiz Flow ═══ */

.quiz-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(245, 245, 247, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
}

.quiz-tally {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

.quiz-single-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin: 16px 0 0;
    box-shadow: var(--shadow);
    animation: slide-up 0.3s ease;
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.question-text-large {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.5;
    margin: 16px 0 20px;
    color: var(--text);
}

.quiz-single-card .choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Choice states after answering */
.choice.correct-flash {
    background: var(--success-dim) !important;
    border-color: var(--success) !important;
    color: var(--success) !important;
    animation: flash-green 0.4s ease;
}

@keyframes flash-green {
    0%   { background: rgba(52, 199, 89, 0.30); transform: scale(1.02); }
    100% { background: var(--success-dim); transform: scale(1); }
}

.choice.wrong-flash {
    background: var(--danger-dim) !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
    animation: flash-red 0.4s ease;
}

@keyframes flash-red {
    0%   { background: rgba(255, 59, 48, 0.30); transform: scale(1.02); }
    100% { background: var(--danger-dim); transform: scale(1); }
}

.choice.dimmed {
    opacity: 0.35;
}

.choice:disabled {
    cursor: default;
}

.choice-check {
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
}

.choice-x {
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger);
}

/* Feedback panel */
.feedback-panel {
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    animation: slide-up 0.3s ease;
}

.feedback-panel.correct {
    background: var(--success-dim);
    border: 1px solid rgba(52, 199, 89, 0.25);
}

.feedback-panel.wrong {
    background: var(--danger-dim);
    border: 1px solid rgba(255, 59, 48, 0.25);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.feedback-icon {
    font-size: 1.3rem;
}

.feedback-result {
    font-size: 1.1rem;
    font-weight: 700;
}

.feedback-panel.correct .feedback-result {
    color: var(--success);
}

.feedback-panel.wrong .feedback-result {
    color: var(--danger);
}

.feedback-answer {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-xs);
}

.feedback-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.feedback-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success);
}

.feedback-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.feedback-mastery {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.feedback-mastery.up {
    background: var(--success-dim);
    color: var(--success);
}

.feedback-mastery.down {
    background: var(--danger-dim);
    color: var(--danger);
}

.feedback-mastery.same {
    background: var(--bg-input);
    color: var(--text-dim);
}

.feedback-notes {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dim);
}

/* Action bar below feedback */
.quiz-action-bar {
    padding: 16px;
    display: flex;
    justify-content: center;
}

.btn-large {
    width: 100%;
    max-width: 400px;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
}

/* ─── Ingestion UI ─────────────────────────────────── */

.ingest-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.ingest-tab {
    flex: 1;
    padding: 12px 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ingest-tab.active {
    background: var(--bg-card);
    color: var(--accent);
    border-color: var(--border-hover);
}

.btn-full {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
}

.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-input);
}

.file-upload-area:hover,
.file-upload-area.has-file {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.file-upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.file-upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.file-upload-hint {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.ingest-draft-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ingest-draft-actions .btn {
    flex: 1;
    min-width: 120px;
}

.ingest-drafts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.draft-card {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.draft-check {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
}

.draft-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--accent);
}

.draft-num {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dim);
    min-width: 28px;
}

.draft-body {
    flex: 1;
}

.draft-body .form-group {
    margin-bottom: 10px;
}

/* ─── Ingestion History ─────────────────────────────── */

.ingest-hist-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.ingest-hist-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ingest-hist-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--card-border, #2a2a3e);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
}

.ingest-hist-card:hover {
    border-color: var(--accent, #6c5ce7);
}

.ingest-hist-num {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dim, #888);
    min-width: 40px;
}

.ingest-hist-body {
    flex: 1;
}

.ingest-hist-date {
    font-size: 0.85rem;
    color: var(--text-dim, #888);
    margin-bottom: 4px;
}

.ingest-hist-items {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.ingest-hist-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ingest-hist-cat {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent, #6c5ce7);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
}

@media (max-width: 480px) {
    .ingest-hist-summary {
        flex-direction: column;
        gap: 8px;
    }
}

/* ─── Topics: Primary View Styling ────────────────────── */

/* Nav card variants */
.nav-card-primary {
    border-color: var(--accent, #6c5ce7);
    background: rgba(108, 92, 231, 0.08);
}
.nav-card-primary .nav-icon { color: var(--accent, #6c5ce7); }
.nav-card-primary .nav-label { color: var(--accent, #6c5ce7); }

.nav-card-secondary {
    opacity: 0.7;
}

/* Topic tags (inline on items, quiz cards, etc.) */
.topic-tag {
    display: inline-block;
    background: rgba(108, 92, 231, 0.12);
    color: var(--accent, #6c5ce7);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    margin-right: 4px;
    white-space: nowrap;
}

/* Topic dashboard */
.topic-dashboard {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #333344);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.topic-dash-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border, #333344);
}

.topic-dash-stat {
    text-align: center;
}

.topic-dash-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text, #eee);
    line-height: 1.2;
}

.topic-dash-label {
    font-size: 0.75rem;
    color: var(--text-dim, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.topic-dash-section {
    margin-bottom: 12px;
}

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

.topic-dash-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim, #888);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topic-dash-section-title .icon-svg {
    width: 14px;
    height: 14px;
}

.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(108, 92, 231, 0.12);
    color: var(--accent, #6c5ce7);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.topic-chip:hover {
    background: rgba(108, 92, 231, 0.22);
    transform: translateY(-1px);
}

.topic-chip-weak {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
}

.topic-chip-weak:hover {
    background: rgba(231, 76, 60, 0.22);
}

.topic-chip-strong {
    background: rgba(46, 204, 113, 0.12);
    color: #2ecc71;
    cursor: default;
}

.topic-chip-strong:hover {
    transform: none;
}

/* Topic cards */
.topic-card {
    margin-bottom: 12px;
}

.topic-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.topic-card-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 8px 12px;
}

/* Actions bar */
.topic-actions-bar {
    margin-bottom: 12px;
}

/* Merge panel */
.topic-merge-panel {
    background: var(--card-bg, #1e1e2e);
    border: 2px dashed var(--accent, #6c5ce7);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.topic-merge-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topic-merge-hint {
    font-size: 0.8rem;
    color: var(--text-dim, #888);
    margin-bottom: 12px;
}

/* Quiz session badge */
.quiz-session-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent, #6c5ce7);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 12px;
    width: fit-content;
}

.quiz-session-badge .icon-svg {
    width: 14px;
    height: 14px;
}

/* Due pill */
.due-pill {
    display: inline-block;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Cat stats row (reuse for topics) */
.cat-stats-row {
    display: flex;
    gap: 16px;
    margin: 10px 0;
}

.cat-stat {
    text-align: center;
}

.cat-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.cat-stat-value.good { color: #2ecc71; }
.cat-stat-value.okay { color: #f39c12; }
.cat-stat-value.poor { color: #e74c3c; }

.cat-stat-label {
    font-size: 0.7rem;
    color: var(--text-dim, #888);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.cat-badges {
    margin-top: 4px;
}

.result-item-meta {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ─── Topic Search & Auto-Suggest ─────────────────────── */

.topic-search-container {
    position: relative;
    margin-bottom: 16px;
}

.topic-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #333344);
    border-radius: 10px;
    padding: 10px 14px;
    transition: border-color 0.2s;
}

.topic-search-box:focus-within {
    border-color: var(--accent, #6c5ce7);
}

.topic-search-icon {
    display: flex;
    align-items: center;
    color: var(--text-dim, #888);
    flex-shrink: 0;
}

.topic-search-icon svg {
    width: 18px;
    height: 18px;
}

#topic-search {
    flex: 1;
    background: none;
    border: none;
    color: var(--text, #fff);
    font-size: 0.95rem;
    outline: none;
}

#topic-search::placeholder {
    color: var(--text-dim, #666);
}

.topic-search-clear {
    background: none;
    border: none;
    color: var(--text-dim, #888);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.topic-search-clear:hover {
    color: var(--text, #fff);
    background: rgba(255,255,255,0.08);
}

/* Auto-suggest dropdown (shared) */
.topic-suggest-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #333344);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
}

/* Inline variant for form inputs (positioned within parent) */
.topic-suggest-inline {
    top: calc(100% + 2px);
    left: 0;
    right: 0;
}

.topic-suggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

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

.topic-suggest-item:hover {
    background: rgba(108, 92, 231, 0.15);
}

.topic-suggest-name {
    color: var(--accent, #6c5ce7);
    font-weight: 600;
    font-size: 0.9rem;
}

.topic-suggest-count {
    color: var(--text-dim, #888);
    font-size: 0.78rem;
}

