@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   ASISTENCIASPRO — SISTEMA DE DISEÑO UNIFICADO v2.0
   Responsivo · Temas Claro/Oscuro · Premium UI
   ============================================================ */

/* ========================
   VARIABLES — TEMA CLARO (Defecto)
   ======================== */
:root {
    /* Fondos */
    --bg-main:          #f0f4f8;
    --bg-sidebar:       #ffffff;
    --bg-header:        rgba(255, 255, 255, 0.92);
    --bg-card:          #ffffff;
    --bg-input:         #ffffff;
    --bg-hover:         #f1f5f9;
    --bg-active:        #eef0fd;
    --bg-table-head:    #f8fafc;
    --bg-table-row:     #f9fafb;

    /* Texto */
    --text-primary:     #0f172a;
    --text-secondary:   #475569;
    --text-muted:       #94a3b8;
    --text-white:       #ffffff;
    --text-on-primary:  #ffffff;

    /* Bordes */
    --border-color:     #e2e8f0;
    --border-focus:     #4f5de4;
    --border-input:     #cbd5e1;
    --focus-ring:       0 0 0 4px rgba(79, 93, 228, 0.16);

    /* Paleta principal */
    --primary:          #4f5de4;
    --primary-hover:    #3d4ac7;
    --primary-light:    #eef0fd;
    --primary-dark:     #2d3a9e;
    --primary-gradient: linear-gradient(135deg, #4f5de4 0%, #3b82f6 100%);

    /* Semánticos */
    --success:          #10b981;
    --success-light:    #ecfdf5;
    --danger:           #ef4444;
    --danger-light:     #fef2f2;
    --warning:          #f59e0b;
    --warning-light:    #fffbeb;
    --info:             #3b82f6;
    --info-light:       #eff6ff;

    /* Layout */
    --sidebar-width:    220px;
    --header-height:    60px;

    /* Bordes redondeados */
    --radius-xs:        4px;
    --radius-sm:        8px;
    --radius-md:        12px;
    --radius-lg:        16px;
    --radius-xl:        24px;

    /* Sombras */
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md:        0 4px 16px -2px rgba(15,23,42,0.06), 0 2px 6px -1px rgba(15,23,42,0.03);
    --shadow-lg:        0 12px 32px -4px rgba(15,23,42,0.10), 0 4px 12px -2px rgba(15,23,42,0.05);
    --shadow-xl:        0 20px 48px -8px rgba(15,23,42,0.14), 0 8px 20px -4px rgba(15,23,42,0.06);

    /* Transiciones */
    --transition:       all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast:  all 0.15s ease;

    /* Fuente base */
    --font-base-size:   15px;

    /* Sidebar */
    --sidebar-section-label-color: #94a3b8;
    --sidebar-footer-bg:  #f8fafc;
    --sidebar-footer-name-color: #0f172a;
    --sidebar-footer-role-color: #64748b;
    --select-bg:        #ffffff;
    --select-color:     #0f172a;
}

/* ========================
   VARIABLES — TEMA OSCURO
   ======================== */
[data-theme="dark"] {
    --bg-main:          #0f172a;
    --bg-sidebar:       #1e293b;
    --bg-header:        rgba(15, 23, 42, 0.96);
    --bg-card:          #1e293b;
    --bg-input:         #0f172a;
    --bg-hover:         #334155;
    --bg-active:        #312e81;
    --bg-table-head:    #0f172a;
    --bg-table-row:     #243044;

    --text-primary:     #f1f5f9;
    --text-secondary:   #cbd5e1;
    --text-muted:       #64748b;
    --text-white:       #ffffff;
    --text-on-primary:  #ffffff;

    --border-color:     #334155;
    --border-focus:     #6366f1;
    --border-input:     #3d4f66;

    --primary-light:    #1e2a4a;
    --success-light:    #052e1c;
    --danger-light:     #2a0a0a;
    --warning-light:    #2a1a00;
    --info-light:       #0b1e38;

    --sidebar-section-label-color: #475569;
    --sidebar-footer-bg:  #0f172a;
    --sidebar-footer-name-color: #f1f5f9;
    --sidebar-footer-role-color: #94a3b8;
    --select-bg:        #1e293b;
    --select-color:     #f1f5f9;
}

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

html {
    font-size: var(--font-base-size);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1,h2,h3,h4,h5,h6 {
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* ========================
   LAYOUT PRINCIPAL
   ======================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-main);
}

/* ========================
   SIDEBAR
   ======================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    min-height: var(--header-height);
    text-decoration: none;
    transition: border-color 0.3s ease;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4f5de4 0%, #3730a3 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(79, 93, 228, 0.3);
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}
.sidebar-brand-text span { color: #4f5de4; }

/* Nav Container */
.sidebar-nav {
    flex: 1;
    padding: 0.6rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-label-color);
    padding: 1.1rem 1.25rem 0.35rem 1.25rem;
    transition: color 0.3s ease;
}

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.1rem 0.65rem;
    padding: 0.58rem 0.8rem;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    border: 1px solid transparent;
}

.sidebar-link .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.18s ease;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.sidebar-link:hover .nav-icon { color: var(--primary); }
.sidebar-link:hover .sidebar-icon-box { transform: scale(1.05); }

/* Active Pill */
.sidebar-link.active {
    background: var(--primary-gradient);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 14px -2px rgba(79, 93, 228, 0.38);
    border-color: transparent;
}
.sidebar-link.active .sidebar-icon-box {
    background: rgba(255,255,255,0.2) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.3) !important;
}
.sidebar-link.active .nav-icon { color: #ffffff; }

/* Icon Boxes */
.sidebar-icon-box {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}
.sidebar-icon-box svg { width: 16px; height: 16px; stroke-width: 2.2; }

/* Color Themes para íconos */
.icon-indigo  { background: rgba(79, 93, 228, 0.1);  color: #4f5de4; border-color: rgba(79, 93, 228, 0.18); }
.icon-amber   { background: rgba(245, 158, 11, 0.12); color: #d97706; border-color: rgba(245, 158, 11, 0.22); }
.icon-sky     { background: rgba(14, 165, 233, 0.12); color: #0284c7; border-color: rgba(14, 165, 233, 0.22); }
.icon-emerald { background: rgba(16, 185, 129, 0.12); color: #059669; border-color: rgba(16, 185, 129, 0.22); }
.icon-purple  { background: rgba(139, 92, 246, 0.12); color: #7c3aed; border-color: rgba(139, 92, 246, 0.22); }
.icon-rose    { background: rgba(244, 63, 94, 0.12);  color: #e11d48; border-color: rgba(244, 63, 94, 0.22); }
.icon-teal    { background: rgba(20, 184, 166, 0.12); color: #0d9488; border-color: rgba(20, 184, 166, 0.22); }
.icon-blue    { background: rgba(59, 130, 246, 0.12); color: #2563eb; border-color: rgba(59, 130, 246, 0.22); }
.icon-lime    { background: rgba(132, 204, 22, 0.15); color: #65a30d; border-color: rgba(132, 204, 22, 0.25); }
.icon-cyan    { background: rgba(6, 182, 212, 0.12);  color: #0891b2; border-color: rgba(6, 182, 212, 0.22); }

/* Badge de Sidebar */
.sidebar-link .nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* Footer del Sidebar */
.sidebar-footer {
    margin: 0.65rem;
    padding: 0.7rem 0.8rem;
    background: var(--sidebar-footer-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-footer-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f5de4, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(79, 93, 228, 0.2);
}

.sidebar-footer-info { overflow: hidden; flex: 1; min-width: 0; }
.sidebar-footer-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--sidebar-footer-name-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}
.sidebar-footer-role { font-size: 0.7rem; color: var(--sidebar-footer-role-color); font-weight: 500; transition: color 0.3s ease; }

.sidebar-footer-logout {
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-footer-logout:hover { color: #ef4444; background: var(--danger-light); }

/* ========================
   MAIN AREA
   ======================== */
.main-area {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* ========================
   TOP HEADER
   ======================== */
.main-header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px -2px rgba(15, 23, 42, 0.04);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    gap: 0.75rem;
}

.main-header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex-shrink: 1;
}
.main-header-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}
.main-header-subtitle {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.main-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* Reloj del header */
.header-clock {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    white-space: nowrap;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Role Badge */
.header-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(79, 93, 228, 0.08);
    color: #4f5de4;
    border: 1px solid rgba(79, 93, 228, 0.25);
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.header-role-badge select {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    outline: none;
    padding: 0;
}
.header-role-badge select option {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 600;
}

/* Role badge colores por rol */
.header-role-badge.role-badge-ti      { background: rgba(129,140,248,0.12); color: #818cf8; border-color: rgba(129,140,248,0.35); }
.header-role-badge.role-badge-director { background: rgba(251,191,36,0.12);  color: #f59e0b; border-color: rgba(251,191,36,0.35); }
.header-role-badge.role-badge-encargado { background: rgba(45,212,191,0.12); color: #14b8a6; border-color: rgba(45,212,191,0.35); }
.header-role-badge.role-badge-auditor  { background: rgba(156,163,175,0.12); color: #9ca3af; border-color: rgba(156,163,175,0.35); }
.header-role-badge.role-badge-docente  { background: rgba(52,211,153,0.12);  color: #10b981; border-color: rgba(52,211,153,0.35); }
.header-role-badge.role-badge-estudiante { background: rgba(56,189,248,0.12); color: #38bdf8; border-color: rgba(56,189,248,0.35); }

/* Botones del header */
.header-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    font-size: 0.9rem;
    flex-shrink: 0;
}
.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* Botón demo/secondary en header */
.header-demo-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.header-demo-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ========================
   PAGE CONTENT
   ======================== */
.page-content {
    padding: 1.4rem 1.75rem;
    flex: 1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ========================
   DASHBOARD SECTIONS (Animadas)
   ======================== */
.dashboard-section { display: none; }
.dashboard-section.active {
    display: block;
    animation: sectionFadeIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.3s ease, background-color 0.3s ease;
    cursor: default;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -4px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.stat-val {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
    transition: color 0.3s ease;
}

.stat-lbl {
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 600;
    transition: color 0.3s ease;
}

/* ========================
   CARDS
   ======================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.22s ease;
}
.card:hover { border-color: var(--border-input); }

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    transition: color 0.3s ease;
}
.card-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    transition: color 0.3s ease;
}

/* ========================
   BOTONES
   ======================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.52rem 1.1rem;
    font-size: 0.855rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    vertical-align: middle;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 93, 228, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79, 93, 228, 0.35); transform: translateY(-1px); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-input); }

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35); transform: translateY(-1px); }

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-success:hover { box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35); transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover { box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35); transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 0.38rem 0.6rem;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.btn-sm   { padding: 0.32rem 0.7rem; font-size: 0.78rem; }
.btn-lg   { padding: 0.7rem 1.5rem; font-size: 0.95rem; }

/* ========================
   TABLAS
   ======================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    display: block;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.835rem;
    min-width: 500px;
}

thead th {
    background: var(--bg-table-head);
    padding: 0.62rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease;
}

tbody td {
    padding: 0.62rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    transition: color 0.3s ease, border-color 0.3s ease;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ========================
   BADGES
   ======================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.badge-primary  { background: var(--primary-light); color: var(--primary); }
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-danger   { background: var(--danger-light);  color: var(--danger); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: var(--info-light);    color: var(--info); }
.badge-gray     { background: var(--bg-hover);      color: var(--text-secondary); }
.badge-pending  { background: var(--warning-light); color: var(--warning); }
.badge-active   { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--danger-light);  color: var(--danger); }
.badge-day-lv   { background: #e0e7ff; color: #3730a3; }
.badge-day-mj   { background: #fef3c7; color: #92400e; }
.badge-day-lm   { background: #d1fae5; color: #065f46; }
.badge-day-sa   { background: #fce7f3; color: #9d174d; }

/* ========================
   FORMULARIOS
   ======================== */
.form-group { margin-bottom: 1rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}
label.required::after { content: " *"; color: var(--danger); }

/* ========================
   INPUTS & SELECTS — Con Soporte Completo de Temas
   ======================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="search"],
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 10px;
    padding: 0.56rem 0.88rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.3s ease, color 0.3s ease;
    outline: none;
    line-height: 1.5;
    appearance: auto;
    -webkit-appearance: auto;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79, 93, 228, 0.14);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

select { cursor: pointer; }

/* Select: opciones respetan el tema */
select option {
    background: var(--select-bg);
    color: var(--select-color);
}

/* ========================
   SEARCH BAR
   ======================== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 0.48rem 0.88rem;
    min-width: 240px;
    transition: var(--transition-fast);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,93,228,.1); }
.search-bar input {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.875rem;
    box-shadow: none;
    width: 100%;
    color: var(--text-primary);
}
.search-bar input:focus { box-shadow: none; border: none; }
.search-bar .search-icon { color: var(--text-muted); font-size: 0.9rem; flex-shrink: 0; }

/* ========================
   MODALES
   ======================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 540px;
    max-height: 92vh;
    overflow-y: auto;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.modal-title { font-size: 0.98rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-hover);
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body { padding: 1.4rem; }
.modal-footer {
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ========================
   MODALES INLINE (divs como modal)
   ======================== */
.card[style*="position:fixed"],
div[style*="position:fixed"][style*="z-index"] > .card {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ========================
   TOAST/NOTIFICATION GLOBAL
   ======================== */
.notification-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.notification-overlay.show { opacity: 1; pointer-events: auto; }

.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1.65rem 2rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.93rem;
    font-weight: 600;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.3), 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 280px;
    max-width: 420px;
    width: 90%;
    cursor: pointer;
}
.notification.show { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }

.toast-badge {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    animation: badgePop 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes badgePop { 0%{transform:scale(0)} 70%{transform:scale(1.12)} 100%{transform:scale(1)} }

.toast-badge-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; box-shadow: 0 8px 20px rgba(16,185,129,0.38); }
.toast-badge-error   { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: #fff; box-shadow: 0 8px 20px rgba(239,68,68,0.38); }
.toast-badge-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #fff; box-shadow: 0 8px 20px rgba(245,158,11,0.38); }
.toast-badge-info    { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; box-shadow: 0 8px 20px rgba(59,130,246,0.38); }

.toast-title { font-size: 1.12rem; font-weight: 800; color: var(--text-primary); margin: 0; letter-spacing: -0.01em; }
.toast-body  { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.45; }

/* ========================
   LOGIN PAGE
   ======================== */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--bg-main);
}
.login-left {
    flex: 1;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}
.login-left::before, .login-left::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.login-left::before { top: -80px; right: -80px; width: 280px; height: 280px; }
.login-left::after  { bottom: -60px; left: -60px; width: 220px; height: 220px; }

.login-left-content { position: relative; z-index: 1; max-width: 400px; }
.login-logo { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 2.5rem; }
.login-logo-icon { width: 40px; height: 40px; background: rgba(255,255,255,0.2); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.login-logo-text  { font-size: 1.25rem; font-weight: 800; color: white; }
.login-logo-text span { opacity: 0.75; }

.login-hero-title { font-size: 1.85rem; font-weight: 800; color: white; margin-bottom: 0.9rem; line-height: 1.2; }
.login-hero-desc  { font-size: 0.9rem; color: rgba(255,255,255,0.75); line-height: 1.7; }

.login-features { margin-top: 2.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.login-feature { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: rgba(255,255,255,0.85); }
.login-feature-dot { width: 6px; height: 6px; background: rgba(255,255,255,0.6); border-radius: 50%; flex-shrink: 0; }

.login-right {
    width: 440px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    background: var(--bg-card);
    overflow-y: auto;
    transition: background-color 0.3s ease;
}

/* ========================
   MOBILE BOTTOM NAV
   ======================== */
.mobile-bottom-nav { display: none; }

/* ========================
   DESKTOP NAV BAR (LATERAL) — Para cuando sidebar se colapsa
   ======================== */
.desktop-nav-bar { display: none; }

/* ========================
   THEME TOGGLE BUTTON
   ======================== */
.theme-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 1rem;
    flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--primary); }

/* ========================
   NAVEGACIÓN DE PESTAÑAS (TABS)
   ======================== */
.tabs-nav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.855rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ========================
   PROGRESS BAR
   ======================== */
.progress-bar-outer {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar-inner {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* ========================
   SEPARADORES
   ======================== */
.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.25rem 0;
    transition: border-color 0.3s ease;
}

/* ========================
   ACORDEONES (details/summary)
   ======================== */
details > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition-fast);
}
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { background: var(--bg-hover); }
details[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

/* ========================
   NÚMERO DE SERIES / CONTADORES
   ======================== */
.seq-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ========================
   UTILIDADES DE GRID
   ======================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ========================
   COLORES ESPECIALES INCES
   ======================== */
.badge-inces-si  { background: rgba(16,185,129,0.12); color: #059669; border: 1px solid rgba(16,185,129,0.28); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.72rem; font-weight: 700; }
.badge-inces-no  { background: rgba(239,68,68,0.10);  color: #dc2626; border: 1px solid rgba(239,68,68,0.25); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.72rem; font-weight: 700; }

/* ========================
   FIRMA DIGITAL (CANVAS)
   ======================== */
.signature-canvas {
    width: 100%;
    height: 140px;
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    cursor: crosshair;
    display: block;
    transition: border-color 0.18s ease, background-color 0.3s ease;
    touch-action: none;
}
.signature-canvas:hover, .signature-canvas:focus {
    border-color: var(--primary);
    outline: none;
}

/* ========================
   SECCIONES DE FORMULARIO CON CABECERA
   ======================== */
.form-section-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.3s ease, border-color 0.3s ease;
}

/* ========================
   RESPONSIVE — TABLET (1024px)
   ======================== */
@media (max-width: 1024px) {
    :root { --sidebar-width: 200px; }
    .page-content { padding: 1.2rem 1.4rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .header-clock #clock-date { display: none; }
    .main-header-subtitle { display: none; }
}

/* ========================
   RESPONSIVE — MOBILE NAV (< 900px)
   Sidebar se oculta, aparece barra de navegación inferior
   ======================== */
@media (max-width: 900px) {
    :root { --sidebar-width: 0px; }

    .sidebar {
        transform: translateX(-100%);
        width: 240px;
        z-index: 300;
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
        width: 100%;
        padding-bottom: 72px; /* Espacio para nav inferior */
    }

    .page-content { padding: 1rem; }

    /* Overlay cuando sidebar móvil está abierto */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        backdrop-filter: blur(2px);
        z-index: 280;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.open { opacity: 1; pointer-events: all; }

    /* Botón hamburguesa en header */
    .btn-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        background: var(--bg-card);
        color: var(--text-secondary);
        cursor: pointer;
        flex-shrink: 0;
        transition: var(--transition-fast);
    }
    .btn-menu-toggle:hover { background: var(--bg-hover); color: var(--primary); }

    /* Barra de nav inferior */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-sidebar);
        border-top: 1px solid var(--border-color);
        z-index: 200;
        height: 68px;
        align-items: stretch;
        padding: 0 0.25rem;
        gap: 0.1rem;
        overflow-x: auto;
        scrollbar-width: none;
        box-shadow: 0 -4px 20px -2px rgba(0,0,0,0.06);
        transition: background-color 0.3s ease, border-color 0.3s ease;
    }
    .mobile-bottom-nav::-webkit-scrollbar { display: none; }

    .mobile-bottom-nav .sidebar-section-label,
    .mobile-bottom-nav .nav-badge { display: none; }

    .mobile-bottom-nav .sidebar-link {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.45rem 0.5rem;
        margin: 0.3rem 0.1rem;
        border-radius: 10px;
        min-width: 56px;
        flex-shrink: 0;
        gap: 0.25rem;
        color: var(--text-muted);
        font-size: 0;
        white-space: nowrap;
        overflow: visible;
        border: 1px solid transparent;
    }

    .mobile-bottom-nav .sidebar-link-text {
        font-size: 0.62rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 62px;
        letter-spacing: -0.01em;
        color: var(--text-muted);
        transition: color 0.18s ease;
    }

    .mobile-bottom-nav .sidebar-link:hover,
    .mobile-bottom-nav .sidebar-link.active {
        color: var(--primary);
        background: var(--primary-light);
        border-color: rgba(79, 93, 228, 0.2);
    }

    .mobile-bottom-nav .sidebar-link.active .sidebar-link-text,
    .mobile-bottom-nav .sidebar-link:hover .sidebar-link-text {
        color: var(--primary);
        font-weight: 800;
    }

    .mobile-bottom-nav .sidebar-link .sidebar-icon-box {
        width: 26px;
        height: 26px;
        border-radius: 8px;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-bottom-nav .sidebar-link .sidebar-icon-box svg { width: 17px; height: 17px; }
    .mobile-bottom-nav .sidebar-link.active .sidebar-icon-box { transform: scale(1.08); }

    /* Header en móvil: más compacto */
    .main-header { padding: 0 0.85rem; gap: 0.5rem; }
    .main-header-subtitle { display: none; }
    .header-clock { display: none; }
    .main-header-title { font-size: 0.92rem; }
    .header-role-badge { display: none; }

    /* Stats en 2 columnas */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

    /* Formularios en 1 columna */
    .form-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 0.75rem; }

    /* Modales de pantalla completa en móvil */
    div[style*="position:fixed"] > .card {
        max-height: 92vh;
        overflow-y: auto;
    }
}

/* ========================
   RESPONSIVE — SMARTPHONE (< 640px)
   ======================== */
@media (max-width: 640px) {
    .page-content { padding: 0.8rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }

    .stat-card { padding: 1rem; }
    .stat-val { font-size: 1.5rem; }

    .card { padding: 1rem; }

    /* Inputs más grandes para facilitar el toque en móvil */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="search"],
    select,
    textarea {
        font-size: 1rem; /* Previene auto-zoom en iOS */
        min-height: 44px;
    }

    .btn-primary, .btn-secondary {
        min-height: 44px;
        border-radius: 10px;
        font-size: 0.92rem;
    }

    .form-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    table { min-width: 480px; }

    /* Canvases de firma */
    .signature-canvas { height: 150px; }

    /* Modales más anchos */
    .modal { max-width: 98%; }
    div[style*="position:fixed"] > .card {
        width: 96% !important;
        padding: 1.25rem !important;
    }

    /* Notificación toast */
    .notification { width: 92%; padding: 1.35rem 1.5rem; }
}

/* ========================
   RESPONSIVE — PANTALLA MUY PEQUEÑA (< 380px)
   ======================== */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-content { padding: 0.65rem; }
    .mobile-bottom-nav .sidebar-link { min-width: 48px; }
    .mobile-bottom-nav .sidebar-link-text { max-width: 52px; }
}

/* ========================
   MEJORAS VISUALES: ICONOS & SOMBRAS
   ======================== */
.stat-icon, .sidebar-icon-box {
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

/* ========================
   ESTILOS ESPECIALES PARA MODALES INLINE (divs position:fixed)
   ======================== */
div[style*="position:fixed"][style*="z-index"] {
    /* Asegurar que los modales inline también cubran la pantalla */
}

/* Para modales inline de la planilla INCES, docente y admin */
div[id*="modal"] > div,
div[id*="Modal"] > div {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

div[id*="modal"] h2,
div[id*="modal"] h3,
div[id*="modal"] h4,
div[id*="Modal"] h2,
div[id*="Modal"] h3,
div[id*="Modal"] h4 {
    color: var(--text-primary);
}

div[id*="modal"] p,
div[id*="Modal"] p {
    color: var(--text-secondary);
}

div[id*="modal"] label,
div[id*="Modal"] label {
    color: var(--text-primary);
}

/* ========================
   MEJORAS DE ACCESIBILIDAD
   ======================== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========================
   ANIMACIONES MICRO
   ======================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.animate-fade-in     { animation: fadeIn 0.3s ease forwards; }
.animate-fade-in-up  { animation: fadeInUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.animate-scale-in    { animation: scaleIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* ========================
   INSTITUTION SELECTOR (Registro Público)
   ======================== */
.institution-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.85rem;
}
.institution-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    min-height: 90px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}
.institution-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.institution-btn.selected { border-color: var(--primary); color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(79,93,228,0.12); }

/* ========================
   OCR UPLOAD AREA
   ======================== */
.ocr-upload-area {
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-input);
    color: var(--text-secondary);
}
.ocr-upload-area:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.ocr-upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }

/* ========================
   SCROLLBAR ESTILIZADO
   ======================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========================
   PRINT MEDIA
   ======================== */
@media print {
    .sidebar, .mobile-bottom-nav, .main-header, .header-btn, .btn, .no-print {
        display: none !important;
    }
    .main-area { margin-left: 0; width: 100%; }
    .page-content { padding: 0; }
    body { background: white; color: black; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ========================
   OCULTAR HAMBURGUESA EN DESKTOP (> 900px)
   ======================== */
@media (min-width: 901px) {
    .btn-menu-toggle { display: none !important; }
    .sidebar-overlay { display: none !important; }
}

/* ========================
   FOOTER DE CONTACTO — JONTHTECH
   ======================== */
.app-footer {
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
    margin-top: auto;
}

.app-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
    padding: 0.85rem 1.75rem;
    max-width: 100%;
}

.app-footer-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    transition: color 0.3s ease;
    min-width: 0;
}

.app-footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-gradient);
    border-radius: 8px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(79, 93, 228, 0.25);
}

.app-footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}
.app-footer-text strong {
    color: var(--text-secondary);
    font-weight: 700;
}

.app-footer-links {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.app-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.7rem;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    color: var(--text-secondary);
    background: var(--bg-hover);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.app-footer-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* YouTube */
.footer-yt {
    background: rgba(255, 0, 0, 0.08);
    color: #e60023;
    border-color: rgba(255, 0, 0, 0.18);
}
.footer-yt:hover {
    background: #ff0000;
    color: #ffffff;
    border-color: #ff0000;
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.3);
}

/* Instagram */
.footer-ig {
    background: rgba(225, 48, 108, 0.08);
    color: #c13584;
    border-color: rgba(225, 48, 108, 0.18);
}
.footer-ig:hover {
    background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(193, 53, 132, 0.35);
}

/* Discord */
.footer-dc {
    background: rgba(88, 101, 242, 0.08);
    color: #5865f2;
    border-color: rgba(88, 101, 242, 0.18);
}
.footer-dc:hover {
    background: #5865f2;
    color: #ffffff;
    border-color: #5865f2;
    box-shadow: 0 4px 14px rgba(88, 101, 242, 0.35);
}

/* WhatsApp */
.footer-wa {
    background: rgba(37, 211, 102, 0.08);
    color: #25d366;
    border-color: rgba(37, 211, 102, 0.18);
}
.footer-wa:hover {
    background: #25d366;
    color: #ffffff;
    border-color: #25d366;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

/* Footer en móvil */
@media (max-width: 900px) {
    .app-footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.85rem 1rem;
        padding-bottom: calc(0.85rem + 68px); /* Espacio para la nav inferior */
    }
    .app-footer-links {
        justify-content: center;
    }
    .app-footer-link span {
        display: none; /* Solo íconos en móvil */
    }
    .app-footer-link {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .app-footer-brand { font-size: 0.7rem; }
    .app-footer-inner { gap: 0.6rem; }
}

