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

html {
    height: 100%;
    width: 100%;
}

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --dropdown-bg-rgb: 248, 250, 252;
    --text-primary: #4b5563;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --primary: #06b6d4;
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-soft: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --dropdown-bg-rgb: 15, 23, 42;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

[data-theme-variant="deep-dark"] {
    color-scheme: dark;
    --bg-primary: #020617;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --dropdown-bg-rgb: 2, 6, 23;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --primary: #22d3ee;
}

[data-theme="claude"] {
    --bg-primary: #f5f5f0;
    --bg-secondary: #ffffff;
    --bg-tertiary: #ebebe0;
    --dropdown-bg-rgb: 245, 245, 240;
    --text-primary: #4e4e4e;
    --text-secondary: #4d4d4d;
    --text-muted: #808080;
    --border-color: #d1d1c2;
    --primary: #d97706;
    --accent: #06b6d4;
    --shadow-soft: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

[data-theme-variant="claude-dark"] {
    color-scheme: dark;
    --bg-primary: #171717;
    --bg-secondary: #212121;
    --bg-tertiary: #2a2a2a;
    --dropdown-bg-rgb: 23, 23, 23;
    --text-primary: #e3e3e3;
    --text-secondary: #b4b4b4;
    --text-muted: #737373;
    --border-color: #333333;
    --primary: #d97757;
    --accent: #cc785c;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

[data-theme-variant="aurora"] {
    color-scheme: dark;
    --bg-primary: #071a17;
    --bg-secondary: #0d2420;
    --bg-tertiary: #12312c;
    --dropdown-bg-rgb: 7, 26, 23;
    --text-primary: #e6fffb;
    --text-secondary: #a7f3d0;
    --text-muted: #7dd3fc;
    --border-color: #14443d;
    --primary: #22c55e;
    --accent: #06b6d4;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.45);
}

[data-theme-variant="cobalt"] {
    --bg-primary: #f1f7ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8f0ff;
    --dropdown-bg-rgb: 241, 247, 255;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #dbeafe;
    --primary: #2563eb;
    --accent: #06b6d4;
}

[data-theme-variant="rose"] {
    --bg-primary: #fff1f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #ffe4e6;
    --dropdown-bg-rgb: 255, 241, 245;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --border-color: #fecdd3;
    --primary: #ec4899;
    --accent: #22d3ee;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100%;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}
body:has(.app-container:has(.dashboard-layout)) {
    height: 100%;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font: inherit;
}

.container {
    width: min(1280px, 100% - 32px);
    margin: 0 auto;
    padding: 20px 0 40px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 16px;
}

@media (min-width: 1800px) {
    .container {
        width: min(1400px, 100% - 48px);
    }
}

@media (max-width: 768px) {
    .container {
        width: calc(100% - 20px);
        padding: 16px 0 32px;
        gap: 12px;
    }
}

/* Cuando el container envuelve dashboard-layout: ocupar toda la pantalla como en Asistencia */
.container:has(.dashboard-layout) {
    width: 100%;
    min-width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    padding: 0;
    margin: 0;
    gap: 0;
    box-sizing: border-box;
}
/* app-container con layout (students, módulos): llenar viewport para que el footer quede abajo */
.app-container:has(.dashboard-layout) {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
.app-container:has(.dashboard-layout) .dashboard-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    width: 100%;
    overflow: hidden;
}
.container:has(.dashboard-layout) .dashboard-layout {
    flex: 1;
    min-height: 0;
    min-width: 100%;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}
/* Main siempre 72px; al abrir el sidebar este se superpone (z-index) y el contenido no se corre */
.container:has(.dashboard-layout) .dashboard-main,
.app-container:has(.dashboard-layout) .dashboard-main {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    margin-left: 72px;
    padding: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
/* Sidebar fijo (position: fixed): siempre visible a la izquierda, por encima del contenido */
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 256px !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    z-index: 1100;
}
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed {
    width: 72px !important;
}
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder {
    flex-shrink: 0;
    min-width: 0;
    width: 0 !important;
}
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder:has(.dashboard-sidebar.collapsed),
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder:has(.dashboard-sidebar.collapsed) {
    width: 0 !important;
}
/* Navbar fijo (position: fixed): siempre visible arriba */
.container:has(.dashboard-layout) #dashboard-navbar-placeholder,
.app-container:has(.dashboard-layout) #dashboard-navbar-placeholder {
    width: 100%;
    flex-shrink: 0;
    height: 64px;
    min-height: 64px;
}
/* Navbar fija en left: 72px; al abrir el sidebar este se superpone y la barra no se corre */
.container:has(.dashboard-layout) .dashboard-main .dashboard-navbar,
.app-container:has(.dashboard-layout) .dashboard-main .dashboard-navbar {
    position: fixed !important;
    top: 0 !important;
    left: 72px !important;
    right: 0 !important;
    width: auto !important;
    height: 64px !important;
    z-index: 35;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0;
}
.container:has(.dashboard-layout) .dashboard-main .dashboard-navbar .navbar-inner,
.app-container:has(.dashboard-layout) .dashboard-main .dashboard-navbar .navbar-inner {
    width: 100%;
    max-width: none;
    padding: 0 1rem;
    box-sizing: border-box;
}

/* ========= Dashboard layout estilo OciannClass: sidebar fijo + main con navbar gradiente ========= */
.dashboard-layout {
    display: flex;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    gap: 0;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* Sidebar: fijo izquierda, altura completa, gradiente (estilo OciannClass) */
.dashboard-sidebar {
    width: 256px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
    position: relative;
}

.dashboard-sidebar.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1100;
    width: 256px;
    background: linear-gradient(180deg, #0A1929 0%, #0f2942 30%, #152839 55%, #1a3d4a 80%, #0d4a4a 100%);
    background-color: #152839;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    margin-right: 0;
    box-shadow: none;
}

.dashboard-sidebar.app-sidebar .sidebar-logo {
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-sidebar.app-sidebar .sidebar-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    width: 100%;
}

.dashboard-sidebar.app-sidebar .sidebar-logo-img {
    max-height: 44px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.dashboard-sidebar.app-sidebar .sidebar-logo-emblem {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-sidebar.app-sidebar .sidebar-logo-text {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.dashboard-sidebar.app-sidebar .sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* permite que el flex item se encoja y muestre scroll */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1rem;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    -ms-overflow-style: none;
}

.dashboard-sidebar.app-sidebar .sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.dashboard-sidebar.app-sidebar .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.dashboard-sidebar.app-sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}
.dashboard-sidebar.app-sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.dashboard-sidebar.app-sidebar .sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem 0 0 0.75rem;
    margin-right: 0;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none;
}

.dashboard-sidebar.app-sidebar .sidebar-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
    color: #fff;
}

.dashboard-sidebar.app-sidebar .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.dashboard-sidebar.app-sidebar .sidebar-link:hover i {
    color: #fff;
}

.dashboard-sidebar.app-sidebar .sidebar-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.dashboard-sidebar.app-sidebar .sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.75rem 1rem 0.25rem;
}

.dashboard-sidebar.app-sidebar .sidebar-user {
    flex-shrink: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.dashboard-sidebar.app-sidebar .sidebar-user:hover {
    background: rgba(255, 255, 255, 0.08);
}
.dashboard-sidebar.app-sidebar .sidebar-user:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
}
.dashboard-sidebar.app-sidebar .sidebar-user:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.dashboard-sidebar.app-sidebar .sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    overflow: hidden;
    flex-shrink: 0;
}

.dashboard-sidebar.app-sidebar .sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-sidebar.app-sidebar .sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.dashboard-sidebar.app-sidebar .sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-sidebar.app-sidebar .sidebar-user-period {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-sidebar.collapsed {
    width: 72px;
}

.dashboard-sidebar.collapsed.app-sidebar {
    width: 72px;
}

.dashboard-sidebar.collapsed .sidebar-logo-text,
.dashboard-sidebar.collapsed .sidebar-link span,
.dashboard-sidebar.collapsed .sidebar-section-label,
.dashboard-sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    padding: 0;
    margin: 0;
}

.dashboard-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.dashboard-sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.dashboard-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Sidebar siempre cerrado: se abre al pasar el mouse (hover) */
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover {
    width: 256px !important;
}
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-logo-text,
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-link span,
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-section-label,
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-user-info,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-logo-text,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-link span,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-section-label,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-user-info {
    opacity: 1;
    visibility: visible;
    width: auto;
    overflow: visible;
    padding: 0;
    margin: 0;
}
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-link,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-link {
    justify-content: flex-start;
    padding-left: 14px;
    padding-right: 14px;
}
.container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-user,
.app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.collapsed:hover .sidebar-user {
    justify-content: flex-start;
}
/* Sidebar al expandir por hover se superpone; main y navbar no se mueven */

/* Botón contraer/expandir sidebar: oculto de momento (solo en dashboard) */
#dashboardSidebar .sidebar-toggle,
#dashboardSidebar #sidebarToggle {
    display: none !important;
    visibility: hidden !important;
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transform: translateY(-50%);
    z-index: 50;
    transition: background 0.2s ease, color 0.2s ease;
}

.dashboard-sidebar.app-sidebar .sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.dashboard-sidebar.app-sidebar .sidebar-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.sidebar-nav-director {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    margin-top: 8px;
}

/* Main: margen fijo 72px; el sidebar se superpone al abrirse sin desplazar el contenido */
.dashboard-main {
    flex: 1;
    min-width: 0;
    margin-left: 72px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Navbar estilo OciannClass: barra gradiente h-16, iconos a la derecha */
.dashboard-navbar.gradient-header {
    flex-shrink: 0;
    height: 64px;
    padding: 0 1rem;
    background: linear-gradient(135deg, #152839 0%, #2b4b63 50%, #365d78 100%);
    border: none;
    border-radius: 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 30;
}

.dashboard-navbar .navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 100%;
    max-width: 100%;
}

.dashboard-navbar .navbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.dashboard-navbar .navbar-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dashboard-navbar .navbar-title-text {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-navbar .navbar-period-badge {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-navbar .navbar-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.dashboard-navbar .navbar-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.dashboard-navbar .nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    position: relative;
}

.dashboard-navbar .nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dashboard-navbar .nav-btn i {
    font-size: 1.1rem;
}

.dashboard-navbar .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* SEA Status Badge */

.dashboard-navbar .theme-selector-wrapper {
    position: relative;
}

/* Dropdown de tema: posición fija para no ser recortado por overflow del layout (top/right se setean en JS) */
.dashboard-navbar .theme-dropdown {
    position: fixed;
    z-index: 2100;
}

/* Animaciones de entrada para elementos del layout */
.container.page-visible .dashboard-sidebar {
    opacity: 0;
    animation: softRevealRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.05s;
}

.container.page-visible .dashboard-navbar {
    opacity: 0;
    animation: softRevealLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.1s;
}

.director-only {
    display: none !important;
}

html[data-initial-role-view="director"] .director-only,
html[data-initial-role-view="both"] .director-only {
    display: block !important;
}

/* #directorSidebarNav visibility is toggled by dashboard.js (role tabs) */

@media (max-width: 1100px) {
    .dashboard-sidebar.app-sidebar {
        width: 72px;
    }
    .dashboard-main {
        margin-left: 72px;
    }
    .dashboard-sidebar .sidebar-logo-text,
    .dashboard-sidebar .sidebar-link span,
    .dashboard-sidebar .sidebar-section-label,
    .dashboard-sidebar .sidebar-user-info {
        opacity: 0;
        visibility: hidden;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
        padding: 0;
        margin: 0;
    }
    .dashboard-sidebar .sidebar-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }
    .dashboard-sidebar .sidebar-user {
        justify-content: center;
    }
    .dashboard-sidebar .sidebar-toggle {
        display: none;
    }
}

/* Botón hamburguesa: oculto en escritorio, visible solo en móvil (se muestra en @media max-width: 768px) */
.dashboard-navbar .navbar-mobile-menu,
.dashboard-navbar #navbarMobileMenu {
    display: none;
}

/* Overlay móvil cuando el sidebar está abierto (debajo del sidebar para que el sidebar quede encima) */
body.sidebar-overlay-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1050;
    pointer-events: auto;
}

/* Móvil: sidebar oculto, contenido a ancho completo (como panel izquierdo de referencia) */
@media (max-width: 768px) {
    /* Misma especificidad que las reglas globales para que el sidebar quede fuera de pantalla */
    .container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar:not(.mobile-open),
    .app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar:not(.mobile-open) {
        transform: translateX(-100%) !important;
        width: 256px !important;
        transition: transform 0.25s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }
    .container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.mobile-open,
    .app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder .dashboard-sidebar.app-sidebar.mobile-open {
        transform: translateX(0) !important;
        z-index: 1110;
    }
    /* Fallback por si no aplica el selector anterior */
    .dashboard-sidebar.app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease, width 0.25s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }
    .dashboard-sidebar.app-sidebar.mobile-open {
        transform: translateX(0);
        z-index: 1110;
        width: 256px !important;
        min-width: 256px !important;
    }
    /* En móvil el placeholder no ocupa espacio cuando el sidebar está abierto: el sidebar se superpone y el contenido no se corre */
    .container:has(.dashboard-layout) #dashboard-sidebar-placeholder:has(.dashboard-sidebar.mobile-open),
    .app-container:has(.dashboard-layout) #dashboard-sidebar-placeholder:has(.dashboard-sidebar.mobile-open) {
        width: 0 !important;
        min-width: 0 !important;
    }
    /* En móvil, cuando el sidebar está abierto, mostrar nombres de módulos y contenido completo */
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-logo-text,
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-link span,
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-section-label,
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-user-info {
        opacity: 1 !important;
        visibility: visible !important;
        width: auto !important;
        max-width: none !important;
        overflow: visible !important;
        white-space: nowrap !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-link {
        justify-content: flex-start !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-user {
        justify-content: flex-start !important;
    }
    .dashboard-sidebar.app-sidebar.mobile-open .sidebar-nav {
        width: 100% !important;
    }
    /* Evitar que el sidebar se vea si sobresale en móvil */
    .container:has(.dashboard-layout),
    .app-container:has(.dashboard-layout) {
        overflow-x: hidden;
    }
    /* Contenido principal y navbar a ancho completo en móvil */
    .dashboard-main,
    .container:has(.dashboard-layout) .dashboard-main,
    .app-container:has(.dashboard-layout) .dashboard-main,
    .container:has(.dashboard-layout) .dashboard-layout:has(.dashboard-sidebar.collapsed) .dashboard-main,
    .app-container:has(.dashboard-layout) .dashboard-layout:has(.dashboard-sidebar.collapsed) .dashboard-main {
        margin-left: 0 !important;
    }
    .container:has(.dashboard-layout) .dashboard-main .dashboard-navbar,
    .app-container:has(.dashboard-layout) .dashboard-main .dashboard-navbar,
    .container:has(.dashboard-layout) .dashboard-layout:has(.dashboard-sidebar.collapsed) .dashboard-main .dashboard-navbar,
    .app-container:has(.dashboard-layout) .dashboard-layout:has(.dashboard-sidebar.collapsed) .dashboard-main .dashboard-navbar {
        left: 0 !important;
        z-index: 1100 !important; /* por encima del contenido (p. ej. header cotidiano z-index 1000) */
    }
    .dashboard-sidebar.collapsed ~ .dashboard-main {
        margin-left: 0 !important;
    }
    /* Menú hamburguesa visible en móvil para abrir el sidebar */
    .dashboard-navbar .navbar-mobile-menu,
    .dashboard-navbar #navbarMobileMenu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        margin-right: 8px;
        border: none;
        border-radius: 10px;
        background: var(--bg-tertiary, rgba(255,255,255,0.1));
        color: var(--text-primary, #fff);
        cursor: pointer;
        font-size: 1.25rem;
        pointer-events: auto !important;
        position: relative;
        z-index: 10;
    }
    .dashboard-navbar #navbarMobileMenu:hover {
        background: var(--bg-secondary, rgba(255,255,255,0.15));
    }
    .dashboard-navbar #navbarMobileMenu[aria-expanded="true"] {
        background: var(--primary, #06b6d4);
        color: #fff;
    }
    /* En móvil ocultar todas las opciones del navbar excepto hamburguesa y logout */
    .dashboard-navbar .navbar-right .nav-btn:not(.nav-btn-logout),
    .dashboard-navbar .navbar-right .theme-selector-wrapper {
        display: none !important;
    }
    .dashboard-navbar .navbar-right .nav-btn-logout {
        display: flex !important;
    }
    /* En móvil no mostrar nombre ni período en la navbar */
    .dashboard-navbar .navbar-title,
    .dashboard-navbar .navbar-title-text,
    .dashboard-navbar .navbar-period-badge,
    .dashboard-navbar #teacherProfileName {
        display: none !important;
    }
    .dashboard-sidebar.collapsed ~ .dashboard-main {
        margin-left: 0 !important;
    }
}

.fade-in {
    animation: fadeInUp 0.35s ease forwards;
}

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

/* Animaciones de entrada suave para el Dashboard */
.container.page-visible .profile-avatar {
    opacity: 0;
    animation: softScale 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.1s;
    border-radius: 50% !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Bypass para carga instantánea desde caché */
.container.page-visible .profile-avatar.cache-instant {
    opacity: 1 !important;
    animation: none !important;
    transform: scale(1) !important;
}

.container.page-visible #teacherProfileName {
    opacity: 0;
    animation: softRevealRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.15s;
}

.container.page-visible .current-period {
    opacity: 0;
    animation: softRevealRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.25s;
}

.container.page-visible .controls-box {
    opacity: 0;
    animation: softRevealLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.2s;
}

/* Staggering para elementos internos de controls-box */
.container.page-visible #themeToggleBtn {
    opacity: 0;
    animation: softScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.45s;
}

.container.page-visible #ociannclassAccountStatusBtn,
.container.page-visible #ociannclassAccountStatusBtn i.fa-crown {
    opacity: 0;
    animation: softScale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.55s;
}

/* Efecto de pulso suave inicial para la corona */
@keyframes crownPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes softRevealLeft {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

@keyframes softScale {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.admin-only,
.teacher-only {
    display: none;
}

/* Mostrar sidebar y navbar en todos los módulos con dashboard-layout (no solo en dashboard) */
.container:has(.dashboard-layout) #dashboardSidebar.teacher-only,
.app-container:has(.dashboard-layout) #dashboardSidebar.teacher-only {
    display: flex !important;
}
.container:has(.dashboard-layout) #dashboardNavbar.teacher-only,
.app-container:has(.dashboard-layout) #dashboardNavbar.teacher-only {
    display: block !important;
}
.container:has(.dashboard-layout) #dashboardNavbar .controls-box.teacher-only,
.app-container:has(.dashboard-layout) #dashboardNavbar .controls-box.teacher-only {
    display: flex !important;
}

/* Banner "Activa tu cuenta" (email no verificado; no bloquea acceso) */
.email-activation-banner.teacher-only,
.container:has(.dashboard-layout) .email-activation-banner.teacher-only,
.app-container:has(.dashboard-layout) .email-activation-banner.teacher-only {
    display: block !important;
}
.email-activation-banner {
    display: block;
    background: linear-gradient(135deg, var(--primary) 0%, #0ea5e9 100%);
    color: #fff;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow-soft);
}
.email-activation-banner-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
}
.email-activation-banner-icon {
    opacity: 0.95;
}
.email-activation-banner-text {
    flex: 1;
    min-width: 200px;
}
.email-activation-banner-link {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}
.email-activation-banner-link:hover {
    color: #e0f2fe;
}
.email-activation-open-btn:hover {
    color: #e0f2fe;
}
.profile-completion-banner {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
}
.profile-completion-open-btn:hover {
    color: #ccfbf1;
}

/* ========= Botones y chips ========= */
.action-btn,
.btn-primary-minimal,
.floating-btn,
.friends-icon-btn,
.mark-all-read-btn,
.close-notifications-btn,
.view-all-btn,
.modal-close,
.logout-close-btn,
.btn-change-email,
.btn-email-action,
.role-tab,
.tab-btn,
.file-input-label,
.btn-search {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn,
.btn-primary-minimal,
.btn-email-action {
    padding: 10px 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    min-height: 40px;
}

.action-btn:hover,
.btn-primary-minimal:hover,
.btn-email-action:hover,
.role-tab:hover,
.tab-btn:hover,
.file-input-label:hover,
.btn-search:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    border-color: var(--primary);
}

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

