/* ===== Design tokens & shared chrome (light default; dark via html[data-theme="dark"]) ===== */

:root {
    --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
    --focus-ring: 0 0 0 2px rgba(99, 102, 241, 0.22);
    --header-h: 56px;
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----- Site header ----- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 3000;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid #dde3ee;
    backdrop-filter: blur(10px);
}

.site-header-inner {
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: min(100%, 520px);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.01em;
    color: #0c1454;
    text-decoration: none;
}

.site-brand:hover {
    text-decoration: none;
}

.site-brand:hover .site-brand-text {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-logo {
    display: block;
    flex-shrink: 0;
    width: auto;
    max-width: 180px;
    max-height: 44px;
    height: auto;
    object-fit: contain;
}

.app-logo--theme-dark {
    display: none;
}

[data-theme="dark"] .app-logo--theme-light {
    display: none;
}

[data-theme="dark"] .app-logo--theme-dark {
    display: block;
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-md);
    border: 1px solid #cfd6e4;
    background: #ffffff;
    cursor: pointer;
    color: #0c1454;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    background: #f4f6fb;
    border-color: #b8c4dc;
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.theme-toggle svg {
    display: none;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.theme-toggle .theme-icon-moon {
    display: block;
}

.theme-toggle .theme-icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .theme-icon-moon {
    display: none;
}

/* ----- Dark theme (presentation overrides; keeps layout & class names) ----- */

[data-theme="dark"] .site-header {
    background: rgba(22, 30, 42, 0.92);
    border-bottom-color: #2f3d52;
}

[data-theme="dark"] .site-brand {
    color: #e8ecff;
}

[data-theme="dark"] .theme-toggle {
    background: #1e2836;
    border-color: #3d4d61;
    color: #e8ecff;
    box-shadow: none;
}

[data-theme="dark"] .theme-toggle:hover {
    background: #263143;
    border-color: #5a6d85;
}

[data-theme="dark"] body {
    background: #0e131a !important;
    color: #e6edf3 !important;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
    color: #e8ecff !important;
}

[data-theme="dark"] .card {
    background: #161d28 !important;
    border-color: #2a3544 !important;
    border-top-color: #8ba3ff !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] .page-intro,
[data-theme="dark"] .panel-tip {
    background: #1a2432 !important;
    color: #b8c5d9 !important;
    border: 1px solid #2f3d52;
}

[data-theme="dark"] .context-line,
[data-theme="dark"] .left-panel-card p,
[data-theme="dark"] .left-panel-card li,
[data-theme="dark"] .left-panel-card div {
    color: #c5d0e0 !important;
}

[data-theme="dark"] .soft-divider {
    border-top-color: #2f3d52 !important;
}

[data-theme="dark"] .btn-primary {
    background: linear-gradient(165deg, #a8b8ff 0%, #8ba4ff 45%, #6b8aed 100%) !important;
    color: #0a0f18 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .btn-primary:hover:not(:disabled):not(.disabled) {
    background: linear-gradient(165deg, #c4d0ff 0%, #a8b8ff 50%, #8ba4ff 100%) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.26) inset,
        0 3px 12px rgba(0, 0, 0, 0.26) !important;
}

[data-theme="dark"] .btn-secondary {
    background: linear-gradient(180deg, #243044 0%, #1e2836 100%) !important;
    color: #e8ecff !important;
    border: 1px solid #3d4d61 !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 1px 4px rgba(0, 0, 0, 0.18) !important;
}

[data-theme="dark"] .btn-secondary:hover:not(:disabled):not(.disabled) {
    background: linear-gradient(180deg, #2d3d52 0%, #263143 100%) !important;
    border-color: #5a6d85 !important;
}

[data-theme="dark"] .btn-danger {
    background: linear-gradient(165deg, #e54848 0%, #b91c1c 45%, #7f1d1d 100%) !important;
    color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.22) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 2px 8px rgba(0, 0, 0, 0.28) !important;
}

[data-theme="dark"] .btn-danger:hover:not(:disabled):not(.disabled) {
    background: linear-gradient(165deg, #f16363 0%, #dc2626 50%, #b91c1c 100%) !important;
}

[data-theme="dark"] .filter-btn.active-filter {
    background: linear-gradient(165deg, #a8b8ff 0%, #8ba4ff 50%, #6b8aed 100%) !important;
    color: #0a0f18 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

/* App shell: flat buttons (match Create SBA Questions page) */
[data-theme="dark"] .app-shell .btn-primary {
    background: #64748b !important;
    color: #f8fafc !important;
    border-color: #64748b !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-primary:hover:not(:disabled):not(.disabled) {
    background: #94a3b8 !important;
    border-color: #94a3b8 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-secondary {
    background: #1e2836 !important;
    color: #e2e8f0 !important;
    border-color: #3d4d61 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-secondary:hover:not(:disabled):not(.disabled) {
    background: #263143 !important;
    border-color: #5a6d85 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-danger {
    background: #b4534d !important;
    color: #ffffff !important;
    border-color: #b4534d !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-danger:hover:not(:disabled):not(.disabled) {
    background: #9f423d !important;
    border-color: #9f423d !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-danger-outline {
    background: transparent !important;
    color: #f0a8a4 !important;
    border-color: #7f4a47 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-danger-outline:hover:not(:disabled):not(.disabled) {
    background: #2a1c1c !important;
    border-color: #9f5a56 !important;
}

[data-theme="dark"] .app-shell .btn-quiet {
    background: transparent !important;
    color: #b8c5d9 !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .btn-quiet:hover:not(:disabled):not(.disabled) {
    background: #1e2836 !important;
    color: #e8ecff !important;
    border-color: #3d4d61 !important;
}

[data-theme="dark"] .app-shell .card {
    background: #161d28 !important;
    border-color: #2a3544 !important;
    border-top-color: #5a6d85 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .app-shell .page-intro,
[data-theme="dark"] .app-shell .helper-box,
[data-theme="dark"] .app-shell .setup-required-notice,
[data-theme="dark"] .app-shell .variant-status-box {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
    color: #9fb0c8 !important;
}

[data-theme="dark"] .app-shell .app-panel-heading,
[data-theme="dark"] .app-shell .generator-panel-heading,
[data-theme="dark"] .app-shell .left-panel-card > h3 {
    color: #e8ecff !important;
}

[data-theme="dark"] .app-shell .empty-state,
[data-theme="dark"] .app-shell .workspace-empty--compact,
[data-theme="dark"] .app-shell .panel-tip--compact {
    color: #9fb0c8 !important;
}

[data-theme="dark"] .page-sba-generator .question-nav-row,
[data-theme="dark"] .page-variant .question-nav-row {
    border-bottom-color: #2f3d52 !important;
}

[data-theme="dark"] .question-nav-label {
    color: #9fb0c8 !important;
}

[data-theme="dark"] #instructions-panel .collapsible-header:hover,
[data-theme="dark"] #original-question-panel .collapsible-header:hover,
[data-theme="dark"] #generated-question-panel .collapsible-header:hover {
    background: #1a2330 !important;
}

[data-theme="dark"] .export-panel-error {
    color: #fca5a5 !important;
}

/* Homepage landing — dark mode readability (light mode unchanged) */

[data-theme="dark"] body.page-home .site-brand,
[data-theme="dark"] body.page-home .site-brand-text {
    color: #f1f5f9 !important;
}

[data-theme="dark"] body.page-home .site-brand:hover .site-brand-text {
    color: #ffffff !important;
}

[data-theme="dark"] .page-home .home-hero-title {
    color: #f8fafc !important;
}

[data-theme="dark"] .page-home .home-hero-subtitle {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .page-home .home-landing-hero {
    background: #141c26 !important;
    border: 1px solid #475569 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28) !important;
}

[data-theme="dark"] .page-home .home-hero-divider {
    border-top-color: #475569 !important;
}

[data-theme="dark"] .page-home .home-hero-action {
    background: #1a2332 !important;
    border-color: #475569 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .page-home .home-hero-action-title {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .page-home .home-hero-action-text {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .page-home .home-hero-action-icon--create {
    color: #94a3b8 !important;
    background: #243044 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .page-home .home-hero-action-icon--variants {
    color: #e8b4b4 !important;
    background: #2a1f1f !important;
    border-color: #6b4545 !important;
}

[data-theme="dark"] .page-home .home-hero-action-btn--create {
    color: #e0e7ff !important;
    border-color: #a5b4fc !important;
    background: transparent !important;
}

[data-theme="dark"] .page-home .home-hero-action-btn--create:hover {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-color: #c7d2fe !important;
}

[data-theme="dark"] .page-home .home-hero-action-btn--variants {
    color: #f0d4d4 !important;
    border-color: #c49a9a !important;
    background: transparent !important;
}

[data-theme="dark"] .page-home .home-hero-action-btn--variants:hover {
    background: #2a1f1f !important;
    border-color: #d4a5a5 !important;
    color: #fce7e7 !important;
}

[data-theme="dark"] .page-home .home-hero-advisory {
    color: #cbd5e1 !important;
    background: #1a2740 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .page-home .home-hero-advisory-icon {
    color: #93c5fd !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-item:not(:last-child)::before {
    background: #475569 !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-copy strong {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-copy p {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-marker--draft {
    color: #93c5fd !important;
    background: #1e3a5f !important;
    border-color: #3b82f6 !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-marker--review {
    color: #cbd5e1 !important;
    background: #243044 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-marker--edit {
    color: #e8b4b4 !important;
    background: #2a1f1f !important;
    border-color: #6b4545 !important;
}

[data-theme="dark"] .page-home .home-workflow-timeline-marker--approve {
    color: #86efac !important;
    background: #14532d !important;
    border-color: #22c55e !important;
}

/* Question preview card — soft off-white in dark mode (readable, not stark) */
[data-theme="dark"] .page-home .home-preview-card {
    background: #eef2f7 !important;
    border-color: #d1d5db !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28) !important;
}

[data-theme="dark"] .page-home .home-preview-stem {
    color: #334155 !important;
}

[data-theme="dark"] .page-home .home-preview-options li {
    color: #475569 !important;
}

[data-theme="dark"] .page-home .home-preview-opt-label {
    color: #64748b !important;
}

[data-theme="dark"] .page-home .home-preview-opt--correct {
    background: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
    color: #166534 !important;
}

[data-theme="dark"] .page-home .home-preview-meta,
[data-theme="dark"] .page-home .home-preview-meta strong {
    color: #64748b !important;
}

[data-theme="dark"] .page-home .home-preview-status {
    color: #64748b !important;
    background: #e8eef4 !important;
    border-color: #d1d5db !important;
}

[data-theme="dark"] .page-home .home-preview-q-badge {
    color: #ffffff !important;
    background: #010057 !important;
}


[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="file"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] #jump-select {
    background: #121922 !important;
    border-color: #3d4d61 !important;
    color: #e6edf3 !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 2px 8px rgba(0, 0, 0, 0.28) inset !important;
}

[data-theme="dark"] input[type="file"] {
    background: #141c26 !important;
    border-color: #4a5d75 !important;
    border-style: dashed !important;
    color: #dce6f2 !important;
    box-shadow: none !important;
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="file"]):focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] #jump-select:focus,
[data-theme="dark"] input[type="file"]:focus {
    outline: none;
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="file"]):focus-visible,
[data-theme="dark"] textarea:focus-visible,
[data-theme="dark"] select:focus-visible,
[data-theme="dark"] #jump-select:focus-visible,
[data-theme="dark"] input[type="file"]:focus-visible {
    border-color: #8ba4ff !important;
    box-shadow:
        0 0 0 1px rgba(139, 164, 255, 0.35),
        0 0 0 4px rgba(139, 164, 255, 0.14),
        0 1px 0 rgba(255, 255, 255, 0.05) inset !important;
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="file"])::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #7d8fa8 !important;
    opacity: 1;
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="file"]):disabled,
[data-theme="dark"] textarea:disabled,
[data-theme="dark"] select:disabled,
[data-theme="dark"] #jump-select:disabled {
    background: #0e1318 !important;
    color: #5c6b82 !important;
    opacity: 0.75 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .generator-form label,
[data-theme="dark"] #edit-panel label,
[data-theme="dark"] .jump-container label {
    color: #dce6f2 !important;
}

[data-theme="dark"] .checkbox-list {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
}

[data-theme="dark"] .checkbox-list label {
    color: #dce6f2 !important;
}

[data-theme="dark"] .question-card {
    background: #161d28 !important;
    border-color: #2f3d52 !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] input[type="checkbox"] {
    accent-color: #8ba4ff;
}

[data-theme="dark"] .question-card p,
[data-theme="dark"] .question-card li {
    color: #d1dde9 !important;
}

[data-theme="dark"] .generator-style-review {
    border-top-color: #2f3d52 !important;
}

[data-theme="dark"] .generator-style-review--na {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
}

[data-theme="dark"] .generator-style-review-na-text {
    color: #94a3b8 !important;
}

[data-theme="dark"] .generator-style-review--clear {
    background: #0f2418 !important;
    border-color: #166534 !important;
    color: #bbf7d0 !important;
}

[data-theme="dark"] .generator-style-review-clear-icon {
    color: #4ade80 !important;
}

[data-theme="dark"] .generator-style-review--warnings {
    background: #2a2210 !important;
    border-color: #854d0e !important;
}

[data-theme="dark"] .generator-style-review-title {
    color: #fcd34d !important;
}

[data-theme="dark"] .generator-style-review-sub {
    color: #d9c79a !important;
}

[data-theme="dark"] .generator-style-warning-item {
    border-top-color: rgba(245, 158, 11, 0.2) !important;
}

[data-theme="dark"] .style-warning-message {
    color: #fde68a !important;
}

[data-theme="dark"] .style-warning-meta {
    color: #d9c79a !important;
}

[data-theme="dark"] .style-warning-field strong {
    color: #fde68a !important;
}

[data-theme="dark"] .style-warning-code {
    background: rgba(0, 0, 0, 0.35) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .style-severity-warning {
    background: #422006 !important;
    color: #fcd34d !important;
    border-color: #854d0e !important;
}

[data-theme="dark"] .generator-ai-review {
    border-color: #3730a3 !important;
    background: #1e1b4b !important;
}

[data-theme="dark"] .generator-ai-review--result {
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%) !important;
}

[data-theme="dark"] .generator-ai-review-title {
    color: #c7d2fe !important;
}

[data-theme="dark"] .generator-ai-review-sub {
    color: #a5b4fc !important;
}

[data-theme="dark"] .generator-ai-review-summary,
[data-theme="dark"] .generator-ai-review-ratings,
[data-theme="dark"] .generator-ai-review-scores {
    color: #e0e7ff !important;
}

[data-theme="dark"] .generator-ai-review-h4 {
    color: #a5b4fc !important;
}

[data-theme="dark"] .generator-ai-review--error {
    background: #450a0a !important;
    border-color: #991b1b !important;
}

[data-theme="dark"] .generator-ai-review-error-text {
    color: #fecaca !important;
}

[data-theme="dark"] .generator-clinical-safety {
    border-color: #854d0e !important;
    background: #422006 !important;
}

[data-theme="dark"] .generator-clinical-safety--result {
    border-color: #166534 !important;
    background: #052e16 !important;
}

[data-theme="dark"] .generator-clinical-safety--faculty {
    border-color: #c2410c !important;
    background: #431407 !important;
}

[data-theme="dark"] .generator-clinical-safety--unsafe {
    border-color: #991b1b !important;
    background: #450a0a !important;
}

[data-theme="dark"] .generator-clinical-safety-title,
[data-theme="dark"] .generator-clinical-safety-summary,
[data-theme="dark"] .generator-clinical-safety-ratings {
    color: #fef3c7 !important;
}

[data-theme="dark"] .generator-clinical-safety-bullets {
    color: #fde68a !important;
}

[data-theme="dark"] .style-severity-high {
    background: #431407 !important;
    color: #fdba74 !important;
    border-color: #9a3412 !important;
}

[data-theme="dark"] .style-severity-error {
    background: #450a0a !important;
    color: #fecaca !important;
    border-color: #991b1b !important;
}

[data-theme="dark"] .style-severity-info {
    background: #082f49 !important;
    color: #bae6fd !important;
    border-color: #0369a1 !important;
}

[data-theme="dark"] .question-status[data-status="Draft"] {
    background: #252d3d !important;
    color: #c4d0ff !important;
}

[data-theme="dark"] .question-status[data-status="Done"] {
    background: #14532d !important;
    color: #bbf7d0 !important;
}

[data-theme="dark"] .question-status[data-status="Rejected"] {
    background: #450a0a !important;
    color: #fecaca !important;
}

[data-theme="dark"] .question-actions button,
[data-theme="dark"] #close-edit-panel,
[data-theme="dark"] #prev-question-btn,
[data-theme="dark"] #next-question-btn,
[data-theme="dark"] #prev-source-btn,
[data-theme="dark"] #next-source-btn,
[data-theme="dark"] #prev-source-btn-original,
[data-theme="dark"] #next-source-btn-original,
[data-theme="dark"] #next-draft-btn {
    background: linear-gradient(165deg, #a8b8ff 0%, #8ba4ff 45%, #6b8aed 100%) !important;
    color: #0a0f18 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .question-actions button:hover:not(:disabled),
[data-theme="dark"] #close-edit-panel:hover:not(:disabled),
[data-theme="dark"] #prev-question-btn:hover:not(:disabled),
[data-theme="dark"] #next-question-btn:hover:not(:disabled),
[data-theme="dark"] #prev-source-btn:hover:not(:disabled),
[data-theme="dark"] #next-source-btn:hover:not(:disabled),
[data-theme="dark"] #prev-source-btn-original:hover:not(:disabled),
[data-theme="dark"] #next-source-btn-original:hover:not(:disabled),
[data-theme="dark"] #next-draft-btn:hover:not(:disabled) {
    background: linear-gradient(165deg, #c4d0ff 0%, #a8b8ff 50%, #8ba4ff 100%) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.26) inset,
        0 3px 12px rgba(0, 0, 0, 0.26) !important;
}

[data-theme="dark"] .question-actions .reject-btn,
[data-theme="dark"] .btn-danger.reject-btn {
    background: linear-gradient(165deg, #e54848 0%, #b91c1c 45%, #7f1d1d 100%) !important;
    color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.22) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 2px 8px rgba(0, 0, 0, 0.28) !important;
}

[data-theme="dark"] .question-actions .reject-btn:hover:not(:disabled),
[data-theme="dark"] .btn-danger.reject-btn:hover:not(:disabled) {
    background: linear-gradient(165deg, #f16363 0%, #dc2626 50%, #b91c1c 100%) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.14) inset,
        0 3px 12px rgba(0, 0, 0, 0.32) !important;
}

[data-theme="dark"] .progress-status {
    background: #1a2432 !important;
    border-color: #3d4d61 !important;
    color: #dce6f2 !important;
}

[data-theme="dark"] .progress-spinner {
    border-color: #3d4d61 !important;
    border-top-color: #8ba4ff !important;
}

[data-theme="dark"] .variant-success-status {
    background: #14532d !important;
    border-color: #166534 !important;
    color: #bbf7d0 !important;
}

[data-theme="dark"] .variant-error-status {
    background: #450a0a !important;
    border-color: #7f1d1d !important;
    color: #fecaca !important;
}

[data-theme="dark"] #edit-panel-wrapper {
    background: #161d28 !important;
    border-left-color: #2f3d52 !important;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] #edit-panel-header {
    background: #161d28 !important;
    border-bottom-color: #2f3d52 !important;
}

[data-theme="dark"] #save-question-btn {
    background: linear-gradient(165deg, #a8b8ff 0%, #8ba4ff 45%, #6b8aed 100%) !important;
    color: #0a0f18 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] #save-question-btn:hover {
    background: linear-gradient(165deg, #c4d0ff 0%, #a8b8ff 50%, #8ba4ff 100%) !important;
}

[data-theme="dark"] body.edit-panel-open::before {
    background: rgba(0, 0, 0, 0.55) !important;
}

[data-theme="dark"] .autosave-status {
    background: #1a2432 !important;
    color: #b8c5d9 !important;
}

[data-theme="dark"] .autosave-status.pending {
    background: #422006 !important;
    color: #fde68a !important;
}

[data-theme="dark"] .autosave-status.saving {
    background: #1e2836 !important;
    color: #c4d0ff !important;
}

[data-theme="dark"] .autosave-status.saved {
    background: #14532d !important;
    color: #bbf7d0 !important;
}

[data-theme="dark"] .autosave-status.error {
    background: #450a0a !important;
    color: #fecaca !important;
}

[data-theme="dark"] .app-modal-overlay {
    background: rgba(0, 0, 0, 0.65) !important;
}

[data-theme="dark"] .app-modal {
    background: #161d28 !important;
    border-color: #2f3d52 !important;
    box-shadow: var(--shadow-lg) !important;
}

[data-theme="dark"] .app-modal-header {
    background: #1a2432 !important;
    border-bottom-color: #2f3d52 !important;
}

[data-theme="dark"] .export-forms-note {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
    color: #9fb0c8 !important;
}

[data-theme="dark"] .export-forms-note strong {
    color: #dce6f2 !important;
}

[data-theme="dark"] .app-modal-body p {
    color: #d1dde9 !important;
}

[data-theme="dark"] .modal-icon-btn {
    color: #b8c5d9 !important;
}

[data-theme="dark"] .modal-icon-btn:hover {
    color: #e8ecff !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

[data-theme="dark"] .modal-icon-btn:focus-visible {
    border-color: #5a6d85 !important;
    background: rgba(139, 164, 255, 0.12) !important;
    box-shadow: 0 0 0 2px rgba(139, 164, 255, 0.22) !important;
}

[data-theme="dark"] .info-icon {
    background: #252d3d !important;
    color: #c4d0ff !important;
}

[data-theme="dark"] .export-ready-item {
    border-bottom-color: #2f3d52 !important;
}

[data-theme="dark"] .export-ready-title {
    color: #e6edf3 !important;
}

[data-theme="dark"] .variant-status-box {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
}

[data-theme="dark"] .variant-selection-count {
    color: #c4d0ff !important;
}

[data-theme="dark"] .variant-source-item {
    background: #161d28 !important;
    border-color: #2f3d52 !important;
}

[data-theme="dark"] .variant-source-item.active {
    border-color: #8ba4ff !important;
    background: #1e2836 !important;
}

[data-theme="dark"] .variant-preview-table th {
    background: #1a2432 !important;
    color: #e8ecff !important;
}

[data-theme="dark"] .variant-preview-table td,
[data-theme="dark"] .variant-preview-table th {
    border-bottom-color: #2f3d52 !important;
    color: #dce6f2 !important;
}

[data-theme="dark"] .variant-preview-table-wrap,
[data-theme="dark"] .variant-table-wrap {
    border-color: #2f3d52 !important;
    background: #121922 !important;
}

[data-theme="dark"] .variant-preview-table tbody tr:nth-child(even) td {
    background: #141c26 !important;
}

[data-theme="dark"] .variant-review-empty {
    color: #9fb0c8 !important;
}

[data-theme="dark"] .variant-current-include {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
    color: #e6edf3 !important;
}

[data-theme="dark"] .variant-edit-panel {
    background: #141c26 !important;
    border-color: #2f3d52 !important;
}

[data-theme="dark"] .variant-debug-pre {
    background: #0e131a !important;
    border-color: #2f3d52 !important;
    color: #dce6f2 !important;
}

[data-theme="dark"] .correct-option {
    background: #14532d !important;
    border-left-color: #4ade80 !important;
}

[data-theme="dark"] .distractor-option {
    background: #1a2432 !important;
}

[data-theme="dark"] .chevron {
    color: #9fb0c8 !important;
}

[data-theme="dark"] #question-counter,
[data-theme="dark"] #source-counter,
[data-theme="dark"] #source-counter-original {
    color: #b8c5d9 !important;
}

[data-theme="dark"] .home-hero-logo {
    filter: brightness(1.05) contrast(1.02);
}

/* ----- Scrollbars (Firefox + WebKit) ----- */
* {
    scrollbar-width: thin;
    scrollbar-color: #b8c4d9 #eef1f7;
}

[data-theme="dark"] * {
    scrollbar-color: #3d4d61 #0e131a;
}

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

::-webkit-scrollbar-track {
    background: #eef1f7;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: #b8c4d9;
    border-radius: 8px;
    border: 2px solid #eef1f7;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0e131a;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3d4d61;
    border-color: #0e131a;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .progress-spinner {
        animation: none !important;
        border-top-color: #010057;
        opacity: 0.85;
    }

    [data-theme="dark"] .progress-spinner {
        border-top-color: #8ba4ff;
    }

    #edit-panel-wrapper {
        transition: none !important;
    }

    .collapsible .chevron,
    #instructions-panel .chevron,
    #original-question-panel .chevron,
    #generated-question-panel .chevron {
        transition: none !important;
    }

    .btn,
    #save-question-btn,
    .question-actions button,
    #close-edit-panel,
    #prev-question-btn,
    #next-question-btn,
    #prev-source-btn,
    #next-source-btn,
    #prev-source-btn-original,
    #next-source-btn-original,
    #next-draft-btn,
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not([type="file"]),
    select,
    textarea,
    #jump-select,
    input[type="file"] {
        transition: none !important;
    }

    .btn:hover:not(:disabled):not(.disabled),
    #save-question-btn:hover {
        transform: none !important;
    }
}

@media (max-width: 640px) {
    .site-brand {
        gap: 8px;
        max-width: calc(100vw - 88px);
    }

    .site-brand-text {
        font-size: 14px;
    }

    .app-logo {
        max-height: 38px;
        max-width: 140px;
    }
}
