/* === CSS Variables — Dark (default) === */
:root, [data-theme="dark"] {
    --bg-primary: #151518;
    --bg-secondary: #1e1e22;
    --bg-tertiary: #28282e;
    --bg-card: #1e1e22;
    --bg-input: #2a2a30;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c80;
    --accent: #14b8a6;
    --accent-hover: #0d9488;
    --accent-light: #5eead4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #35353c;
    --shadow: rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-lg: 12px;
}

/* === CSS Variables — Light === */
[data-theme="light"] {
    --bg-primary: #f4f7f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #edf2f2;
    --bg-card: #ffffff;
    --bg-input: #f0f4f4;
    --text-primary: #2c2c2c;
    --text-secondary: #5c5c5c;
    --text-muted: #8a8a8a;
    --accent: #0d9488;
    --accent-hover: #0f766e;
    --accent-light: #0d9488;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --border: #dce4e4;
    --shadow: rgba(0, 0, 0, 0.06);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    color: var(--accent-light);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

/* === App Layout === */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.top-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
}

/* === Nav Bar === */
.nav-bar {
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 56px;
}

.nav-bar .brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.1rem;
}
.brand-logo {
    height: 36px;
    width: 36px;
    object-fit: contain;
    border: none;
    background: transparent;
    display: block;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-links .nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.nav-links .nav-link i {
    font-size: 1rem;
    opacity: 0.8;
}

.nav-links .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-links .nav-link.active {
    color: #0d9488;
    background: rgba(13, 148, 136, 0.12);
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

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

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-light);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

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

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

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

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-action {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.btn-action:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.35rem 0.5rem;
    font-size: 1rem;
    line-height: 1;
    min-width: 2rem;
    text-align: center;
}

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

/* === Form Controls === */
input, select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
}

/* === Study Page Layout === */
.study-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px - 3rem);
    gap: 0;
}

.study-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-shrink: 0;
}

.panel-expand-bar {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    flex-shrink: 0;
}

.btn-expand {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.2rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-expand:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-expand.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.study-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
}

.study-panels.chat-focused {
    grid-template-columns: 3fr 1fr;
}

.study-panels.browser-focused {
    grid-template-columns: 1fr 3fr;
}

.study-panels > div {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === Timer === */
.timer-display {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
}

.timer-display.work {
    color: var(--accent-light);
}

.timer-display.break-time {
    color: var(--success);
}

.timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
}

/* === Chat Panel === */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    border-right: 1px solid var(--border);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.chat-input-area input {
    flex: 1;
}

.btn-quiz {
    background: var(--accent-secondary, #8b5cf6);
    color: #fff;
    border: none;
    white-space: nowrap;
}

.btn-quiz:hover {
    opacity: 0.85;
}

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

.spinner-sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

/* === Browser Panel === */
.browser-panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.browser-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    user-select: none;
}

.browser-tab:hover {
    color: var(--text-primary);
}

.browser-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

.browser-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.browser-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.browser-toolbar input {
    flex: 1;
}

.browser-frame {
    flex: 1;
    border: none;
    background: white;
}

.embed-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.embed-warning a {
    color: var(--accent-light);
    white-space: nowrap;
    text-decoration: none;
    font-weight: 500;
}

.embed-warning a:hover {
    text-decoration: underline;
}

.embed-warning button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.15rem;
    margin-left: auto;
}

/* === Quiz Panel === */
.quiz-panel {
    padding: 1.25rem;
    overflow-y: auto;
}

.quiz-question {
    margin-bottom: 1.5rem;
}

.quiz-question h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.quiz-option:hover {
    border-color: var(--accent);
}