.btn-primary:hover {
    background: #0891b2;
}

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

.btn-primary-minimal {
    background: var(--bg-secondary);
}

.btn-change-email {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.friends-icon-btn,
.floating-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: all 0.2s ease;
    font-size: 1rem;
    flex-shrink: 0;
    position: relative;
    box-shadow: none;
    cursor: pointer;
}

.friends-icon-btn:hover,
.floating-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    border: none;
    transform: scale(1.05);
    box-shadow: none;
}

.floating-btn-bell {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

[data-theme="dark"] .floating-btn-bell {
    color: var(--text-secondary);
    background: transparent;
    border: none;
}

.floating-btn-period {
    background: transparent;
    border: none;
    color: var(--primary);
}

.floating-btn-stats {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.floating-btn-logout {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.friends-icon-btn {
    width: 48px;
    padding: 0;
    position: relative;
}

[data-theme="dark"] .friends-icon-btn,
[data-theme="dark"] .floating-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

[data-theme="dark"] .floating-btn-period {
    background: transparent;
    border: none;
    color: var(--primary);
}

.friends-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    position: absolute;
    top: -4px;
    right: -4px;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.header-stats-btn {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border-color: rgba(16, 185, 129, 0.2);
}

.floating-btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
}
.floating-btn-period:hover { 
    background: rgba(6, 182, 212, 0.1); 
    color: var(--primary); 
    transform: translateY(-2px);
}
.floating-btn-stats:hover { background: rgba(16, 185, 129, 0.1); color: #10b981; border: none; }
.floating-btn-bell:hover { background: rgba(6, 182, 212, 0.1); color: var(--primary); border: none; }

.month-badge,
.hero-tag,
.absent-badge,
.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 600;
}

.current-period {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    min-width: 0;
    max-width: 100%;
    margin-top: 4px;
}

.period-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.period-info {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
}

.period-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.8;
}

.period-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.month-badge.ok { background: rgba(34, 197, 94, 0.12); color: #059669; border-color: rgba(34, 197, 94, 0.22); }
.month-badge.info { background: rgba(59, 130, 246, 0.12); color: #2563eb; border-color: rgba(59, 130, 246, 0.22); }

/* ========= Cabecera tipo red social ========= */
#teacherProfileSection {
    display: none !important; /* oculto de momento */
}
.teacher-profile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px; /* Bordes más redondeados y modernos */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: visible !important; /* Aseguramos que las notificaciones no se corten */
    z-index: 100; /* Aseguramos que el header esté sobre otros elementos */
    transition: all 0.3s ease;
}

.teacher-profile .profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 20px; /* Aumentado para mejores proporciones con el avatar más grande */
    min-width: 0;
    flex: 1 1 auto;
}

.profile-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 28px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 2.5px var(--bg-secondary), 0 0 0 3.5px rgba(0,0,0,0.06), 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-avatar i {
    transition: opacity 0.5s ease;
}

.profile-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 2.5px var(--bg-secondary), 0 0 0 3.5px rgba(0,0,0,0.08), 0 8px 20px rgba(0, 0, 0, 0.12);
}

.profile-avatar-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar img { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%; 
    object-fit: cover;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    z-index: 2;
    /* Prevent sub-pixel border artifacts */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.profile-avatar img.loaded {
    opacity: 1;
}

.profile-details h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.profile-details .school {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.profile-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible !important;
}

.header-controls { 
    display: flex; 
    align-items: center;
    justify-content: flex-end;
    overflow: visible !important;
}

.controls-box {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: none;
    white-space: nowrap;
    overflow-x: visible; /* Cambiado de auto para permitir el dropdown */
    overflow-y: visible;
    min-height: auto;
    max-width: 100%;
}

/* Selector de Temas */
.theme-selector-wrapper {
    position: relative;
    display: inline-block;
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: rgba(var(--dropdown-bg-rgb, 255, 255, 255), 0.75);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.25);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    min-width: 280px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2100;
}

.theme-dropdown.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.theme-dropdown::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 18px;
    border: 10px solid transparent;
    border-bottom-color: var(--bg-primary);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid transparent;
}

.theme-option:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.theme-option.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.theme-option i {
    font-size: 1rem;
    width: 20px;
    display: flex;
    justify-content: center;
    transition: transform 0.3s ease;
}

.theme-option.active i {
    transform: scale(1.1);
}

.theme-option span {
    flex: 1;
}

/* Ajustes para temas oscuros en el dropdown */
[data-theme="dark"] .theme-option.active,
[data-theme-variant="deep-dark"] .theme-option.active,
[data-theme-variant="claude-dark"] .theme-option.active,
[data-theme-variant="aurora"] .theme-option.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

[data-theme-variant="cobalt"] .theme-option.active {
    background: #cffafe;
    color: #0891b2;
}

[data-theme-variant="rose"] .theme-option.active {
    background: #fff1f2;
    color: #ec4899;
}

@media (max-width: 900px) {
    .theme-dropdown {
        top: calc(100% + 5px) !important;
        bottom: auto !important;
        right: 0 !important;
        left: auto !important;
        transform: translateY(10px) scale(0.95);
        grid-template-columns: repeat(2, 1fr) !important;
        min-width: 250px !important;
    }
    
    .theme-dropdown.show {
        transform: translateY(0) scale(1) !important;
    }
    
    .theme-dropdown::after {
        top: -10px !important;
        bottom: auto !important;
        border-top-color: transparent !important;
        border-bottom-color: var(--bg-primary) !important;
        right: 15px !important;
        left: auto !important;
        transform: none !important;
    }
}

/* Fix for JS forcing display: block on flex containers */
.controls-box[style*="display: block"],
.controls-box[style*="display:block"] {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

.teacher-profile[style*="display: block"],
.teacher-profile[style*="display:block"],
.module-card[style*="display: block"],
.module-card[style*="display:block"] {
    display: flex !important;
}

[data-theme="dark"] .controls-box {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(100, 116, 139, 0.2);
}

.controls-divider { 
    width: 1px;
    height: 32px;
    background: var(--border-color);
    margin: 0 4px;
    opacity: 0.4;
    flex-shrink: 0;
}

[data-theme="dark"] .controls-divider {
    background: rgba(255, 255, 255, 0.15);
}

.brand-floating {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 6px;
}

.brand-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 12px;
    background: transparent;
    border: none;
}

[data-theme="dark"] .brand-chip {
    background: transparent;
}

