/* ===== CSS Variables (Theme System) ===== */
:root {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-primary-rgb: 255, 255, 255;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;

    --accent-primary: #3b82f6;
    --accent-secondary: #6366f1;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-primary-rgb: 59, 130, 246;
    --accent-secondary-rgb: 99, 102, 241;
    --accent-active-bg: rgba(59, 130, 246, 0.14);
    --accent-active-bg-strong: rgba(59, 130, 246, 0.18);

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    --header-height: 70px;
    --footer-height: auto;
}


[data-palette="indigo"] {
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --accent-glow: rgba(99, 102, 241, 0.15);
    --accent-primary-rgb: 99, 102, 241;
    --accent-secondary-rgb: 139, 92, 246;
    --accent-active-bg: rgba(99, 102, 241, 0.13);
    --accent-active-bg-strong: rgba(99, 102, 241, 0.18);
}

[data-palette="sky"] {
    --accent-primary: #0ea5e9;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    --accent-glow: rgba(14, 165, 233, 0.15);
    --accent-primary-rgb: 14, 165, 233;
    --accent-secondary-rgb: 6, 182, 212;
    --accent-active-bg: rgba(14, 165, 233, 0.13);
    --accent-active-bg-strong: rgba(14, 165, 233, 0.18);
}

[data-palette="teal"] {
    --accent-primary: #14b8a6;
    --accent-secondary: #10b981;
    --accent-gradient: linear-gradient(135deg, #14b8a6 0%, #10b981 100%);
    --accent-glow: rgba(20, 184, 166, 0.15);
    --accent-primary-rgb: 20, 184, 166;
    --accent-secondary-rgb: 16, 185, 129;
    --accent-active-bg: rgba(20, 184, 166, 0.13);
    --accent-active-bg-strong: rgba(20, 184, 166, 0.18);
}

[data-palette="emerald"] {
    --accent-primary: #10b981;
    --accent-secondary: #84cc16;
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #84cc16 100%);
    --accent-glow: rgba(16, 185, 129, 0.15);
    --accent-primary-rgb: 16, 185, 129;
    --accent-secondary-rgb: 132, 204, 22;
    --accent-active-bg: rgba(16, 185, 129, 0.13);
    --accent-active-bg-strong: rgba(16, 185, 129, 0.18);
}

[data-palette="lime"] {
    --accent-primary: #84cc16;
    --accent-secondary: #22c55e;
    --accent-gradient: linear-gradient(135deg, #84cc16 0%, #22c55e 100%);
    --accent-glow: rgba(132, 204, 22, 0.15);
    --accent-primary-rgb: 132, 204, 22;
    --accent-secondary-rgb: 34, 197, 94;
    --accent-active-bg: rgba(132, 204, 22, 0.13);
    --accent-active-bg-strong: rgba(132, 204, 22, 0.18);
}

[data-palette="amber"] {
    --accent-primary: #f59e0b;
    --accent-secondary: #f97316;
    --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --accent-glow: rgba(245, 158, 11, 0.16);
    --accent-primary-rgb: 245, 158, 11;
    --accent-secondary-rgb: 249, 115, 22;
    --accent-active-bg: rgba(245, 158, 11, 0.13);
    --accent-active-bg-strong: rgba(245, 158, 11, 0.18);
}

[data-palette="orange"] {
    --accent-primary: #f97316;
    --accent-secondary: #ef4444;
    --accent-gradient: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    --accent-glow: rgba(249, 115, 22, 0.16);
    --accent-primary-rgb: 249, 115, 22;
    --accent-secondary-rgb: 239, 68, 68;
    --accent-active-bg: rgba(249, 115, 22, 0.13);
    --accent-active-bg-strong: rgba(249, 115, 22, 0.18);
}

[data-palette="rose"] {
    --accent-primary: #ec4899;
    --accent-secondary: #db2777;
    --accent-gradient: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    --accent-glow: rgba(236, 72, 153, 0.15);
    --accent-primary-rgb: 236, 72, 153;
    --accent-secondary-rgb: 219, 39, 119;
    --accent-active-bg: rgba(236, 72, 153, 0.13);
    --accent-active-bg-strong: rgba(236, 72, 153, 0.18);
}

[data-palette="violet"] {
    --accent-primary: #8b5cf6;
    --accent-secondary: #d946ef;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    --accent-glow: rgba(139, 92, 246, 0.15);
    --accent-primary-rgb: 139, 92, 246;
    --accent-secondary-rgb: 217, 70, 239;
    --accent-active-bg: rgba(139, 92, 246, 0.13);
    --accent-active-bg-strong: rgba(139, 92, 246, 0.18);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-primary-rgb: 15, 23, 42;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #60a5fa;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #60a5fa 0%, #818cf8 100%);
    --accent-glow: rgba(96, 165, 250, 0.2);
    --accent-primary-rgb: 96, 165, 250;
    --accent-secondary-rgb: 129, 140, 248;
    --accent-active-bg: rgba(96, 165, 250, 0.16);
    --accent-active-bg-strong: rgba(96, 165, 250, 0.22);

    --border-color: #334155;
    --border-light: #1e293b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"][data-palette="indigo"] {
    --accent-primary: #818cf8;
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    --accent-glow: rgba(129, 140, 248, 0.22);
    --accent-primary-rgb: 129, 140, 248;
    --accent-secondary-rgb: 167, 139, 250;
    --accent-active-bg: rgba(129, 140, 248, 0.16);
    --accent-active-bg-strong: rgba(129, 140, 248, 0.22);
}

[data-theme="dark"][data-palette="sky"] {
    --accent-primary: #38bdf8;
    --accent-secondary: #22d3ee;
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #22d3ee 100%);
    --accent-glow: rgba(56, 189, 248, 0.22);
    --accent-primary-rgb: 56, 189, 248;
    --accent-secondary-rgb: 34, 211, 238;
    --accent-active-bg: rgba(56, 189, 248, 0.16);
    --accent-active-bg-strong: rgba(56, 189, 248, 0.22);
}

[data-theme="dark"][data-palette="teal"] {
    --accent-primary: #2dd4bf;
    --accent-secondary: #34d399;
    --accent-gradient: linear-gradient(135deg, #2dd4bf 0%, #34d399 100%);
    --accent-glow: rgba(45, 212, 191, 0.2);
    --accent-primary-rgb: 45, 212, 191;
    --accent-secondary-rgb: 52, 211, 153;
    --accent-active-bg: rgba(45, 212, 191, 0.15);
    --accent-active-bg-strong: rgba(45, 212, 191, 0.21);
}

[data-theme="dark"][data-palette="emerald"] {
    --accent-primary: #34d399;
    --accent-secondary: #a3e635;
    --accent-gradient: linear-gradient(135deg, #34d399 0%, #a3e635 100%);
    --accent-glow: rgba(52, 211, 153, 0.2);
    --accent-primary-rgb: 52, 211, 153;
    --accent-secondary-rgb: 163, 230, 53;
    --accent-active-bg: rgba(52, 211, 153, 0.15);
    --accent-active-bg-strong: rgba(52, 211, 153, 0.21);
}

[data-theme="dark"][data-palette="lime"] {
    --accent-primary: #a3e635;
    --accent-secondary: #4ade80;
    --accent-gradient: linear-gradient(135deg, #a3e635 0%, #4ade80 100%);
    --accent-glow: rgba(163, 230, 53, 0.17);
    --accent-primary-rgb: 163, 230, 53;
    --accent-secondary-rgb: 74, 222, 128;
    --accent-active-bg: rgba(163, 230, 53, 0.14);
    --accent-active-bg-strong: rgba(163, 230, 53, 0.20);
}

[data-theme="dark"][data-palette="amber"] {
    --accent-primary: #fbbf24;
    --accent-secondary: #fb923c;
    --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #fb923c 100%);
    --accent-glow: rgba(251, 191, 36, 0.2);
    --accent-primary-rgb: 251, 191, 36;
    --accent-secondary-rgb: 251, 146, 60;
    --accent-active-bg: rgba(251, 191, 36, 0.15);
    --accent-active-bg-strong: rgba(251, 191, 36, 0.21);
}

[data-theme="dark"][data-palette="orange"] {
    --accent-primary: #fb923c;
    --accent-secondary: #f87171;
    --accent-gradient: linear-gradient(135deg, #fb923c 0%, #f87171 100%);
    --accent-glow: rgba(251, 146, 60, 0.18);
    --accent-primary-rgb: 251, 146, 60;
    --accent-secondary-rgb: 248, 113, 113;
    --accent-active-bg: rgba(251, 146, 60, 0.14);
    --accent-active-bg-strong: rgba(251, 146, 60, 0.21);
}

[data-theme="dark"][data-palette="rose"] {
    --accent-primary: #f472b6;
    --accent-secondary: #ec4899;
    --accent-gradient: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
    --accent-glow: rgba(244, 114, 182, 0.2);
    --accent-primary-rgb: 244, 114, 182;
    --accent-secondary-rgb: 236, 72, 153;
    --accent-active-bg: rgba(244, 114, 182, 0.15);
    --accent-active-bg-strong: rgba(244, 114, 182, 0.21);
}

[data-theme="dark"][data-palette="violet"] {
    --accent-primary: #a78bfa;
    --accent-secondary: #e879f9;
    --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #e879f9 100%);
    --accent-glow: rgba(167, 139, 250, 0.21);
    --accent-primary-rgb: 167, 139, 250;
    --accent-secondary-rgb: 232, 121, 249;
    --accent-active-bg: rgba(167, 139, 250, 0.16);
    --accent-active-bg-strong: rgba(167, 139, 250, 0.22);
}

/* ===== Page Loader ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    animation: pulse-logo 1.5s ease-in-out infinite;
    box-shadow:
        0 0 20px rgba(var(--accent-primary-rgb), 0.4),
        0 0 40px rgba(var(--accent-secondary-rgb), 0.3),
        0 0 60px rgba(var(--accent-primary-rgb), 0.2);
}

[data-theme="dark"] .loader-logo {
    box-shadow:
        0 0 20px rgba(var(--accent-primary-rgb), 0.5),
        0 0 40px rgba(var(--accent-secondary-rgb), 0.4),
        0 0 60px rgba(var(--accent-primary-rgb), 0.25);
}

@keyframes pulse-logo {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        transform: scale(1.08);
        opacity: 0.9;
        filter: brightness(1.1);
    }
}

.loader-spinner {
    width: 48px;
    height: 48px;
    position: relative;
}

.loader-spinner::before,
.loader-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.loader-spinner::before {
    width: 100%;
    height: 100%;
    border: 3px solid var(--border-color);
}

.loader-spinner::after {
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    animation: spin 0.8s linear infinite;
}

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

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 0%,
            var(--bg-secondary) 50%,
            var(--bg-tertiary) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 180px;
    height: 180px;
    border-radius: var(--radius-xl);
    margin: 0 auto 1.5rem;
}

.skeleton-card {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.skeleton-button {
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius-lg);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-base), color var(--transition-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

h3 {
    font-size: clamp(1.125rem, 3vw, 1.375rem);
}

p {
    color: var(--text-secondary);
    line-height: 1.75;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ===== Header & Navigation ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.28);
    z-index: 1000;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), color var(--transition-base);
}

/* Glassmorphism en ::before para que nav y otros hijos puedan usar backdrop-filter */
header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.12), transparent 36%),
        rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);
    transition: background var(--transition-base);
}

[data-theme="dark"] header::before {
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.14), transparent 38%),
        rgba(15, 23, 42, 0.48);
}

