/* =========================================
   1. VARIABLES Y CONFIGURACIÓN GLOBAL
   ========================================= */
:root {
    /* Paleta de Colores "Safe & Vibrant" */
    --primary: #6366f1;       /* Indigo vibrante (Acción principal) */
    --primary-hover: #4f46e5; /* Indigo oscuro (Hover) */
    --secondary: #10b981;     /* Esmeralda (Éxito/Calma) */
    --accent: #f43f5e;        /* Rosa Coral (Alertas/Atención) */
    
    /* Fondos y Textos */
    --bg-body: #f8fafc;       /* Gris muy claro (casi blanco) */
    --bg-card: #ffffff;       /* Blanco puro para tarjetas */
    --text-main: #1e293b;     /* Gris oscuro (No negro puro) */
    --text-light: #64748b;    /* Gris medio para subtítulos */
    
    /* Tipografía */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Efectos UI */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
}

/* Reset Básico Moderno */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth; /* Desplazamiento suave al dar click en menú */
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden; /* Evita scroll horizontal indeseado */
}

/* Contenedor centralizado para limitar el ancho en pantallas grandes */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* =========================================
   2. BARRA DE NAVEGACIÓN (GLASSMORPHISM)
   ========================================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85); /* Transparencia */
    backdrop-filter: blur(10px); /* Efecto vidrio esmerilado */
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: none; /* Oculto en móvil por defecto */
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    margin-left: 2rem;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

/* En escritorio sí mostramos los links */
@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

/* Botón fantasma (Ghost Button) */
.btn-ghost {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-ghost:hover {
    background-color: rgba(99, 102, 241, 0.1);
}

/* =========================================
   3. HERO SECTION (PORTADA)
   ========================================= */
.hero-section {
    padding: 4rem 0 2rem;
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}



/* Estilo para el Supertítulo del Sistema */
.system-title {
    font-family: var(--font-heading);
    font-size: 1rem;          /* Tamaño discreto pero legible */
    font-weight: 800;           /* Letra gruesa */
    text-transform: uppercase;  /* Todo en mayúsculas */
    letter-spacing: 2px;        /* Separación entre letras (Toque moderno) */
    color: var(--text-light);   /* Color gris medio (o usa var(--primary) si lo quieres morado) */
    margin-bottom: 1rem;        /* Espacio antes del badge */
    display: block;
}

/* Ajuste opcional: Si quieres que resalte más, cambia el color */
/* .system-title { color: var(--primary); } */


@media (min-width: 992px) {
    .hero-content {
        grid-template-columns: 1fr 1fr; /* Dos columnas en escritorio */
    }
}

.badge-soft {
    display: inline-block;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    margin-bottom: 1.5rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.highlight {
    color: var(--primary);
    position: relative;
    white-space: nowrap;
}

/* Subrayado creativo */
.highlight::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(99, 102, 241, 0.2);
    z-index: -1;
    border-radius: 4px;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 500px;
}

/* Botones Principales */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: .5rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px; /* Botón píldora */
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
}

.link-secondary {
    margin-left: 1.5rem;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    transition: var(--transition);
}

.link-secondary:hover {
    color: var(--primary);
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    /* Animación suave de flotación */
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* =========================================
   4. SECCIÓN DE CARACTERÍSTICAS (GRID)
   ========================================= */
.features-section {
    padding: 5rem 0;
    background-color: #fff;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1rem;
}

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

.feature-card {
    background: var(--bg-body);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
}

.feature-card:hover {
    background: #fff;
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.1);
    transform: translateY(-5px);
}

.icon-box {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* =========================================
   5. TEMAS (TARJETAS ESTILO APP)
   ========================================= */
.topics-section {
    padding: 5rem 0;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(3, auto); /* Fuerza exactamente 3 columnas */
    gap: 1.5rem; /* Espacio entre tarjetas */
    justify-content: center; /* Centra el bloque entero en la pantalla */
    justify-items: center; /* ESTA ES LA CLAVE: Evita que se estiren, conservan el tamaño de su texto */
}

.topic-card {
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topic-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px) scale(1.02);
}