.brand-emblem {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -1px;
    position: relative;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

.brand-emblem-main {
    position: relative;
    display: inline-block;
    line-height: 1;
    font-size: 0;
}

.brand-emblem-main::before {
    content: 'E';
    position: relative;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-emblem-main::after {
    content: '1';
    position: absolute;
    top: -2px;
    right: -9px;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
}

.brand-text {
    display: flex;
    align-items: baseline;
    line-height: 1;
}

.brand-name {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.2px;
    color: var(--text-secondary);
}

.brand-highlight {
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 900px) {
    .teacher-profile .profile-header {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    .profile-actions { 
        width: 100%; 
        justify-content: center;
    }
    .header-controls {
        justify-content: center;
        width: 100%;
        overflow-x: visible;
    }
    .controls-box {
        width: auto;
        flex-wrap: nowrap !important;
        overflow-x: visible;
    }
}

@media (max-width: 640px) {
    .controls-box {
        padding: 8px 12px;
        gap: 6px;
        border-radius: 16px;
        overflow-x: visible;
    }
    .controls-divider { display: none; }
    .brand-text { display: none; }
    .brand-emblem { width: 32px; height: 32px; }
    .floating-btn,
    .friends-icon-btn { 
        width: 36px; 
        height: 36px; 
        padding: 0;
        justify-content: center;
        font-size: 0.95rem;
    }
}

/* ========= Bienvenida y tabs ========= */
.welcome-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.welcome-school {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.welcome-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.welcome-subtitle {
    color: var(--text-secondary);
}

.role-view-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-soft);
}

.role-tab {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.role-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========= Tarjetas de stats ========= */
.admin-stats { margin-top: 4px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.full-width-card {
    grid-column: 1 / -1 !important;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .stat-card {
        padding: 16px;
        border-radius: 16px;
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0.5;
}

.stat-card:hover { 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stat-content { display: flex; gap: 12px; align-items: center; }

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: grid;
    place-items: center;
    color: var(--primary);
    flex-shrink: 0;
    font-size: 18px;
}

.stat-info h3 { font-size: 1.25rem; font-weight: 700; }
.stat-info p { color: var(--text-secondary); font-weight: 500; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px; }

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

.stat-title { font-weight: 700; color: var(--text-primary); letter-spacing: 0.5px; font-size: 0.9rem; }
.stat-header-metric { font-weight: 700; color: var(--primary); font-size: 0.9rem; }

.compact-card { padding: 12px; }
.chart-card-compact canvas { width: 100%; }

.attendance-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 1100px) {
    .attendance-insights { grid-template-columns: 1fr; }
    
    .teacher-profile .profile-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .profile-info {
        display: flex;
        width: 100%;
        align-items: center;
        gap: 15px;
    }

    .profile-details {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex: 1;
    }
    
    .profile-details h2 {
        margin-bottom: 0;
        font-size: 1.4rem;
    }

    /* Forzar que el periodo aparezca abajo del todo si queremos, 
       pero por ahora aseguramos que no choque con la barra */
    .current-period {
        margin-top: 0;
        align-self: flex-start;
    }

    .profile-actions {
        width: 100%;
        margin-top: 5px;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .controls-box {
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
        padding: 10px 14px;
        background: var(--bg-tertiary);
        border-radius: 15px;
    }
    
    /* En tablet, ocultamos el texto de Ociann Class para dar mas espacio si es necesario */
    .brand-text {
        display: none;
    }
    .brand-chip {
        padding: 4px;
    }
}

.attendance-chart-area { 
    background: var(--bg-tertiary); 
    border-radius: 20px; 
    padding: 20px; 
    border: 1px solid var(--border-color);
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 250px;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.attendance-chart-area canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.attendance-absent-summary { background: var(--bg-tertiary); border-radius: 20px; padding: 20px; border: 1px solid var(--border-color); }
.absent-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 16px; 
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}
.absent-title { font-weight: 800; font-size: 1rem; color: var(--text-primary); display: flex; gap: 8px; align-items: center; }
.absent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.absent-item {
    background: var(--bg-secondary);
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.absent-item:hover {
    border-color: var(--danger);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
}

.absent-student {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.absent-student-name {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.absent-name-line {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.absent-name-line.secondary {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.absent-student-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.absent-grade-pill {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--text-muted);
}

.absent-date {
    color: var(--text-muted);
    font-weight: 500;
}

.absent-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 60px;
}

.absent-count {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--danger);
    line-height: 1;
}

.absent-count-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.absent-list.scrollable {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
}

.absent-list.scrollable::-webkit-scrollbar {
    width: 4px;
}

.absent-list.scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.absent-empty { color: var(--text-secondary); font-size: 0.85rem; }

.meta-badge { background: rgba(15, 118, 110, 0.1); color: #0f766e; border-color: rgba(15, 118, 110, 0.2); }
.absent-badge { 
    background: rgba(239, 68, 68, 0.1); 
    color: var(--danger); 
    padding: 4px 12px; 
    border-radius: 999px; 
    font-size: 0.75rem; 
    font-weight: 800; 
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ========= Módulos ========= */
.modules-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    box-sizing: border-box;
}

/* Tarjeta de bienvenida AVI: estilos movidos a css/avi-welcome.css */

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    width: 100%;
}

@media (min-width: 1200px) {
    .modules-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (min-width: 1600px) {
    .modules-grid { gap: 18px; }
}

/* ===== Widget de horario del día (dashboard) ===== */
.dashboard-schedule-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    width: 100%;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease;
}

.dashboard-schedule-widget:hover {
    box-shadow: var(--shadow-hover);
}

.schedule-widget-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.schedule-widget-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.schedule-widget-header i {
    color: var(--primary);
    font-size: 1rem;
}

.schedule-widget-body {
    min-height: 2.5rem;
}

.schedule-widget-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.schedule-widget-loading .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.schedule-widget-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.schedule-widget-empty,
.schedule-widget-free {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.schedule-widget-empty .schedule-widget-cta,
.schedule-widget-free .schedule-widget-cta {
    margin-top: 0.75rem;
}

.schedule-widget-cta .btn-schedule {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.schedule-widget-cta .btn-schedule:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.schedule-widget-cta .btn-schedule i {
    font-size: 0.85rem;
}

.schedule-widget-weekend-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.schedule-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.schedule-widget-list::-webkit-scrollbar {
    width: 6px;
}

.schedule-widget-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.schedule-widget-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.schedule-widget-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.4rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.schedule-widget-list li:last-child {
    border-bottom: none;
}

.schedule-widget-list .lesson-time {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    min-width: 5.5rem;
}

.schedule-widget-list .lesson-subject {
    font-weight: 500;
    flex: 1;
}

.schedule-widget-list .lesson-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Unidocente: misma hora, varias materias en una fila */
.schedule-widget-list .schedule-widget-lesson--multi .lesson-subject {
    font-size: 0.85rem;
}

.module-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    min-height: 150px;
}

[data-theme="dark"] .module-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.module-card::after {
    content: '\f061';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.module-card:hover::after {
    color: var(--primary);
    opacity: 1;
    transform: translateX(3px);
}

.module-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.module-card:hover .module-icon {
    transform: scale(1.1);
}

.module-icon svg {
    width: 28px;
    height: 28px;
}

.module-icon i {
    font-size: 1.5rem;
}

.module-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.module-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Module Icon Colors - Solid Opaque */
.module-icon.students { background: #dbeafe; color: #2563eb; }
.module-icon.attendance { background: #dcfce7; color: #16a34a; }
.module-icon.cotidiano { background: #ecfeff; color: #0891b2; }
.module-icon.evaluations { background: #ffedd5; color: #ea580c; }
.module-icon.boletas { background: #fee2e2; color: #dc2626; }
.module-icon.minutas { background: #fce7f3; color: #db2777; }
.module-icon.planeamiento { background: #ecfeff; color: #06b6d4; }
.module-icon.recursos { background: #ecfeff; color: #0891b2; }
.module-icon.materias { background: #f1f5f9; color: #475569; }
.module-icon.diagnostic-exam { background: #ecfeff; color: #06b6d4; }
.module-icon.reportes { background: #f0fdf4; color: #16a34a; }
.module-icon.sea { background: #ecfeff; color: #0891b2; }
.module-icon.comportamiento { background: #f0f9ff; color: #0284c7; }
.module-icon.trabajos { background: #f8fafc; color: #64748b; }
.module-icon.horarios { background: #fff7ed; color: #d97706; }
.module-icon.calendario { background: #dbeafe; color: #2563eb; }
.module-icon.formularios { background: #ecfeff; color: #06b6d4; }
.module-icon.avichat { background: #ecfeff; color: #0891b2; }
.module-icon.sala-de-profes { background: #ecfeff; color: #0891b2; }
.module-icon.admin { background: var(--primary); color: #ffffff; }

/* Modo oscuro - iconos con fondos más oscuros */
[data-theme="dark"] .module-icon.students { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
[data-theme="dark"] .module-icon.attendance { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
[data-theme="dark"] .module-icon.cotidiano { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.evaluations { background: rgba(234, 88, 12, 0.2); color: #fb923c; }
[data-theme="dark"] .module-icon.boletas { background: rgba(220, 38, 38, 0.2); color: #f87171; }
[data-theme="dark"] .module-icon.minutas { background: rgba(219, 39, 119, 0.2); color: #f472b6; }
[data-theme="dark"] .module-icon.planeamiento { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
[data-theme="dark"] .module-icon.recursos { background: rgba(8, 145, 178, 0.2); color: #22d3ee; }
[data-theme="dark"] .module-icon.materias { background: rgba(71, 85, 105, 0.2); color: #cbd5e1; }
[data-theme="dark"] .module-icon.diagnostic-exam { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
[data-theme="dark"] .module-icon.reportes { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
[data-theme="dark"] .module-icon.sea { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.comportamiento { background: rgba(2, 132, 199, 0.2); color: #38bdf8; }
[data-theme="dark"] .module-icon.trabajos { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
[data-theme="dark"] .module-icon.horarios { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }
[data-theme="dark"] .module-icon.calendario { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
[data-theme="dark"] .module-icon.formularios { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.avichat { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.sala-de-profes { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }

.module-status { display: none; }

/* ========= Toasts y notificaciones ========= */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    min-width: 280px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show { transform: translateX(0); }
.toast.success { border-left: 4px solid var(--accent); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
.toast-title { font-weight: 700; color: var(--text-primary); }
.toast-message { color: var(--text-secondary); font-size: 0.9rem; }

.notification-overlay,
.notifications-overlay,
.modal-overlay,
.logout-modal-overlay,
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px 10px;
}

.notification-overlay.show,
.notifications-overlay.show,
.modal-overlay.show,
.logout-modal-overlay.show,
.welcome-overlay.show { 
    display: flex; 
    opacity: 1; 
}

.notification-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 44px 40px 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.05);
    min-width: 360px;
    max-width: 500px;
    width: 92vw;
    text-align: center;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.5s cubic-bezier(0.215, 0.61, 0.355, 1), opacity 0.4s ease;
    position: relative;
    overflow: hidden;
}

.notification-modal.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.notification-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    margin: 0 auto 24px;
    font-size: 36px;
    position: relative;
    transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.notification-icon.loading {
    background: rgba(6, 182, 212, 0.08);
    color: var(--primary);
    border: 2.5px solid rgba(6, 182, 212, 0.15);
    animation: notif-icon-pulse 2s ease-in-out infinite;
}

.notification-icon.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    animation: notif-icon-success-in 0.7s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
}

.notification-icon.success::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2.5px solid rgba(34, 197, 94, 0.25);
    animation: notif-success-ripple 1s 0.3s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
    opacity: 0;
}

.notification-icon.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    animation: notif-icon-success-in 0.7s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

@keyframes notif-icon-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99,102,241,0.15); }
    50% { transform: scale(1.04); box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}

@keyframes notif-icon-pop {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    75% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes notif-icon-success-in {
    0% { transform: scale(0); opacity: 0; }
    40% { transform: scale(1.08); opacity: 1; }
    65% { transform: scale(0.96); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes notif-success-ripple {
    0% { transform: scale(0.85); opacity: 0; }
    40% { opacity: 1; }
    100% { transform: scale(1.15); opacity: 0; }
}

/* Animated checkmark SVG */
.checkmark-svg { width: 52px; height: 52px; }
.checkmark-circle { 
    stroke: #fff; 
    stroke-width: 2; 
    stroke-dasharray: 166; 
    stroke-dashoffset: 166; 
    animation: checkmark-circle-draw 0.6s 0.15s cubic-bezier(0.65, 0, 0.45, 1) forwards;
    fill: none;
}
.checkmark-check { 
    stroke: #fff; 
    stroke-width: 3.5; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
    stroke-dasharray: 48; 
    stroke-dashoffset: 48; 
    animation: checkmark-draw 0.4s 0.55s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmark-circle-draw {
    to { stroke-dashoffset: 0; }
}
@keyframes checkmark-draw {
    to { stroke-dashoffset: 0; }
}

/* Animated error X SVG */
.error-svg { width: 52px; height: 52px; }
.error-circle { stroke: #fff; stroke-width: 2; stroke-dasharray: 166; stroke-dashoffset: 166; animation: checkmark-circle-draw 0.6s 0.15s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
.error-x { stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 56; stroke-dashoffset: 56; animation: checkmark-draw 0.4s 0.55s cubic-bezier(0.65, 0, 0.45, 1) forwards; }

/* Custom loading spinner */
.period-loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
}
.period-loading-spinner div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    animation: period-bounce 1.6s ease-in-out infinite both;
}
.period-loading-spinner div:nth-child(1) { animation-delay: -0.32s; }
.period-loading-spinner div:nth-child(2) { animation-delay: -0.16s; }
.period-loading-spinner div:nth-child(3) { animation-delay: 0s; }

@keyframes period-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Progress bar */
.notification-progress {
    margin-top: 20px;
    height: 4px;
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.1);
    overflow: hidden;
}

.notification-progress-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), #22d3ee);
    transition: width 0.3s ease;
}

.notification-progress-bar.indeterminate {
    width: 40%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* State-specific modal styling */
.notification-modal.state-success .notification-title { color: #22c55e; }
.notification-modal.state-error .notification-title { color: #ef4444; }

/* Staggered content reveal for success/error states */
.notification-modal.state-success .notification-title,
.notification-modal.state-error .notification-title {
    animation: notif-content-up 0.5s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

.notification-modal.state-success .notification-message,
.notification-modal.state-error .notification-message {
    animation: notif-content-up 0.5s 0.4s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

.notification-modal.state-success .notification-details,
.notification-modal.state-error .notification-details {
    animation: notif-content-up 0.5s 0.55s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

@keyframes notif-content-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notification-modal .notification-title { 
    font-size: 1.85rem; 
    font-weight: 800; 
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.notification-modal .notification-message { 
    color: var(--text-secondary); 
    font-size: 1.08rem;
    line-height: 1.55;
    margin-bottom: 22px;
}

.notification-details { 
    display: none !important;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 20px;
    opacity: 0;
    transform: translateY(8px);
    animation: detail-row-in 0.4s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
    position: relative;
}

.detail-row:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border-color);
    opacity: 0.5;
}

@keyframes detail-row-in {
    to { opacity: 1; transform: translateY(0); }
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-values {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-from,
.detail-to {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.detail-from {
    color: var(--text-secondary);
    font-weight: 600;
    opacity: 0;
    position: relative;
    display: inline-block;
    animation: detail-val-in 0.35s 0.2s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

.detail-from::after {
    content: '';
    position: absolute;
    left: -2px;
    right: -2px;
    top: 50%;
    height: 8px; /* Tachón estilo crayón grueso */
    background: rgba(239, 68, 68, 0.22);
    transform: translateY(-50%) rotate(-1deg);
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: crayon-strike 0.5s 0.35s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

[data-theme="dark"] .detail-from::after {
    background: rgba(239, 68, 68, 0.35);
}

@keyframes crayon-strike {
    from { width: 0; opacity: 0; }
    to { width: calc(100% + 4px); opacity: 1; }
}

.detail-to {
    color: #10b981;
    opacity: 0;
    animation: detail-val-in 0.35s 0.5s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

[data-theme="dark"] .detail-to {
    color: #34d399; /* Verde esmeralda más vibrante para modo oscuro */
}

.detail-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    opacity: 0;
    animation: detail-arrow-in 0.4s 0.35s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

.detail-arrow svg {
    display: block;
}

@keyframes detail-val-in {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes detail-arrow-in {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

/* ========= Dropdown de notificaciones (Mejorado - Diseño de Modal Centrado) ========= */
.notifications-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 15px)) scale(0.98);
    width: 600px;
    max-width: calc(100% - 32px);
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2100;
    display: flex;
    flex-direction: column;
}

.notifications-dropdown.show { 
    transform: translate(-50%, -50%) scale(1); 
    opacity: 1; 
    pointer-events: auto; 
}

.notifications-header {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notifications-header h3 i {
    color: #fff;
    background: #10b981;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    font-size: 0.95rem;
}

.notifications-actions {
    display: flex;
    gap: 10px;
}

.notifications-actions button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-actions button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.notifications-actions .close-notifications-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.notifications-actions .close-notifications-btn:hover {
    background: var(--danger);
    color: white;
}

.notifications-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* Scrollbar Minimalista */
.notifications-content::-webkit-scrollbar {
    width: 6px;
}

.notifications-content::-webkit-scrollbar-track {
    background: transparent;
}

.notifications-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

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

.notifications-content {
    min-height: 180px;
}

.loading-notifications {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading-notifications .spinner-small {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.no-notifications {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.no-notifications-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.no-notifications h4 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.no-notifications p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-item {
    padding: 16px 24px;
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.notification-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0%;
    background: #10b981;
    transition: height 0.3s ease;
    border-radius: 0 4px 4px 0;
}

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

.notification-item:hover::before {
    height: 40%;
}

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

.notification-item.unread {
    background: rgba(16, 185, 129, 0.03);
}

.notification-item.unread .notification-title {
    color: var(--text-primary);
}

.notification-item .notification-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.notification-item .notification-icon.critical { background: rgba(239, 68, 68, 0.08); color: var(--danger); }
.notification-item .notification-icon.warning { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.notification-item .notification-icon.info { background: rgba(16, 185, 129, 0.08); color: #10b981; }

.notification-item .notification-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 !important;
}

.notification-item .notification-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.notification-item .notification-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.notification-item .notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.notification-item .notification-time::before {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
}

.notif-badge {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
    letter-spacing: 0.4px;
}

.badge-critical { background: var(--danger); color: #fff; }
.badge-warning { background: var(--warning); color: #fff; }

.notifications-footer {
    padding: 20px 24px;
    text-align: center;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.mark-all-as-read-footer-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #10b981;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.mark-all-as-read-footer-btn i {
    font-size: 0.9rem;
    color: white;
}

.mark-all-as-read-footer-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

.mark-all-as-read-footer-btn:hover i {
    color: white;
}

@media (max-width: 600px) {
    /* Ocultar botones flotantes cuando las notificaciones están abiertas */
    body.notifications-open #aiChatButton {
        display: none !important;
    }

    .notifications-dropdown {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: translateY(100%) !important;
        border: none !important;
        max-width: none !important;
        margin: 0 !important;
        background: var(--bg-secondary) !important;
    }

    .notifications-dropdown.show {
        transform: translateY(0) !important;
    }

    .notifications-header {
        padding: 16px 20px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-secondary);
    }

    .close-notifications-btn {
        width: 44px !important;
        height: 44px !important;
    }

    .notification-item {
        padding: 16px 20px;
        gap: 12px;
    }

    .notification-item .notification-icon {
        width: 40px;
        height: 40px;
    }

    .notifications-footer {
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: var(--bg-secondary);
        box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    }
}

/* ========= Modales ========= */
.modal-overlay.show,
.logout-modal-overlay.show,
.welcome-overlay.show { display: flex; }

.welcome-overlay .welcome-modal {
    width: min(720px, 94vw);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
    margin: auto;
    animation: modalIn 0.2s ease;
}

.welcome-overlay .welcome-header {
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 18px 20px 14px;
    box-shadow: none;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.10) 0%, rgba(168, 85, 247, 0.08) 100%);
    text-align: center;
}

.welcome-overlay .welcome-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 12px 26px rgba(6, 182, 212, 0.35);
}

.welcome-overlay .welcome-header h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.welcome-overlay .welcome-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.welcome-overlay .welcome-content {
    padding: 16px 20px 18px;
}

.welcome-overlay .welcome-message h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 900;
}

.welcome-overlay .welcome-message p {
    margin: 0 0 12px;
    color: var(--text-secondary);
}

.welcome-overlay .welcome-steps {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.welcome-overlay .step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.welcome-overlay .step-number {
    width: 26px;
    height: 26px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(6, 182, 212, 0.14);
    color: var(--primary);
    font-weight: 900;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.welcome-overlay .step-text {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.welcome-overlay .welcome-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.welcome-overlay .btn-welcome-primary {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(6, 182, 212, 0.35);
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    min-height: 44px;
}

.welcome-overlay .btn-welcome-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(6, 182, 212, 0.25);
    filter: brightness(1.02);
}

.welcome-overlay .btn-welcome-primary:active {
    transform: translateY(0);
}

.welcome-overlay .btn-welcome-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.22), 0 16px 34px rgba(6, 182, 212, 0.25);
}

@media (max-width: 600px) {
    .welcome-overlay {
        padding: 10px;
        align-items: flex-start; /* Better for long modals on mobile */
    }
    .welcome-overlay .welcome-modal {
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: 16px;
    }
    .welcome-overlay .welcome-header {
        padding: 14px 16px;
    }
    .welcome-overlay .welcome-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        margin-bottom: 8px;
    }
    .welcome-overlay .welcome-header h2 {
        font-size: 1.15rem;
    }
    .welcome-overlay .welcome-content {
        padding: 14px 16px;
    }
    .welcome-overlay .welcome-steps {
        gap: 8px;
    }
    .welcome-overlay .step-item {
        padding: 8px 10px;
    }
    .welcome-overlay .btn-welcome-primary {
        width: 100%;
        justify-content: center;
    }
}

.modal-container,
.logout-modal,
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: min(600px, 94vw);
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-large { width: min(1100px, 96vw); }
.modal-fullscreen { 
    width: 98vw; 
    height: 98vh; 
    max-height: 98vh;
    border-radius: 24px;
    margin: 1vh auto;
}

.modal-fullscreen .modal-body {
    padding: 32px;
}

@media (max-width: 768px) {
    .modal-fullscreen {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
}

@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title i { color: var(--primary); }

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 1.2rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbar (Slider) */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    border: 2px solid var(--bg-secondary);
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close,
.close-btn,
.logout-close-btn { 
    width: 32px; 
    height: 32px; 
    border-radius: 8px; 
    display: grid; 
    place-items: center; 
    font-size: 1.1rem; 
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover,
.logout-close-btn:hover {
    background: var(--bg-secondary);
    color: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

/* ========= Modal de Período Académico (Rediseñado) ========= */
.period-modal-overlay {
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.55);
}

.period-modal-container {
    width: min(560px, 94vw);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 60px rgba(2, 6, 23, 0.3), 0 0 0 1px rgba(255,255,255,0.04);
    animation: none;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    overflow: hidden;
    background: var(--bg-secondary);
}

[data-theme="dark"] .period-modal-container {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme-variant="deep-dark"] .period-modal-container { background: #020617; }
[data-theme-variant="aurora"] .period-modal-container { background: #071a17; }
[data-theme-variant="claude-dark"] .period-modal-container { background: #171717; }

.period-modal-overlay.show .period-modal-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.period-modal-overlay.closing .period-modal-container {
    transform: translateY(12px) scale(0.97);
    opacity: 0;
}

/* Header */
.period-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(245,158,11,0.06) 0%, transparent 100%);
}

[data-theme="dark"] .period-modal-header {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
    border-color: rgba(255, 255, 255, 0.05);
}

.period-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.period-header-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

[data-theme="dark"] .period-header-icon {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}

.period-modal-header .modal-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.period-header-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 2px 0 0;
    line-height: 1.3;
}

.period-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.period-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Body */
.period-modal-body {
    padding: 20px 24px;
}

.period-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.period-form-group {
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

[data-theme="dark"] .period-form-group {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.period-form-group:focus-within {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

[data-theme="dark"] .period-form-group:focus-within {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.03);
}

.period-form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

[data-theme="dark"] .period-form-label {
    color: var(--text-muted);
}

.period-form-label i {
    color: #f59e0b;
    font-size: 0.82rem;
}

.period-select-wrapper {
    position: relative;
}

.period-form-select {
    width: 100%;
    padding: 10px 32px 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
    outline: none;
}

[data-theme="dark"] .period-form-select {
    color-scheme: dark;
    background: #111827;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

[data-theme="dark"] .period-form-select option {
    background-color: #1f2937;
    color: #f8fafc;
}

[data-theme-variant="deep-dark"] .period-form-select option { background-color: #020617; }
[data-theme-variant="aurora"] .period-form-select option { background-color: #071a17; }
[data-theme-variant="claude-dark"] .period-form-select option { background-color: #171717; }

.period-form-select:focus {
    border-color: #f59e0b;
}

[data-theme="dark"] .period-form-select:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.period-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.period-select-wrapper:focus-within .period-select-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: #f59e0b;
}

/* Acceso rápido a sincronización */
.period-sync-shortcut {
    margin-top: 14px;
    border: 1px dashed rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.06);
    border-radius: 12px;
    padding: 10px;
}

.period-sync-open-btn {
    width: 100%;
    min-height: 42px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid rgba(217, 119, 6, 0.35);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.18));
    color: #92400e;
    transition: all 0.3s ease;
}

[data-theme="dark"] .period-sync-open-btn {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.15));
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.period-sync-open-btn:hover {
    border-color: rgba(217, 119, 6, 0.5);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.3));
    color: #78350f;
    transform: translateY(-1px);
}

[data-theme="dark"] .period-sync-open-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

.period-sync-shortcut-hint {
    margin: 8px 2px 0;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Modal dedicado para sincronización */
.semester-sync-modal-container {
    width: min(680px, 94vw);
}

/* Herramienta de sincronización de estudiantes entre semestres */
.period-copy-tool {
    margin-top: 16px;
    border: 1px solid rgba(245, 158, 11, 0.25);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
    border-radius: 14px;
    padding: 14px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .period-copy-tool {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.04) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-color: rgba(245, 158, 11, 0.15);
}

.period-copy-tool.is-disabled {
    opacity: 0.75;
}

.period-copy-tool-standalone {
    margin-top: 0;
}

.period-copy-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.period-copy-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.period-copy-title i {
    color: #d97706;
}

[data-theme="dark"] .period-copy-title i {
    color: #fbbf24;
}

.period-copy-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #92400e;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 3px 7px;
    border-radius: 999px;
}

[data-theme="dark"] .period-copy-badge {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.22);
}

.period-copy-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    margin-bottom: 16px;
}

[data-theme="dark"] .period-copy-warning {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px 14px;
    border-radius: 12px;
}

.period-copy-warning i {
    margin-top: 1px;
}

.period-copy-impact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.period-copy-impact span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.period-copy-impact i {
    color: #10b981;
}

[data-theme="dark"] .period-copy-impact span {
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
}

[data-theme="dark"] .period-copy-impact i {
    color: #34d399;
}

/* Nuevos estilos visuales para la sincronización */
.sync-comparison-container {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 14px;
}

.sync-card {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .sync-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.sync-card.source {
    border-left-width: 4px;
    border-left-color: #3b82f6;
}

.sync-card.destination {
    border-left-width: 4px;
    border-left-color: #f59e0b;
}

.sync-card-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: -4px;
}

.sync-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sync-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sync-stat-item {
    display: flex;
    flex-direction: column;
}

.sync-stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.sync-stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.sync-arrow-container {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.sync-impact-modern {
    margin-top: 16px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.05);
    border: 1px dashed rgba(16, 185, 129, 0.2);
    border-radius: 12px;
}

[data-theme="dark"] .sync-impact-modern {
    background: rgba(16, 185, 129, 0.02);
}

.sync-impact-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-impact-list {
    display: grid;
    gap: 6px;
}

.sync-impact-item {
    font-size: 0.78rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.sync-impact-item i {
    color: #10b981;
    font-size: 0.8rem;
    margin-top: 2px;
}

.period-copy-summary {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.period-copy-controls {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
}

.period-copy-group {
    background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .period-copy-group {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.period-copy-summary {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 10px 11px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

[data-theme="dark"] .period-copy-summary {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.08);
}

.period-copy-summary-grid {
    display: grid;
    gap: 4px;
}

.period-copy-summary-grid strong {
    color: var(--text-primary);
    font-weight: 700;
}

.period-copy-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.period-copy-btn-secondary,
.period-copy-btn-primary {
    border-radius: 10px;
    min-height: 40px;
    font-size: 0.82rem;
    font-weight: 700;
    justify-content: center;
    transition: all 0.2s ease;
}

.period-copy-btn-secondary {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .period-copy-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
}

.period-copy-btn-secondary:hover {
    border-color: #d97706;
    color: #b45309;
}

[data-theme="dark"] .period-copy-btn-secondary:hover {
    border-color: #fbbf24;
    background: rgba(255, 255, 255, 0.08);
    color: #fbbf24;
}

.period-copy-btn-primary {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    border: none;
}

[data-theme="dark"] .period-copy-btn-primary {
    background: linear-gradient(135deg, #b45309, #92400e);
}

.period-copy-btn-primary:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .period-copy-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.period-copy-btn-primary:disabled,
.period-copy-btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
.period-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(0deg, rgba(148, 163, 184, 0.04) 0%, transparent 100%);
}

.period-btn-apply {
    min-width: 130px;
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
    transition: all 0.25s ease;
}

.period-btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.period-btn-apply:active {
    transform: translateY(0);
}

#applyPeriodBtn.changed {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), 0 4px 14px rgba(245, 158, 11, 0.25);
    animation: period-btn-glow 2s ease-in-out infinite;
}

@keyframes period-btn-glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(245,158,11,0.15), 0 4px 14px rgba(245,158,11,0.2); }
    50% { box-shadow: 0 0 0 5px rgba(245,158,11,0.25), 0 6px 20px rgba(245,158,11,0.35); }
}

.period-btn-cancel {
    min-width: 110px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

[data-theme="dark"] .period-modal-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0%, transparent 100%);
}

[data-theme="dark"] .period-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

[data-theme="dark"] .period-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #f1f5f9;
}

[data-theme="dark"] .period-btn-apply {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.period-btn-cancel:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .period-modal-overlay {
        padding: 16px;
        align-items: center; /* Centrado vertical */
    }

    .period-modal-container {
        width: min(500px, 100%);
        border-radius: 24px; /* Bordes redondeados parejos */
        max-height: 90vh;
        overflow-y: auto;
        transform: translateY(20px) scale(0.95); /* Animación desde centro */
    }

    .period-modal-overlay.show .period-modal-container {
        transform: translateY(0) scale(1);
    }

    .period-modal-overlay.closing .period-modal-container {
        transform: translateY(15px) scale(0.95);
        opacity: 0;
    }

    .period-modal-header {
        padding: 18px 20px 14px;
    }

    .period-header-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 0.95rem;
    }

    .period-modal-header .modal-title {
        font-size: 1.05rem;
    }

    .period-modal-body {
        padding: 16px 20px;
    }

    .period-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .period-form-group {
        padding: 12px 14px;
    }

    .period-modal-footer {
        padding: 14px 20px 24px;
        flex-direction: row;
        gap: 10px;
    }

    .period-btn-apply,
    .period-btn-cancel {
        flex: 1;
        min-width: 0;
    }

    .semester-sync-modal-container {
        width: min(540px, 100%);
    }

    .period-copy-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .period-modal-header {
        padding: 16px 16px 12px;
    }

    .period-header-hint {
        font-size: 0.75rem;
    }

    .period-modal-body {
        padding: 14px 16px;
    }

    .period-modal-footer {
        padding: 12px 16px 20px;
    }
}

/* ========= Formularios ========= */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 10px; }
.form-label { font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.form-input,
.form-select,
.email-input,
#friendSearchInput {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.05rem;
}

.form-input:focus,
.form-select:focus,
.email-input:focus,
#friendSearchInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.file-input-label {
    padding: 12px 14px;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.profile-photo-area { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.profile-photo-preview { width: 100px; height: 100px; border-radius: var(--radius-md); background: var(--bg-tertiary); border: 1px solid var(--border-color); display: grid; place-items: center; overflow: hidden; }

/* ========= Items de información ========= */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.info-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.info-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--bg-tertiary); color: var(--primary); display: grid; place-items: center; font-size: 1.2rem; }
.info-content h4 { font-size: 0.85rem; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.info-content p,
.email-value { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; font-size: 1.05rem; }

.email-display { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.email-edit-container { margin-top: 12px; padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-tertiary); }
.email-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.email-error-message { margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.08); color: var(--danger); display: flex; gap: 8px; align-items: center; }

/* ========= Dropdown y modales de amigos ========= */
.friends-modal-header,
.friends-tabs { border-bottom: 1px solid var(--border-color); }
.pending-list,
.search-results,
.friends-list { display: grid; gap: 10px; }

/* ========= Bloques de estudiantes y métricas ========= */
.students-modern { display: flex; flex-direction: column; gap: 20px; }
.students-modern-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.students-modern-title { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }
.students-modern-body { display: flex; flex-direction: column; gap: 24px; }

.students-icon { background: rgba(6, 182, 212, 0.1); color: var(--primary); width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.2rem; }

.students-circles-row { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }
.circle-stat { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px; 
    transition: transform 0.3s ease;
}
.circle-stat:hover { transform: translateY(-5px); }

.circle-wrapper { 
    width: 90px; 
    height: 90px; 
    position: relative; 
    display: grid; 
    place-items: center; 
    background: var(--bg-tertiary);
    border-radius: 50%;
}

.circle-ring { 
    position: absolute; 
    inset: 0; 
    border-radius: 50%; 
    border: 3px solid rgba(6, 182, 212, 0.1); 
}

.circle-stat.active .circle-ring { border-top-color: var(--accent); border-width: 4px; }
.circle-stat.inactive .circle-ring { border-top-color: var(--danger); border-width: 4px; }
.circle-stat.total .circle-ring { border-color: var(--primary); border-width: 4px; opacity: 0.3; }

.circle-core { position: relative; z-index: 1; display: grid; place-items: center; }
.circle-number { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.circle-label { color: var(--text-secondary); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.circle-percent { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-tertiary); margin-top: -4px; }
.circle-stat.active .circle-percent { color: var(--accent); background: rgba(16, 185, 129, 0.1); }
.circle-stat.inactive .circle-percent { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

.students-metrics-row { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.metric-box { flex: 1; min-width: 100px; background: var(--bg-tertiary); padding: 12px; border-radius: 16px; border: 1px solid var(--border-color); transition: all 0.2s ease; }
.metric-box:hover { border-color: var(--primary); transform: translateY(-2px); }
.metric-number { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.metric-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-top: 2px; }
.metric-separator { display: none; }

.students-minutas { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--bg-tertiary); 
    padding: 12px 16px; 
    border-radius: 16px; 
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.students-minutas:hover { border-color: var(--primary); }
.minutas-number { font-weight: 800; font-size: 1.2rem; color: var(--text-primary); }
.minutas-label { color: var(--text-secondary); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; font-size: 0.7rem; }

.students-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; color: var(--text-secondary); font-size: 0.75rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-color); }
.dot-active { background: var(--accent); }
.dot-inactive { background: var(--danger); }

.students-birthdays { margin-top: 6px; border-top: 1px dashed var(--border-color); padding-top: 10px; }
.birthdays-title { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.birthdays-list { display: grid; gap: 8px; }
.birthday-card { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    padding: 12px; 
    display: flex; 
    gap: 14px; 
    align-items: center; 
    transition: all 0.2s ease;
}
.birthday-card:hover { 
    border-color: var(--primary); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateX(4px);
}
.date-badge { 
    min-width: 56px; 
    height: 56px;
    text-align: center; 
    border-radius: 14px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(79, 70, 229, 0.08); 
    color: var(--primary); 
    border: 1px solid rgba(79, 70, 229, 0.15); 
    font-weight: 800; 
    font-size: 0.9rem; 
    line-height: 1.2;
}
.birthday-name { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; }
.birthday-meta { color: var(--text-secondary); font-weight: 500; font-size: 0.8rem; }

/* ========= Cotidiano ========= */
.cotidiano-grade-box { display: flex; flex-direction: column; gap: 16px; }
.cotidiano-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 700; color: var(--text-primary); }
.cotidiano-subject-select { padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-tertiary); color: var(--text-primary); font-weight: 600; cursor: pointer; outline: none; transition: all 0.2s ease; }
.cotidiano-subject-select:hover { border-color: var(--primary); }
.cotidiano-chart-wrapper { 
    padding: 20px; 
    background: var(--bg-tertiary); 
    border-radius: 20px; 
    border: 1px solid var(--border-color); 
    min-height: 250px; 
    display: grid; 
    place-items: center; 
}

@media (max-width: 768px) {
    .cotidiano-chart-wrapper {
        padding: 10px;
        min-height: 220px;
    }
}
.cotidiano-empty { text-align: center; color: var(--text-secondary); padding: 10px; }

/* ========= Semestre Horizontal ========= */
.semester-card.horizontal-layout {
    display: flex;
    flex-direction: column;
}

.semester-card.horizontal-layout .semester-progress-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 40px;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.semester-card.horizontal-layout .semester-circular {
    flex: 0 0 280px;
    height: 280px;
    min-height: 280px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%; /* Make the container circular too */
    padding: 0;
    border: 1px solid var(--border-color);
    position: relative;
}

.semester-card.horizontal-layout .semester-timeline-container {
    flex: 1;
    min-width: 320px;
    margin-top: 0;
    background: transparent;
    padding: 0;
}

.semester-card.horizontal-layout .semester-events-modern {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

@media (max-width: 900px) {
    .semester-card.horizontal-layout .semester-progress-wrapper {
        flex-direction: column;
        gap: 24px;
        align-items: center;
        padding: 10px 0;
    }
    .semester-card.horizontal-layout .semester-circular {
        flex: 0 0 220px;
        width: 220px;
        height: 220px;
        min-height: 220px;
        margin: 0 auto;
    }
    .semester-progress-svg {
        width: 180px;
        height: 180px;
    }
    .semester-percent {
        font-size: 2.5rem;
    }
    .semester-center-sub {
        font-size: 0.85rem;
    }
    .semester-card.horizontal-layout .semester-timeline-container {
        width: 100%;
        min-width: unset;
    }
    .semester-card.horizontal-layout .semester-events-modern {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .semester-card.horizontal-layout .semester-circular {
        flex: 0 0 180px;
        width: 180px;
        height: 180px;
        min-height: 180px;
    }
    .semester-progress-svg {
        width: 150px;
        height: 150px;
    }
    .semester-percent {
        font-size: 2rem;
    }
}

/* ========= Semestre ========= */
.semester-progress-wrapper { display: grid; grid-template-columns: 1fr; gap: 12px; }
.semester-circular { 
    width: 100%; 
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-tertiary); 
    border-radius: 24px; 
    padding: 30px; 
    border: 1px solid var(--border-color); 
    position: relative; 
    overflow: hidden;
    min-height: 280px;
}

.semester-circular::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.semester-progress-svg { 
    width: 220px; 
    height: 220px; 
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1)); 
    z-index: 1;
    display: block;
}
.semester-ring-bg { fill: none; stroke: var(--border-color); stroke-width: 8; opacity: 0.5; }
.semester-ring-progress { fill: none; stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1); }
.semester-ring-glow { fill: none; stroke-width: 12; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; opacity: 0.3; }

.semester-center { 
    position: absolute; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px; 
    z-index: 2; 
    pointer-events: none;
    width: 100%;
}
.semester-percent { 
    font-size: 3.2rem; 
    font-weight: 900; 
    color: var(--text-primary); 
    line-height: 1; 
    margin: 0;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}
.semester-center-sub { 
    color: var(--text-secondary); 
    font-weight: 700; 
    font-size: 1.1rem; 
    margin: 0;
}
.semester-center-range { 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    font-weight: 500; 
    margin: 0;
}
.semester-card .stat-subtitle {
    text-align: center;
    margin-bottom: 1.5rem;
}

.semester-timeline-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    padding: 16px;
}

.semester-timeline-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.semester-months { 
    display: flex; 
    gap: 16px; 
    overflow-x: auto;
    padding: 10px 5px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.semester-months::-webkit-scrollbar {
    height: 6px;
}

.semester-months::-webkit-scrollbar-track {
    background: transparent;
}

.semester-months::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.semester-month {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 90px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.semester-month.completed {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.semester-month.current {
    background: var(--bg-secondary);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.2);
    transform: scale(1.05);
    z-index: 1;
}

.semester-month .point {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
}

.semester-month.completed .point { color: var(--accent); }
.semester-month.current .point { color: var(--primary); }

.semester-month .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}
.semester-events-modern { margin-top: 20px; display: grid; gap: 12px; }
.semester-events-header { font-weight: 800; color: var(--text-primary); display: flex; gap: 10px; align-items: center; font-size: 1rem; margin-bottom: 4px; }
.semester-events-list { display: grid; gap: 10px; }

.semester-event-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.2s ease;
    position: relative;
}

.semester-event-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.semester-event-item.done { opacity: 0.6; filter: grayscale(0.5); }
.semester-event-item.next-up { border-color: var(--primary); background: rgba(79, 70, 229, 0.05); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1); }

.semester-event-item .icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.semester-event-item .info { flex: 1; min-width: 0; }
.semester-event-item .title { font-weight: 700; color: var(--text-primary); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.semester-event-item .date { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }

.semester-next-event { 
    padding: 16px; 
    border: 2px dashed var(--primary); 
    border-radius: 20px; 
    background: rgba(79, 70, 229, 0.05); 
    position: relative;
    overflow: hidden;
}

.next-event-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 4px 12px;
    border-bottom-left-radius: 12px;
}

.semester-event-item.next-up .pulse {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    animation: pulse-primary 2s infinite;
}

@keyframes pulse-primary {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

/* ========= Logout modal ========= */
.logout-modal { padding: 0; }
.logout-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.logout-modal-body { padding: 16px 20px; color: var(--text-secondary); }
.logout-modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; }
.logout-impact { padding-left: 16px; margin-top: 6px; display: grid; gap: 2px; font-size: 0.9rem; }

/* ========= Main content (paridad Asistencia / Students) ========= */
/* Cualquier main hijo directo de dashboard-main crece y hace scroll para que el footer quede abajo */
.container:has(.dashboard-layout) .dashboard-main > main,
.app-container:has(.dashboard-layout) .dashboard-main > main {
    flex: 1 1 0%;
    min-height: 0 !important;
    overflow: auto;
}

/* ========= Footer ========= */
/* Footer siempre al final: main hace scroll y el footer queda visible abajo */
#dashboard-footer-placeholder {
    flex-shrink: 0;
    margin-top: auto;
    padding: 0 1rem 1rem;
    min-height: 1px;
}
.footer {
    margin-top: 0;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.footer a { color: var(--primary); font-weight: 600; }
.footer a:hover { text-decoration: underline; }

.footer-version-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color, rgba(148,163,184,0.15));
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2px;
    flex-wrap: wrap;
}
.footer-version-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.footer-version-item i {
    font-size: 0.6rem;
    opacity: 0.7;
}
.footer-version-status i {
    font-size: 0.5rem;
}

/* ========= Spinners ========= */
.spinner { width: 24px; height: 24px; border: 2px solid rgba(79, 70, 229, 0.1); border-top: 2px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
.spinner-small { width: 16px; height: 16px; border: 2px solid rgba(79, 70, 229, 0.1); border-top: 2px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }

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

/* ========= Tabs, indicadores y vistas auxiliares ========= */
.modal-tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 14px; }
.tab-btn { flex: 1; padding: 10px; background: transparent; border: none; color: var(--text-secondary); font-weight: 600; }
.tab-btn.active { color: var(--text-primary); border-bottom: 2px solid var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.friends-modal-header { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.friends-tabs { display: flex; gap: 8px; padding: 10px 12px; background: var(--bg-secondary); }
.friends-tab-btn { flex: 1; padding: 6px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; }
.friends-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.friends-tab { display: none; }
.friends-tab.active { display: block; }
.friends-content { padding: 12px 16px; }
.friends-close { background: transparent; border: none; font-size: 1.1rem; color: var(--text-muted); cursor: pointer; }

.profile-avatar-container { position: relative; display: inline-block; }
.notification-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    border: 2px solid var(--bg-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
    animation: notif-badge-in 0.35s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

@keyframes notif-badge-in {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.notification-indicator.critical { background: #ef4444; box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35); }
.notification-indicator.warning { background: #f97316; box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35); }
.notification-indicator.info { background: #3b82f6; box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35); }
.notification-indicator.system { background: var(--primary); box-shadow: 0 2px 6px rgba(6, 182, 212, 0.35); }

.notification-count { font-weight: 700; letter-spacing: -0.01em; }

/* ========= Stats hero y etiquetas ========= */
.stats-modal-hero { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 20px; 
    padding: 24px; 
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%); 
    border: 1px solid var(--border-color); 
    border-radius: 24px; 
    margin-bottom: 24px; 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02);
}
.stats-hero-text { display: flex; flex-direction: column; gap: 8px; }
.hero-eyebrow { text-transform: uppercase; letter-spacing: 1px; font-weight: 800; color: var(--primary); font-size: 0.7rem; }
.hero-title { font-size: 1.5rem; font-weight: 900; color: var(--text-primary); letter-spacing: -0.5px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.hero-tag { background: var(--bg-secondary); color: var(--text-primary); padding: 6px 14px; border-radius: 12px; font-weight: 700; border: 1px solid var(--border-color); font-size: 0.8rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.hero-tag.subtle { color: var(--text-secondary); font-weight: 600; }
.stats-hero-meta { text-align: right; display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-weight: 800; text-transform: uppercase; letter-spacing: 1px; font-size: 0.65rem; color: var(--text-muted); }
.meta-value { font-weight: 800; color: var(--primary); font-size: 1rem; }
.meta-hint { color: var(--text-muted); font-size: 0.75rem; font-weight: 500; }
.subtle { color: var(--text-muted); }

/* ========= Ajustes de cabeceras de stats ========= */
.chart-centered { justify-content: center; position: relative; }
.chart-centered .stat-icon { position: absolute; left: 0; }
.chart-centered .stat-header-metric { position: absolute; right: 0; }
.metric-inline .stat-icon,
.metric-inline .stat-header-metric { position: static; }
.metric-inline { gap: 8px; }
.chart-icon,
.attendance-icon,
.semester-icon,
.students-icon { background: var(--bg-tertiary); color: var(--primary); }
.stat-subtitle { color: var(--text-secondary); margin-bottom: 8px; font-size: 0.85rem; }
.stat-number { font-size: 1.15rem; font-weight: 700; }
.stat-label-inline { color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.65rem; }
.stat-progress { margin-top: 12px; }
.progress-bar { width: 100%; height: 8px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: inherit; transition: width 0.3s ease; }

/* ========= Cotidiano y tarjetas auxiliares ========= */
.cotidiano-grade-box { display: flex; flex-direction: column; gap: 10px; }
.cotidiano-header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cotidiano-scale { color: var(--text-secondary); font-size: 0.75rem; }
.cotidiano-views-wrapper { display: grid; gap: 10px; }

/* ========= Estado de estudiantes (fallback) ========= */
.students-expanded { border-radius: var(--radius-md); overflow: hidden; }
.students-compact { padding: 0; }
.students-breakdown { display: flex; gap: 10px; }
.breakdown-item { flex: 1; background: var(--bg-tertiary); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.breakdown-number { font-weight: 700; color: var(--text-primary); }
.breakdown-label { color: var(--text-secondary); font-size: 0.75rem; }
.students-summary { display: flex; align-items: center; gap: 12px; }
.main-number { display: flex; align-items: baseline; gap: 6px; }
.students-meta { display: flex; gap: 8px; align-items: center; }
.students-v-separator { display: none; }
.students-hidden-legacy { display: none !important; }

/* ========= Otros textos y logos ========= */
.ociannclass-logo { font-weight: 800; color: var(--primary); }
/* ========= Complementos de semestre ========= */
.semester-ring-glow { fill: none; stroke-width: 10; opacity: 0.18; }
.progress-dot-group { transition: transform 0.2s ease; }
.ring-secondary { opacity: 0.5; }
.legacy-semester-percent { color: var(--text-secondary); font-size: 0.85rem; }

/* ========= Responsive ========= */
@media (max-width: 992px) {
    .attendance-insights { grid-template-columns: 1fr; }
    .welcome-title { font-size: 1.3rem; }
}

@media (max-width: 768px) {
    .modules-grid { 
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .module-card {
        padding: 12px 10px;
        min-height: 140px;
    }
    .module-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    .module-title {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    .module-description {
        font-size: 0.72rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    .stats-grid,
    .info-grid { grid-template-columns: 1fr; }
    .teacher-profile { padding: 15px; }
    .profile-avatar { width: 62px; height: 62px; font-size: 22px; border-radius: 50%; }
    .profile-info { gap: 14px; }
    .profile-details h2 { font-size: 1.25rem; }
    .welcome-header { padding: 12px; }
    .welcome-title { font-size: 1.2rem; }
    .toast-container { right: 12px; left: 12px; }
    .toast { width: 100%; min-width: unset; }
    
    /* Período compacto en móvil */
    .current-period { 
        padding: 4px 10px; 
        max-width: 280px;
    }
    .period-icon { width: 22px; height: 22px; font-size: 0.65rem; }
    .period-label { font-size: 0.55rem; }
    .period-value { font-size: 0.72rem; }
}

@media (max-width: 520px) {
    .controls-box { gap: 4px; padding: 6px 10px; border-radius: 14px; }
    .controls-divider { display: none; }
    .brand-text { display: none; }
    .brand-emblem { width: 36px; height: 36px; }
    .brand-emblem-main::before { font-size: 1.05rem; }
    .brand-emblem-main::after { top: -1px; right: -7px; font-size: 0.55rem; }
    .brand-chip { padding: 2px; }
    .floating-btn,
    .friends-icon-btn { width: 34px; height: 34px; font-size: 0.85rem; }
    .notification-modal { width: calc(100% - 32px); }
    .birthday-body { flex-direction: column; align-items: flex-start; }
    
    .modules-grid { gap: 8px; }
    .module-card { padding: 12px 8px; min-height: 130px; }
    .module-icon { width: 42px; height: 42px; font-size: 1rem; margin-bottom: 8px; }
    .module-title { font-size: 0.85rem; }
    .module-description {
        font-size: 0.68rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    /* Período muy compacto */
    .current-period { 
        padding: 3px 8px; 
        gap: 6px;
        max-width: 220px;
    }
    .period-icon { width: 20px; height: 20px; }
    .period-value { font-size: 0.68rem; }
}

/* Extra compact layout for very small screens */
@media (max-width: 420px) {
    .controls-box { gap: 3px; padding: 6px 8px; }
    .brand-floating { margin-right: 3px; }
    .brand-emblem { width: 32px; height: 32px; }
    .brand-emblem-main::before { font-size: 0.9rem; }
    .brand-emblem-main::after { top: -1px; right: -6px; font-size: 0.48rem; }
    .floating-btn,
    .friends-icon-btn { width: 30px; height: 30px; font-size: 0.8rem; }
    
    .modules-grid { gap: 8px; }
    .module-card { padding: 12px 8px; min-height: 130px; }
    
    .current-period { max-width: 180px; }
    .period-label { display: none; }
}

/* ========= Modo teléfono limpio (máxima legibilidad, mínimo ruido) ========= */
@media (max-width: 600px) {
    /* Tarjetas de módulos: solo icono + título, sin descripción ni flecha */
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .module-card {
        padding: 14px 10px;
        min-height: 100px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        border-radius: 14px;
    }
    .module-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    .module-card::after {
        display: none;
    }
    .module-description {
        display: none !important;
    }
    .module-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 6px;
    }
    .module-icon svg {
        width: 24px;
        height: 24px;
    }
    .module-title {
        font-size: 0.8rem;
        font-weight: 600;
        margin-bottom: 0;
        line-height: 1.25;
    }
    /* Pestañas Docente/Director más compactas */
    .role-view-tabs {
        padding: 4px;
        gap: 4px;
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    .role-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .role-tab i {
        font-size: 0.85rem;
    }
    /* Tarjeta AVI más compacta */
    .avi-welcome-card {
        padding: 14px 16px;
        border-radius: 14px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }
    .avi-welcome-inner {
        gap: 14px;
    }
    .avi-welcome-avatar {
        width: 52px;
        height: 52px;
    }
    .avi-welcome-title {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    .avi-welcome-desc {
        display: none;
    }
    .avi-welcome-prompt {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
    .avi-welcome-input {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    .avi-welcome-send {
        width: 40px;
        height: 40px;
    }
    /* Período activo más compacto en navbar */
    .dashboard-main .current-period {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    /* Menos padding en el contenido principal */
    .dashboard-main {
        padding: 0.75rem 0.75rem;
    }
    .modules-section {
        padding-top: 0;
    }
}

@media (max-width: 480px) {
    /* Teléfonos muy pequeños: tarjetas aún más compactas */
    .modules-grid {
        gap: 8px;
    }
    .module-card {
        padding: 12px 8px;
        min-height: 88px;
    }
    .module-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 4px;
    }
    .module-icon svg {
        width: 20px;
        height: 20px;
    }
    .module-title {
        font-size: 0.75rem;
    }
}

/* Global Slider (Range Input) Styles */
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--bg-tertiary); border-radius: 5px; outline: none; margin: 10px 0; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: var(--primary); cursor: pointer; border-radius: 50%; border: 3px solid var(--bg-secondary); box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: all 0.2s ease; }
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.2); background: var(--primary); }

/* Theme Selector Styles */
.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.theme-opt {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    transition: all 0.2s ease;
}

.theme-opt:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-opt:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.theme-opt.active {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.theme-opt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.theme-opt-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--primary);
    flex: 0 0 auto;
}

.theme-opt[data-theme-val="light"] .theme-opt-icon { color: #f59e0b; }
.theme-opt[data-theme-val="dark"] .theme-opt-icon { color: #22d3ee; }
.theme-opt[data-theme-val="deep-dark"] .theme-opt-icon { color: #cbd5e1; }
.theme-opt[data-theme-val="claude"] .theme-opt-icon { color: #d97706; }
.theme-opt[data-theme-val="claude-dark"] .theme-opt-icon { color: #f59e0b; }
.theme-opt[data-theme-val="aurora"] .theme-opt-icon { color: #22c55e; }
.theme-opt[data-theme-val="cobalt"] .theme-opt-icon { color: #2563eb; }
.theme-opt[data-theme-val="rose"] .theme-opt-icon { color: #ec4899; }

.theme-opt-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-opt-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.theme-opt-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-opt-check {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-opt-check i {
    font-size: 0.7rem;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.theme-opt.active .theme-opt-check {
    background: var(--primary);
    border-color: var(--primary);
}

.theme-opt.active .theme-opt-check i {
    opacity: 1;
    transform: scale(1);
}

.theme-preview {
    width: 100%;
    height: 50px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.theme-preview::before,
.theme-preview::after {
    content: '';
    position: absolute;
}

.theme-preview.light { background-color: #f8fafc; }
.theme-preview.light::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.light::after { width: 70%; height: 15%; background: #06b6d4; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.dark { background-color: #0f172a; }
.theme-preview.dark::before { width: 30%; height: 100%; background: #1e293b; left: 0; }
.theme-preview.dark::after { width: 70%; height: 15%; background: #0891b2; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.deep-dark { background-color: #020617; }
.theme-preview.deep-dark::before { width: 30%; height: 100%; background: #0f172a; left: 0; }
.theme-preview.deep-dark::after { width: 70%; height: 15%; background: #22d3ee; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.claude { background-color: #f5f5f0; }
.theme-preview.claude::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.claude::after { width: 70%; height: 15%; background: #d97706; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.claude-dark { background-color: #0b1220; }
.theme-preview.claude-dark::before { width: 30%; height: 100%; background: #121a2b; left: 0; }
.theme-preview.claude-dark::after { width: 70%; height: 15%; background: #f59e0b; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.aurora { background: linear-gradient(135deg, #071a17 0%, #0b2d25 55%, #0b1220 100%); }
.theme-preview.aurora::before { width: 30%; height: 100%; background: rgba(255,255,255,0.06); left: 0; }
.theme-preview.aurora::after { width: 70%; height: 15%; background: linear-gradient(90deg, #22c55e 0%, #06b6d4 55%, #0891b2 100%); top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.cobalt { background-color: #f1f7ff; }
.theme-preview.cobalt::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.cobalt::after { width: 70%; height: 15%; background: #2563eb; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.rose { background-color: #fff1f5; }
.theme-preview.rose::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.rose::after { width: 70%; height: 15%; background: #ec4899; top: 8px; right: 4px; border-radius: 3px; }

.profile-avatar img { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%; 
    object-fit: cover;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    z-index: 2;
    /* Prevent sub-pixel border artifacts */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.profile-avatar img.loaded {
    opacity: 1;
}

.profile-details h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.profile-details .school {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.profile-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible !important;
}

.header-controls { 
    display: flex; 
    align-items: center;
    justify-content: flex-end;
    overflow: visible !important;
}

.controls-box {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: none;
    white-space: nowrap;
    overflow-x: visible; /* Cambiado de auto para permitir el dropdown */
    overflow-y: visible;
    min-height: auto;
    max-width: 100%;
}

/* Selector de Temas */
.theme-selector-wrapper {
    position: relative;
    display: inline-block;
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: rgba(var(--dropdown-bg-rgb, 255, 255, 255), 0.75);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.25);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    min-width: 280px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2100;
}

.theme-dropdown.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.theme-dropdown::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 18px;
    border: 10px solid transparent;
    border-bottom-color: var(--bg-primary);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid transparent;
}

.theme-option:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.theme-option.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.theme-option i {
    font-size: 1rem;
    width: 20px;
    display: flex;
    justify-content: center;
    transition: transform 0.3s ease;
}

.theme-option.active i {
    transform: scale(1.1);
}

.theme-option span {
    flex: 1;
}

/* Ajustes para temas oscuros en el dropdown */
[data-theme="dark"] .theme-option.active,
[data-theme-variant="deep-dark"] .theme-option.active,
[data-theme-variant="claude-dark"] .theme-option.active,
[data-theme-variant="aurora"] .theme-option.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

[data-theme-variant="cobalt"] .theme-option.active {
    background: #cffafe;
    color: #0891b2;
}

[data-theme-variant="rose"] .theme-option.active {
    background: #fff1f2;
    color: #ec4899;
}

@media (max-width: 900px) {
    .theme-dropdown {
        top: calc(100% + 5px) !important;
        bottom: auto !important;
        right: 0 !important;
        left: auto !important;
        transform: translateY(10px) scale(0.95);
        grid-template-columns: repeat(2, 1fr) !important;
        min-width: 250px !important;
    }
    
    .theme-dropdown.show {
        transform: translateY(0) scale(1) !important;
    }
    
    .theme-dropdown::after {
        top: -10px !important;
        bottom: auto !important;
        border-top-color: transparent !important;
        border-bottom-color: var(--bg-primary) !important;
        right: 15px !important;
        left: auto !important;
        transform: none !important;
    }
}

/* Fix for JS forcing display: block on flex containers */
.controls-box[style*="display: block"],
.controls-box[style*="display:block"] {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

.teacher-profile[style*="display: block"],
.teacher-profile[style*="display:block"],
.module-card[style*="display: block"],
.module-card[style*="display:block"] {
    display: flex !important;
}

[data-theme="dark"] .controls-box {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(100, 116, 139, 0.2);
}

.controls-divider { 
    width: 1px;
    height: 32px;
    background: var(--border-color);
    margin: 0 4px;
    opacity: 0.4;
    flex-shrink: 0;
}

[data-theme="dark"] .controls-divider {
    background: rgba(255, 255, 255, 0.15);
}

.brand-floating {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 6px;
}

.brand-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 12px;
    background: transparent;
    border: none;
}

[data-theme="dark"] .brand-chip {
    background: transparent;
}

.brand-emblem {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -1px;
    position: relative;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

.brand-emblem-main {
    position: relative;
    display: inline-block;
    line-height: 1;
    font-size: 0;
}

.brand-emblem-main::before {
    content: 'E';
    position: relative;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-emblem-main::after {
    content: '1';
    position: absolute;
    top: -2px;
    right: -9px;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
}

.brand-text {
    display: flex;
    align-items: baseline;
    line-height: 1;
}

.brand-name {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.2px;
    color: var(--text-secondary);
}

.brand-highlight {
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 900px) {
    .teacher-profile .profile-header {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    .profile-actions { 
        width: 100%; 
        justify-content: center;
    }
    .header-controls {
        justify-content: center;
        width: 100%;
        overflow-x: visible;
    }
    .controls-box {
        width: auto;
        flex-wrap: nowrap !important;
        overflow-x: visible;
    }
}

@media (max-width: 640px) {
    .controls-box {
        padding: 8px 12px;
        gap: 6px;
        border-radius: 16px;
        overflow-x: visible;
    }
    .controls-divider { display: none; }
    .brand-text { display: none; }
    .brand-emblem { width: 32px; height: 32px; }
    .floating-btn,
    .friends-icon-btn { 
        width: 36px; 
        height: 36px; 
        padding: 0;
        justify-content: center;
        font-size: 0.95rem;
    }
}

/* ========= Bienvenida y tabs ========= */
.welcome-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.welcome-school {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.welcome-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.welcome-subtitle {
    color: var(--text-secondary);
}

.role-view-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-soft);
}

.role-tab {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.role-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========= Tarjetas de stats ========= */
.admin-stats { margin-top: 4px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.full-width-card {
    grid-column: 1 / -1 !important;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .stat-card {
        padding: 16px;
        border-radius: 16px;
    }
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0.5;
}

.stat-card:hover { 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stat-content { display: flex; gap: 12px; align-items: center; }

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: grid;
    place-items: center;
    color: var(--primary);
    flex-shrink: 0;
    font-size: 18px;
}

.stat-info h3 { font-size: 1.25rem; font-weight: 700; }
.stat-info p { color: var(--text-secondary); font-weight: 500; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px; }

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

.stat-title { font-weight: 700; color: var(--text-primary); letter-spacing: 0.5px; font-size: 0.9rem; }
.stat-header-metric { font-weight: 700; color: var(--primary); font-size: 0.9rem; }

.compact-card { padding: 12px; }
.chart-card-compact canvas { width: 100%; }

.attendance-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 1100px) {
    .attendance-insights { grid-template-columns: 1fr; }
    
    .teacher-profile .profile-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .profile-info {
        display: flex;
        width: 100%;
        align-items: center;
        gap: 15px;
    }

    .profile-details {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex: 1;
    }
    
    .profile-details h2 {
        margin-bottom: 0;
        font-size: 1.4rem;
    }

    /* Forzar que el periodo aparezca abajo del todo si queremos, 
       pero por ahora aseguramos que no choque con la barra */
    .current-period {
        margin-top: 0;
        align-self: flex-start;
    }

    .profile-actions {
        width: 100%;
        margin-top: 5px;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .controls-box {
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
        padding: 10px 14px;
        background: var(--bg-tertiary);
        border-radius: 15px;
    }
    
    /* En tablet, ocultamos el texto de Ociann Class para dar mas espacio si es necesario */
    .brand-text {
        display: none;
    }
    .brand-chip {
        padding: 4px;
    }
}

.attendance-chart-area { 
    background: var(--bg-tertiary); 
    border-radius: 20px; 
    padding: 20px; 
    border: 1px solid var(--border-color);
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 250px;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.attendance-chart-area canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.attendance-absent-summary { background: var(--bg-tertiary); border-radius: 20px; padding: 20px; border: 1px solid var(--border-color); }
.absent-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 16px; 
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}
.absent-title { font-weight: 800; font-size: 1rem; color: var(--text-primary); display: flex; gap: 8px; align-items: center; }
.absent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.absent-item {
    background: var(--bg-secondary);
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.absent-item:hover {
    border-color: var(--danger);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
}

.absent-student {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.absent-student-name {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.absent-name-line {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.absent-name-line.secondary {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.absent-student-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.absent-grade-pill {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--text-muted);
}

.absent-date {
    color: var(--text-muted);
    font-weight: 500;
}

.absent-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 60px;
}

.absent-count {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--danger);
    line-height: 1;
}

.absent-count-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.absent-list.scrollable {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
}

.absent-list.scrollable::-webkit-scrollbar {
    width: 4px;
}

.absent-list.scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.absent-empty { color: var(--text-secondary); font-size: 0.85rem; }

.meta-badge { background: rgba(15, 118, 110, 0.1); color: #0f766e; border-color: rgba(15, 118, 110, 0.2); }
.absent-badge { 
    background: rgba(239, 68, 68, 0.1); 
    color: var(--danger); 
    padding: 4px 12px; 
    border-radius: 999px; 
    font-size: 0.75rem; 
    font-weight: 800; 
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ========= Módulos ========= */
.modules-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    box-sizing: border-box;
}

/* Tarjeta de bienvenida AVI: estilos movidos a css/avi-welcome.css */

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    width: 100%;
}

@media (min-width: 1200px) {
    .modules-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (min-width: 1600px) {
    .modules-grid { gap: 18px; }
}

/* ===== Widget de horario del día (dashboard) ===== */
.dashboard-schedule-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    width: 100%;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease;
}

.dashboard-schedule-widget:hover {
    box-shadow: var(--shadow-hover);
}

.schedule-widget-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.schedule-widget-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.schedule-widget-header i {
    color: var(--primary);
    font-size: 1rem;
}

.schedule-widget-body {
    min-height: 2.5rem;
}

.schedule-widget-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.schedule-widget-loading .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.schedule-widget-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.schedule-widget-empty,
.schedule-widget-free {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.schedule-widget-empty .schedule-widget-cta,
.schedule-widget-free .schedule-widget-cta {
    margin-top: 0.75rem;
}

.schedule-widget-cta .btn-schedule {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.schedule-widget-cta .btn-schedule:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.schedule-widget-cta .btn-schedule i {
    font-size: 0.85rem;
}

.schedule-widget-weekend-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.schedule-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.schedule-widget-list::-webkit-scrollbar {
    width: 6px;
}

.schedule-widget-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.schedule-widget-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.schedule-widget-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.4rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.schedule-widget-list li:last-child {
    border-bottom: none;
}

.schedule-widget-list .lesson-time {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    min-width: 5.5rem;
}

.schedule-widget-list .lesson-subject {
    font-weight: 500;
    flex: 1;
}

.schedule-widget-list .lesson-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Unidocente: misma hora, varias materias en una fila */
.schedule-widget-list .schedule-widget-lesson--multi .lesson-subject {
    font-size: 0.85rem;
}

.module-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    min-height: 150px;
}

[data-theme="dark"] .module-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.module-card::after {
    content: '\f061';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.module-card:hover::after {
    color: var(--primary);
    opacity: 1;
    transform: translateX(3px);
}

.module-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.module-card:hover .module-icon {
    transform: scale(1.1);
}

.module-icon svg {
    width: 28px;
    height: 28px;
}

.module-icon i {
    font-size: 1.5rem;
}

.module-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.module-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Module Icon Colors - Solid Opaque */
.module-icon.students { background: #dbeafe; color: #2563eb; }
.module-icon.attendance { background: #dcfce7; color: #16a34a; }
.module-icon.cotidiano { background: #ecfeff; color: #0891b2; }
.module-icon.evaluations { background: #ffedd5; color: #ea580c; }
.module-icon.boletas { background: #fee2e2; color: #dc2626; }
.module-icon.minutas { background: #fce7f3; color: #db2777; }
.module-icon.planeamiento { background: #ecfeff; color: #06b6d4; }
.module-icon.recursos { background: #ecfeff; color: #0891b2; }
.module-icon.materias { background: #f1f5f9; color: #475569; }
.module-icon.diagnostic-exam { background: #ecfeff; color: #06b6d4; }
.module-icon.reportes { background: #f0fdf4; color: #16a34a; }
.module-icon.sea { background: #ecfeff; color: #0891b2; }
.module-icon.comportamiento { background: #f0f9ff; color: #0284c7; }
.module-icon.trabajos { background: #f8fafc; color: #64748b; }
.module-icon.horarios { background: #fff7ed; color: #d97706; }
.module-icon.calendario { background: #dbeafe; color: #2563eb; }
.module-icon.formularios { background: #ecfeff; color: #06b6d4; }
.module-icon.avichat { background: #ecfeff; color: #0891b2; }
.module-icon.sala-de-profes { background: #ecfeff; color: #0891b2; }
.module-icon.admin { background: var(--primary); color: #ffffff; }

/* Modo oscuro - iconos con fondos más oscuros */
[data-theme="dark"] .module-icon.students { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
[data-theme="dark"] .module-icon.attendance { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
[data-theme="dark"] .module-icon.cotidiano { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.evaluations { background: rgba(234, 88, 12, 0.2); color: #fb923c; }
[data-theme="dark"] .module-icon.boletas { background: rgba(220, 38, 38, 0.2); color: #f87171; }
[data-theme="dark"] .module-icon.minutas { background: rgba(219, 39, 119, 0.2); color: #f472b6; }
[data-theme="dark"] .module-icon.planeamiento { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
[data-theme="dark"] .module-icon.recursos { background: rgba(8, 145, 178, 0.2); color: #22d3ee; }
[data-theme="dark"] .module-icon.materias { background: rgba(71, 85, 105, 0.2); color: #cbd5e1; }
[data-theme="dark"] .module-icon.diagnostic-exam { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
[data-theme="dark"] .module-icon.reportes { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
[data-theme="dark"] .module-icon.sea { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.comportamiento { background: rgba(2, 132, 199, 0.2); color: #38bdf8; }
[data-theme="dark"] .module-icon.trabajos { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
[data-theme="dark"] .module-icon.horarios { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }
[data-theme="dark"] .module-icon.calendario { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
[data-theme="dark"] .module-icon.formularios { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.avichat { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
[data-theme="dark"] .module-icon.sala-de-profes { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }

.module-status { display: none; }

/* ========= Toasts y notificaciones ========= */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    min-width: 280px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show { transform: translateX(0); }
.toast.success { border-left: 4px solid var(--accent); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
.toast-title { font-weight: 700; color: var(--text-primary); }
.toast-message { color: var(--text-secondary); font-size: 0.9rem; }

.notification-overlay,
.notifications-overlay,
.modal-overlay,
.logout-modal-overlay,
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px 10px;
}

.notification-overlay.show,
.notifications-overlay.show,
.modal-overlay.show,
.logout-modal-overlay.show,
.welcome-overlay.show { 
    display: flex; 
    opacity: 1; 
}

.notification-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 44px 40px 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.05);
    min-width: 360px;
    max-width: 500px;
    width: 92vw;
    text-align: center;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.5s cubic-bezier(0.215, 0.61, 0.355, 1), opacity 0.4s ease;
    position: relative;
    overflow: hidden;
}

.notification-modal.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.notification-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    margin: 0 auto 24px;
    font-size: 36px;
    position: relative;
    transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.notification-icon.loading {
    background: rgba(6, 182, 212, 0.08);
    color: var(--primary);
    border: 2.5px solid rgba(6, 182, 212, 0.15);
    animation: notif-icon-pulse 2s ease-in-out infinite;
}

.notification-icon.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    animation: notif-icon-success-in 0.7s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
}

.notification-icon.success::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2.5px solid rgba(34, 197, 94, 0.25);
    animation: notif-success-ripple 1s 0.3s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
    opacity: 0;
}

.notification-icon.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    animation: notif-icon-success-in 0.7s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

@keyframes notif-icon-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99,102,241,0.15); }
    50% { transform: scale(1.04); box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}

@keyframes notif-icon-pop {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    75% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes notif-icon-success-in {
    0% { transform: scale(0); opacity: 0; }
    40% { transform: scale(1.08); opacity: 1; }
    65% { transform: scale(0.96); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes notif-success-ripple {
    0% { transform: scale(0.85); opacity: 0; }
    40% { opacity: 1; }
    100% { transform: scale(1.15); opacity: 0; }
}

/* Animated checkmark SVG */
.checkmark-svg { width: 52px; height: 52px; }
.checkmark-circle { 
    stroke: #fff; 
    stroke-width: 2; 
    stroke-dasharray: 166; 
    stroke-dashoffset: 166; 
    animation: checkmark-circle-draw 0.6s 0.15s cubic-bezier(0.65, 0, 0.45, 1) forwards;
    fill: none;
}
.checkmark-check { 
    stroke: #fff; 
    stroke-width: 3.5; 
    stroke-linecap: round; 
    stroke-linejoin: round; 
    stroke-dasharray: 48; 
    stroke-dashoffset: 48; 
    animation: checkmark-draw 0.4s 0.55s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmark-circle-draw {
    to { stroke-dashoffset: 0; }
}
@keyframes checkmark-draw {
    to { stroke-dashoffset: 0; }
}

/* Animated error X SVG */
.error-svg { width: 52px; height: 52px; }
.error-circle { stroke: #fff; stroke-width: 2; stroke-dasharray: 166; stroke-dashoffset: 166; animation: checkmark-circle-draw 0.6s 0.15s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
.error-x { stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 56; stroke-dashoffset: 56; animation: checkmark-draw 0.4s 0.55s cubic-bezier(0.65, 0, 0.45, 1) forwards; }

/* Custom loading spinner */
.period-loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
}
.period-loading-spinner div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    animation: period-bounce 1.6s ease-in-out infinite both;
}
.period-loading-spinner div:nth-child(1) { animation-delay: -0.32s; }
.period-loading-spinner div:nth-child(2) { animation-delay: -0.16s; }
.period-loading-spinner div:nth-child(3) { animation-delay: 0s; }

@keyframes period-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Progress bar */
.notification-progress {
    margin-top: 20px;
    height: 4px;
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.1);
    overflow: hidden;
}

.notification-progress-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), #22d3ee);
    transition: width 0.3s ease;
}

.notification-progress-bar.indeterminate {
    width: 40%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* State-specific modal styling */
.notification-modal.state-success .notification-title { color: #22c55e; }
.notification-modal.state-error .notification-title { color: #ef4444; }

/* Staggered content reveal for success/error states */
.notification-modal.state-success .notification-title,
.notification-modal.state-error .notification-title {
    animation: notif-content-up 0.5s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

.notification-modal.state-success .notification-message,
.notification-modal.state-error .notification-message {
    animation: notif-content-up 0.5s 0.4s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

.notification-modal.state-success .notification-details,
.notification-modal.state-error .notification-details {
    animation: notif-content-up 0.5s 0.55s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

@keyframes notif-content-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notification-modal .notification-title { 
    font-size: 1.85rem; 
    font-weight: 800; 
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.notification-modal .notification-message { 
    color: var(--text-secondary); 
    font-size: 1.08rem;
    line-height: 1.55;
    margin-bottom: 22px;
}

.notification-details { 
    display: none !important;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 20px;
    opacity: 0;
    transform: translateY(8px);
    animation: detail-row-in 0.4s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
    position: relative;
}

.detail-row:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border-color);
    opacity: 0.5;
}

@keyframes detail-row-in {
    to { opacity: 1; transform: translateY(0); }
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-values {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-from,
.detail-to {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.detail-from {
    color: var(--text-secondary);
    font-weight: 600;
    opacity: 0;
    position: relative;
    display: inline-block;
    animation: detail-val-in 0.35s 0.2s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

.detail-from::after {
    content: '';
    position: absolute;
    left: -2px;
    right: -2px;
    top: 50%;
    height: 8px; /* Tachón estilo crayón grueso */
    background: rgba(239, 68, 68, 0.22);
    transform: translateY(-50%) rotate(-1deg);
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: crayon-strike 0.5s 0.35s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

[data-theme="dark"] .detail-from::after {
    background: rgba(239, 68, 68, 0.35);
}

@keyframes crayon-strike {
    from { width: 0; opacity: 0; }
    to { width: calc(100% + 4px); opacity: 1; }
}

.detail-to {
    color: #10b981;
    opacity: 0;
    animation: detail-val-in 0.35s 0.5s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

[data-theme="dark"] .detail-to {
    color: #34d399; /* Verde esmeralda más vibrante para modo oscuro */
}

.detail-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    opacity: 0;
    animation: detail-arrow-in 0.4s 0.35s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

.detail-arrow svg {
    display: block;
}

@keyframes detail-val-in {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes detail-arrow-in {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

/* ========= Dropdown de notificaciones (Mejorado - Diseño de Modal Centrado) ========= */
.notifications-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 15px)) scale(0.98);
    width: 600px;
    max-width: calc(100% - 32px);
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2100;
    display: flex;
    flex-direction: column;
}

.notifications-dropdown.show { 
    transform: translate(-50%, -50%) scale(1); 
    opacity: 1; 
    pointer-events: auto; 
}

.notifications-header {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notifications-header h3 i {
    color: #fff;
    background: #10b981;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
    font-size: 0.95rem;
}

.notifications-actions {
    display: flex;
    gap: 10px;
}

.notifications-actions button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-actions button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.notifications-actions .close-notifications-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.notifications-actions .close-notifications-btn:hover {
    background: var(--danger);
    color: white;
}

.notifications-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* Scrollbar Minimalista */
.notifications-content::-webkit-scrollbar {
    width: 6px;
}

.notifications-content::-webkit-scrollbar-track {
    background: transparent;
}

.notifications-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

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

.notifications-content {
    min-height: 180px;
}

.loading-notifications {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading-notifications .spinner-small {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.no-notifications {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.no-notifications-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.no-notifications h4 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.no-notifications p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-item {
    padding: 16px 24px;
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.notification-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0%;
    background: #10b981;
    transition: height 0.3s ease;
    border-radius: 0 4px 4px 0;
}

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

.notification-item:hover::before {
    height: 40%;
}

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

.notification-item.unread {
    background: rgba(16, 185, 129, 0.03);
}

.notification-item.unread .notification-title {
    color: var(--text-primary);
}

.notification-item .notification-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.notification-item .notification-icon.critical { background: rgba(239, 68, 68, 0.08); color: var(--danger); }
.notification-item .notification-icon.warning { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.notification-item .notification-icon.info { background: rgba(16, 185, 129, 0.08); color: #10b981; }

.notification-item .notification-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 !important;
}

.notification-item .notification-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.notification-item .notification-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.notification-item .notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.notification-item .notification-time::before {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
}

.notif-badge {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
    letter-spacing: 0.4px;
}

.badge-critical { background: var(--danger); color: #fff; }
.badge-warning { background: var(--warning); color: #fff; }

.notifications-footer {
    padding: 20px 24px;
    text-align: center;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.mark-all-as-read-footer-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #10b981;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.mark-all-as-read-footer-btn i {
    font-size: 0.9rem;
    color: white;
}

.mark-all-as-read-footer-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

.mark-all-as-read-footer-btn:hover i {
    color: white;
}

@media (max-width: 600px) {
    /* Ocultar botones flotantes cuando las notificaciones están abiertas */
    body.notifications-open #aiChatButton,
    body.notifications-open .module-nav-trigger {
        display: none !important;
    }

    .notifications-dropdown {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: translateY(100%) !important;
        border: none !important;
        max-width: none !important;
        margin: 0 !important;
        background: var(--bg-secondary) !important;
    }

    .notifications-dropdown.show {
        transform: translateY(0) !important;
    }

    .notifications-header {
        padding: 16px 20px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-secondary);
    }

    .close-notifications-btn {
        width: 44px !important;
        height: 44px !important;
    }

    .notification-item {
        padding: 16px 20px;
        gap: 12px;
    }

    .notification-item .notification-icon {
        width: 40px;
        height: 40px;
    }

    .notifications-footer {
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: var(--bg-secondary);
        box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    }
}

/* ========= Modales ========= */
.modal-overlay.show,
.logout-modal-overlay.show,
.welcome-overlay.show { display: flex; }

.welcome-overlay .welcome-modal {
    width: min(720px, 94vw);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
    margin: auto;
    animation: modalIn 0.2s ease;
}

.welcome-overlay .welcome-header {
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 18px 20px 14px;
    box-shadow: none;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.10) 0%, rgba(168, 85, 247, 0.08) 100%);
    text-align: center;
}

.welcome-overlay .welcome-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #fff;
    font-size: 24px;
    box-shadow: 0 12px 26px rgba(6, 182, 212, 0.35);
}

.welcome-overlay .welcome-header h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.welcome-overlay .welcome-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.welcome-overlay .welcome-content {
    padding: 16px 20px 18px;
}

.welcome-overlay .welcome-message h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 900;
}

.welcome-overlay .welcome-message p {
    margin: 0 0 12px;
    color: var(--text-secondary);
}

.welcome-overlay .welcome-steps {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.welcome-overlay .step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.welcome-overlay .step-number {
    width: 26px;
    height: 26px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(6, 182, 212, 0.14);
    color: var(--primary);
    font-weight: 900;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.welcome-overlay .step-text {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.welcome-overlay .welcome-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.welcome-overlay .btn-welcome-primary {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(6, 182, 212, 0.35);
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    min-height: 44px;
}

.welcome-overlay .btn-welcome-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(6, 182, 212, 0.25);
    filter: brightness(1.02);
}

.welcome-overlay .btn-welcome-primary:active {
    transform: translateY(0);
}

.welcome-overlay .btn-welcome-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.22), 0 16px 34px rgba(6, 182, 212, 0.25);
}

@media (max-width: 600px) {
    .welcome-overlay {
        padding: 10px;
        align-items: flex-start; /* Better for long modals on mobile */
    }
    .welcome-overlay .welcome-modal {
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: 16px;
    }
    .welcome-overlay .welcome-header {
        padding: 14px 16px;
    }
    .welcome-overlay .welcome-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        margin-bottom: 8px;
    }
    .welcome-overlay .welcome-header h2 {
        font-size: 1.15rem;
    }
    .welcome-overlay .welcome-content {
        padding: 14px 16px;
    }
    .welcome-overlay .welcome-steps {
        gap: 8px;
    }
    .welcome-overlay .step-item {
        padding: 8px 10px;
    }
    .welcome-overlay .btn-welcome-primary {
        width: 100%;
        justify-content: center;
    }
}

.modal-container,
.logout-modal,
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: min(600px, 94vw);
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-large { width: min(1100px, 96vw); }
.modal-fullscreen { 
    width: 98vw; 
    height: 98vh; 
    max-height: 98vh;
    border-radius: 24px;
    margin: 1vh auto;
}

.modal-fullscreen .modal-body {
    padding: 32px;
}

@media (max-width: 768px) {
    .modal-fullscreen {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
}

@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title i { color: var(--primary); }

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 1.2rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbar (Slider) */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    border: 2px solid var(--bg-secondary);
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close,
.close-btn,
.logout-close-btn { 
    width: 32px; 
    height: 32px; 
    border-radius: 8px; 
    display: grid; 
    place-items: center; 
    font-size: 1.1rem; 
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover,
.logout-close-btn:hover {
    background: var(--bg-secondary);
    color: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

/* ========= Modal de Período Académico (Rediseñado) ========= */
.period-modal-overlay {
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.55);
}

.period-modal-container {
    width: min(560px, 94vw);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 60px rgba(2, 6, 23, 0.3), 0 0 0 1px rgba(255,255,255,0.04);
    animation: none;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    overflow: hidden;
    background: var(--bg-secondary);
}

[data-theme="dark"] .period-modal-container {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme-variant="deep-dark"] .period-modal-container { background: #020617; }
[data-theme-variant="aurora"] .period-modal-container { background: #071a17; }
[data-theme-variant="claude-dark"] .period-modal-container { background: #171717; }

.period-modal-overlay.show .period-modal-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.period-modal-overlay.closing .period-modal-container {
    transform: translateY(12px) scale(0.97);
    opacity: 0;
}

/* Header */
.period-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(245,158,11,0.06) 0%, transparent 100%);
}

[data-theme="dark"] .period-modal-header {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(0, 0, 0, 0) 100%);
    border-color: rgba(255, 255, 255, 0.05);
}

.period-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.period-header-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

[data-theme="dark"] .period-header-icon {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}

.period-modal-header .modal-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.period-header-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 2px 0 0;
    line-height: 1.3;
}

.period-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.period-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Body */
.period-modal-body {
    padding: 20px 24px;
}

.period-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.period-form-group {
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

[data-theme="dark"] .period-form-group {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.period-form-group:focus-within {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

[data-theme="dark"] .period-form-group:focus-within {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.03);
}

.period-form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

[data-theme="dark"] .period-form-label {
    color: var(--text-muted);
}

.period-form-label i {
    color: #f59e0b;
    font-size: 0.82rem;
}

.period-select-wrapper {
    position: relative;
}

.period-form-select {
    width: 100%;
    padding: 10px 32px 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
    outline: none;
}

[data-theme="dark"] .period-form-select {
    color-scheme: dark;
    background: #111827;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

[data-theme="dark"] .period-form-select option {
    background-color: #1f2937;
    color: #f8fafc;
}

[data-theme-variant="deep-dark"] .period-form-select option { background-color: #020617; }
[data-theme-variant="aurora"] .period-form-select option { background-color: #071a17; }
[data-theme-variant="claude-dark"] .period-form-select option { background-color: #171717; }

.period-form-select:focus {
    border-color: #f59e0b;
}

[data-theme="dark"] .period-form-select:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.period-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.period-select-wrapper:focus-within .period-select-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: #f59e0b;
}

/* Acceso rápido a sincronización */
.period-sync-shortcut {
    margin-top: 14px;
    border: 1px dashed rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.06);
    border-radius: 12px;
    padding: 10px;
}

.period-sync-open-btn {
    width: 100%;
    min-height: 42px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid rgba(217, 119, 6, 0.35);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.18));
    color: #92400e;
    transition: all 0.3s ease;
}

[data-theme="dark"] .period-sync-open-btn {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.15));
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.period-sync-open-btn:hover {
    border-color: rgba(217, 119, 6, 0.5);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.3));
    color: #78350f;
    transform: translateY(-1px);
}

[data-theme="dark"] .period-sync-open-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

.period-sync-shortcut-hint {
    margin: 8px 2px 0;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Modal dedicado para sincronización */
.semester-sync-modal-container {
    width: min(680px, 94vw);
}

/* Herramienta de sincronización de estudiantes entre semestres */
.period-copy-tool {
    margin-top: 16px;
    border: 1px solid rgba(245, 158, 11, 0.25);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
    border-radius: 14px;
    padding: 14px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .period-copy-tool {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.04) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-color: rgba(245, 158, 11, 0.15);
}

.period-copy-tool.is-disabled {
    opacity: 0.75;
}

.period-copy-tool-standalone {
    margin-top: 0;
}

.period-copy-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.period-copy-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.period-copy-title i {
    color: #d97706;
}

[data-theme="dark"] .period-copy-title i {
    color: #fbbf24;
}

.period-copy-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #92400e;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 3px 7px;
    border-radius: 999px;
}

[data-theme="dark"] .period-copy-badge {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.22);
}

.period-copy-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    margin-bottom: 16px;
}

[data-theme="dark"] .period-copy-warning {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px 14px;
    border-radius: 12px;
}

.period-copy-warning i {
    margin-top: 1px;
}

.period-copy-impact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.period-copy-impact span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.period-copy-impact i {
    color: #10b981;
}

[data-theme="dark"] .period-copy-impact span {
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
}

[data-theme="dark"] .period-copy-impact i {
    color: #34d399;
}

/* Nuevos estilos visuales para la sincronización */
.sync-comparison-container {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 14px;
}

.sync-card {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .sync-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.sync-card.source {
    border-left-width: 4px;
    border-left-color: #3b82f6;
}

.sync-card.destination {
    border-left-width: 4px;
    border-left-color: #f59e0b;
}

.sync-card-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: -4px;
}

.sync-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sync-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.sync-stat-item {
    display: flex;
    flex-direction: column;
}

.sync-stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.sync-stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.sync-arrow-container {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.sync-impact-modern {
    margin-top: 16px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.05);
    border: 1px dashed rgba(16, 185, 129, 0.2);
    border-radius: 12px;
}

[data-theme="dark"] .sync-impact-modern {
    background: rgba(16, 185, 129, 0.02);
}

.sync-impact-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-impact-list {
    display: grid;
    gap: 6px;
}

.sync-impact-item {
    font-size: 0.78rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.sync-impact-item i {
    color: #10b981;
    font-size: 0.8rem;
    margin-top: 2px;
}

.period-copy-summary {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.period-copy-controls {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
}

.period-copy-group {
    background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .period-copy-group {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.period-copy-summary {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 10px 11px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

[data-theme="dark"] .period-copy-summary {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.08);
}

.period-copy-summary-grid {
    display: grid;
    gap: 4px;
}

.period-copy-summary-grid strong {
    color: var(--text-primary);
    font-weight: 700;
}

.period-copy-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.period-copy-btn-secondary,
.period-copy-btn-primary {
    border-radius: 10px;
    min-height: 40px;
    font-size: 0.82rem;
    font-weight: 700;
    justify-content: center;
    transition: all 0.2s ease;
}

.period-copy-btn-secondary {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .period-copy-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
}

.period-copy-btn-secondary:hover {
    border-color: #d97706;
    color: #b45309;
}

[data-theme="dark"] .period-copy-btn-secondary:hover {
    border-color: #fbbf24;
    background: rgba(255, 255, 255, 0.08);
    color: #fbbf24;
}

.period-copy-btn-primary {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    border: none;
}

[data-theme="dark"] .period-copy-btn-primary {
    background: linear-gradient(135deg, #b45309, #92400e);
}

.period-copy-btn-primary:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .period-copy-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.period-copy-btn-primary:disabled,
.period-copy-btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
.period-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(0deg, rgba(148, 163, 184, 0.04) 0%, transparent 100%);
}

.period-btn-apply {
    min-width: 130px;
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
    transition: all 0.25s ease;
}

.period-btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.period-btn-apply:active {
    transform: translateY(0);
}

#applyPeriodBtn.changed {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), 0 4px 14px rgba(245, 158, 11, 0.25);
    animation: period-btn-glow 2s ease-in-out infinite;
}

@keyframes period-btn-glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(245,158,11,0.15), 0 4px 14px rgba(245,158,11,0.2); }
    50% { box-shadow: 0 0 0 5px rgba(245,158,11,0.25), 0 6px 20px rgba(245,158,11,0.35); }
}

.period-btn-cancel {
    min-width: 110px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

[data-theme="dark"] .period-modal-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0%, transparent 100%);
}

[data-theme="dark"] .period-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

[data-theme="dark"] .period-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #f1f5f9;
}

[data-theme="dark"] .period-btn-apply {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.period-btn-cancel:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .period-modal-overlay {
        padding: 16px;
        align-items: center; /* Centrado vertical */
    }

    .period-modal-container {
        width: min(500px, 100%);
        border-radius: 24px; /* Bordes redondeados parejos */
        max-height: 90vh;
        overflow-y: auto;
        transform: translateY(20px) scale(0.95); /* Animación desde centro */
    }

    .period-modal-overlay.show .period-modal-container {
        transform: translateY(0) scale(1);
    }

    .period-modal-overlay.closing .period-modal-container {
        transform: translateY(15px) scale(0.95);
        opacity: 0;
    }

    .period-modal-header {
        padding: 18px 20px 14px;
    }

    .period-header-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 0.95rem;
    }

    .period-modal-header .modal-title {
        font-size: 1.05rem;
    }

    .period-modal-body {
        padding: 16px 20px;
    }

    .period-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .period-form-group {
        padding: 12px 14px;
    }

    .period-modal-footer {
        padding: 14px 20px 24px;
        flex-direction: row;
        gap: 10px;
    }

    .period-btn-apply,
    .period-btn-cancel {
        flex: 1;
        min-width: 0;
    }

    .semester-sync-modal-container {
        width: min(540px, 100%);
    }

    .period-copy-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .period-modal-header {
        padding: 16px 16px 12px;
    }

    .period-header-hint {
        font-size: 0.75rem;
    }

    .period-modal-body {
        padding: 14px 16px;
    }

    .period-modal-footer {
        padding: 12px 16px 20px;
    }
}

/* ========= Formularios ========= */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 10px; }
.form-label { font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.form-input,
.form-select,
.email-input,
#friendSearchInput {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.05rem;
}

.form-input:focus,
.form-select:focus,
.email-input:focus,
#friendSearchInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.file-input-label {
    padding: 12px 14px;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.profile-photo-area { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.profile-photo-preview { width: 100px; height: 100px; border-radius: var(--radius-md); background: var(--bg-tertiary); border: 1px solid var(--border-color); display: grid; place-items: center; overflow: hidden; }

/* ========= Items de información ========= */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.info-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.info-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--bg-tertiary); color: var(--primary); display: grid; place-items: center; font-size: 1.2rem; }
.info-content h4 { font-size: 0.85rem; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.info-content p,
.email-value { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; font-size: 1.05rem; }

.email-display { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.email-edit-container { margin-top: 12px; padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-tertiary); }
.email-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.email-error-message { margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.08); color: var(--danger); display: flex; gap: 8px; align-items: center; }

/* ========= Dropdown y modales de amigos ========= */
.friends-modal-header,
.friends-tabs { border-bottom: 1px solid var(--border-color); }
.pending-list,
.search-results,
.friends-list { display: grid; gap: 10px; }

/* ========= Bloques de estudiantes y métricas ========= */
.students-modern { display: flex; flex-direction: column; gap: 20px; }
.students-modern-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.students-modern-title { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }
.students-modern-body { display: flex; flex-direction: column; gap: 24px; }

.students-icon { background: rgba(6, 182, 212, 0.1); color: var(--primary); width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.2rem; }

.students-circles-row { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }
.circle-stat { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 10px; 
    transition: transform 0.3s ease;
}
.circle-stat:hover { transform: translateY(-5px); }

.circle-wrapper { 
    width: 90px; 
    height: 90px; 
    position: relative; 
    display: grid; 
    place-items: center; 
    background: var(--bg-tertiary);
    border-radius: 50%;
}

.circle-ring { 
    position: absolute; 
    inset: 0; 
    border-radius: 50%; 
    border: 3px solid rgba(6, 182, 212, 0.1); 
}

.circle-stat.active .circle-ring { border-top-color: var(--accent); border-width: 4px; }
.circle-stat.inactive .circle-ring { border-top-color: var(--danger); border-width: 4px; }
.circle-stat.total .circle-ring { border-color: var(--primary); border-width: 4px; opacity: 0.3; }

.circle-core { position: relative; z-index: 1; display: grid; place-items: center; }
.circle-number { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.circle-label { color: var(--text-secondary); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.circle-percent { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-tertiary); margin-top: -4px; }
.circle-stat.active .circle-percent { color: var(--accent); background: rgba(16, 185, 129, 0.1); }
.circle-stat.inactive .circle-percent { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

.students-metrics-row { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.metric-box { flex: 1; min-width: 100px; background: var(--bg-tertiary); padding: 12px; border-radius: 16px; border: 1px solid var(--border-color); transition: all 0.2s ease; }
.metric-box:hover { border-color: var(--primary); transform: translateY(-2px); }
.metric-number { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.metric-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-top: 2px; }
.metric-separator { display: none; }

.students-minutas { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--bg-tertiary); 
    padding: 12px 16px; 
    border-radius: 16px; 
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.students-minutas:hover { border-color: var(--primary); }
.minutas-number { font-weight: 800; font-size: 1.2rem; color: var(--text-primary); }
.minutas-label { color: var(--text-secondary); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; font-size: 0.7rem; }

.students-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; color: var(--text-secondary); font-size: 0.75rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-color); }
.dot-active { background: var(--accent); }
.dot-inactive { background: var(--danger); }

.students-birthdays { margin-top: 6px; border-top: 1px dashed var(--border-color); padding-top: 10px; }
.birthdays-title { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.birthdays-list { display: grid; gap: 8px; }
.birthday-card { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    padding: 12px; 
    display: flex; 
    gap: 14px; 
    align-items: center; 
    transition: all 0.2s ease;
}
.birthday-card:hover { 
    border-color: var(--primary); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateX(4px);
}
.date-badge { 
    min-width: 56px; 
    height: 56px;
    text-align: center; 
    border-radius: 14px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(79, 70, 229, 0.08); 
    color: var(--primary); 
    border: 1px solid rgba(79, 70, 229, 0.15); 
    font-weight: 800; 
    font-size: 0.9rem; 
    line-height: 1.2;
}
.birthday-name { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; }
.birthday-meta { color: var(--text-secondary); font-weight: 500; font-size: 0.8rem; }

/* ========= Cotidiano ========= */
.cotidiano-grade-box { display: flex; flex-direction: column; gap: 16px; }
.cotidiano-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 700; color: var(--text-primary); }
.cotidiano-subject-select { padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-tertiary); color: var(--text-primary); font-weight: 600; cursor: pointer; outline: none; transition: all 0.2s ease; }
.cotidiano-subject-select:hover { border-color: var(--primary); }
.cotidiano-chart-wrapper { 
    padding: 20px; 
    background: var(--bg-tertiary); 
    border-radius: 20px; 
    border: 1px solid var(--border-color); 
    min-height: 250px; 
    display: grid; 
    place-items: center; 
}

@media (max-width: 768px) {
    .cotidiano-chart-wrapper {
        padding: 10px;
        min-height: 220px;
    }
}
.cotidiano-empty { text-align: center; color: var(--text-secondary); padding: 10px; }

/* ========= Semestre Horizontal ========= */
.semester-card.horizontal-layout {
    display: flex;
    flex-direction: column;
}

.semester-card.horizontal-layout .semester-progress-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 40px;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.semester-card.horizontal-layout .semester-circular {
    flex: 0 0 280px;
    height: 280px;
    min-height: 280px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%; /* Make the container circular too */
    padding: 0;
    border: 1px solid var(--border-color);
    position: relative;
}

.semester-card.horizontal-layout .semester-timeline-container {
    flex: 1;
    min-width: 320px;
    margin-top: 0;
    background: transparent;
    padding: 0;
}

.semester-card.horizontal-layout .semester-events-modern {
    margin-top: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

@media (max-width: 900px) {
    .semester-card.horizontal-layout .semester-progress-wrapper {
        flex-direction: column;
        gap: 24px;
        align-items: center;
        padding: 10px 0;
    }
    .semester-card.horizontal-layout .semester-circular {
        flex: 0 0 220px;
        width: 220px;
        height: 220px;
        min-height: 220px;
        margin: 0 auto;
    }
    .semester-progress-svg {
        width: 180px;
        height: 180px;
    }
    .semester-percent {
        font-size: 2.5rem;
    }
    .semester-center-sub {
        font-size: 0.85rem;
    }
    .semester-card.horizontal-layout .semester-timeline-container {
        width: 100%;
        min-width: unset;
    }
    .semester-card.horizontal-layout .semester-events-modern {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .semester-card.horizontal-layout .semester-circular {
        flex: 0 0 180px;
        width: 180px;
        height: 180px;
        min-height: 180px;
    }
    .semester-progress-svg {
        width: 150px;
        height: 150px;
    }
    .semester-percent {
        font-size: 2rem;
    }
}

/* ========= Semestre ========= */
.semester-progress-wrapper { display: grid; grid-template-columns: 1fr; gap: 12px; }
.semester-circular { 
    width: 100%; 
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-tertiary); 
    border-radius: 24px; 
    padding: 30px; 
    border: 1px solid var(--border-color); 
    position: relative; 
    overflow: hidden;
    min-height: 280px;
}

.semester-circular::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.semester-progress-svg { 
    width: 220px; 
    height: 220px; 
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1)); 
    z-index: 1;
    display: block;
}
.semester-ring-bg { fill: none; stroke: var(--border-color); stroke-width: 8; opacity: 0.5; }
.semester-ring-progress { fill: none; stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1); }
.semester-ring-glow { fill: none; stroke-width: 12; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; opacity: 0.3; }

.semester-center { 
    position: absolute; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px; 
    z-index: 2; 
    pointer-events: none;
    width: 100%;
}
.semester-percent { 
    font-size: 3.2rem; 
    font-weight: 900; 
    color: var(--text-primary); 
    line-height: 1; 
    margin: 0;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}
.semester-center-sub { 
    color: var(--text-secondary); 
    font-weight: 700; 
    font-size: 1.1rem; 
    margin: 0;
}
.semester-center-range { 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    font-weight: 500; 
    margin: 0;
}
.semester-card .stat-subtitle {
    text-align: center;
    margin-bottom: 1.5rem;
}

.semester-timeline-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    padding: 16px;
}

.semester-timeline-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.semester-months { 
    display: flex; 
    gap: 16px; 
    overflow-x: auto;
    padding: 10px 5px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.semester-months::-webkit-scrollbar {
    height: 6px;
}

.semester-months::-webkit-scrollbar-track {
    background: transparent;
}

.semester-months::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.semester-month {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 90px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.semester-month.completed {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.semester-month.current {
    background: var(--bg-secondary);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.2);
    transform: scale(1.05);
    z-index: 1;
}

.semester-month .point {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
}

.semester-month.completed .point { color: var(--accent); }
.semester-month.current .point { color: var(--primary); }

.semester-month .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}
.semester-events-modern { margin-top: 20px; display: grid; gap: 12px; }
.semester-events-header { font-weight: 800; color: var(--text-primary); display: flex; gap: 10px; align-items: center; font-size: 1rem; margin-bottom: 4px; }
.semester-events-list { display: grid; gap: 10px; }

.semester-event-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.2s ease;
    position: relative;
}

.semester-event-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.semester-event-item.done { opacity: 0.6; filter: grayscale(0.5); }
.semester-event-item.next-up { border-color: var(--primary); background: rgba(79, 70, 229, 0.05); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1); }

.semester-event-item .icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.semester-event-item .info { flex: 1; min-width: 0; }
.semester-event-item .title { font-weight: 700; color: var(--text-primary); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.semester-event-item .date { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }

.semester-next-event { 
    padding: 16px; 
    border: 2px dashed var(--primary); 
    border-radius: 20px; 
    background: rgba(79, 70, 229, 0.05); 
    position: relative;
    overflow: hidden;
}

.next-event-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 4px 12px;
    border-bottom-left-radius: 12px;
}

.semester-event-item.next-up .pulse {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    animation: pulse-primary 2s infinite;
}

@keyframes pulse-primary {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

/* ========= Logout modal ========= */
.logout-modal { padding: 0; }
.logout-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.logout-modal-body { padding: 16px 20px; color: var(--text-secondary); }
.logout-modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; justify-content: flex-end; }
.logout-impact { padding-left: 16px; margin-top: 6px; display: grid; gap: 2px; font-size: 0.9rem; }

/* ========= Main content (paridad Asistencia / Students) ========= */
/* Cualquier main hijo directo de dashboard-main crece y hace scroll para que el footer quede abajo */
.container:has(.dashboard-layout) .dashboard-main > main,
.app-container:has(.dashboard-layout) .dashboard-main > main {
    flex: 1 1 0%;
    min-height: 0 !important;
    overflow: auto;
}

/* ========= Footer ========= */
/* Footer siempre al final: main hace scroll y el footer queda visible abajo */
#dashboard-footer-placeholder {
    flex-shrink: 0;
    margin-top: auto;
    padding: 0 1rem 1rem;
    min-height: 1px;
}
.footer {
    margin-top: 0;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.footer a { color: var(--primary); font-weight: 600; }
.footer a:hover { text-decoration: underline; }

.footer-version-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color, rgba(148,163,184,0.15));
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2px;
    flex-wrap: wrap;
}
.footer-version-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.footer-version-item i {
    font-size: 0.6rem;
    opacity: 0.7;
}
.footer-version-status i {
    font-size: 0.5rem;
}

/* ========= Spinners ========= */
.spinner { width: 24px; height: 24px; border: 2px solid rgba(79, 70, 229, 0.1); border-top: 2px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
.spinner-small { width: 16px; height: 16px; border: 2px solid rgba(79, 70, 229, 0.1); border-top: 2px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }

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

/* ========= Tabs, indicadores y vistas auxiliares ========= */
.modal-tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 14px; }
.tab-btn { flex: 1; padding: 10px; background: transparent; border: none; color: var(--text-secondary); font-weight: 600; }
.tab-btn.active { color: var(--text-primary); border-bottom: 2px solid var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.friends-modal-header { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.friends-tabs { display: flex; gap: 8px; padding: 10px 12px; background: var(--bg-secondary); }
.friends-tab-btn { flex: 1; padding: 6px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; }
.friends-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.friends-tab { display: none; }
.friends-tab.active { display: block; }
.friends-content { padding: 12px 16px; }
.friends-close { background: transparent; border: none; font-size: 1.1rem; color: var(--text-muted); cursor: pointer; }

.profile-avatar-container { position: relative; display: inline-block; }
.notification-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    border: 2px solid var(--bg-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
    animation: notif-badge-in 0.35s cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

@keyframes notif-badge-in {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.notification-indicator.critical { background: #ef4444; box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35); }
.notification-indicator.warning { background: #f97316; box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35); }
.notification-indicator.info { background: #3b82f6; box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35); }
.notification-indicator.system { background: var(--primary); box-shadow: 0 2px 6px rgba(6, 182, 212, 0.35); }

.notification-count { font-weight: 700; letter-spacing: -0.01em; }

/* ========= Stats hero y etiquetas ========= */
.stats-modal-hero { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 20px; 
    padding: 24px; 
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%); 
    border: 1px solid var(--border-color); 
    border-radius: 24px; 
    margin-bottom: 24px; 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02);
}
.stats-hero-text { display: flex; flex-direction: column; gap: 8px; }
.hero-eyebrow { text-transform: uppercase; letter-spacing: 1px; font-weight: 800; color: var(--primary); font-size: 0.7rem; }
.hero-title { font-size: 1.5rem; font-weight: 900; color: var(--text-primary); letter-spacing: -0.5px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.hero-tag { background: var(--bg-secondary); color: var(--text-primary); padding: 6px 14px; border-radius: 12px; font-weight: 700; border: 1px solid var(--border-color); font-size: 0.8rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.hero-tag.subtle { color: var(--text-secondary); font-weight: 600; }
.stats-hero-meta { text-align: right; display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-weight: 800; text-transform: uppercase; letter-spacing: 1px; font-size: 0.65rem; color: var(--text-muted); }
.meta-value { font-weight: 800; color: var(--primary); font-size: 1rem; }
.meta-hint { color: var(--text-muted); font-size: 0.75rem; font-weight: 500; }
.subtle { color: var(--text-muted); }

/* ========= Ajustes de cabeceras de stats ========= */
.chart-centered { justify-content: center; position: relative; }
.chart-centered .stat-icon { position: absolute; left: 0; }
.chart-centered .stat-header-metric { position: absolute; right: 0; }
.metric-inline .stat-icon,
.metric-inline .stat-header-metric { position: static; }
.metric-inline { gap: 8px; }
.chart-icon,
.attendance-icon,
.semester-icon,
.students-icon { background: var(--bg-tertiary); color: var(--primary); }
.stat-subtitle { color: var(--text-secondary); margin-bottom: 8px; font-size: 0.85rem; }
.stat-number { font-size: 1.15rem; font-weight: 700; }
.stat-label-inline { color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.65rem; }
.stat-progress { margin-top: 12px; }
.progress-bar { width: 100%; height: 8px; background: var(--bg-tertiary); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: inherit; transition: width 0.3s ease; }

/* ========= Cotidiano y tarjetas auxiliares ========= */
.cotidiano-grade-box { display: flex; flex-direction: column; gap: 10px; }
.cotidiano-header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cotidiano-scale { color: var(--text-secondary); font-size: 0.75rem; }
.cotidiano-views-wrapper { display: grid; gap: 10px; }

/* ========= Estado de estudiantes (fallback) ========= */
.students-expanded { border-radius: var(--radius-md); overflow: hidden; }
.students-compact { padding: 0; }
.students-breakdown { display: flex; gap: 10px; }
.breakdown-item { flex: 1; background: var(--bg-tertiary); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.breakdown-number { font-weight: 700; color: var(--text-primary); }
.breakdown-label { color: var(--text-secondary); font-size: 0.75rem; }
.students-summary { display: flex; align-items: center; gap: 12px; }
.main-number { display: flex; align-items: baseline; gap: 6px; }
.students-meta { display: flex; gap: 8px; align-items: center; }
.students-v-separator { display: none; }
.students-hidden-legacy { display: none !important; }

/* ========= Otros textos y logos ========= */
.ociannclass-logo { font-weight: 800; color: var(--primary); }
/* ========= Complementos de semestre ========= */
.semester-ring-glow { fill: none; stroke-width: 10; opacity: 0.18; }
.progress-dot-group { transition: transform 0.2s ease; }
.ring-secondary { opacity: 0.5; }
.legacy-semester-percent { color: var(--text-secondary); font-size: 0.85rem; }

/* ========= Responsive ========= */
@media (max-width: 992px) {
    .attendance-insights { grid-template-columns: 1fr; }
    .welcome-title { font-size: 1.3rem; }
}

@media (max-width: 768px) {
    .modules-grid { 
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .module-card {
        padding: 12px 10px;
        min-height: 140px;
    }
    .module-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    .module-title {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    .module-description {
        font-size: 0.72rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    .stats-grid,
    .info-grid { grid-template-columns: 1fr; }
    .teacher-profile { padding: 15px; }
    .profile-avatar { width: 62px; height: 62px; font-size: 22px; border-radius: 50%; }
    .profile-info { gap: 14px; }
    .profile-details h2 { font-size: 1.25rem; }
    .welcome-header { padding: 12px; }
    .welcome-title { font-size: 1.2rem; }
    .toast-container { right: 12px; left: 12px; }
    .toast { width: 100%; min-width: unset; }
    
    /* Período compacto en móvil */
    .current-period { 
        padding: 4px 10px; 
        max-width: 280px;
    }
    .period-icon { width: 22px; height: 22px; font-size: 0.65rem; }
    .period-label { font-size: 0.55rem; }
    .period-value { font-size: 0.72rem; }
}

@media (max-width: 520px) {
    .controls-box { gap: 4px; padding: 6px 10px; border-radius: 14px; }
    .controls-divider { display: none; }
    .brand-text { display: none; }
    .brand-emblem { width: 36px; height: 36px; }
    .brand-emblem-main::before { font-size: 1.05rem; }
    .brand-emblem-main::after { top: -1px; right: -7px; font-size: 0.55rem; }
    .brand-chip { padding: 2px; }
    .floating-btn,
    .friends-icon-btn { width: 34px; height: 34px; font-size: 0.85rem; }
    .notification-modal { width: calc(100% - 32px); }
    .birthday-body { flex-direction: column; align-items: flex-start; }
    
    .modules-grid { gap: 8px; }
    .module-card { padding: 12px 8px; min-height: 130px; }
    .module-icon { width: 42px; height: 42px; font-size: 1rem; margin-bottom: 8px; }
    .module-title { font-size: 0.85rem; }
    .module-description {
        font-size: 0.68rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    /* Período muy compacto */
    .current-period { 
        padding: 3px 8px; 
        gap: 6px;
        max-width: 220px;
    }
    .period-icon { width: 20px; height: 20px; }
    .period-value { font-size: 0.68rem; }
}

/* Extra compact layout for very small screens */
@media (max-width: 420px) {
    .controls-box { gap: 3px; padding: 6px 8px; }
    .brand-floating { margin-right: 3px; }
    .brand-emblem { width: 32px; height: 32px; }
    .brand-emblem-main::before { font-size: 0.9rem; }
    .brand-emblem-main::after { top: -1px; right: -6px; font-size: 0.48rem; }
    .floating-btn,
    .friends-icon-btn { width: 30px; height: 30px; font-size: 0.8rem; }
    
    .modules-grid { gap: 8px; }
    .module-card { padding: 12px 8px; min-height: 130px; }
    
    .current-period { max-width: 180px; }
    .period-label { display: none; }
}

/* ========= Modo teléfono limpio (máxima legibilidad, mínimo ruido) ========= */
@media (max-width: 600px) {
    /* Tarjetas de módulos: solo icono + título, sin descripción ni flecha */
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .module-card {
        padding: 14px 10px;
        min-height: 100px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        border-radius: 14px;
    }
    .module-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    .module-card::after {
        display: none;
    }
    .module-description {
        display: none !important;
    }
    .module-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 6px;
    }
    .module-icon svg {
        width: 24px;
        height: 24px;
    }
    .module-title {
        font-size: 0.8rem;
        font-weight: 600;
        margin-bottom: 0;
        line-height: 1.25;
    }
    /* Pestañas Docente/Director más compactas */
    .role-view-tabs {
        padding: 4px;
        gap: 4px;
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    .role-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .role-tab i {
        font-size: 0.85rem;
    }
    /* Tarjeta AVI más compacta */
    .avi-welcome-card {
        padding: 14px 16px;
        border-radius: 14px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }
    .avi-welcome-inner {
        gap: 14px;
    }
    .avi-welcome-avatar {
        width: 52px;
        height: 52px;
    }
    .avi-welcome-title {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    .avi-welcome-desc {
        display: none;
    }
    .avi-welcome-prompt {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
    .avi-welcome-input {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    .avi-welcome-send {
        width: 40px;
        height: 40px;
    }
    /* Período activo más compacto en navbar */
    .dashboard-main .current-period {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    /* Menos padding en el contenido principal */
    .dashboard-main {
        padding: 0.75rem 0.75rem;
    }
    .modules-section {
        padding-top: 0;
    }
}

@media (max-width: 480px) {
    /* Teléfonos muy pequeños: tarjetas aún más compactas */
    .modules-grid {
        gap: 8px;
    }
    .module-card {
        padding: 12px 8px;
        min-height: 88px;
    }
    .module-icon {
        width: 38px;
        height: 38px;
        margin-bottom: 4px;
    }
    .module-icon svg {
        width: 20px;
        height: 20px;
    }
    .module-title {
        font-size: 0.75rem;
    }
}

/* Global Slider (Range Input) Styles */
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--bg-tertiary); border-radius: 5px; outline: none; margin: 10px 0; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: var(--primary); cursor: pointer; border-radius: 50%; border: 3px solid var(--bg-secondary); box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: all 0.2s ease; }
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.2); background: var(--primary); }

/* Theme Selector Styles */
.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.theme-opt {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    transition: all 0.2s ease;
}

.theme-opt:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-opt:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.theme-opt.active {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.theme-opt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.theme-opt-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--primary);
    flex: 0 0 auto;
}

.theme-opt[data-theme-val="light"] .theme-opt-icon { color: #f59e0b; }
.theme-opt[data-theme-val="dark"] .theme-opt-icon { color: #22d3ee; }
.theme-opt[data-theme-val="deep-dark"] .theme-opt-icon { color: #cbd5e1; }
.theme-opt[data-theme-val="claude"] .theme-opt-icon { color: #d97706; }
.theme-opt[data-theme-val="claude-dark"] .theme-opt-icon { color: #f59e0b; }
.theme-opt[data-theme-val="aurora"] .theme-opt-icon { color: #22c55e; }
.theme-opt[data-theme-val="cobalt"] .theme-opt-icon { color: #2563eb; }
.theme-opt[data-theme-val="rose"] .theme-opt-icon { color: #ec4899; }

.theme-opt-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-opt-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.theme-opt-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-opt-check {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-opt-check i {
    font-size: 0.7rem;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.theme-opt.active .theme-opt-check {
    background: var(--primary);
    border-color: var(--primary);
}

.theme-opt.active .theme-opt-check i {
    opacity: 1;
    transform: scale(1);
}

.theme-preview {
    width: 100%;
    height: 50px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.theme-preview::before,
.theme-preview::after {
    content: '';
    position: absolute;
}

.theme-preview.light { background-color: #f8fafc; }
.theme-preview.light::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.light::after { width: 70%; height: 15%; background: #06b6d4; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.dark { background-color: #0f172a; }
.theme-preview.dark::before { width: 30%; height: 100%; background: #1e293b; left: 0; }
.theme-preview.dark::after { width: 70%; height: 15%; background: #0891b2; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.deep-dark { background-color: #020617; }
.theme-preview.deep-dark::before { width: 30%; height: 100%; background: #0f172a; left: 0; }
.theme-preview.deep-dark::after { width: 70%; height: 15%; background: #22d3ee; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.claude { background-color: #f5f5f0; }
.theme-preview.claude::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.claude::after { width: 70%; height: 15%; background: #d97706; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.claude-dark { background-color: #0b1220; }
.theme-preview.claude-dark::before { width: 30%; height: 100%; background: #121a2b; left: 0; }
.theme-preview.claude-dark::after { width: 70%; height: 15%; background: #f59e0b; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.aurora { background: linear-gradient(135deg, #071a17 0%, #0b2d25 55%, #0b1220 100%); }
.theme-preview.aurora::before { width: 30%; height: 100%; background: rgba(255,255,255,0.06); left: 0; }
.theme-preview.aurora::after { width: 70%; height: 15%; background: linear-gradient(90deg, #22c55e 0%, #06b6d4 55%, #0891b2 100%); top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.cobalt { background-color: #f1f7ff; }
.theme-preview.cobalt::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.cobalt::after { width: 70%; height: 15%; background: #2563eb; top: 8px; right: 4px; border-radius: 3px; }

.theme-preview.rose { background-color: #fff1f5; }
.theme-preview.rose::before { width: 30%; height: 100%; background: #ffffff; left: 0; }
.theme-preview.rose::after { width: 70%; height: 15%; background: #ec4899; top: 8px; right: 4px; border-radius: 3px; }

.profile-settings-modal .profile-photo-main {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: center;
}

.profile-settings-modal #profilePhotoPreview {
    width: 200px;
    height: 200px;
    background: transparent;
    border: none;
    display: grid;
    place-items: center;
}

.profile-settings-modal #profilePhotoCropper {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 3px solid var(--border-color);
    overflow: hidden;
    position: relative;
    display: grid;
    place-items: center;
    user-select: none;
    touch-action: none;
    cursor: grab;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.profile-settings-modal #profilePhotoCropper:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.profile-settings-modal #profilePhotoCropper:active { cursor: grabbing; }

.profile-settings-modal #profilePhotoPreview.empty #profilePhotoCropper::before {
    content: "\\f007";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 4rem;
    color: var(--text-muted);
    opacity: 0.3;
}

.profile-settings-modal #profilePhotoCropper::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.profile-settings-modal #profilePreview {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(var(--scale, 1));
    transform-origin: center;
    will-change: transform;
    display: none;
    pointer-events: none;
}

.profile-settings-modal #profilePhotoPreview.has-image #profilePreview { display: block; }

/* Sección de carga de foto */
.profile-settings-modal .profile-photo-upload-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.profile-settings-modal .profile-upload-btn {
    padding: 16px 32px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.profile-settings-modal .profile-upload-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
}

.profile-settings-modal .profile-upload-btn:active {
    transform: translateY(0);
}

.profile-settings-modal .profile-upload-btn i {
    font-size: 1.1rem;
}

.profile-settings-modal .profile-upload-hint {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-settings-modal .profile-upload-hint i {
    color: var(--primary);
}

/* Controles de recorte */
.profile-settings-modal .photo-crop-controls-wrapper {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.profile-settings-modal .crop-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.profile-settings-modal .crop-controls-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-settings-modal .crop-controls-header h4 i {
    color: var(--primary);
}

.profile-settings-modal .btn-icon-reset {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-settings-modal .btn-icon-reset:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.profile-settings-modal .photo-crop-controls {
    display: grid;
    gap: 20px;
}

.profile-settings-modal .crop-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.profile-settings-modal .crop-label i {
    color: var(--primary);
    font-size: 0.85rem;
}

.profile-settings-modal .photo-crop-zoom {
    display: grid;
    gap: 8px;
}

.profile-settings-modal .zoom-slider-wrapper {
    display: grid;
    grid-template-columns: 24px 1fr 24px;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.profile-settings-modal .zoom-slider-wrapper i {
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.profile-settings-modal .zoom-slider-wrapper i:hover {
    color: var(--primary);
}

.profile-settings-modal .photo-crop-pan {
    display: grid;
    gap: 12px;
}

.profile-settings-modal .photo-crop-pan-row {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 12px;
}

.profile-settings-modal .photo-crop-pan-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    background: var(--bg-tertiary);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: grid;
    place-items: center;
}

.profile-settings-modal .pan-buttons {
    display: flex;
    gap: 6px;
}

.profile-settings-modal .photo-crop-nudge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-settings-modal .photo-crop-nudge:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
    transform: translateY(-1px);
}

.profile-settings-modal .photo-crop-nudge:active { 
    transform: translateY(0); 
}

.profile-settings-modal .photo-crop-nudge:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.profile-settings-modal .photo-crop-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Evitar distorsión en avatares */
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    display: block;
}

/* ========================================
   FIX GLOBAL: modales visibles (no invisibles bloqueando)
   Aplica a .modal-overlay, .recursos-modal-overlay y variantes
   ======================================== */
.modal-overlay.modal-open,
.modal-overlay[style*="flex"],
.recursos-modal-overlay.modal-open,
.recursos-modal-overlay[style*="flex"],
[class*="modal-overlay"].modal-open,
[class*="modal-overlay"][style*="flex"] {
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999999 !important;
    background: rgba(0, 0, 0, 0.5) !important;
}
.modal-overlay .modal-content,
.recursos-modal-overlay .modal-content,
.recursos-modal-overlay .recursos-modal-container {
    visibility: visible !important;
    opacity: 1 !important;
}

/* ========================================
   Banner de Impersonación Admin
   ======================================== */
#admin-impersonation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    padding: 0;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    font-family: 'Inter', 'Poppins', sans-serif;
}
.impersonation-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    flex-wrap: wrap;
}
.impersonation-banner-content i.fa-user-secret {
    font-size: 1.1rem;
}
.impersonation-return-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
}
.impersonation-return-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.04);
}
body.impersonation-active {
    padding-top: 46px !important;
}
body.impersonation-active .dashboard-sidebar {
    top: 46px !important;
    height: calc(100vh - 46px) !important;
}
@media (max-width: 768px) {
    .impersonation-banner-content {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    .impersonation-return-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
}


/* Estilos para el nuevo diseño de bienvenida Ociann Class */
.welcome-overlay .welcome-icon-large {
    font-size: 64px;
    margin: 0 auto 16px;
    display: block;
    line-height: 1;
}

.welcome-overlay .welcome-header {
    padding: 32px 24px 24px !important;
    background: transparent !important;
}

.welcome-overlay .welcome-header h2 {
    font-size: 2rem !important;
    margin: 0 0 12px !important;
}

.welcome-overlay .welcome-subtitle {
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

.welcome-overlay .welcome-content {
    padding: 24px 32px 32px !important;
    text-align: center !important;
}

.welcome-overlay .welcome-explore-title {
    margin: 0 0 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.welcome-overlay .welcome-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.welcome-overlay .welcome-feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.welcome-overlay .welcome-feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.welcome-overlay .welcome-feature-card .feature-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-primary);
}

.welcome-overlay .welcome-feature-card .feature-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-overlay .welcome-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.welcome-overlay .welcome-footer i {
    color: var(--primary);
}

@media (max-width: 600px) {
    .welcome-overlay .welcome-header {
        padding: 24px 20px 20px !important;
    }
    .welcome-overlay .welcome-icon-large {
        font-size: 48px;
        margin-bottom: 12px;
    }
    .welcome-overlay .welcome-header h2 {
        font-size: 1.5rem !important;
    }
    .welcome-overlay .welcome-subtitle {
        font-size: 0.9rem !important;
    }
    .welcome-overlay .welcome-content {
        padding: 20px 16px 24px !important;
    }
    .welcome-overlay .welcome-explore-title {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }
    .welcome-overlay .welcome-features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 24px;
    }
    .welcome-overlay .welcome-feature-card {
        padding: 20px 12px;
    }
    .welcome-overlay .welcome-feature-card .feature-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    .welcome-overlay .welcome-feature-card .feature-title {
        font-size: 0.9rem;
    }
    .welcome-overlay .welcome-footer {
        font-size: 0.85rem;
        padding-top: 12px;
    }
}

/* ========================================
   WIDGETS DE ASISTENCIA Y EVALUACIONES
   ======================================== */

/* Contenedor de widgets en fila de 3 columnas */
.dashboard-widgets-row-3cols {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.75rem;
    margin-top: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Si está dentro del grid principal, que ocupe todo el ancho */
#teacherModulesGrid .dashboard-widgets-row-3cols {
    grid-column: 1 / -1;
    width: 100%;
}

.dashboard-widgets-row-3cols .dashboard-schedule-widget,
.dashboard-widgets-row-3cols .dashboard-attendance-widget,
.dashboard-widgets-row-3cols .dashboard-evaluations-widget {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Asegurar que los widgets dentro del contenedor de 3 columnas tengan el mismo estilo */
.dashboard-widgets-row-3cols .dashboard-schedule-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease;
}

.dashboard-widgets-row-3cols .dashboard-attendance-widget,
.dashboard-widgets-row-3cols .dashboard-evaluations-widget {
    min-height: 320px;
}

@media (max-width: 1400px) {
    .dashboard-widgets-row-3cols {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 900px) {
    .dashboard-widgets-row-3cols {
        grid-template-columns: 1fr !important;
    }
}

/* Contenedor de widgets en fila de 2 columnas (para calendario) */
.dashboard-widgets-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 0.75rem;
}

@media (max-width: 1200px) {
    .dashboard-widgets-row {
        grid-template-columns: 1fr;
    }
}

/* Contenedor de widgets de estadísticas en fila de 3 columnas */
.dashboard-stats-widgets-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.75rem;
    margin-top: 0.75rem;
    width: 100%;
    grid-column: 1 / -1;
}

.dashboard-stats-widgets-row .stat-card {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

/* Pantallas grandes (más de 1600px) - 3 columnas */
@media (min-width: 1600px) {
    .dashboard-stats-widgets-row {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem;
    }
}

/* Pantallas medianas-grandes (1200px - 1600px) - 3 columnas con gap menor */
@media (max-width: 1600px) and (min-width: 1200px) {
    .dashboard-stats-widgets-row {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem;
    }
    
    .dashboard-stats-widgets-row .stat-card {
        padding: 20px;
    }
}

/* Pantallas medianas (900px - 1200px) - 2 columnas */
@media (max-width: 1200px) and (min-width: 900px) {
    .dashboard-stats-widgets-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    
    .dashboard-stats-widgets-row .evaluation-donut-card {
        grid-column: 1 / -1;
    }
    
    .dashboard-stats-widgets-row .stat-card {
        padding: 18px;
    }
}

/* Pantallas pequeñas (600px - 900px) - 2 columnas más compactas */
@media (max-width: 900px) and (min-width: 600px) {
    .dashboard-stats-widgets-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .evaluation-donut-card {
        grid-column: 1 / -1;
    }
    
    .dashboard-stats-widgets-row .stat-card {
        padding: 16px;
        border-radius: 16px;
    }
    
    .dashboard-stats-widgets-row .students-modern-body {
        gap: 0.75rem;
    }
    
    .dashboard-stats-widgets-row .students-circles-row {
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .circle-stat {
        transform: scale(0.9);
    }
}

/* Pantallas muy pequeñas (menos de 600px) - 1 columna */
@media (max-width: 600px) {
    .dashboard-stats-widgets-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .dashboard-stats-widgets-row .stat-card {
        padding: 14px;
        border-radius: 14px;
    }
    
    .dashboard-stats-widgets-row .students-modern-body {
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .students-circles-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .circle-stat {
        flex: 0 0 auto;
        min-width: 80px;
    }
    
    .dashboard-stats-widgets-row .students-metrics-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .attendance-insights {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .dashboard-stats-widgets-row .attendance-chart-area {
        min-height: 200px;
        padding: 12px;
        border-radius: 14px;
    }
    
    .dashboard-stats-widgets-row .attendance-chart-area canvas {
        max-height: 200px !important;
        width: 100% !important;
    }
    
    .dashboard-stats-widgets-row .cotidiano-grade-box {
        padding: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .cotidiano-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .dashboard-stats-widgets-row .cotidiano-subject-select {
        width: 100%;
    }
    
    .dashboard-stats-widgets-row .stat-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .stat-title {
        font-size: 0.85rem;
    }
    
    .dashboard-stats-widgets-row .stat-header-metric {
        font-size: 0.8rem;
    }
}

/* Ajustes adicionales para widgets de estadísticas en diferentes tamaños */
@media (max-width: 1400px) {
    .dashboard-stats-widgets-row .stat-card {
        min-height: auto;
    }
    
    .dashboard-stats-widgets-row .students-circles-row {
        gap: 0.75rem;
    }
    
    .dashboard-stats-widgets-row .circle-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .dashboard-stats-widgets-row .circle-core {
        width: 50px;
        height: 50px;
    }
    
    .dashboard-stats-widgets-row .circle-number {
        font-size: 1.1rem;
    }
    
    .dashboard-stats-widgets-row .attendance-chart-area {
        padding: 16px;
        min-height: 200px;
        max-height: 280px;
    }
    
    .dashboard-stats-widgets-row .attendance-chart-area canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
}

@media (max-width: 900px) {
    .dashboard-stats-widgets-row .students-circles-row {
        gap: 0.5rem;
    }
    
    .dashboard-stats-widgets-row .circle-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .dashboard-stats-widgets-row .circle-core {
        width: 45px;
        height: 45px;
    }
    
    .dashboard-stats-widgets-row .circle-number {
        font-size: 1rem;
    }
    
    .dashboard-stats-widgets-row .circle-label {
        font-size: 0.7rem;
    }
    
    .dashboard-stats-widgets-row .metric-number {
        font-size: 1.2rem;
    }
    
    .dashboard-stats-widgets-row .metric-label {
        font-size: 0.75rem;
    }
    
    .dashboard-stats-widgets-row .attendance-chart-area {
        padding: 14px;
        border-radius: 16px;
        min-height: 180px;
        max-height: 220px;
    }
    
    .dashboard-stats-widgets-row .attendance-chart-area canvas {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
    }
    
    .dashboard-stats-widgets-row .cotidiano-chart-wrapper canvas {
        max-height: 180px !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Widget de asistencia (secciones del día) */
.dashboard-attendance-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dashboard-attendance-widget:hover {
    box-shadow: var(--shadow-hover);
}

.dashboard-attendance-inner {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
}

.dashboard-attendance-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.dashboard-attendance-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(22, 163, 74, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-soft);
}

.dashboard-attendance-title-wrap {
    flex: 1;
    min-width: 0;
}

.dashboard-attendance-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.2rem 0;
}

.dashboard-attendance-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.35;
}

.dashboard-attendance-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dashboard-attendance-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.dashboard-attendance-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 400px;
}

.dashboard-attendance-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.dashboard-attendance-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: translateX(2px);
}

.dashboard-attendance-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.dashboard-attendance-item-info {
    flex: 1;
    min-width: 0;
}

.dashboard-attendance-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dashboard-attendance-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-attendance-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.15rem 0.4rem;
    background: var(--bg-primary);
    border-radius: 4px;
}

.dashboard-attendance-item-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.dashboard-attendance-item-status.attendance-taken {
    background: rgba(22, 163, 74, 0.1);
    color: var(--accent);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.dashboard-attendance-item-status.attendance-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.dashboard-attendance-item-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dashboard-attendance-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dashboard-attendance-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 1rem;
}

.dashboard-attendance-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: auto;
}

.dashboard-attendance-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.dashboard-attendance-link:hover {
    color: var(--accent);
}

/* Widget de evaluaciones pendientes */
.dashboard-evaluations-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dashboard-evaluations-widget:hover {
    box-shadow: var(--shadow-hover);
}

.dashboard-evaluations-inner {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
}

.dashboard-evaluations-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.dashboard-evaluations-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(234, 88, 12, 0.1);
    color: #ea580c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-soft);
}

.dashboard-evaluations-title-wrap {
    flex: 1;
    min-width: 0;
}

.dashboard-evaluations-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.2rem 0;
}

.dashboard-evaluations-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.35;
}

.dashboard-evaluations-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dashboard-evaluations-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.dashboard-evaluations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 400px;
}

.dashboard-evaluations-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.dashboard-evaluations-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: translateX(2px);
}

.dashboard-evaluations-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.dashboard-evaluations-item-info {
    flex: 1;
    min-width: 0;
}

.dashboard-evaluations-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dashboard-evaluations-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dashboard-evaluations-item-urgency {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.dashboard-evaluations-item-urgency.urgency-overdue {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.dashboard-evaluations-item-urgency.urgency-due {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.dashboard-evaluations-item-urgency.urgency-tomorrow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.dashboard-evaluations-item-urgency.urgency-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.dashboard-evaluations-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dashboard-evaluations-date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dashboard-evaluations-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 1rem;
}

.dashboard-evaluations-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: auto;
}

.dashboard-evaluations-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.dashboard-evaluations-link:hover {
    color: var(--accent);
}

@keyframes confirmFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes confirmSlideIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }