:root,
[data-theme="indigo"] {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #e0e7ff;
    --topbar-gradient: linear-gradient(135deg, #4338ca 0%, #1e1b4b 100%);
    --accent: #d97706;
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --surface-subtle: #f8fafc;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #ca8a04;
    --warning-light: #fef9c3;
    --info: #2563eb;
    --info-light: #dbeafe;
}

[data-theme="esmeralda"] {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-light: #ccfbf1;
    --topbar-gradient: linear-gradient(135deg, #0f766e 0%, #064e3b 100%);
    --bg: #f3f8f7;
}

[data-theme="oceano"] {
    --primary: #0284c7;
    --primary-dark: #0369a1;
    --primary-light: #e0f2fe;
    --topbar-gradient: linear-gradient(135deg, #0284c7 0%, #0c4a6e 100%);
    --bg: #f0f7ff;
}

[data-theme="purpura"] {
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --primary-light: #f3e8ff;
    --topbar-gradient: linear-gradient(135deg, #7c3aed 0%, #3b0764 100%);
    --bg: #f8f5ff;
}

[data-theme="terracota"] {
    --primary: #ea580c;
    --primary-dark: #9a3412;
    --primary-light: #ffedd5;
    --topbar-gradient: linear-gradient(135deg, #c2410c 0%, #431407 100%);
    --bg: #faf8f5;
    --surface-subtle: #fffbeb;
}

[data-theme="oscuro"] {
    --primary: #6366f1;
    --primary-dark: #818cf8;
    --primary-light: rgba(99, 102, 241, 0.2);
    --topbar-gradient: linear-gradient(135deg, #1e1b4b 0%, #090d16 100%);
    --bg: #0b1120;
    --card-bg: #1e293b;
    --surface-subtle: #0f172a;
    --input-bg: #0f172a;
    --input-border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

body {
    font-family: 'Segoe UI Variable Text', 'Segoe UI Variable Display', 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    background-image:
        radial-gradient(at 0% 0%, var(--primary-light) 0px, transparent 52%),
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.07) 0px, transparent 48%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar estilo Windows 11 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Barra de título superior nativa estilo Windows 11 (Mica / Fluent) */
.win11-titlebar {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 14px;
    background: rgba(15, 23, 42, 0.28);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    -webkit-app-region: drag;
    user-select: none;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.92);
}

.win11-titlebar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.win11-app-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: block;
}

.win11-app-title {
    font-weight: 600;
    letter-spacing: 0.1px;
    font-size: 0.78rem;
}

.win11-badge {
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.win11-caption-btns {
    display: flex;
    align-items: stretch;
    height: 38px;
    -webkit-app-region: no-drag;
}

.win11-caption-btn {
    width: 46px;
    height: 38px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.win11-caption-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.win11-caption-btn:active {
    background: rgba(255, 255, 255, 0.06);
}

.win11-caption-close:hover {
    background: #c42b1c !important;
    color: #ffffff !important;
}

.win11-caption-close:active {
    background: #b12618 !important;
}

/* Navbar / Header (Fija arriba en todo momento) */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1200;
    background: var(--topbar-gradient);
    color: #fff;
    padding: 0.85rem 1.5rem;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.16);
    transition: background 0.35s ease, box-shadow 0.35s ease;
}

.topbar.has-win11-bar {
    padding: 0 0 0.8rem 0;
}

.topbar.has-win11-bar .topbar-inner {
    padding: 0.75rem 1.5rem 0 1.5rem;
}

@keyframes topbarWarningBlink {
    0%, 100% {
        background: linear-gradient(135deg, #b45309 0%, #991b1b 100%);
        box-shadow: 0 4px 20px rgba(220, 38, 38, 0.45);
    }
    50% {
        background: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
        box-shadow: 0 4px 28px rgba(245, 158, 11, 0.75);
    }
}

@keyframes badgeAlertPulse {
    0%, 100% {
        transform: scale(1);
        background: #dc2626;
        border-color: #fde047;
        box-shadow: 0 0 0 0 rgba(254, 240, 138, 0.7);
    }
    50% {
        transform: scale(1.06);
        background: #b91c1c;
        border-color: #ffffff;
        box-shadow: 0 0 14px 4px rgba(254, 240, 138, 0.55);
    }
}

.topbar.timer-warning {
    animation: topbarWarningBlink 1.6s infinite ease-in-out;
}

.topbar.timer-closed {
    background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
}

.timer-badge-warning {
    animation: badgeAlertPulse 1.1s infinite ease-in-out !important;
    color: #fef08a !important;
}

/* Velo de pantalla al terminar el tiempo */
.time-up-veil {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.time-up-veil.visible {
    display: flex;
}

.time-up-veil-card {
    background: #ffffff;
    border: 2px solid #dc2626;
    border-radius: 16px;
    max-width: 540px;
    width: 100%;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.brand p {
    font-size: 0.88rem;
    opacity: 0.88;
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-link {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
}

.btn-link:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Controles de ventana propios del programa (Sin bordes nativos de Windows) */
.topbar-frameless {
    -webkit-app-region: drag;
    user-select: none;
}

.topbar-frameless button,
.topbar-frameless a,
.topbar-frameless input,
.topbar-frameless label,
.topbar-frameless .nav-links {
    -webkit-app-region: no-drag;
}

.app-win-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
    -webkit-app-region: no-drag;
}

.app-win-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.app-win-btn:hover {
    background: rgba(255, 255, 255, 0.26);
    transform: translateY(-1px);
}

.app-win-close {
    background: rgba(239, 68, 68, 0.88);
    border-color: rgba(254, 202, 202, 0.5);
    font-size: 1rem;
}

.app-win-close:hover {
    background: #dc2626;
    border-color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.45);
    transform: scale(1.06);
}

.container {
    max-width: 1100px;
    margin: 1.8rem auto;
    padding: 0 1.25rem 3rem;
}

/* Tabs (Estilo Windows 11 Segmented Pivot) */
.tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 1.4rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.3rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.16s ease;
    position: relative;
}

.tab-btn:hover {
    background: var(--surface-subtle);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
}

/* Cards (Superficie WinUI 3 / Mica) */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 1.55rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), 0 0 1px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.card-header {
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.85rem;
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

/* Reading Box */
.reading-box {
    background: var(--card-bg);
    border-top: 4px solid var(--primary);
    padding: 1.75rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}

.reading-meta {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.75rem;
}

.reading-title {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 0.35rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.reading-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.reading-content p {
    margin-bottom: 1.1rem;
    font-size: 1.04rem;
    line-height: 1.78;
    color: var(--text);
    text-align: justify;
}

.reading-content p:last-child {
    margin-bottom: 0;
}

.reading-content h1, .reading-content h2, .reading-content h3 {
    color: var(--text);
    margin: 1.2rem 0 0.6rem;
}

.reading-content ul, .reading-content ol {
    margin: 0.75rem 0 1.1rem 1.6rem;
}

.reading-content blockquote {
    border-left: 4px solid var(--primary);
    background: var(--surface-subtle);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-style: italic;
}

/* Word-like Editor */
.word-editor-wrapper {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
}

.word-toolbar {
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e1;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.word-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding-right: 0.5rem;
    margin-right: 0.25rem;
    border-right: 1px solid #cbd5e1;
}

.word-toolbar-group:last-child {
    border-right: none;
}

.word-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.word-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.word-select {
    padding: 0.32rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.84rem;
    background: #fff;
    color: #1e293b;
}

.word-canvas-container {
    padding: 1.5rem;
    background: #e2e8f0;
    max-height: 520px;
    overflow-y: auto;
}

.word-page {
    background: #ffffff;
    max-width: 820px;
    min-height: 360px;
    margin: 0 auto;
    padding: 2.25rem 2.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    outline: none;
    font-size: 1.03rem;
    line-height: 1.75;
    color: #1e293b;
}

.word-page:focus {
    box-shadow: 0 0 0 2px var(--primary), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.word-page p {
    margin-bottom: 1rem;
}

.builder-question-card {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.15rem;
}

/* Task Type Selector Cards */
.task-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.task-type-option {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.15rem;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.task-type-option:hover {
    border-color: var(--primary);
    background: #f0fdfa;
}

.task-type-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.12);
}

.task-type-icon {
    font-size: 1.7rem;
    line-height: 1;
}

/* Responsive 16:9 YouTube Video Container */
.video-section-list {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    margin: 1.15rem 0;
}

.video-item-card {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
}

.video-item-header {
    background: #1e293b;
    color: #f8fafc;
    padding: 0.7rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.92rem;
}

.video-item-header a {
    color: #5eead4;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
}

.video-item-header a:hover {
    text-decoration: underline;
}

.video-responsive {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    background: #000;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Featured Cover Image */
.featured-cover-wrapper {
    width: 100%;
    max-height: 360px;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    background: #0f172a;
}

.featured-cover-wrapper img {
    width: 100%;
    height: 100%;
    max-height: 360px;
    object-fit: cover;
    display: block;
}

/* Simulated WhatsApp Link Preview Card */
.whatsapp-preview-card {
    background: #dcf8c6;
    border: 1px solid #b7e49c;
    border-radius: 12px;
    padding: 0.65rem;
    max-width: 380px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.whatsapp-preview-inner {
    background: #f0f9eb;
    border-left: 4px solid #25d366;
    border-radius: 8px;
    overflow: hidden;
}

.whatsapp-preview-inner img {
    width: 100%;
    height: 165px;
    object-fit: cover;
    display: block;
}

.whatsapp-preview-text {
    padding: 0.55rem 0.75rem;
}

.whatsapp-preview-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #111827;
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

.whatsapp-preview-desc {
    font-size: 0.8rem;
    color: #4b5563;
    line-height: 1.35;
}

/* Real-Time Status Pulse */
@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2563eb;
    margin-right: 6px;
    animation: pulseDot 1.8s infinite;
}

/* Floating Bottom Unsaved Changes Bar */
.floating-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.85rem 1.5rem;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.25);
    z-index: 1500;
    transform: translateY(110%);
    transition: transform 0.25s ease-in-out;
    border-top: 3px solid var(--accent);
}

.floating-save-bar.visible {
    transform: translateY(0);
}

.floating-save-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.unsaved-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
    margin-right: 8px;
}

/* Form Elements */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text);
    font-size: 0.9rem;
}

.input-control,
.textarea-control,
.select-control {
    width: 100%;
    padding: 0.62rem 0.85rem;
    border: 1px solid var(--input-border);
    border-bottom: 2px solid #94a3b8;
    border-radius: 6px;
    font-size: 0.93rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    background: var(--input-bg);
}

.input-control:hover,
.textarea-control:hover,
.select-control:hover {
    border-color: #94a3b8;
}

.input-control:focus,
.textarea-control:focus,
.select-control:focus {
    outline: none;
    border-color: var(--input-border);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.textarea-control {
    min-height: 110px;
    resize: vertical;
}

.question-item {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.1rem;
}

.question-num {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.76rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}

.question-text {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    font-size: 0.98rem;
}

.mc-option-item,
.vf-option-item,
.rel-pair-row {
    background: var(--card-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text) !important;
    border-radius: 10px;
    transition: border-color 0.15s;
}

.mc-option-item:hover,
.vf-option-item:hover {
    border-color: var(--primary) !important;
}

/* Buttons (Estilo Fluent UI Windows 11) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.58rem 1.15rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.14s ease;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(15, 23, 42, 0.08);
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-warning {
    background: var(--accent);
    color: #fff;
}

.btn-warning:hover {
    background: #b45309;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

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

.btn-outline:hover {
    background: var(--surface-subtle);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-pendiente {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-calificado {
    background: var(--success-light);
    color: var(--success);
}

.badge-devuelto {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-reenviado {
    background: var(--info-light);
    color: var(--info);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: #14532d;
    border: 1px solid #86efac;
}

.alert-error {
    background: var(--danger-light);
    color: #7f1d1d;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: var(--warning-light);
    color: #713f12;
    border: 1px solid #fde047;
}

/* Admin Stats & Table */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 0.2rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

th, td {
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

th {
    background: var(--surface-subtle);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tr:hover td {
    background: var(--surface-subtle);
}

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

.modal-backdrop.open {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    color: var(--text);
    border-radius: 16px;
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.guia-box {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    color: var(--primary-dark);
    margin-bottom: 0.6rem;
    border-radius: 6px;
}

.student-answer-box {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    white-space: pre-wrap;
    margin-bottom: 0.65rem;
}

/* Student Login / Session Gateway (Diseño Comercial SaaS) */
.gateway-wrapper {
    max-width: 520px;
    margin: 2.5rem auto;
    padding: 0 1.25rem;
}

.gateway-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.12);
}

.session-code-highlight {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: #92400e;
    margin-bottom: 1.25rem;
    font-size: 0.86rem;
}

.session-code-pill {
    display: inline-block;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #78350f;
    font-family: monospace;
    font-size: 1rem;
    font-weight: 800;
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
    letter-spacing: 0.04em;
}

.active-session-bar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.75rem 1.15rem;
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

/* Theme Picker Cards */
.theme-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 0.65rem;
}

.theme-card-option {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--card-bg);
    transition: all 0.18s ease;
}

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

.theme-card-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.theme-swatch-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 5px rgba(0,0,0,0.18);
}

@media (max-width: 640px) {
    .reading-box {
        padding: 1.25rem;
    }
    .reading-content p {
        text-align: left;
    }
    .gateway-card {
        padding: 1.35rem;
    }
}