header.scrolled {
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12), 0 12px 34px rgba(var(--accent-primary-rgb), 0.1);
}

[data-theme="dark"] header.scrolled {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28), 0 12px 34px rgba(var(--accent-primary-rgb), 0.1);
}

/* ── Fallback text (antes de que JS detecte data-surface) ── */
header .logo {
    color: #1e293b;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] header .logo {
    color: #f1f5f9;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

header nav a {
    color: #1e293b;
}

header nav a:hover {
    color: #0f172a;
    background: rgba(226, 232, 240, 0.75);
}

header nav a.activo {
    color: var(--accent-primary);
    background: var(--accent-active-bg);
}

[data-theme="dark"] header nav a {
    color: #e2e8f0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] header nav a:hover {
    color: #f8fafc;
    background: rgba(51, 65, 85, 0.7);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] header nav a.activo {
    color: var(--accent-primary);
    background: var(--accent-active-bg-strong);
}

header .notifications-button {
    background: rgba(226, 232, 240, 0.85);
    border-color: rgba(203, 213, 225, 0.9);
    box-shadow: none;
}

[data-theme="dark"] header .notifications-button {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(71, 85, 105, 0.7);
}

header .theme-toggle {
    background: rgba(226, 232, 240, 0.85);
    border-color: rgba(203, 213, 225, 0.9);
}

header .theme-toggle-thumb {
    background: #ffffff;
}

header .theme-toggle-thumb svg,
header .mobile-menu-btn {
    color: #475569;
}

[data-theme="dark"] header .theme-toggle {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(71, 85, 105, 0.7);
}

[data-theme="dark"] header .theme-toggle-thumb {
    background: #0f172a;
}

[data-theme="dark"] header .theme-toggle-thumb svg,
[data-theme="dark"] header .mobile-menu-btn {
    color: #cbd5e1;
}

/* ── data-surface: cambia el TEMA COMPLETO del header según el contenido bajo él ── */
/* Especificidad: html header[data-surface] = (0,1,2) > [data-theme] header = (0,1,1) → siempre gana en fondo */
/* Con elementos hijos: (0,1,4) > (0,1,3) → siempre gana en texto */

/* Contenido claro debajo → header completo en modo claro (aunque el tema sea oscuro) */
html header[data-surface="light"] {
    border-bottom-color: rgba(var(--accent-primary-rgb), 0.28);
}

html header[data-surface="light"]::before {
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.12), transparent 36%),
        rgba(255, 255, 255, 0.42);
}

html header[data-surface="light"] .logo {
    color: #0f172a;
    text-shadow: none;
}

html header[data-surface="light"] nav a {
    color: #0f172a;
    text-shadow: none;
}

html header[data-surface="light"] nav a:hover {
    color: #020617;
    background: rgba(226, 232, 240, 0.8);
}

html header[data-surface="light"] .notifications-button {
    background: rgba(226, 232, 240, 0.9);
    border-color: rgba(203, 213, 225, 0.95);
    box-shadow: none;
}

html header[data-surface="light"] .theme-toggle {
    background: rgba(226, 232, 240, 0.9);
    border-color: rgba(203, 213, 225, 0.95);
}

html header[data-surface="light"] .theme-toggle-thumb {
    background: #ffffff;
}

html header[data-surface="light"] .theme-toggle-thumb svg,
html header[data-surface="light"] .mobile-menu-btn {
    color: #334155;
}

html header[data-surface="light"] .palette-toggle {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(203, 213, 225, 0.95);
}

/* Contenido oscuro debajo → header completo en modo oscuro (aunque el tema sea claro) */
html header[data-surface="dark"] {
    border-bottom-color: rgba(var(--accent-primary-rgb), 0.28);
}

html header[data-surface="dark"]::before {
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.14), transparent 38%),
        rgba(15, 23, 42, 0.48);
}

html header[data-surface="dark"] .logo {
    color: #f8fafc;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.8);
}

html header[data-surface="dark"] nav a {
    color: #f1f5f9;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

html header[data-surface="dark"] nav a:hover {
    color: #ffffff;
    background: rgba(51, 65, 85, 0.7);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

html header[data-surface="dark"] .notifications-button {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(71, 85, 105, 0.7);
    box-shadow: none;
}

html header[data-surface="dark"] .theme-toggle {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(71, 85, 105, 0.7);
}

html header[data-surface="dark"] .theme-toggle-thumb {
    background: #0f172a;
}

html header[data-surface="dark"] .theme-toggle-thumb svg,
html header[data-surface="dark"] .mobile-menu-btn {
    color: #cbd5e1;
}

html header[data-surface="dark"] .palette-toggle {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(71, 85, 105, 0.7);
}

.header-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.375rem;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.logo:hover .logo-img {
    transform: scale(1.05);
}

nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

nav a {
    position: relative;
    padding: 0.625rem 0.85rem;
    font-size: 0.91rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

nav a.activo {
    color: var(--accent-primary);
    background: var(--accent-glow);
}

nav a.activo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    margin-left: 1rem;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
}

.theme-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--bg-card);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-spring);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-thumb svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(20px);
}


/* Palette Picker */
.palette-picker {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 1rem;
}

.palette-toggle {
    position: relative;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base);
    -webkit-tap-highlight-color: transparent;
}

.palette-toggle:hover,
.palette-picker.is-open .palette-toggle {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
    transform: translateY(-1px);
}

.palette-toggle-dot {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.palette-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: 270px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: rgba(var(--bg-primary-rgb), 0.96);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
    z-index: 1100;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.palette-picker.is-open .palette-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.palette-option {
    min-height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.palette-option:hover,
.palette-option.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-active-bg);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.palette-option.is-active {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.palette-option-swatch {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: var(--radius-full);
    background: var(--palette-option-color, var(--accent-primary));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.palette-picker + .theme-toggle {
    margin-left: 0.5rem;
}

header .palette-toggle {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(203, 213, 225, 0.9);
}

[data-theme="dark"] header .palette-toggle {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(71, 85, 105, 0.7);
}

@media (max-width: 768px) {
    .palette-picker {
        margin-left: 0.5rem;
    }

    .palette-menu {
        right: -3.5rem;
        width: min(86vw, 260px);
    }
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-tertiary);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* ===== Main Content ===== */
main {
    flex: 1;
    margin-top: var(--header-height);
    padding: 2rem 1.5rem;
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Profile Section (Index) ===== */
.profile-section {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    align-items: start;
    padding: 3rem 0;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 2rem;
    text-align: center;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.profile-image-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 1.5rem;
}

.profile-image-link {
    display: block;
    text-decoration: none;
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-xl);
    border: 3px solid var(--border-color);
    transition: all var(--transition-base);
}

.profile-card:hover .profile-image {
    border-color: #ec4899;
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.2);
}

.profile-image:focus-visible {
    border-color: #ec4899;
    outline: 2px solid #ec4899;
    outline-offset: 2px;
}

/* ===== Love Page ===== */
.love-section {
    grid-template-columns: 1fr;
    max-width: 920px;
    margin: 0 auto;
}

.love-message-card {
    text-align: center;
}

.love-photo {
    width: min(100%, 420px);
    height: auto;
    border-radius: var(--radius-xl);
    border: 3px solid #ec4899;
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.25);
    margin: 0 auto 1.25rem;
    display: block;
}

.love-heart {
    color: #ec4899;
}

.love-message {
    margin: 1rem 0 0;
    font-size: clamp(1.4rem, 3.2vw, 2.4rem);
    line-height: 1.35;
    font-weight: 700;
    color: #ec4899;
}

.profile-status {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: #22c55e;
    border: 3px solid var(--bg-card);
    border-radius: 50%;
}

.profile-name {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-title {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

.profile-contact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.contact-item:hover {
    background: var(--accent-glow);
    color: var(--accent-primary);
    transform: translateX(4px);
}

.contact-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.contact-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile Content */
.profile-content {
    padding: 1rem 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title i {
    font-size: 1.5rem;
    color: var(--accent-primary);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title svg {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.bio-text {
    color: var(--text-secondary);
    text-align: justify;
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.bio-text:last-child {
    margin-bottom: 0;
}

/* Skills/Tags */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.skill-tag:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-glow);
}

.skill-tag i {
    font-size: 1rem;
    width: 16px;
    height: 16px;
}

.skill-tag svg {
    width: 16px;
    height: 16px;
}

/* ===== Search Panel ===== */
.search-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.search-panel:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-input-wrapper svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-results-count {
    display: none;
}

.search-clear {
    display: none;
    width: 28px;
    min-width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-clear:hover {
    background: var(--accent-glow);
    color: var(--accent-primary);
}

.search-clear svg {
    width: 16px;
    height: 16px;
}

.search-clear.visible {
    display: flex;
}

/* ===== Material Reader ===== */
.reader-panel {
    background:
        radial-gradient(circle at top right, var(--accent-glow), transparent 32%),
        var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.reader-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.reader-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-primary);
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.reader-panel-title {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    margin-bottom: 0.5rem;
}

.reader-panel-authors {
    margin-bottom: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.reader-panel-description {
    max-width: 62ch;
    color: var(--text-tertiary);
}

.reader-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.reader-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.reader-back-link:hover {
    color: var(--accent-primary);
}

.reader-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.reader-pdf-link:hover {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
}

.reader-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem 1rem;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.02);
}

.reader-state i {
    font-size: 2rem;
    color: var(--accent-primary);
}

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

.reader-content {
    display: grid;
    gap: 1rem;
}

.reader-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.reader-course-badge,
.reader-pages-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.reader-doc-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 0.25rem;
}

.reader-pages {
    display: grid;
    gap: 1rem;
}

.reader-page {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.reader-page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reader-page-title h3 {
    font-size: 1rem;
    margin: 0;
}

.reader-page-number {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.reader-page-body {
    display: grid;
    gap: 0.75rem;
}

.reader-subsection-card {
    display: grid;
    gap: 0.85rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-left: 5px solid var(--accent-primary);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), var(--bg-card));
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.reader-subsection-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.18);
}

.reader-subsection-body {
    display: grid;
    gap: 0.75rem;
}

[data-theme="dark"] .reader-subsection-card {
    border-color: rgba(96, 165, 250, 0.24);
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.12), rgba(15, 23, 42, 0.92));
    box-shadow: 0 18px 38px rgba(2, 6, 23, 0.42);
}

[data-theme="dark"] .reader-subsection-title {
    border-bottom-color: rgba(96, 165, 250, 0.22);
}

.reader-command-group {
    border: 1px solid #1f2937;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: #0b1220;
    box-shadow: var(--shadow-sm);
}

.reader-command-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.9rem;
    background: #111827;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.reader-command-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.reader-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid rgba(96, 165, 250, 0.28);
    background: rgba(59, 130, 246, 0.14);
    color: #dbeafe;
    border-radius: var(--radius-md);
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.reader-copy-btn:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(96, 165, 250, 0.5);
}

.reader-copy-btn.is-copied {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.42);
    color: #d1fae5;
}

.reader-command-pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    color: #e2e8f0;
    font-size: 0.92rem;
    line-height: 1.75;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.reader-command-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.reader-command-line + .reader-command-line {
    margin-top: 0.25rem;
}

.reader-line {
    color: var(--text-secondary);
    line-height: 1.7;
}

.reader-line code {
    display: inline-block;
    padding: 0.08rem 0.42rem;
    border-radius: 0.45rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    font-size: 0.92em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.reader-line strong {
    color: var(--text-primary);
}

.reader-line.is-heading {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.reader-line.is-bullet {
    position: relative;
    padding-left: 1.1rem;
}

.reader-line.is-bullet::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    left: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--accent-primary);
}


/* ===== Clase individual reader ===== */
.class-reader-page {
    max-width: 1040px;
}

.class-reader-hero {
    position: relative;
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1.4rem;
    padding: 1.35rem 1.5rem;
    border: 1px solid rgba(var(--accent-primary-rgb), 0.22);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.13), rgba(var(--accent-secondary-rgb), 0.06)),
        var(--bg-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.class-reader-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 0.35rem;
    background: var(--accent-gradient);
    pointer-events: none;
}

.class-reader-hero .reader-back-link {
    width: fit-content;
    min-height: 2.25rem;
    margin-bottom: 0.25rem;
    padding: 0.42rem 0.72rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.class-reader-hero .page-title,
.class-reader-hero .page-description {
    position: relative;
    z-index: 1;
}

.class-reader-hero .page-title {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.class-reader-hero .page-description {
    max-width: 62ch;
}

.class-reader-panel {
    padding: 0;
    overflow: hidden;
    border-color: rgba(var(--accent-primary-rgb), 0.18);
}

.class-reader-panel .reader-panel-header {
    margin-bottom: 0;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.08), rgba(var(--accent-secondary-rgb), 0.04));
}

.class-reader-panel .reader-panel-title {
    font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.class-reader-panel .reader-pdf-link {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 26px rgba(var(--accent-primary-rgb), 0.2);
}

.class-reader-panel .reader-pdf-link:hover {
    color: #fff;
    transform: translateY(-1px);
}

.class-reader-panel .reader-state,
.class-reader-panel .reader-content {
    margin: 1.25rem;
}

.class-reader-panel .reader-meta {
    padding: 0.25rem 0 0.5rem;
}

.class-material-page .reader-course-badge,
.class-material-page .reader-pages-badge {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.class-material-page .reader-doc-title {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.class-material-page .reader-pages {
    gap: 1.15rem;
}

.class-material-page .reader-page {
    border-radius: var(--radius-xl);
    padding: 1.35rem;
    background:
        linear-gradient(180deg, rgba(var(--accent-primary-rgb), 0.04), transparent 4.5rem),
        var(--bg-primary);
}

.class-material-page .reader-page-title {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.class-material-page .reader-page-title h3 {
    font-size: 1.08rem;
}

.class-material-page .reader-page-number {
    padding: 0.28rem 0.58rem;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 700;
}

.class-material-page .reader-subsection-card {
    border-left-width: 0;
    border-top: 4px solid var(--accent-primary);
}

.class-material-page .reader-line {
    font-size: 0.98rem;
}

.class-material-page .reader-slide-pages {
    gap: 1.4rem;
}

.class-material-page .reader-slide-page {
    padding: 0;
    overflow: hidden;
    background: var(--bg-primary);
}

.class-material-page .reader-slide-page .reader-page-title {
    padding: 0.9rem 1rem;
    background: var(--bg-secondary);
}

.class-material-page .reader-slide-body {
    background: #111827;
}

.class-material-page .reader-slide-image {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

/* ===== Content Cards (Clases/Manuales) ===== */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.page-title svg {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
}

.page-description {
    color: var(--text-tertiary);
    font-size: 1rem;
}

/* Category/Subject Cards */
.content-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
}

.category-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.category-card.hidden {
    display: none;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.category-header:hover {
    background: var(--bg-secondary);
}

.category-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.category-icon svg {
    width: 24px;
    height: 24px;
}

.category-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

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

.category-arrow {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.category-card.expanded .category-arrow {
    transform: rotate(180deg);
}

/* Category Content */
.category-content {
    display: none;
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.category-card.expanded .category-content {
    display: block;
}

/* Topic Groups */
.topic-group {
    margin-top: 1.25rem;
}

.topic-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.topic-header:hover {
    background: var(--bg-tertiary);
}

.topic-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.topic-group.expanded .topic-arrow {
    transform: rotate(90deg);
}

.topic-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.topic-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
}

/* Links List */
.links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
}

.topic-group.expanded .links-list {
    display: block;
}

.link-item {
    margin-top: 0.5rem;
    padding-left: 2.25rem;
}

.material-actions {
    display: flex;
    align-items: stretch;
    gap: 0.625rem;
}

.material-trigger {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.5;
    transition: all var(--transition-fast);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.material-trigger:hover {
    background: var(--accent-glow);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateX(4px);
}

.material-trigger.is-active {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
    color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.material-trigger:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.material-trigger i:first-child {
    flex-shrink: 0;
    margin-top: 0.125rem;
    font-size: 1rem;
}

.material-trigger svg:first-child {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.material-trigger .manual-os-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 0.125rem;
    object-fit: contain;
}

.material-trigger span {
    flex: 1;
    word-break: break-word;
}

.material-pdf-action {
    width: 46px;
    min-width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.material-pdf-action:hover {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
    color: var(--accent-primary);
}

/* Direct links (no subtopics) */
.direct-link {
    margin-top: 0.75rem;
}

.direct-link .material-trigger {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}


/* Search Highlight */
.highlight,
mark.highlight {
    background: linear-gradient(120deg, rgba(59, 130, 246, 0.25) 0%, rgba(99, 102, 241, 0.25) 100%);
    color: var(--accent-primary);
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

[data-theme="dark"] .highlight,
[data-theme="dark"] mark.highlight {
    background: linear-gradient(120deg, rgba(96, 165, 250, 0.3) 0%, rgba(129, 140, 248, 0.3) 100%);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.no-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results p {
    font-size: 1rem;
}

/* ===== Footer ===== */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-top: auto;
    transition: all var(--transition-base);
}

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

.footer-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-item svg {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

.footer-item a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.footer-item a:hover {
    color: var(--accent-primary);
}

.footer-copyright {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.animate-slide-in {
    animation: slideInLeft 0.4s ease-out forwards;
}

/* Staggered animations */
.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

/* ===== Learn ===== */
.learn-shell {
    display: grid;
    gap: 2rem;
}

.learn-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.9fr);
    gap: 2rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.2), transparent 34%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.16), transparent 32%),
        var(--bg-card);
    box-shadow: var(--shadow-lg);
}

.learn-hero-copy {
    position: relative;
    z-index: 1;
}

.learn-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-full);
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-primary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.learn-hero-copy h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 1.02;
    margin-bottom: 1rem;
}

.learn-hero-copy p {
    max-width: 62ch;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.learn-hero-actions,
.learn-module-actions,
.learn-command-list,
.learn-terminal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.learn-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    font-weight: 700;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.learn-button:hover {
    transform: translateY(-1px);
}

.learn-button.primary {
    color: #eff6ff;
    background: linear-gradient(135deg, #2563eb, #0891b2);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.22);
}

.learn-button.secondary {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(148, 163, 184, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.learn-hero-panel,
.learn-path,
.learn-lab-layout,
.learn-reference {
    display: grid;
    gap: 1rem;
}

.learn-progress-card,
.learn-highlight-card,
.learn-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
}

.learn-progress-card {
    padding: 1.3rem;
    border-color: rgba(147, 51, 234, 0.34);
    background:
        radial-gradient(circle at top left, rgba(192, 132, 252, 0.34), transparent 42%),
        linear-gradient(135deg, rgba(245, 232, 255, 0.98), rgba(233, 213, 255, 0.94));
    box-shadow: 0 22px 46px rgba(109, 40, 217, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.learn-progress-card strong,
.learn-highlight-card strong,
.learn-reference-card strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.learn-progress-card p,
.learn-section-header p,
.learn-module-body p,
.learn-reference-card p,
.learn-highlight-card p,
.learn-highlight-card li {
    color: var(--text-secondary);
    line-height: 1.6;
}

.learn-progress-bar {
    width: 100%;
    height: 12px;
    margin: 1rem 0 0.65rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
}

.learn-progress-bar span {
    display: block;
    width: 18%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #10b981);
}

.learn-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.learn-highlight-card {
    padding: 1.3rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.9));
    color: #e2e8f0;
}

.learn-highlight-card p,
.learn-highlight-card li {
    color: rgba(226, 232, 240, 0.84);
}

.learn-highlight-card ul {
    margin-top: 0.9rem;
    padding-left: 1.1rem;
}

.learn-highlight-card li + li {
    margin-top: 0.45rem;
}

.learn-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 1.75rem;
}

.learn-theory-stack {
    display: grid;
    gap: 1.75rem;
}

.learn-theory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 1.15rem;
    margin-bottom: 1.15rem;
}

.learn-section {
    padding: 1.4rem;
}

.learn-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.learn-section-header h2 {
    font-size: 1.35rem;
    margin-bottom: 0.35rem;
}

.learn-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    font-size: 0.82rem;
    font-weight: 700;
}

.learn-module-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 250, 252, 0.94));
}

.learn-module-card.is-locked {
    opacity: 0.7;
}

.learn-module-card.is-complete {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 18px 34px rgba(16, 185, 129, 0.12);
}

.learn-module-step {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #eff6ff;
    background: linear-gradient(135deg, #2563eb, #0284c7);
    box-shadow: 0 14px 25px rgba(37, 99, 235, 0.2);
}

.learn-module-body h3 {
    font-size: 1.02rem;
    margin-bottom: 0.4rem;
}

.learn-module-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0.9rem 0 0.95rem;
}

.learn-module-tags span {
    padding: 0.38rem 0.65rem;
    border-radius: var(--radius-full);
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.learn-chip-button,
.learn-command-list button,
.learn-terminal-actions button {
    font: inherit;
    cursor: pointer;
}

.learn-chip-button,
.learn-command-list button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
}

.learn-chip-button:hover,
.learn-command-list button:hover {
    border-color: rgba(37, 99, 235, 0.32);
    color: var(--accent-primary);
}

.learn-lab-brief {
    display: grid;
    gap: 0.75rem;
    padding: 1.1rem;
    border-radius: var(--radius-xl);
    background: rgba(8, 47, 73, 0.06);
    border: 1px solid rgba(14, 116, 144, 0.14);
}

.learn-theory-terminal {
    margin-top: 1rem;
    margin-bottom: 1.2rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.learn-section > .learn-highlight-card,
.learn-section > .learn-lab-brief,
.learn-section > .learn-reference,
.learn-section > .learn-terminal-actions {
    margin-top: 1.25rem;
}

.learn-theory-command {
    color: #93c5fd;
    font-size: 0.92rem;
    margin-bottom: 0.55rem;
}

.learn-theory-output {
    color: #e2e8f0;
    font-size: 0.96rem;
    word-break: break-word;
}

.learn-terminal {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.42);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 16%),
        linear-gradient(180deg, #050816, #0a1020 55%, #03060f);
    box-shadow: 0 30px 70px rgba(2, 6, 23, 0.42);
}

.learn-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    color: rgba(226, 232, 240, 0.86);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(8, 12, 24, 0.95));
}

.learn-terminal-dots {
    display: flex;
    gap: 0.4rem;
}

.learn-terminal-dots span {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
}

.learn-terminal-dots span:nth-child(1) { background: #f87171; }
.learn-terminal-dots span:nth-child(2) { background: #fbbf24; }
.learn-terminal-dots span:nth-child(3) { background: #34d399; }

.learn-terminal-title {
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: none;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: rgba(226, 232, 240, 0.72);
}

.learn-terminal-body {
    position: relative;
    min-height: 360px;
    max-height: 520px;
    overflow: auto;
    padding: 1rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #e5eefc;
    background:
        radial-gradient(circle at top, rgba(56, 189, 248, 0.07), transparent 32%),
        repeating-linear-gradient(180deg, rgba(148, 163, 184, 0.02), rgba(148, 163, 184, 0.02) 1px, transparent 1px, transparent 24px);
    text-shadow: 0 0 8px rgba(148, 163, 184, 0.05);
    scrollbar-color: rgba(71, 85, 105, 0.9) transparent;
}

.learn-terminal-body.is-editor-open {
    overflow: hidden;
}

.learn-terminal-body.is-editor-open > :not(.learn-editor-overlay) {
    display: none;
}

.learn-terminal-line {
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 1.45rem;
}

.learn-terminal-line + .learn-terminal-line {
    margin-top: 0.15rem;
}

.learn-terminal-line.is-command {
    color: #f8fafc;
}

.learn-terminal-line .prompt-fragment {
    color: #34d399;
}

.learn-terminal-line .command-fragment {
    color: #f8fafc;
}

.learn-terminal-line.is-output {
    color: #cbd5e1;
}

.learn-terminal-line.is-output .ls-entry {
    white-space: pre;
}

.learn-terminal-line.is-output .ls-entry + .ls-entry {
    margin-left: 1.2rem;
}

.learn-terminal-line.is-output .ls-entry.is-dir {
    color: #60a5fa;
    font-weight: 700;
}

.learn-terminal-line.is-output .ls-entry.is-file {
    color: #dbeafe;
}

.learn-terminal-line.is-error {
    color: #fda4af;
}

.learn-terminal-line.is-success {
    color: #86efac;
}

.learn-terminal-line.is-muted {
    color: #94a3b8;
}

.learn-terminal-prompt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    border-top: none;
    margin-top: 0.15rem;
}

.learn-terminal-prompt-label {
    color: #34d399;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.92rem;
    white-space: nowrap;
}

.learn-terminal-entry {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 1ch;
    cursor: text;
}

.learn-terminal-text-before,
.learn-terminal-text-selection,
.learn-terminal-text-after {
    color: #f8fafc;
    white-space: pre;
}

.learn-terminal-text-selection {
    color: #eff6ff;
    background: rgba(37, 99, 235, 0.42);
    border-radius: 2px;
}

.learn-terminal-input {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 100%;
    opacity: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    outline: none;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    color: #f8fafc;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.96rem;
    caret-color: transparent;
}

.learn-terminal-input:focus,
.learn-terminal-input:focus-visible,
.learn-terminal-input:active {
    outline: none;
    border: 0;
    box-shadow: none !important;
    background: transparent !important;
}

.learn-terminal-input::placeholder {
    color: rgba(148, 163, 184, 0.36);
}

.learn-terminal-live-prompt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 1.45rem;
}

.learn-terminal-cursor {
    width: 0.7ch;
    height: 1.15em;
    background: rgba(226, 232, 240, 0.92);
    box-shadow: 0 0 10px rgba(226, 232, 240, 0.16);
    animation: terminalCursorBlink 1s steps(1, end) infinite;
    flex: 0 0 auto;
    vertical-align: middle;
}

.learn-terminal-live-prompt.is-blurred .learn-terminal-cursor {
    opacity: 0.35;
    animation: none;
}

@keyframes terminalCursorBlink {
    0%, 49% {
        opacity: 1;
    }

    50%, 100% {
        opacity: 0;
    }
}

.learn-terminal-body::-webkit-scrollbar {
    width: 10px;
}

.learn-terminal-body::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.8);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.learn-terminal-body::-webkit-scrollbar-track {
    background: transparent;
}

.learn-editor-overlay {
    position: absolute;
    inset: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, rgba(56, 189, 248, 0.06), transparent 30%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.98), rgba(3, 7, 18, 0.98));
    z-index: 3;
}

.learn-editor-shell {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.94);
}

.learn-editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.25);
    color: #cbd5e1;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.83rem;
    background: rgba(15, 23, 42, 0.9);
}

.learn-editor-title,
.learn-editor-mode,
.learn-editor-command,
.learn-editor-status,
.learn-editor-hint,
.learn-editor-textarea {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.learn-editor-title {
    color: #e2e8f0;
}

.learn-editor-mode {
    color: #86efac;
}

.learn-editor-textarea {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 0.85rem 0.95rem;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: #e5eefc;
    line-height: 1.55;
    font-size: 0.95rem;
    white-space: pre;
    tab-size: 4;
    caret-color: #e2e8f0;
}

.learn-editor-textarea::selection {
    background: rgba(37, 99, 235, 0.42);
    color: #eff6ff;
}

.learn-editor-command,
.learn-editor-status,
.learn-editor-hint {
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
}

.learn-editor-command {
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid rgba(71, 85, 105, 0.25);
}

.learn-editor-status {
    color: #0f172a;
    background: #facc15;
}

.learn-editor-hint {
    color: #bfdbfe;
    background: rgba(30, 41, 59, 0.88);
    border-top: 1px solid rgba(71, 85, 105, 0.22);
}

.learn-terminal-actions button {
    flex: 1;
    min-height: 44px;
    border-radius: var(--radius-lg);
}

.learn-terminal-actions button:not([data-module-complete]) {
    border: 1px solid rgba(59, 130, 246, 0.34);
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.94), rgba(59, 130, 246, 0.94));
    color: #eff6ff;
    box-shadow: 0 16px 34px rgba(29, 78, 216, 0.2);
}

.learn-terminal-actions button:not([data-module-complete]):hover {
    border-color: rgba(147, 197, 253, 0.54);
    color: #ffffff;
}

.learn-terminal-actions button[data-module-complete] {
    border: 1px solid rgba(34, 197, 94, 0.38);
    background: linear-gradient(135deg, rgba(21, 128, 61, 0.96), rgba(34, 197, 94, 0.96));
    color: #f0fdf4;
    box-shadow: 0 16px 34px rgba(21, 128, 61, 0.22);
}

.learn-terminal-actions button[data-module-complete]:hover {
    border-color: rgba(134, 239, 172, 0.52);
    color: #ffffff;
}

.learn-terminal-actions button[data-module-complete]:disabled {
    border-color: rgba(34, 197, 94, 0.24);
    background: linear-gradient(135deg, rgba(21, 128, 61, 0.58), rgba(34, 197, 94, 0.58));
    color: rgba(240, 253, 244, 0.78);
    box-shadow: none;
    cursor: not-allowed;
}

.learn-terminal-actions button.is-advance {
    border-color: rgba(168, 85, 247, 0.42);
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.96), rgba(147, 51, 234, 0.96));
    color: #faf5ff;
    box-shadow: 0 16px 34px rgba(109, 40, 217, 0.26);
}

.learn-terminal-actions button.is-advance:hover {
    border-color: rgba(196, 181, 253, 0.56);
    color: #ffffff;
    box-shadow: 0 18px 38px rgba(109, 40, 217, 0.34);
}

.learn-reference-card {
    padding: 1rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(59, 130, 246, 0.28);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.2), transparent 42%),
        linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(219, 234, 254, 0.92));
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.12);
}

.learn-reference-card code {
    font-size: 0.92em;
}

.learn-guide-list {
    margin: 0.7rem 0 0;
    padding-left: 1.2rem;
    color: var(--text-secondary);
}

.learn-guide-list li + li {
    margin-top: 0.45rem;
}

.learn-guide-list code {
    font-size: 0.9em;
}

.learn-editor-guide {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 20px;
    border: 1px solid rgba(245, 158, 11, 0.52);
    background:
        radial-gradient(circle at top left, rgba(250, 204, 21, 0.34), transparent 42%),
        linear-gradient(135deg, rgba(255, 247, 204, 0.99), rgba(253, 230, 138, 0.97));
    box-shadow: 0 20px 46px rgba(202, 138, 4, 0.24);
    animation: editorGuideBounce 0.6s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

.learn-editor-guide-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding: 0.42rem 0.75rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.24);
    color: #78350f;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.learn-editor-guide-card {
    padding: 1rem 1.05rem;
    border-radius: 16px;
    border: 1px solid rgba(245, 158, 11, 0.24);
    background: rgba(255, 251, 235, 0.82);
}

.learn-editor-guide-card strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.learn-exam-card {
    margin-top: 1rem;
    padding: 1.1rem;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(14, 116, 144, 0.16);
    background: rgba(248, 250, 252, 0.82);
}