.quiz-option.selected {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.quiz-option.incorrect {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.quiz-results {
    text-align: center;
    padding: 1.5rem;
}

.quiz-score {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-light);
}

.question-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.question-type-badge.truefalse {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.question-type-badge.fillintheblank {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.3);
}

/* === Provider Selector === */
.provider-selector {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.provider-selector label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.provider-selector select {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

/* === Study Context Selector === */
.context-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
}

.study-context-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    margin-left: 0.6rem;
}

.study-context-selector > label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.context-dropdown-wrapper {
    position: relative;
}

.context-toggle {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    min-width: 140px;
    text-align: left;
}

.context-toggle .placeholder {
    color: var(--text-secondary);
}

.context-toggle .selected-count {
    color: var(--accent-light);
}

.context-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    z-index: 100;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.context-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-primary);
}

.context-option:hover {
    background: var(--bg-primary);
}

.context-option input[type="checkbox"] {
    accent-color: var(--accent);
}

.context-empty {
    padding: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.selected-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    max-width: 300px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
}

.tag-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.tag-remove:hover {
    opacity: 1;
}

/* === Tables === */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* === Tags === */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(13, 148, 136, 0.2);
    color: #0d9488;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* === Page Headers === */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.dashboard-banner {
    max-height: 120px;
    max-width: 540px;
    object-fit: contain;
    flex-shrink: 0;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* === Dashboard Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* === Settings === */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.setting-row label {
    min-width: 180px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.setting-row input,
.setting-row select {
    flex: 1;
    max-width: 400px;
}

.secret-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 440px;
}

.secret-input input {
    flex: 1;
    max-width: none;
}

/* === Session Detail Tabs === */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

/* === Weakness Insight Cards === */
.weakness-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 3px solid var(--warning);
}

.weakness-card .area {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.weakness-card .description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.weakness-card .suggestion {
    font-size: 0.85rem;
    color: var(--accent-light);
}

/* === Due Reviews List === */
.due-reviews-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.review-card {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 3px solid var(--warning);
}

.review-card .area {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.review-card .description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.review-card .suggestion {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Saving Overlay === */
.saving-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(2px);
}

.saving-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 3rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

/* === Loading & Empty States === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.75rem;
}

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

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* === Error UI === */
#blazor-error-ui {
    background: var(--danger);
    color: white;
    padding: 0.75rem 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    display: none;
}

#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    color: white;
    margin-left: 1rem;
}

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: white;
    border-radius: var(--radius);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* === Markdown Content in Chat === */
.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin: 0.25rem 0;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin: 0.5rem 0 0.25rem 0;
    color: var(--text-primary);
}

.markdown-content ul, .markdown-content ol {
    margin: 0.25rem 0;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin: 0.15rem 0;
}

.markdown-content code {
    background: var(--bg-tertiary);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.markdown-content pre {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0.5rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.5rem 0;
    padding: 0.25rem 0.75rem;
    color: var(--text-secondary);
}

.markdown-content strong {
    color: var(--text-primary);
}

.markdown-content table {
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85em;
}

.markdown-content a {
    color: var(--accent-light);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
    cursor: pointer;
}

.markdown-content a:hover {
    color: var(--accent);
}

/* Compact sources section (last list in AI responses) */
.markdown-content > p:has(+ ul:last-child),
.markdown-content > p:has(+ ol:last-child) {
    margin-bottom: 0;
}

.markdown-content > ul:last-child,
.markdown-content > ol:last-child {
    font-size: 0.8em;
    line-height: 1.3;
    margin: 0;
    padding-left: 1.2rem;
}

.markdown-content > ul:last-child li,
.markdown-content > ol:last-child li {
    margin: 0;
}

.markdown-content th, .markdown-content td {
    border: 1px solid var(--border);
    padding: 0.35rem 0.5rem;
}

/* === RSVP Speed Reader === */
.rsvp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
    outline: none;
}

.rsvp-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 3rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: 90vw;
    max-width: 700px;
    min-height: 350px;
}

.rsvp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.rsvp-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.rsvp-display {
    position: relative;
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    font-family: 'Consolas', 'Courier New', monospace;
}

.rsvp-guide-line {
    position: absolute;
    top: 15%;
    bottom: 15%;
    left: 50%;
    width: 2px;
    background: var(--accent);
    opacity: 0.4;
    z-index: 1;
}

.rsvp-word {
    position: relative;
    z-index: 2;
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.rsvp-before, .rsvp-after {
    color: var(--text-primary);
}

.rsvp-orp {
    color: var(--accent);
    font-weight: 700;
}

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

.rsvp-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.rsvp-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rsvp-wpm {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-light);
    min-width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.rsvp-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === GitHub Export Modal === */
.github-export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.github-export-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: 90vw;
    max-width: 550px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.github-export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.github-export-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.github-repo-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.repo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

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

.repo-item:hover {
    background: var(--bg-tertiary);
}

.repo-item.selected {
    background: var(--accent);
    color: white;
}

.repo-item.selected span {
    color: white;
}

/* === Utility Classes === */
.nowrap { white-space: nowrap; }
.fw-600 { font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.mb-05 { margin-bottom: 0.5rem; }
.mb-075 { margin-bottom: 0.75rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-1-5 { margin-bottom: 1.5rem; }
.mt-05 { margin-top: 0.5rem; }
.mt-075 { margin-top: 0.75rem; }
.mt-1 { margin-top: 1rem; }
.mt-1-5 { margin-top: 1.5rem; }
.mr-025 { margin-right: 0.25rem; }
.text-secondary-sm { color: var(--text-secondary); font-size: 0.85rem; }
.text-muted-sm { color: var(--text-muted); font-size: 0.75rem; }
.status-success { color: var(--success); font-size: 0.85rem; }
.status-danger { color: var(--danger); font-size: 0.85rem; }
.status-success-sm { color: var(--success); font-size: 0.75rem; }
.status-danger-sm { color: var(--danger); font-size: 0.75rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }

/* === Warning Banner (Study, SpacedRepetition) === */
.warning-banner {
    background: var(--warning, #fef3c7);
    border: 1px solid var(--warning-border, #f59e0b);
    color: var(--warning-text, #92400e);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dismiss-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: inherit;
    padding: 0 0.25rem;
}

/* === Review Banner (SessionDetail) === */
.review-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.review-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.review-banner-link {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.btn-review {
    background: #fff;
    color: var(--accent);
    font-weight: 600;
}

/* === GitHub Export Modal (SessionDetail, SessionHistory) === */
.btn-close-modal {
    background: transparent;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
}

.export-success {
    text-align: center;
    padding: 2rem 1rem;
}

.export-success-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.export-success-title {
    color: var(--success);
    margin-bottom: 0.5rem;
}

.export-success-text {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.export-success-link {
    color: var(--accent);
    word-break: break-all;
}

.loading-center {
    text-align: center;
    padding: 2rem;
}

.export-error {
    color: var(--danger);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.badge-private {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.1rem 0.4rem;
    border-radius: 1rem;
}

.create-repo-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.create-repo-form input {
    flex: 1;
}

.btn-tertiary {
    background: var(--bg-tertiary);
    font-size: 0.85rem;
}

.file-preview {
    margin-top: 1rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.modal-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.modal-field {
    margin-bottom: 0.75rem;
}

/* === Page Header Row (SessionDetail) === */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* === Session Detail: Content === */
.card-scrollable {
    max-height: 60vh;
    overflow-y: auto;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem;
}

.quiz-question-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quiz-question-header h4 {
    margin: 0;
}

.quiz-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.answer-label-correct {
    margin-left: auto;
    color: var(--success);
}

.answer-label-incorrect {
    margin-left: auto;
    color: var(--danger);
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

.note-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.note-content {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
}

.note-timestamp {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.weakness-confidence {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* === Pagination (SessionHistory) === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.pagination-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* === Settings === */
.help-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.help-text-lg {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.help-link {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 500;
}

.setting-row input[type="checkbox"] {
    width: auto;
}

.setting-row-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.setting-row-col label {
    min-width: unset;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-textarea {
    width: 100%;
    max-width: 600px;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
}

.settings-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.settings-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.test-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* === Spaced Repetition === */
.sr-status-due {
    color: var(--warning);
    font-weight: 600;
}

.sr-status-scheduled {
    color: var(--success);
}

/* === QuizPanel === */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.quiz-submit-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.quiz-results-text {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* === Study Page === */
.browser-right-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.browser-col-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* === BrowserPanel === */
.browser-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-open-tab {
    text-decoration: none;
    font-size: 0.75rem;
}

.btn-summarize {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    font-size: 0.75rem;
}

.btn-summarize:hover {
    background: #2563eb;
    border-color: #2563eb;
}

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

.pdf-file-label {
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.pdf-file-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pdf-loading {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    padding: 0 0.5rem;
}

.podcast-audio-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    flex: 1;
}

.podcast-audio-player {
    width: 100%;
    max-width: 600px;
}

/* === PomodoroTimer === */
.timer-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* === RsvpReader === */
.rsvp-done-text {
    color: var(--text-muted);
    font-size: 1rem;
}

/* === Auth Pages === */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.5rem;
    margin: 0 0 0.25rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group label {
    margin-bottom: 0;
}

.btn-full {
    width: 100%;
    padding: 0.7rem;
    margin-top: 0.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 0.25rem;
}

/* Nav user section */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}
.nav-dropdown {
    position: relative;
}
.nav-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.nav-dropdown-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.nav-dropdown-btn i { font-size: 1.2rem; }
.nav-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-width: 180px;
    padding: 0.4rem;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
    width: 100%;
    cursor: pointer;
}
.nav-dropdown-item:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.nav-dropdown-item i { font-size: 1rem; opacity: 0.8; }
.nav-dropdown-item--admin { color: #f59e0b; }
.nav-dropdown-item--logout { color: #f87171; }
.nav-dropdown-item--logout:hover { background: rgba(248,113,113,0.1); color: #f87171; }
.nav-dropdown-divider { height: 1px; background: var(--border-color); margin: 0.3rem 0; }

.nav-user-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* === Billing Page === */
.billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.plan-badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.plan-free {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.plan-pro {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.billing-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.usage-stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.usage-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.usage-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.usage-value {
    font-size: 0.9rem;
    font-weight: 600;
}

.usage-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

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

/* === Admin Page === */
.nav-admin {
    color: var(--warning) !important;
    font-weight: 600;
}

.admin-config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.admin-config-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.admin-config-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-config-value {
    font-size: 0.9rem;
    font-family: monospace;
}

/* === Upgrade Prompt === */
.upgrade-prompt {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.upgrade-prompt-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 480px;
    text-align: center;
}

.upgrade-prompt-card h2 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.upgrade-prompt-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.upgrade-prompt-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.upgrade-prompt-reset {
    font-size: 0.8rem;
    color: var(--text-muted) !important;
    margin-bottom: 0 !important;
}

/* ── Publish panel ───────────────────────────────────────────── */
.publish-panel {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.publish-panel-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.publish-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.publish-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Explore / Community Feed ─────────────────────────────────── */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.explore-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.explore-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.explore-card-topic {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.explore-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.explore-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.explore-card-link {
    display: inline-block;
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
}

.explore-card-link:hover {
    text-decoration: underline;
}

/* ── Publish badge ───────────────────────────────────────────── */
.badge-published {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* === Public User Profile === */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-avatar-sm {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
}

.profile-avatar-preview {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.75rem;
}

.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.profile-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.profile-username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.profile-bio {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
    max-width: 560px;
}

.profile-website-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--accent-light);
    font-size: 0.9rem;
}

.profile-website-link:hover {
    text-decoration: underline;
}

.profile-cta {
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 1.5rem;
}

.profile-cta p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* === Handle input === */
.handle-input-row {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
}

.handle-at {
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.handle-input-row input,
.handle-input-row .form-input {
    border-radius: 0 var(--radius) var(--radius) 0 !important;
    flex: 1;
}

.handle-status {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    min-height: 1.2em;
}

.handle-status.available { color: var(--success); }
.handle-status.taken { color: var(--danger); }
.handle-status.checking { color: var(--text-muted); }

/* === Profile inline edit === */
.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-width: 480px;
}

.profile-edit-textarea {
    resize: vertical;
}

.profile-edit-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === Counter input (admin +/- controls) === */
.counter-input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.counter-input span {
    min-width: 2.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

/* === Book Rights === */
.book-rights-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.book-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.book-cover-thumb {
    width: 48px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.book-cover-placeholder {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.course-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.book-search-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.book-search-row .form-input {
    flex: 1;
}

.book-results-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.book-result-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.book-status-available {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.book-status-taken {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.book-status-owned {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* === Flashcard button (in chat toolbar) === */
.btn-flashcard {
    background: var(--bg-tertiary);
    color: var(--accent-light);
    border: 1px solid var(--accent-light);
}

.btn-flashcard:hover {
    background: var(--accent-light);
    color: var(--bg-primary);
}

/* === Flashcard Panel === */
.flashcard-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    height: 100%;
}

.flashcard-progress-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.flashcard-progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

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

.flashcard-card {
    min-height: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: stretch;
    transition: box-shadow 0.15s;
}

.flashcard-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.flashcard-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    text-align: center;
    gap: 0.75rem;
}

.flashcard-front {
    display: flex;
}

.flashcard-back {
    display: none;
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-secondary));
    border-radius: var(--radius);
}

.flashcard-card.flipped .flashcard-front {
    display: none;
}

.flashcard-card.flipped .flashcard-back {
    display: flex;
}

.flashcard-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.flashcard-face p {
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.5;
}

.flashcard-img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: var(--radius);
    margin: 0.25rem 0;
}

.flashcard-tap-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.flashcard-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-flashcard-know {
    background: color-mix(in srgb, var(--success) 15%, var(--bg-secondary));
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: var(--radius);
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-flashcard-know:hover {
    background: var(--success);
    color: var(--bg-primary);
}

.btn-flashcard-again {
    background: color-mix(in srgb, var(--warning, #f59e0b) 15%, var(--bg-secondary));
    color: var(--warning, #f59e0b);
    border: 1px solid var(--warning, #f59e0b);
    border-radius: var(--radius);
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-flashcard-again:hover {
    background: var(--warning, #f59e0b);
    color: var(--bg-primary);
}

/* === Session history stat chips === */
.stat-chip {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    margin-right: 0.25rem;
    margin-top: 0.15rem;
    vertical-align: middle;
}

.stat-chip-quiz {
    background: color-mix(in srgb, var(--accent) 15%, var(--bg-secondary));
    color: var(--accent);
}

.stat-chip-flashcard {
    background: color-mix(in srgb, var(--success) 15%, var(--bg-secondary));
    color: var(--success);
}

/* === Flashcard deck list (session history) === */
.flashcard-deck-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.flashcard-deck-item {
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.flashcard-deck-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.flashcard-deck-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.flashcard-deck-item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.flashcard-deck-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.flashcard-deck-header h3 {
    margin: 0;
}

/* === Auth divider + Google button === */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.1rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
    text-decoration: none;
    color: #3c4043;
}

/* === Rights Tabs === */
.rights-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.rights-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.rights-tab-btn:hover {
    color: var(--text-primary);
}

.rights-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* === Rights Section Titles === */
.rights-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
}

/* === Rights Search Hint / friendly error === */
.rights-search-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 1rem;
    font-style: italic;
}

/* === Info anchor + popover === */
.info-anchor {
    position: relative;
    display: inline-block;
}

.info-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0 0.25rem;
    line-height: 1;
    vertical-align: middle;
    transition: color 0.15s;
}

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

.info-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    min-width: 280px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === Session Resource Reminder === */
.session-resources-reminder {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.session-resources-reminder-label {
    margin: 0;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.session-resources-reminder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* === Social Share Bar === */
.social-share-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.5rem 0;
}

.social-share-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.social-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.375rem 0.9rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.15s ease;
    line-height: 1;
}

.social-share-btn:hover {
    opacity: 0.82;
    text-decoration: none;
}

.social-share-linkedin {
    background: #0a66c2;
    color: #fff;
}

.social-share-x {
    background: #000;
    color: #fff;
}

/* === Sign-Up CTA === */
.signup-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.signup-cta-content {
    flex: 1;
}

.signup-cta-headline {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.signup-cta-body {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.signup-cta-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .signup-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* === Comments Section === */
.comments-section {
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.comments-heading {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-item {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.comment-meta {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-timestamp {
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.comment-body {
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.comment-delete-btn:hover {
    opacity: 1;
}

.comment-input-area {
    margin-top: 1.25rem;
}

.comment-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.625rem 0.75rem;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.comment-textarea:focus {
    border-color: var(--accent);
}

.comment-input-actions {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-end;
}

.comment-login-prompt {
    margin-top: 1rem;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* ===== Follow Feature ===== */

/* Follow button — active/following state */
.btn-follow-active {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.65rem;
}
.btn-follow-active:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Profile follow stats row */
.profile-follow-stats {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.profile-follow-stats strong { color: var(--text-primary); }

/* Follow list section */
.follow-section { margin-top: 1.5rem; }
.follow-section-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.follow-list { display: flex; flex-direction: column; }
.follow-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.follow-user-card:last-child { border-bottom: none; }
.follow-user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.follow-user-info { flex: 1; min-width: 0; }
.follow-user-name { font-weight: 600; font-size: 0.9rem; }
.follow-user-handle { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Notes Panel Expand ===== */
/* Hide browser panel when notes is maximized */
.notes-expanded .browser-col-main {
    display: none;
}

/* ===== Learning Maps ===== */
.lm-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.lm-header { margin-bottom: 1.5rem; }
.lm-header h1 { font-size: 1.8rem; font-weight: 700; margin: 0 0 0.25rem; }
.lm-subtitle { color: var(--text-secondary); margin: 0; }

.lm-generate {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.lm-input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
}
.lm-input:focus { outline: none; border-color: var(--accent); }
.lm-generate-btn { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }

.lm-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lm-spin 0.7s linear infinite;
}
@keyframes lm-spin { to { transform: rotate(360deg); } }

.lm-error {
    background: rgba(239,68,68,0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Accordion */
.lm-accordion { display: flex; flex-direction: column; gap: 0.5rem; }

.lm-accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}
.lm-accordion-item--open { border-color: var(--accent); }

.lm-accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: background 0.15s;
}
.lm-accordion-header:hover { background: var(--bg-tertiary); }

.lm-accordion-chevron { font-size: 0.85rem; color: var(--accent); flex-shrink: 0; width: 14px; }
.lm-accordion-topic { font-weight: 600; font-size: 1rem; flex: 1; }
.lm-accordion-progress { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }

.lm-mini-bar {
    width: 80px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.lm-mini-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}


/* Topic grid */
.lm-accordion-body { border-top: 1px solid var(--border); }

.lm-topic-grid { display: flex; flex-direction: column; }

.lm-topic-row {
    display: grid;
    grid-template-columns: 1fr 100px 60px;
    align-items: center;
    border-top: 1px solid var(--border);
    transition: background 0.15s, opacity 0.2s;
}
.lm-topic-row:hover { background: var(--bg-tertiary); }
.lm-topic-row--done { opacity: 0.5; }

.lm-cell-topic {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
}
.lm-cell-study {
    padding: 0.5rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border);
}
.lm-cell-done {
    padding: 0.5rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border);
}

.lm-topic-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(20,184,166,0.12);
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}
.lm-topic-row--done .lm-topic-num { background: rgba(16,185,129,0.12); color: var(--success); }
.lm-topic-title { font-size: 0.875rem; font-weight: 500; margin-bottom: 0.15rem; }
.lm-topic-desc { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

.lm-btn-study {
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
    background: rgba(20,184,166,0.12);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.lm-btn-study:hover { background: rgba(20,184,166,0.25); }

.lm-btn-toggle {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.lm-btn-toggle:hover { border-color: var(--success); color: var(--success); }
.lm-btn-toggle--done { background: rgba(16,185,129,0.15); border-color: var(--success); color: var(--success); }

.lm-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}


/* Mermaid diagrams */
.mermaid-diagram {
    margin: 1rem 0;
    overflow-x: auto;
    text-align: center;
}
.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* ── Deep Research ────────────────────────────────────────────────────────── */
.source-list { display: flex; flex-direction: column; gap: .6rem; }

.source-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    font-size: .85rem;
    transition: border-color .2s;
}
.source-card.success { border-left: 3px solid var(--success); }
.source-card.failed  { border-left: 3px solid var(--border); opacity: .65; }
.source-card.loading { border-left: 3px solid var(--warning); }
.source-favicon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; margin-top: 2px; }
.source-body    { flex: 1; min-width: 0; }
.source-title   { font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-url     { color: var(--text-muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-snippet { color: var(--text-secondary); font-size: .8rem; margin-top: .2rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.source-status  { flex-shrink: 0; margin-left: auto; }

.phase-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    background: rgba(20,184,166,.1);
    color: var(--accent);
    border: 1px solid rgba(20,184,166,.25);
}
.phase-banner.searching { background: rgba(20,184,166,.1); color: var(--accent); }

.stream-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.1rem;
    font-size: .88rem;
    line-height: 1.7;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Menlo', 'Consolas', monospace;
    color: var(--text-secondary);
}

.report-actions {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.report-body {
    line-height: 1.75;
    color: var(--text-primary);
    font-size: .92rem;
}
.report-body h1 { font-size: 1.4rem; font-weight: 700; margin: 1.5rem 0 .75rem; color: var(--text-primary); }
.report-body h2 { font-size: 1.1rem; font-weight: 700; margin: 1.4rem 0 .6rem; color: var(--text-primary); border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.report-body h3 { font-size: .95rem; font-weight: 700; margin: 1rem 0 .4rem; color: var(--text-primary); }
.report-body p  { margin-bottom: .85rem; }
.report-body ul, .report-body ol { padding-left: 1.4rem; margin-bottom: .85rem; }
.report-body li { margin-bottom: .3rem; }
.report-body blockquote { border-left: 3px solid var(--accent); padding-left: .9rem; color: var(--text-muted); margin: .75rem 0; }
.report-body code { background: var(--bg-tertiary); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; color: var(--accent); }
.report-body pre code { background: none; padding: 0; color: inherit; }
.report-body pre { background: var(--bg-tertiary); color: var(--text-primary); padding: 1rem; border-radius: 8px; overflow-x: auto; margin: .75rem 0; }
.report-body table { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .88rem; }
.report-body th { background: var(--bg-tertiary); font-weight: 600; color: var(--text-primary); }
.report-body th, .report-body td { padding: .5rem .75rem; border: 1px solid var(--border); text-align: left; color: var(--text-primary); }
.report-body a { color: var(--accent); text-decoration: none; }
.report-body a:hover { text-decoration: underline; }
.report-body hr { border: none; border-top: 1px solid var(--border); margin: 1.2rem 0; }

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.video-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-secondary);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.video-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.4); transform: translateY(-2px); border-color: var(--accent); }
.video-thumb-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #0f0f0f; overflow: hidden; }
.video-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.3); opacity: 0; transition: opacity .15s; }
.video-card:hover .video-play-overlay { opacity: 1; }
.video-play-btn { width: 44px; height: 44px; background: #ff0000; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; }
.video-duration { position: absolute; bottom: .4rem; right: .4rem; background: rgba(0,0,0,.8); color: #fff; font-size: .7rem; font-weight: 600; padding: .1rem .35rem; border-radius: 3px; }
.video-info { padding: .7rem; flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.video-title { font-size: .83rem; font-weight: 600; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.video-meta { font-size: .73rem; color: var(--text-muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.video-meta-dot { opacity: .4; }

.alert-danger { background: rgba(239,68,68,.1); color: var(--danger); border: 1px solid rgba(239,68,68,.25); padding: .85rem 1.1rem; border-radius: var(--radius); font-size: .9rem; margin-bottom: 1rem; }