/* =========================================
   6. EXTRAS (EMERGENCIA Y CHAT)
   ========================================= */
.emergency-banner {
    background-color: #ffe4e6; /* Rojo muy suave */
    color: #881337;
    padding: 1rem 0;
    margin-top: 3rem;
    border-top: 1px solid #fda4af;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-emergency {
    background-color: var(--accent);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Footer simple */
.main-footer {
    background-color: #1e293b;
    color: #94a3b8;
    padding: 3rem 0;
    margin-top: auto;
    text-align: center;
}

/* Agrega esto para controlar el espacio en escritorio */
.main-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center; /* Mantiene todo centrado */
    gap: 2rem; /* ESTA ES LA MAGIA: Mucho espacio vertical en escritorio */
}

.main-footer .footer-links a {
    color: #e2e8f0;
    margin: 0 10px;
    text-decoration: none;
}




/* Botón flotante */
.fab-chat {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    z-index: 100;
}

.fab-chat:hover {
    transform: scale(1.1);
}

/* =========================================
   7. AJUSTES ESPECÍFICOS PARA MÓVILES (RESPONSIVE)
   ========================================= */
@media (max-width: 768px) {
    /* --- Arreglo de textos en la Portada (Inicio) --- */
    .hero-section h1 {
        font-size: 1.8rem; /* Reducimos el tamaño para que no se corte */
        line-height: 1.3;
    }
    
    .system-title {
        font-size: 0.85rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }

    /* Centramos el contenido inicial para mejor lectura en móvil */
    .hero-content {
        gap: 1.5rem;
        text-align: left; 
    }

    /* Acomodamos los botones uno debajo de otro */
    .cta-group {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .link-secondary {
        margin-left: 0;
    }

    /* --- Arreglo del Banner de Emergencia --- */
    .emergency-banner .flex-between {
        justify-content: center;
        text-align: center;
    }

    /* --- Arreglo del Footer --- */
    .main-footer {
        font-size: 0.85rem; /* Le bajamos aprox 1pt al texto general */
        padding: 2rem 0;
    }

    .main-footer .container {
        display: flex;
        flex-direction: column;
        gap: 1.5rem; /* Separación entre logo, links y copyright */
    }

    .footer-links {
        display: flex;
        flex-direction: column; /* Apilamos los enlaces en una sola columna */
        gap: 0.7rem;
    }

    .footer-links a {
        margin: 0; /* Quitamos el margen lateral que tenían en escritorio */
    }
    
    /* --- Ajustes para "Cómo funciona" y "Temas" en móvil --- */
    .section-header {
        margin-bottom: 2rem; /* Menos espacio en blanco antes del contenido */
    }

    .section-header h2 {
        font-size: 1.5rem; /* Lo bajamos para que sea menor al H1 (1.8rem) */
        line-height: 1.3;
    }

    .section-header p {
        font-size: 0.95rem; /* Un texto de apoyo un poco más discreto */
    }

    .icon-box {
        font-size: 2.2rem; /* Reducimos el ícono para que no abrume la pantalla */
        margin-bottom: 1rem;
    }

    .feature-card {
        padding: 1.5rem; /* Reducimos el colchón interno de la tarjeta */
    }

    .feature-card h3 {
        font-size: 1.15rem; /* Título de tarjeta más equilibrado */
        margin-bottom: 0.5rem;
    }

    .feature-card p {
        font-size: 0.9rem; /* Texto de la tarjeta más cómodo de leer */
    }

    .topic-card {
        font-size: 0.9rem; /* Tarjetas de temas un poco más compactas */
        padding: 0.8rem 1.2rem;
        width: 100%; /* Opcional: Esto hace que las tarjetas de temas ocupen todo el ancho en móvil, pareciendo botones de lista */
        justify-content: center; /* Centra el contenido si ocupan el 100% */
    }
    
    .topics-grid {
        grid-template-columns: auto; /* En móvil las apila una sobre otra, respetando su tamaño */
    }
}

/* =========================================
   9. ANIMACIÓN DEL HERO (CHECKLIST BUCLE)
   ========================================= */
.animated-hero-graphic {
    position: relative;
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* El Tablero Principal (Estilo Glassmorphism) */
.glass-board {
    position: relative;
    width: 280px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    z-index: 10;
    animation: floatingBoard 6s ease-in-out infinite;
}

/* Bolitas de la barra superior (estilo ventana de app) */
.board-header {
    display: flex;
    gap: 6px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot.red { background-color: #fca5a5; }
.dot.yellow { background-color: #fde047; }
.dot.green { background-color: var(--secondary); }

/* Los elementos de la lista */
.check-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
    opacity: 0;
    animation: fadeInSlide 0.8s ease forwards; /* Aparecen uno por uno al cargar la página */
}

/* Tiempos de aparición de las filas completas */
.i-1 { animation-delay: 0s; }
.i-2 { animation-delay: 0.5s; }
.i-3 { animation-delay: 1s; }

/* La caja del checkbox */
.check-box {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: white;
}

/* La palomita (Animación en bucle) */
.check-mark {
    width: 6px;
    height: 12px;
    border: solid var(--secondary);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg) scale(0); /* Inicia oculta */
    opacity: 0;
    animation: drawCheckLoop 6s infinite; /* Bucle de 6 segundos */
}

/* Tiempos desfasados para que se marquen en orden */
.m-1 { animation-delay: 0s; }
.m-2 { animation-delay: 1s; }
.m-3 { animation-delay: 2s; }

/* Líneas que simulan texto */
.line-group {
    flex-grow: 1;
}

.line-long {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 6px;
    width: 100%;
}

.line-short {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    width: 60%;
}

/* Burbujas flotantes de fondo */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    opacity: 0.15;
    filter: blur(8px);
    z-index: 1;
}

.b-1 {
    width: 120px; height: 120px;
    top: 20px; right: 20px;
    animation: floatBubble 8s ease-in-out infinite alternate;
}

.b-2 {
    width: 80px; height: 80px;
    bottom: 40px; left: 40px;
    background: linear-gradient(135deg, var(--secondary), #34d399);
    animation: floatBubble 6s ease-in-out infinite alternate-reverse;
}

.b-3 {
    width: 60px; height: 60px;
    top: 50%; left: -10px;
    background: linear-gradient(135deg, var(--accent), #fb7185);
    animation: floatBubble 7s ease-in-out infinite alternate;
}

/* =========================================
   KEYFRAMES (Instrucciones de movimiento)
   ========================================= */
@keyframes floatingBoard {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes fadeInSlide {
    0% { opacity: 0; transform: translateX(-20px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* EL BUCLE: Se dibuja, se mantiene, se borra y repite */
@keyframes drawCheckLoop {
    0% { opacity: 0; transform: scale(0) rotate(45deg); }
    10% { opacity: 1; transform: scale(1.2) rotate(45deg); }
    15% { opacity: 1; transform: scale(1) rotate(45deg); } /* Queda marcada */
    70% { opacity: 1; transform: scale(1) rotate(45deg); } /* Permanece visible */
    80% { opacity: 0; transform: scale(0) rotate(45deg); } /* Se borra */
    100% { opacity: 0; transform: scale(0) rotate(45deg); } /* Pausa antes de reiniciar */
}

@keyframes floatBubble {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -30px) scale(1.1); }
}

/* =========================================
   AJUSTES RESPONSIVE (MÓVIL)
   ========================================= */
@media (max-width: 768px) {
    .animated-hero-graphic {
        height: 300px;
    }
    .glass-board {
        width: 240px;
        padding: 1.2rem;
    }
}

    .modal-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(30, 41, 59, 0.8); backdrop-filter: blur(5px);
        display: flex; justify-content: center; align-items: center; z-index: 9999;
    }
    .modal-overlay.hidden { display: none; }
    .modal-card {
        background: var(--bg-card); width: 90%; max-width: 600px;
        border-radius: var(--radius-lg); padding: 2.5rem;
        box-shadow: var(--shadow-lg);
    }
    .modal-title { font-family: var(--font-heading); color: var(--text-main); text-align: center; margin-bottom: 0.5rem; font-size: 1.5rem; }
    .modal-subtitle { font-weight: 600; text-align: center; color: var(--text-light); margin-bottom: 1.5rem; }
    .scrollable { max-height: 40vh; overflow-y: auto; margin-bottom: 1.5rem; padding-right: 10px; text-align: justify;}
    .scrollable p { margin-bottom: 1rem; font-size: 0.95rem; }
    .modal-actions { display: flex; gap: 1rem; justify-content: center; }
    .alert-text { color: var(--accent); }





/* =========================================
   MÓDULO DE AUTENTICACIÓN (LOGIN / REGISTRO)
   ========================================= */

/* =========================================
   MÓDULO AUTH UNIFICADO
========================================= */

.auth-body{
    display:flex;
    flex-direction:column;
    min-height:100vh;
    background:var(--bg-body);
}

.auth-navbar{
    justify-content:center;
    border-bottom:none;
    box-shadow:var(--shadow-sm);
}

.auth-main{
    flex:1;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:3rem 1rem;
}

.auth-container{
    width:100%;
    max-width:560px;
    background:var(--bg-card);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow-lg);
    border:1px solid rgba(0,0,0,.05);
    padding:2.5rem;
}

/* Tabs */

.auth-tabs{
    display:flex;
    border-bottom:1px solid #e2e8f0;
    margin-bottom:2rem;
}

.tab-btn{
    flex:1;
    background:none;
    border:none;
    padding:1rem 0;
    font-family:var(--font-body);
    font-size:1rem;
    font-weight:600;
    color:var(--text-light);
    cursor:pointer;
    transition:var(--transition);
}

.tab-btn.active{
    color:var(--primary);
    border-bottom:2px solid var(--primary);
    margin-bottom:-1px;
}

/* Forms */

.auth-form{
    display:none;
}

.auth-form.active{
    display:block;
    animation:fadeInSlide .35s ease;
}

.auth-title{
    font-family:var(--font-heading);
    font-size:1.6rem;
    color:var(--text-main);
    text-align:center;
    margin-bottom:.5rem;
}

.auth-subtitle{
    text-align:center;
    color:var(--text-light);
    font-size:.95rem;
    margin-bottom:2rem;
}

/* Inputs */

.input-group{
    margin-bottom:1rem;
    position:relative;
}

.input-group input,
.input-group select{
    width:100%;
    height:52px;
    padding:0 1rem;
    border:1px solid #cbd5e1;
    border-radius:var(--radius-md);
    background:#f8fafc;
    color:var(--text-main);
    font-size:0.95rem;
    font-family:var(--font-body);
    transition:var(--transition);
}

.input-group input:focus,
.input-group select:focus{
    outline:none;
    border-color:var(--primary);
    background:#fff;
    box-shadow:0 0 0 3px rgba(99,102,241,.08);
}

.input-group input::placeholder{
    color:#94a3b8;
}

/* Password toggle */

.password-group input{
    padding-right:45px;
}

.toggle-password{
    position:absolute;
    top:50%;
    right:14px;
    transform:translateY(-50%);
    border:none;
    background:none;
    cursor:pointer;
    font-size:1rem;
    opacity:.5;
    transition:var(--transition);
}

.toggle-password:hover{
    opacity:1;
}

/* Links */

.auth-actions{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:1rem;
    margin-top:1.5rem;
}

.auth-actions .btn-primary{
    min-width:140px;
}

/* Hidden */

.hidden{
    display:none !important;
}

/* Error */

.error-text{
    background:#ffe4e6;
    color:#be123c;
    border:1px solid #fecdd3;
    border-radius:var(--radius-md);
    padding:.75rem 1rem;
    margin-bottom:1rem;
    font-size:.9rem;
}

.input-highlight{
    border:1px solid var(--secondary) !important;
}


.checkbox-row{
    display:flex;
    align-items:flex-start;
    gap:.75rem;
    margin:1rem 0 1.5rem;
}

.checkbox-row input[type="checkbox"]{
    width:18px;
    height:18px;
    margin-top:3px;
    accent-color: var(--primary);
    flex-shrink:0;
    cursor:pointer;
}

.checkbox-row label{
    font-size:.9rem;
    color:var(--text-light);
    line-height:1.5;
}

.checkbox-row a{
    color:var(--primary);
    text-decoration:none;
    font-weight:600;
}

.checkbox-row a:hover{
    text-decoration:underline;
}





/* =========================================
   MÓDULO DASHBOARD (UI COMPACTA & RESPONSIVE)
   ========================================= */

.dashboard-body {
    background-color: var(--bg-body);
    margin: 0;
    overflow-x: hidden;
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* --- BARRA LATERAL --- */
/* --- BARRA LATERAL --- */
.sidebar {
    width: 260px;
    background-color: #1e293b;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0; 
    
    /* AÑADIR ESTAS 3 LÍNEAS PARA SOLUCIONAR EL CORTE VERTICAL */
    overflow-y: auto; 
    -ms-overflow-style: none;  /* Oculta scrollbar en IE/Edge */
    scrollbar-width: none;     /* Oculta scrollbar en Firefox */
}

/* AÑADIR ESTA REGLA FUERA DE LA CLASE PARA CHROME/SAFARI */
.sidebar::-webkit-scrollbar { 
    display: none; 
}



.sidebar-header { text-align: center; margin-bottom: 1.5rem; }

.user-profile-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.avatar-circle {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; flex-shrink: 0;
}

.user-info .user-id { font-family: var(--font-heading); font-size: 0.9rem; font-weight: 600; margin: 0; }
.user-info .user-status { font-size: 0.75rem; color: var(--secondary); display: flex; align-items: center; gap: 4px; }
.user-info .user-status::before { content: ""; width: 6px; height: 6px; background: var(--secondary); border-radius: 50%; display: inline-block; }

.sidebar-nav { 
    display: flex; 
    flex-direction: column; 
    gap: 0.25rem; 
    flex-grow: 1; 
}

/* Herramientas Footer Sidebar */
.sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1rem;
    margin-top: 1rem;
    padding-bottom: 3rem; /* AÑADIR ESTO: Crea un colchón visual al final */
}

.nav-link {
    background: transparent; border: none; color: #94a3b8;
    text-align: left; padding: 0.75rem 1rem;
    font-family: var(--font-body); font-size: 0.95rem; font-weight: 500;
    border-radius: var(--radius-md); cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; gap: 10px; white-space: nowrap;
}

.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); color: #fff; }
.nav-link.active { border-left: 3px solid var(--primary); padding-left: calc(1rem - 3px); }

/* SVG Invertido (Para que el logo ccontigo se vea blanco) */
.svg-icon-white {
    width: 2em;
    transition: var(--transition);
}
.nav-link:hover .svg-icon-white, .nav-link.active .svg-icon-white { opacity: 1; }

.btn-logout {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    text-decoration: none; color: #fca5a5; background: rgba(225, 29, 72, 0.1);
    padding: 0.75rem; border-radius: var(--radius-md); font-weight: 600; font-size: 0.9rem; transition: var(--transition);
    margin-top: 0.5rem;
}
.btn-logout:hover { background: rgba(225, 29, 72, 0.2); color: #fecdd3; }

/* --- ÁREA DE TRABAJO --- */
.workspace { 
    padding: 2.5rem 3rem; 
    height: 100vh; 
    overflow-y: auto; 
    flex-grow: 1; /* Ocupa el espacio restante */
    min-width: 0; /* Previene desbordamiento en flexbox */
    box-sizing: border-box;
}

.workspace-header-compact { margin-bottom: 2rem; border-bottom: 1px solid #e2e8f0; padding-bottom: 1rem; }
.workspace-title { font-family: var(--font-heading); font-size: 1.5rem; color: var(--text-main); margin-bottom: 0.25rem; }
.workspace-subtitle { color: var(--text-light); font-size: 0.9rem; margin: 0; line-height: 1.4; }

/* --- GRID COMPACTO --- */
.compact-grid {
    display: grid;
    /* Ajuste responsivo seguro: no menor a 260px para evitar overflow en móviles pequeños */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.list-card {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    gap: 1rem;
}

.list-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon-box {
    font-size: 1.5rem;
    width: 45px; height: 45px;
    background: #f8fafc;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.card-data { flex-grow: 1; min-width: 0; }
.card-title { 
    font-family: var(--font-heading); font-size: 0.95rem; font-weight: 600; 
    color: var(--text-main); margin: 0 0 0.2rem 0; 
    /* Permitir salto de línea para textos largos */
    white-space: normal; line-height: 1.3;
}

/* --- SEMÁFORO Y FECHA --- */
.status-wrap { 
    display: flex; align-items: center; gap: 6px; 
    flex-wrap: wrap; /* Evita que la fecha rompa la caja en móviles */
    margin-top: 4px;
}
.status-label { font-size: 0.75rem; font-weight: 500; color: var(--text-main); }
.status-date { font-size: 0.7rem; color: var(--text-light); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.status-dot.gris { background-color: #cbd5e1; } 
.status-dot.verde { background-color: var(--secondary); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); } 
.status-dot.amarillo { background-color: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); } 
.status-dot.naranja { background-color: #f97316; box-shadow: 0 0 6px rgba(249, 115, 22, 0.4); } 
.status-dot.rojo { background-color: var(--accent); box-shadow: 0 0 6px rgba(244, 63, 94, 0.4); }

.btn-ghost-sm {
    background: rgba(99, 102, 241, 0.05); color: var(--primary);
    border: none; padding: 0.5rem 0.75rem; font-size: 0.85rem; font-weight: 600;
    border-radius: 8px; cursor: pointer; transition: var(--transition);
    white-space: nowrap; flex-shrink: 0;
}
.btn-ghost-sm:hover { background: var(--primary); color: white; }

/* Elementos exclusivos para móvil (Ocultos en escritorio) */
.mobile-header { display: none; }
.sidebar-overlay { display: none; }
.avatar-circle-small { 
    width: 32px; height: 32px; background: var(--primary); 
    border-radius: 50%; display: flex; align-items: center; 
    justify-content: center; font-size: 0.85rem; flex-shrink: 0; 
}

/* --- REESTRUCTURACIÓN MÓVIL (MENÚ OFF-CANVAS TOGGLE) --- */
@media (max-width: 800px) {
    .dashboard-layout { display: block; }
    
    /* Activar Header Móvil */
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #ffffff;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #e2e8f0;
        position: sticky;
        top: 0;
        z-index: 90;
        box-shadow: var(--shadow-sm);
    }

    .menu-toggle {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--primary);
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
    }

    /* Convertir Sidebar a Off-Canvas */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        border-right: none;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Fondo Oscuro para cerrar menú */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100vh;
        background: rgba(15, 23, 42, 0.6);
        z-index: 95;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease-in-out;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    /* Ajuste del Workspace */
    .workspace { 
        padding: 1.5rem 1rem; 
        height: auto; 
    }

    .workspace-title { font-size: 1.25rem; }
    
    .compact-grid { grid-template-columns: 1fr; }
}