.learn-exam-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: start center;
    padding: 1.5rem;
    background: rgba(2, 6, 23, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1100;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.learn-exam-modal[hidden] {
    display: none !important;
}

.learn-exam-modal .learn-exam-card {
    width: min(100%, 760px);
    margin: 0;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
    max-height: calc(100vh - 3rem);
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.learn-exam-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    min-height: 42px;
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.88);
    color: #e2e8f0;
}

.learn-exam-card.is-passed {
    border-color: rgba(34, 197, 94, 0.34);
    box-shadow: 0 16px 34px rgba(34, 197, 94, 0.1);
}

.learn-exam-card.is-failed {
    border-color: rgba(245, 158, 11, 0.34);
    box-shadow: 0 16px 34px rgba(245, 158, 11, 0.1);
}

.learn-exam-score {
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(14, 116, 144, 0.1);
    color: #155e75;
    font-size: 0.88rem;
    font-weight: 700;
}

.learn-exam-grid {
    display: block;
}

.learn-exam-current {
    display: grid;
    gap: 1rem;
}

.learn-exam-current-step {
    font-size: 0.85rem;
    font-weight: 800;
    color: #0f766e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.learn-exam-current-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.learn-exam-options {
    display: grid;
    gap: 0.75rem;
}

.learn-exam-option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-height: 54px;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    text-align: left;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    border-color: rgba(168, 85, 247, 0.28);
    background: linear-gradient(135deg, rgba(250, 245, 255, 0.96), rgba(243, 232, 255, 0.92));
}

.learn-exam-option:hover {
    border-color: rgba(14, 116, 144, 0.28);
    transform: translateY(-1px);
}

.learn-exam-option.is-selected {
    border-color: rgba(34, 197, 94, 0.46);
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.98), rgba(220, 252, 231, 0.94));
    box-shadow: 0 18px 34px rgba(34, 197, 94, 0.16);
    transform: translateY(-2px) scale(1.01);
}

.learn-exam-option-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(168, 85, 247, 0.14);
    color: #7e22ce;
    font-weight: 800;
}

.learn-exam-option.is-selected .learn-exam-option-index {
    background: rgba(34, 197, 94, 0.16);
    color: #15803d;
}

.learn-exam-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    min-width: 0;
}

.learn-exam-footer p {
    margin: 0;
    color: var(--text-secondary);
}

.learn-exam-footer button {
    min-height: 44px;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(14, 116, 144, 0.24);
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.96), rgba(6, 182, 212, 0.94));
    color: #ecfeff;
    font-weight: 700;
}

.learn-exam-footer button:disabled {
    opacity: 0.58;
    box-shadow: none;
    cursor: not-allowed;
}

.learn-exam-footer button.is-ready {
    border-color: rgba(125, 211, 252, 0.48);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12), 0 18px 36px rgba(14, 116, 144, 0.22);
    animation: examReadyPulse 1.2s ease-in-out infinite;
}

.learn-exam-footer button:hover {
    border-color: rgba(125, 211, 252, 0.4);
    color: #ffffff;
}

@keyframes examReadyPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.learn-exam-notice {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(2, 6, 23, 0.44);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1200;
}

.learn-exam-notice[hidden] {
    display: none !important;
}

.learn-exam-notice-card {
    width: min(100%, 520px);
    padding: 1.35rem;
    border-radius: 24px;
    border: 1px solid rgba(245, 158, 11, 0.26);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.96));
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
    animation: examNoticePop 0.26s ease-out both;
}

.learn-exam-notice-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #9a3412;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.learn-exam-notice-card h3 {
    margin: 0.85rem 0 0.5rem;
    color: #7c2d12;
}

.learn-exam-notice-card p {
    margin: 0;
    color: #78350f;
    line-height: 1.65;
}

.learn-exam-notice-card button {
    margin-top: 1rem;
    min-height: 46px;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.96), rgba(245, 158, 11, 0.94));
    color: #fff7ed;
    font-weight: 700;
}

.learn-exam-notice.is-hiding .learn-exam-notice-card {
    animation: examNoticeFade 0.18s ease-in forwards;
}

@keyframes examNoticePop {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes examNoticeFade {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
}

.learn-module-lock {
    margin-top: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

[aria-disabled="true"] {
    pointer-events: none;
    filter: grayscale(0.12);
}

[data-required-command].is-complete {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.08);
}

[data-required-indicator] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    margin-left: 0.45rem;
    color: transparent;
    font-weight: 800;
}

[data-required-command].is-complete [data-required-indicator] {
    color: #10b981;
}

[data-next-module-link] {
    display: none !important;
}

[data-theme="dark"] .learn-exam-card {
    border-color: rgba(14, 116, 144, 0.18);
    background: rgba(15, 23, 42, 0.76);
}

[data-theme="dark"] .learn-exam-modal-close {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.9);
    color: #e2e8f0;
}

[data-theme="dark"] .learn-exam-score {
    background: rgba(6, 182, 212, 0.14);
    color: #a5f3fc;
}

[data-theme="dark"] .learn-exam-current-step {
    color: #67e8f9;
}

[data-theme="dark"] .learn-exam-option {
    border-color: rgba(196, 181, 253, 0.24);
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.24), rgba(2, 6, 23, 0.68));
    color: #e2e8f0;
}

[data-theme="dark"] .learn-exam-option.is-selected {
    border-color: rgba(74, 222, 128, 0.42);
    background: linear-gradient(135deg, rgba(21, 128, 61, 0.3), rgba(2, 6, 23, 0.7));
}

[data-theme="dark"] .learn-exam-option-index {
    background: rgba(168, 85, 247, 0.18);
    color: #e9d5ff;
}

[data-theme="dark"] .learn-exam-option.is-selected .learn-exam-option-index {
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
}

[data-theme="dark"] .learn-editor-guide {
    border-color: rgba(250, 204, 21, 0.42);
    background:
        radial-gradient(circle at top left, rgba(253, 224, 71, 0.24), transparent 42%),
        linear-gradient(135deg, rgba(161, 98, 7, 0.32), rgba(24, 24, 27, 0.94));
}

[data-theme="dark"] .learn-editor-guide-badge {
    background: rgba(250, 204, 21, 0.2);
    color: #fef3c7;
}

[data-theme="dark"] .learn-editor-guide-card {
    border-color: rgba(250, 204, 21, 0.22);
    background: rgba(15, 23, 42, 0.58);
}

@keyframes editorGuideBounce {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    60% {
        opacity: 1;
        transform: translateY(-6px) scale(1.015);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

[data-theme="dark"] .learn-hero,
[data-theme="dark"] .learn-section,
[data-theme="dark"] .learn-module-card,
[data-theme="dark"] .learn-reference-card,
[data-theme="dark"] .learn-progress-card {
    border-color: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .learn-button.secondary {
    background: rgba(15, 23, 42, 0.62);
    border-color: rgba(148, 163, 184, 0.18);
    color: #f8fafc;
}

[data-theme="dark"] .learn-progress-card,
[data-theme="dark"] .learn-section,
[data-theme="dark"] .learn-module-card,
[data-theme="dark"] .learn-reference-card {
    background: rgba(15, 23, 42, 0.72);
}

[data-theme="dark"] .learn-progress-card {
    border-color: rgba(196, 181, 253, 0.22);
    background:
        radial-gradient(circle at top left, rgba(168, 85, 247, 0.2), transparent 42%),
        linear-gradient(135deg, rgba(76, 29, 149, 0.78), rgba(15, 23, 42, 0.84));
    box-shadow: 0 20px 44px rgba(76, 29, 149, 0.22);
}

[data-theme="dark"] .learn-reference-card {
    border-color: rgba(96, 165, 250, 0.3);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.24), transparent 42%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(30, 64, 175, 0.28));
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.18);
}

[data-theme="dark"] .learn-highlight-card {
    border-color: rgba(96, 165, 250, 0.16);
}

[data-theme="dark"] .learn-lab-brief {
    background: rgba(30, 41, 59, 0.82);
    border-color: rgba(96, 165, 250, 0.14);
}

[data-theme="dark"] .learn-command-list button,
[data-theme="dark"] .learn-chip-button {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
}

[data-theme="dark"] .learn-badge {
    background: rgba(16, 185, 129, 0.16);
    color: #6ee7b7;
}


/* Learn palette binding */
.learn-hero {
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.22), transparent 34%),
        radial-gradient(circle at bottom left, rgba(var(--accent-secondary-rgb), 0.16), transparent 32%),
        var(--bg-card);
}

.learn-eyebrow,
.learn-module-tags span,
.learn-exam-score,
.learn-exam-current-step,
.learn-exam-option-index {
    background: var(--accent-active-bg);
    color: var(--accent-primary);
}

.learn-button.primary,
.learn-module-step,
.learn-terminal-actions button:not([data-module-complete]),
.learn-terminal-actions button[data-module-complete],
.learn-terminal-actions button.is-advance,
.learn-exam-footer button,
.learn-exam-notice-card button {
    border-color: rgba(var(--accent-primary-rgb), 0.34);
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(var(--accent-primary-rgb), 0.22);
}

.learn-button.primary:hover,
.learn-terminal-actions button:not([data-module-complete]):hover,
.learn-terminal-actions button[data-module-complete]:hover,
.learn-terminal-actions button.is-advance:hover,
.learn-exam-footer button:hover,
.learn-exam-notice-card button:hover {
    border-color: rgba(var(--accent-secondary-rgb), 0.5);
    box-shadow: 0 18px 38px rgba(var(--accent-primary-rgb), 0.3);
}

.learn-terminal-actions button[data-module-complete]:disabled,
.learn-exam-footer button:disabled {
    border-color: rgba(var(--accent-primary-rgb), 0.22);
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.5), rgba(var(--accent-secondary-rgb), 0.5));
    color: rgba(255, 255, 255, 0.78);
    box-shadow: none;
}

.learn-progress-card {
    border-color: rgba(var(--accent-primary-rgb), 0.28);
    background:
        radial-gradient(circle at top left, rgba(var(--accent-primary-rgb), 0.24), transparent 42%),
        linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.13), rgba(var(--accent-secondary-rgb), 0.1)),
        var(--bg-card);
    box-shadow: 0 22px 46px rgba(var(--accent-primary-rgb), 0.16);
}

.learn-progress-bar span {
    background: var(--accent-gradient);
}

.learn-module-step {
    box-shadow: 0 14px 25px rgba(var(--accent-primary-rgb), 0.22);
}

.learn-module-card:not(.is-locked) {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
}

.learn-chip-button:hover,
.learn-command-list button:hover,
.learn-command-list button:focus-visible,
.learn-chip-button:focus-visible {
    border-color: rgba(var(--accent-primary-rgb), 0.36);
    background: var(--accent-active-bg);
    color: var(--accent-primary);
}

.learn-lab-brief {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
    background: rgba(var(--accent-primary-rgb), 0.06);
}

.learn-reference-card {
    border-color: rgba(var(--accent-primary-rgb), 0.28);
    background:
        radial-gradient(circle at top left, rgba(var(--accent-primary-rgb), 0.18), transparent 42%),
        linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.09), rgba(var(--accent-secondary-rgb), 0.07)),
        var(--bg-card);
    box-shadow: 0 18px 36px rgba(var(--accent-primary-rgb), 0.12);
}

.learn-theory-command,
.learn-terminal-line.is-output .ls-entry.is-dir {
    color: var(--accent-primary);
}

.learn-terminal-body {
    background:
        radial-gradient(circle at top, rgba(var(--accent-primary-rgb), 0.08), transparent 32%),
        repeating-linear-gradient(180deg, rgba(148, 163, 184, 0.02), rgba(148, 163, 184, 0.02) 1px, transparent 1px, transparent 24px);
}

.learn-terminal-text-selection,
.learn-editor-textarea::selection {
    background: rgba(var(--accent-primary-rgb), 0.42);
}

.learn-exam-card {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
}

.learn-exam-option {
    border-color: rgba(var(--accent-primary-rgb), 0.22);
    background:
        linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.08), rgba(var(--accent-secondary-rgb), 0.06)),
        rgba(255, 255, 255, 0.62);
}

.learn-exam-option:hover,
.learn-exam-option.is-selected {
    border-color: rgba(var(--accent-primary-rgb), 0.46);
    background:
        linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.14), rgba(var(--accent-secondary-rgb), 0.1)),
        rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 34px rgba(var(--accent-primary-rgb), 0.16);
}

.learn-exam-option.is-selected .learn-exam-option-index {
    background: var(--accent-gradient);
    color: #ffffff;
}

.learn-exam-footer button.is-ready {
    border-color: rgba(var(--accent-secondary-rgb), 0.48);
    box-shadow: 0 0 0 4px rgba(var(--accent-primary-rgb), 0.12), 0 18px 36px rgba(var(--accent-primary-rgb), 0.22);
}

.learn-highlight-card {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.16), transparent 40%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.9));
}

[data-theme="dark"] .learn-hero {
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.2), transparent 34%),
        radial-gradient(circle at bottom left, rgba(var(--accent-secondary-rgb), 0.14), transparent 32%),
        var(--bg-card);
}

[data-theme="dark"] .learn-progress-card,
[data-theme="dark"] .learn-reference-card {
    border-color: rgba(var(--accent-primary-rgb), 0.28);
    background:
        radial-gradient(circle at top left, rgba(var(--accent-primary-rgb), 0.2), transparent 42%),
        linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.12), rgba(15, 23, 42, 0.82));
    box-shadow: 0 20px 44px rgba(var(--accent-primary-rgb), 0.18);
}

[data-theme="dark"] .learn-highlight-card,
[data-theme="dark"] .learn-lab-brief {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
}

[data-theme="dark"] .learn-lab-brief {
    background: rgba(var(--accent-primary-rgb), 0.08);
}

[data-theme="dark"] .learn-command-list button,
[data-theme="dark"] .learn-chip-button {
    border-color: rgba(var(--accent-primary-rgb), 0.16);
}

[data-theme="dark"] .learn-command-list button:hover,
[data-theme="dark"] .learn-chip-button:hover,
[data-theme="dark"] .learn-command-list button:focus-visible,
[data-theme="dark"] .learn-chip-button:focus-visible {
    border-color: rgba(var(--accent-primary-rgb), 0.38);
    background: var(--accent-active-bg);
    color: var(--accent-primary);
}

[data-theme="dark"] .learn-exam-card {
    border-color: rgba(var(--accent-primary-rgb), 0.2);
}

[data-theme="dark"] .learn-exam-score,
[data-theme="dark"] .learn-exam-current-step,
[data-theme="dark"] .learn-exam-option-index {
    background: var(--accent-active-bg);
    color: var(--accent-primary);
}

[data-theme="dark"] .learn-exam-option {
    border-color: rgba(var(--accent-primary-rgb), 0.22);
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.16), rgba(2, 6, 23, 0.68));
}

[data-theme="dark"] .learn-exam-option:hover,
[data-theme="dark"] .learn-exam-option.is-selected {
    border-color: rgba(var(--accent-primary-rgb), 0.42);
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.26), rgba(2, 6, 23, 0.7));
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .profile-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .learn-hero,
    .learn-grid {
        grid-template-columns: 1fr;
    }

    .profile-card {
        position: static;
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .header-container {
        padding: 0 1rem;
    }

    nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.40);
        backdrop-filter: blur(18px) saturate(165%);
        -webkit-backdrop-filter: blur(18px) saturate(165%);
        border-bottom: 1px solid rgba(203, 213, 225, 0.55);
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
    }

    [data-theme="dark"] nav {
        background: rgba(15, 23, 42, 0.40);
        border-bottom-color: rgba(51, 65, 85, 0.55);
    }

    nav.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    nav a {
        width: 100%;
        text-align: center;
        padding: 0.875rem;
        justify-content: center;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .theme-toggle {
        margin-left: 0.5rem;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    main {
        padding: 1.5rem 1rem;
    }

    .profile-image-container {
        width: 150px;
        height: 150px;
    }

    .category-header {
        padding: 1rem;
    }

    .category-icon {
        width: 40px;
        height: 40px;
    }

    .category-icon svg,
    .category-icon i,
    .category-icon img {
        width: 20px;
        height: 20px;
        font-size: 1.25rem;
    }

    .category-content {
        padding: 0 1rem 1rem;
    }



    .class-reader-hero {
        padding: 1rem;
    }

    .class-reader-panel .reader-panel-header {
        padding: 1rem;
    }

    .class-reader-panel .reader-state,
    .class-reader-panel .reader-content {
        margin: 1rem;
    }

    .class-material-page .reader-page {
        padding: 1rem;
    }

    .class-material-page .reader-page-title {
        align-items: flex-start;
    }


    .reader-panel {
        padding: 1.25rem;
    }

    .reader-panel-header {
        flex-direction: column;
    }

    .reader-panel-actions,
    .reader-pdf-link {
        width: 100%;
    }

    .learn-hero {
        padding: 1.4rem;
    }

    .learn-section {
        padding: 1.1rem;
    }

    .learn-section-header {
        flex-direction: column;
    }

    .learn-hero-copy h1 {
        font-size: 2rem;
    }

    .learn-module-card {
        grid-template-columns: 1fr;
    }

    .learn-module-step {
        width: 2.7rem;
        height: 2.7rem;
    }

    .learn-terminal-body {
        min-height: 300px;
    }

    .learn-terminal-prompt {
        align-items: flex-start;
        flex-direction: column;
    }

    .learn-terminal-actions {
        flex-direction: column;
    }

    .link-item {
        padding-left: 0.5rem;
    }

    .material-actions {
        flex-direction: column;
    }

    .material-pdf-action {
        width: 100%;
        min-width: 100%;
        min-height: 42px;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-info {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    .logo {
        font-size: 1.125rem;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .profile-card {
        padding: 1.5rem;
    }

    .profile-name {
        font-size: 1.25rem;
    }

    .contact-item {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }

    .search-panel {
        padding: 1rem;
    }

    .reader-page {
        padding: 1rem;
    }

    .reader-page-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        font-size: 0.9375rem;
    }
}

/* ===== Utilities ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Hidden utility ===== */
.hidden {
    display: none !important;
}

/* ===== Page Transitions ===== */
body {
    opacity: 1;
    transition: opacity 0.2s ease;
}

body.page-transitioning {
    opacity: 0;
}

body.page-loaded {
    opacity: 1;
}

/* ===== Focus Styles ===== */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
    background: var(--accent-primary);
    color: white;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

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

/* ===== Motion Preferences ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Nav icons ===== */
nav a {
    display: inline-flex;
    align-items: center;
        gap: 0.5rem;
    }

    .learn-exam-footer {
        flex-direction: column;
        align-items: stretch;
    }

nav a i {
    font-size: 1.125rem;
}

/* ===== Category Icons ===== */
.category-icon i {
    font-size: 1.5rem;
}

/* ===== Contact Item Icons ===== */
.contact-item i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

/* ===== Footer Item Icons ===== */
.footer-item i {
    font-size: 1rem;
    color: var(--accent-primary);
}

/* ===== Page Title Icons ===== */
.page-title i {
    font-size: 2rem;
    color: var(--accent-primary);
}

/* ===== Direct Link Icons ===== */
.direct-link a i:first-child {
    font-size: 1.125rem;
}

/* ===== Topic Header Icons ===== */
.topic-header i.topic-arrow {
    font-size: 0.875rem;
    transition: transform var(--transition-base);
}

.topic-group.expanded .topic-arrow {
    transform: rotate(90deg);
}

/* ===== Search Panel Icons ===== */
.search-input-wrapper>i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.search-clear i {
    font-size: 1rem;
}

/* ===== No Results Icon ===== */
.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== ZLS Assistant ===== */
.zls-assistant {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1200;
}

.zls-assistant::before {
    content: '';
    position: absolute;
    inset: auto -1.5rem -1.5rem auto;
    width: 10rem;
    height: 10rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0) 72%);
    pointer-events: none;
}

.zls-assistant-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-full);
    padding: 0;
    width: 3.7rem;
    height: 3.7rem;
    position: relative;
    background: linear-gradient(135deg, #07111f 0%, #0f3c87 52%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 18px 40px rgba(8, 15, 33, 0.35);
    cursor: pointer;
    font: inherit;
}

.zls-assistant-fab i {
    font-size: 1.15rem;
}

.zls-assistant-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Indicador de "en línea" (puntito verde) sobre el avatar */
.zls-assistant-fab::after,
.zls-assistant-orb::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
    animation: zls-online-pulse 2s ease-in-out infinite;
}

@keyframes zls-online-pulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70%      { box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 0 0 0.42rem rgba(34, 197, 94, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .zls-assistant-fab::after,
    .zls-assistant-orb::after {
        animation: none;
    }
}

.zls-assistant-panel {
    position: absolute;
    right: 0;
    bottom: 4.9rem;
    width: min(430px, calc(100vw - 2rem));
    height: min(700px, calc(100vh - 7rem));
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px solid rgba(203, 213, 225, 0.55);
    border-radius: 1.6rem;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity var(--transition-base), transform var(--transition-base);
    overflow: hidden;
}

.zls-assistant.is-expanded .zls-assistant-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    transform-origin: center;
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.zls-assistant.is-expanded .zls-assistant-header {
    border-radius: 0;
}

.zls-assistant.is-expanded .zls-assistant-messages {
    padding-right: 0.55rem;
}

.zls-assistant.is-expanded .zls-assistant-message {
    max-width: min(78%, 980px);
}

.zls-assistant.is-open .zls-assistant-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.zls-assistant-header {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 0 0 auto;
    margin: -1rem -1rem 0;
    padding: 0.9rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.18);
    border-radius: 1.6rem 1.6rem 0 0;
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.12), transparent 36%),
        rgba(255, 255, 255, 0.56);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);
}

.zls-assistant-hero {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    flex: 1 1 auto;
}

.zls-assistant-orb {
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    color: #eff6ff;
    background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
}

.zls-assistant-orb i {
    font-size: 1.2rem;
}

.zls-assistant-header h2 {
    font-size: 1.18rem;
    line-height: 1.1;
    margin: 0;
}

.zls-assistant-eyebrow,
.zls-assistant-status {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zls-assistant-eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #2563eb;
}

.zls-assistant-status,
.zls-assistant-actions small {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.zls-assistant-window-actions {
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 0.55rem;
    flex: 0 0 auto;
}

/* Botones tipo "semáforo" (estilo macOS). Colores fijos, sin importar el tema. */
.zls-assistant-traffic {
    position: relative;
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.55);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.zls-assistant-traffic i {
    font-size: 0.72rem;
    line-height: 1;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

/* El icono aparece al pasar el mouse sobre cualquiera de los botones */
.zls-assistant-window-actions:hover .zls-assistant-traffic i,
.zls-assistant-traffic:focus-visible i {
    opacity: 1;
}

.zls-assistant-traffic:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
}

.zls-assistant-traffic.is-clear { background: #ff5f57; }   /* rojo  · borrar chat */
.zls-assistant-traffic.is-min   { background: #febc2e; }   /* amarillo · minimizar */
.zls-assistant-traffic.is-max   { background: #28c840; }   /* verde · pantalla completa */

.zls-assistant-messages {
    flex: 1 1 0px;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.6rem 0.3rem 0.15rem 0;
    scroll-padding-top: 1.6rem;
}

.zls-assistant-message {
    max-width: 88%;
    min-width: 0;
    box-sizing: border-box;
    /* No se encoge cuando el textarea crece o el panel se hace pequeño */
    flex-shrink: 0;
    padding: 0.95rem 1rem;
    border-radius: 1.1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.zls-assistant-messages > .zls-assistant-message:first-child {
    margin-top: 0.95rem;
}

.zls-assistant-message p {
    margin: 0;
    white-space: normal;
    word-break: break-word;
    line-height: 1.55;
}

.zls-assistant-message.is-assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #be185d;
    border-top-left-radius: 0.45rem;
}

.zls-assistant-message.is-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #082f6b 0%, #1d4ed8 100%);
    color: #ffffff;
    border-top-right-radius: 0.45rem;
}

.zls-assistant-message.is-user p,
.zls-assistant-message.is-user strong,
.zls-assistant-message.is-user span,
.zls-assistant-message.is-user small {
    color: #ffffff !important;
}

.zls-assistant-rich {
    display: grid;
    gap: 0.7rem;
}

.zls-assistant-rich p,
.zls-assistant-rich ul,
.zls-assistant-rich ol,
.zls-assistant-rich h3,
.zls-assistant-rich h4,
.zls-assistant-rich h5 {
    margin: 0;
}

.zls-assistant-rich h3,
.zls-assistant-rich h4,
.zls-assistant-rich h5 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #9d174d;
}

.zls-assistant-rich h3 {
    font-size: 1rem;
}

.zls-assistant-rich h4,
.zls-assistant-rich h5 {
    font-size: 0.93rem;
}

.zls-assistant-rich ul,
.zls-assistant-rich ol {
    padding-left: 1.15rem;
    display: grid;
    gap: 0.45rem;
}

.zls-assistant-rich li {
    line-height: 1.55;
}

.zls-assistant-rich code {
    display: inline-block;
    padding: 0.12rem 0.42rem;
    border-radius: 0.45rem;
    background: rgba(148, 163, 184, 0.16);
    color: #0f3c87;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.85em;
}

/* ── Code blocks en el asistente ── */
.zls-assistant-message.is-assistant {
    /* El bubble no puede ser más ancho que el panel */
    min-width: 0;
    overflow: hidden;
}

.zls-assistant-rich {
    min-width: 0;
    overflow: hidden;
}

.zls-assistant-code-block {
    /* Ocupa todo el ancho del bubble y contiene el scroll horizontal */
    width: 100%;
    box-sizing: border-box;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    margin: 0;
}

.zls-assistant-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(15, 23, 42, 0.06);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.zls-assistant-code-lang {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.75em;
    color: var(--text-secondary, #64748b);
    text-transform: lowercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zls-assistant-copy-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.28rem 0.6rem;
    border: none;
    border-radius: 0.4rem;
    background: transparent;
    color: var(--text-secondary, #64748b);
    font-size: 0.75em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    /* área táctil mínima de 44px en mobile */
    min-height: 2rem;
}

.zls-assistant-copy-btn:hover,
.zls-assistant-copy-btn:active {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
}

.zls-assistant-code-block pre {
    margin: 0;
    padding: 0.8rem 0.9rem;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.04);
    overscroll-behavior-x: contain;
}

.zls-assistant-code-block code {
    display: block !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #0f172a !important;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.83em;
    line-height: 1.6;
    white-space: pre;
    word-break: normal;
    /* hace que el código se pueda desplazar, no que empuje el layout */
    width: max-content;
    min-width: 100%;
}

[data-theme="dark"] .zls-assistant-code-block {
    border-color: rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] .zls-assistant-code-header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(148, 163, 184, 0.1);
}

[data-theme="dark"] .zls-assistant-code-block pre {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .zls-assistant-code-block code {
    color: #cbd5e1 !important;
}

.zls-assistant-rich strong {
    font-weight: 800;
    color: #0f172a;
}

.zls-assistant-rich em {
    font-style: italic;
}

.zls-assistant-message.is-thinking {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.zls-assistant-thinking {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
}

.zls-assistant-thinking span {
    width: 0.48rem;
    height: 0.48rem;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.72);
    animation: zlsAssistantPulse 1s ease-in-out infinite;
}

.zls-assistant-thinking span:nth-child(2) {
    animation-delay: 0.15s;
}

.zls-assistant-thinking span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes zlsAssistantPulse {
    0%,
    80%,
    100% {
        transform: scale(0.75);
        opacity: 0.45;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.zls-assistant-form {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: auto;
    flex: 0 0 auto;
}

.zls-assistant-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.2rem;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.zls-assistant-form textarea {
    width: 100%;
    min-height: 3.25rem;
    max-height: 10rem;
    resize: none;
    border: 0;
    outline: none;
    padding: 0.45rem 0.25rem;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}

.zls-assistant-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0.2rem;
}

.zls-assistant-composer button {
    min-width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 0;
    border-radius: 999px;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
}

.zls-assistant-composer button:disabled,
.zls-assistant-form textarea:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

[data-theme="dark"] .zls-assistant-panel {
    background: rgba(15, 23, 42, 0.40);
    border-color: rgba(51, 65, 85, 0.55);
    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);
}

[data-theme="dark"] .zls-assistant-header {
    border-bottom-color: rgba(var(--accent-primary-rgb), 0.16);
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.08), transparent 40%),
        rgba(15, 23, 42, 0.44);
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.06), 0 8px 20px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .zls-assistant-composer {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(71, 85, 105, 0.62);
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

[data-theme="dark"] .zls-assistant-form textarea {
    color: #f8fafc;
    caret-color: #f8fafc;
}

[data-theme="dark"] .zls-assistant-form textarea::placeholder {
    color: #94a3b8;
}

[data-theme="dark"] .zls-assistant-message.is-user {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 52%, #60a5fa 100%);
    border: 1px solid rgba(147, 197, 253, 0.28);
}

[data-theme="dark"] .zls-assistant-message.is-user p,
[data-theme="dark"] .zls-assistant-message.is-user strong,
[data-theme="dark"] .zls-assistant-message.is-user span,
[data-theme="dark"] .zls-assistant-message.is-user small {
    color: #eff6ff !important;
}

[data-theme="dark"] .zls-assistant-rich h3,
[data-theme="dark"] .zls-assistant-rich h4,
[data-theme="dark"] .zls-assistant-rich h5,
[data-theme="dark"] .zls-assistant-rich strong {
    color: #fbcfe8;
}

[data-theme="dark"] .zls-assistant-rich code {
    background: rgba(51, 65, 85, 0.72);
    color: #bfdbfe;
}

[data-theme="dark"] .zls-assistant-message.is-assistant {
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f9a8d4;
    border: 1px solid rgba(71, 85, 105, 0.45);
}

[data-theme="dark"] .zls-assistant-message.is-assistant p,
[data-theme="dark"] .zls-assistant-message.is-assistant li,
[data-theme="dark"] .zls-assistant-message.is-assistant em {
    color: #e2e8f0;
}

@media (max-width: 640px) {
    /* FAB circular sin etiqueta */
    .zls-assistant {
        right: 0.85rem;
        bottom: 0.85rem;
    }

    .zls-assistant-fab {
        padding: 0;
        border-radius: 999px;
    }

    .zls-assistant-fab span {
        display: none;
    }

    /* En móvil agrandamos los botones para el toque y mostramos siempre el icono (no hay hover) */
    .zls-assistant-traffic {
        width: 1.35rem;
        height: 1.35rem;
    }

    .zls-assistant-traffic i {
        opacity: 1;
        font-size: 0.8rem;
    }

    /* Panel pantalla completa con slide-up */
    .zls-assistant-panel {
        position: fixed;
        inset: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        overflow: hidden;
        transform-origin: bottom center;
        transform: translateY(100%);
        transition: opacity var(--transition-base), transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        padding: 0.85rem;
        padding-top: max(0.85rem, env(safe-area-inset-top));
        padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
    }

    .zls-assistant-messages {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .zls-assistant.is-open .zls-assistant-panel {
        transform: translateY(0);
    }

    /* Botón enviar solo icono */
    .zls-assistant-composer button span {
        display: none;
    }

    .zls-assistant-composer button {
        min-width: 2.75rem;
        padding: 0.8rem;
    }

    .zls-assistant-actions small,
    .zls-assistant-actions {
        display: none;
    }

    /* El status en el header ocupa una tercera línea que se sale en pantallas cortas */
    .zls-assistant-status {
        display: none;
    }

    /* El header queda más compacto y cubre el scroll de mensajes en mobile */
    .zls-assistant-header {
        align-items: center;
        margin: -0.85rem -0.85rem 0;
        padding: 0.78rem 0.85rem 0.72rem;
        border-radius: 0;
    }

    /* Mensajes del asistente más anchos en mobile para que el código quepa */
    .zls-assistant-message {
        max-width: 96%;
    }

    .zls-assistant-code-block pre {
        padding: 0.7rem 0.75rem;
    }

    .zls-assistant-code-block code {
        font-size: 0.78em;
    }
}


/* Assistant palette binding — colors follow the page palette via CSS variables. */
.zls-assistant::before {
    background: radial-gradient(circle, rgba(var(--accent-primary-rgb), 0.22) 0%, rgba(var(--accent-primary-rgb), 0) 72%);
}

.zls-assistant .zls-assistant-fab,
.zls-assistant .zls-assistant-orb,
.zls-assistant .zls-assistant-message.is-user,
.zls-assistant .zls-assistant-composer button {
    background: var(--accent-gradient);
}

.zls-assistant .zls-assistant-fab {
    box-shadow: 0 18px 40px rgba(var(--accent-primary-rgb), 0.28);
}

.zls-assistant .zls-assistant-panel {
    border-color: rgba(var(--accent-primary-rgb), 0.28);
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.12), transparent 36%),
        rgba(255, 255, 255, 0.42);
    box-shadow: 0 24px 60px rgba(var(--accent-primary-rgb), 0.14), 0 18px 50px rgba(15, 23, 42, 0.12);
}

.zls-assistant .zls-assistant-orb,
.zls-assistant .zls-assistant-composer button {
    box-shadow: 0 12px 28px rgba(var(--accent-primary-rgb), 0.28);
}

.zls-assistant .zls-assistant-eyebrow,
.zls-assistant .zls-assistant-rich strong,
.zls-assistant .zls-assistant-copy-btn:hover,
.zls-assistant .zls-assistant-copy-btn:active {
    color: var(--accent-primary);
}

.zls-assistant .zls-assistant-message.is-user {
    border: 1px solid rgba(var(--accent-secondary-rgb), 0.24);
    box-shadow: 0 12px 28px rgba(var(--accent-primary-rgb), 0.18);
}

.zls-assistant .zls-assistant-message.is-assistant {
    border: 1px solid rgba(var(--accent-primary-rgb), 0.12);
}

.zls-assistant .zls-assistant-rich code {
    color: var(--accent-primary);
    background: var(--accent-active-bg);
}

.zls-assistant .zls-assistant-copy-btn:hover,
.zls-assistant .zls-assistant-copy-btn:active {
    background: var(--accent-active-bg);
}

.zls-assistant .zls-assistant-thinking span {
    background: rgba(var(--accent-primary-rgb), 0.72);
}

.zls-assistant .zls-assistant-composer {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 12px 30px rgba(var(--accent-primary-rgb), 0.08);
}

.zls-assistant .zls-assistant-form textarea:focus-visible {
    outline-color: var(--accent-primary);
}

[data-theme="dark"] .zls-assistant .zls-assistant-panel {
    border-color: rgba(var(--accent-primary-rgb), 0.28);
    background:
        radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.14), transparent 38%),
        rgba(15, 23, 42, 0.48);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 18px 50px rgba(var(--accent-primary-rgb), 0.1);
}

[data-theme="dark"] .zls-assistant .zls-assistant-message.is-assistant {
    border-color: rgba(var(--accent-primary-rgb), 0.18);
}

[data-theme="dark"] .zls-assistant .zls-assistant-composer {
    border-color: rgba(var(--accent-primary-rgb), 0.24);
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08), 0 12px 30px rgba(var(--accent-primary-rgb), 0.08);
}

/* ── Notification Widget ── */
.notifications-widget {
    position: relative;
    display: inline-flex;
    z-index: 20;
}

.notifications-button {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.notifications-button:hover,
.notifications-button:focus-visible {
    transform: translateY(-1px);
    border-color: var(--accent-primary);
    background: var(--bg-surface);
    outline: none;
}

.notifications-button i {
    font-size: 1.1rem;
}

.notifications-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    border: 2px solid var(--bg-card);
    line-height: 1;
}

.notifications-badge[hidden] {
    display: none;
}

header nav a .nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 0.35rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.notifications-panel {
    position: fixed;
    top: 60px;
    right: 1rem;
    width: min(360px, calc(100vw - 2rem));
    max-height: 430px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(18px) saturate(165%);
    -webkit-backdrop-filter: blur(18px) saturate(165%);
    border: 1px solid rgba(203, 213, 225, 0.55);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    padding: 0.9rem;
    z-index: 1010;
}

[data-theme="dark"] .notifications-panel {
    background: rgba(15, 23, 42, 0.40);
    border-color: rgba(51, 65, 85, 0.55);
}

.notifications-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.notifications-panel-header strong {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.notifications-browser-push {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.75rem;
    padding: 0.7rem;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: var(--radius-lg);
    background: rgba(37, 99, 235, 0.08);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.notifications-browser-push[hidden] {
    display: none;
}

.notifications-browser-push button {
    justify-self: start;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--accent-primary);
    color: white;
    padding: 0.4rem 0.75rem;
    font-weight: 800;
    cursor: pointer;
}

.notifications-browser-push.is-blocked {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.08);
}


.notifications-list {
    display: grid;
    gap: 0.65rem;
    padding-top: 0.75rem;
}

.notifications-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.35rem 0;
}

.notification-item {
    display: grid;
    gap: 0.3rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

.notification-item.is-unread {
    border-color: rgba(220, 38, 38, 0.45);
}

.notification-item[data-notification-action] {
    cursor: pointer;
}

.notification-item[data-notification-action]:hover {
    border-color: var(--accent-primary);
}


.notification-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.notification-title-row strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.notification-dismiss {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}

.notification-dismiss:hover,
.notification-dismiss:focus-visible {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.45);
    outline: none;
}


.notification-time {
    color: var(--text-muted);
    font-size: 0.76rem;
    white-space: nowrap;
}

.notification-body {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.4;
}

@media (max-width: 560px) {
    .notifications-panel {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100vw - 1.5rem);
    }
}


/* ===== Chats flotantes del foro (persisten en todo el sitio) ===== */
/* Chats flotantes (burbujas), apiladas encima del asistente Elizabeth */
.foro-floaters { position: fixed; right: 1.25rem; bottom: 5.4rem; z-index: 1200; display: flex; flex-direction: column-reverse; gap: 0.6rem; align-items: flex-end; }
.foro-float-bubble { position: relative; width: 3.4rem; height: 3.4rem; border-radius: 50%; border: none; padding: 0; cursor: pointer; overflow: visible; background: var(--accent-gradient); box-shadow: 0 14px 32px rgba(8, 15, 33, 0.30); display: grid; place-items: center; }
.foro-float-bubble > span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; overflow: hidden; }
.foro-float-bubble img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.foro-float-bubble i { font-size: 1.35rem; color: #fff; }
.foro-float-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.66rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg-card); }

.foro-float-panel { position: fixed; right: 1.25rem; bottom: 5.4rem; width: min(380px, calc(100vw - 2rem)); height: min(560px, calc(100vh - 8rem)); z-index: 1201; display: none; flex-direction: column; border: 1px solid rgba(203, 213, 225, 0.55); border-radius: 1.4rem; overflow: hidden; background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%); box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22); }
.foro-float-panel.open { display: flex; }
.foro-float-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.8rem; border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.18); background: radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.12), transparent 36%), rgba(255, 255, 255, 0.56); }
.foro-float-ava { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: var(--accent-gradient); }
.foro-float-ava img { width: 100%; height: 100%; object-fit: cover; }
.foro-float-ava i { color: #fff; }
.foro-float-meta { flex: 1; min-width: 0; }
.foro-float-meta strong { display: block; font-size: 0.92rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foro-float-meta span { font-size: 0.72rem; color: var(--text-tertiary); }
/* Los botones de la cabecera usan el diseño "semáforo" de Elizabeth
   (.zls-assistant-window-actions / .zls-assistant-traffic), definido arriba. */
.foro-float-msgs { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.foro-fmsg { display: flex; gap: 0.45rem; max-width: 90%; }
.foro-fmsg.mine { align-self: flex-end; flex-direction: row-reverse; }
.foro-fmsg-ava { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.foro-fbubble { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.45rem 0.6rem; min-width: 0; }
.foro-fmsg.mine .foro-fbubble { background: var(--accent-active-bg); }
.foro-fname { display: block; font-size: 0.72rem; font-weight: 700; color: var(--accent-primary); margin-bottom: 0.1rem; }
.foro-fname.bot { color: #7c3aed; }
.foro-fbody { font-size: 0.88rem; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }
.foro-ftime { display: block; font-size: 0.62rem; color: var(--text-tertiary); text-align: right; margin-top: 0.15rem; }
.foro-float-msgs .foro-att-img { max-width: 100%; max-height: 200px; }
.foro-float-form { display: flex; align-items: flex-end; gap: 0.4rem; padding: 0.55rem 0.6rem; background: rgba(255, 255, 255, 0.56); backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%); border-top: 1px solid rgba(203, 213, 225, 0.45); }
.foro-float-attach { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text-tertiary); background: var(--bg-secondary); border: 1px solid var(--border-color); }
.foro-float-attach:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.foro-float-form textarea { flex: 1; resize: none; max-height: 90px; min-height: 38px; padding: 0.45rem 0.65rem; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary); font: inherit; font-size: 0.9rem; }
.foro-float-form textarea:focus { outline: none; border-color: var(--accent-primary); }
.foro-float-send { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; background: var(--accent-gradient); color: #fff; font-size: 1.05rem; display: grid; place-items: center; }
[data-theme="dark"] .foro-float-panel { background: rgba(15, 23, 42, 0.55); border-color: rgba(51, 65, 85, 0.55); }
[data-theme="dark"] .foro-float-head { background: radial-gradient(circle at top right, rgba(var(--accent-primary-rgb), 0.08), transparent 40%), rgba(15, 23, 42, 0.44); }
[data-theme="dark"] .foro-float-form { background: rgba(15, 23, 42, 0.9); border-top-color: rgba(71, 85, 105, 0.62); }
@media (max-width: 480px) {
    .foro-float-panel { width: calc(100vw - 1.2rem); right: 0.6rem; }
}

/* Chat flotante del foro maximizado (pantalla completa) */
.foro-float-panel.expanded {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh; max-width: none; border-radius: 0;
}

/* En móvil no se muestra el botón de maximizar (ni en Elizabeth IA ni en las
   burbujas del foro): los paneles ya ocupan casi toda la pantalla. */
@media (max-width: 640px) {
    .zls-assistant-traffic.is-max { display: none; }
}
