/* =============================================================================
   PSICONET — styles.css
   Versión consolidada: layout + componentes + login + responsive
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. VARIABLES CSS
   ----------------------------------------------------------------------------- */
:root {
    /* Marca */
    --primary: #cab9aa;
    --primary-hover: #b8a596;
    --primary-light: #f5f0ec;
    --primary-dark: #a89080;
    --secondary: #9d8562;
    --secondary-hover: #8a7356;
    --secondary-light: #f0ebe3;

    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-bg: #ffffff;
    --sidebar-text: #374151;
    --sidebar-text-light: #6b7280;
    --sidebar-hover: #f5f0ec;
    --sidebar-active: #f0ebe3;
    --sidebar-border: #e5e7eb;

    /* Página */
    --bg-page: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;

    /* Sombras — usando los nuevos colores */
    --shadow-sm: 0 1px 2px 0 rgba(157, 133, 98, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(157, 133, 98, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(157, 133, 98, 0.2);

    /* Estados */
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* iOS safe-area */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* -----------------------------------------------------------------------------
   2. RESET & BASE
   ----------------------------------------------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

/* -----------------------------------------------------------------------------
   3. LAYOUT — SIDEBAR
   ----------------------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transition: transform 0.3s ease;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    flex-shrink: 0;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 100%
    );
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.logo-img {
    width: 100%;
    max-width: 200px;
    height: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text-light);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text);
    padding: 0.75rem 1.25rem;
    margin: 0.125rem 0.75rem;
    border-radius: 8px;
    transition:
        background 0.2s ease,
        color 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    opacity: 0.7;
}

.nav-item:hover,
.nav-item:focus-visible {
    background: var(--sidebar-hover);
    color: var(--secondary);
}

.nav-item:hover .nav-icon,
.nav-item:focus-visible .nav-icon {
    opacity: 1;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--secondary);
    font-weight: 600;
    border-left: 3px solid var(--secondary);
    padding-left: calc(1.25rem - 3px);
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-parent {
    cursor: pointer;
}

.submenu {
    display: none;
    margin-left: 0.5rem;
}

.submenu.active {
    display: block;
}

.submenu .nav-item {
    padding-left: 2.25rem;
    border-left: none;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.sidebar-user {
    flex-shrink: 0;
    background: white;
    border-top: 1px solid var(--sidebar-border);
    padding: 0.875rem 1rem;
    padding-bottom: calc(0.875rem + var(--safe-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    overflow: hidden;
    min-width: 0;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 100%
    );
    color: white;
    font-weight: 700;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    min-width: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.btn-logout:hover,
.btn-logout:focus-visible {
    background: var(--error-light);
    border-color: var(--error);
    color: var(--error);
}

/* -----------------------------------------------------------------------------
   4. LAYOUT — MAIN CONTENT
   ----------------------------------------------------------------------------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    min-width: 0;
}

.top-bar {
    flex-shrink: 0;
    background: white;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(
        135deg,
        var(--primary-dark) 0%,
        var(--secondary) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.top-bar-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.logout-form-top {
    margin: 0;
}

.btn-logout-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn-logout-top:hover,
.btn-logout-top:focus-visible {
    background: var(--error-light);
    border-color: var(--error);
    color: var(--error);
}

.container {
    padding: 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
}

/* -----------------------------------------------------------------------------
   5. MOBILE TOGGLE & OVERLAY
   ----------------------------------------------------------------------------- */
.mobile-toggle {
    display: none;
    position: fixed;
    top: calc(1rem + var(--safe-top));
    left: calc(1rem + var(--safe-left));
    z-index: 1100;
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    touch-action: manipulation;
}

.mobile-toggle:hover {
    background: var(--sidebar-hover);
}

.hamburger {
    width: 24px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 2px;
    background: var(--sidebar-text);
    border-radius: 2px;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 950;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    touch-action: none;
}

.overlay.active {
    display: block;
}

/* -----------------------------------------------------------------------------
   6. ALERTS
   ----------------------------------------------------------------------------- */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border: 1px solid var(--success);
}

.alert-error {
    background-color: var(--error-light);
    color: #991b1b;
    border: 1px solid var(--error);
}

.alert-info {
    background-color: var(--info-light);
    color: #1e40af;
    border: 1px solid var(--info);
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400e;
    border: 1px solid var(--warning);
}

/* -----------------------------------------------------------------------------
   7. BOTONES
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition:
        background 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
    line-height: 1.5;
    touch-action: manipulation;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-secondary {
    background: var(--secondary);
    color: white;
}
.btn-danger {
    background: var(--error);
    color: white;
}
.btn-success {
    background: var(--success);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

/* -----------------------------------------------------------------------------
   8. CARDS
   ----------------------------------------------------------------------------- */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--secondary);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

/* -----------------------------------------------------------------------------
   9. FORMULARIOS
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-size: max(0.875rem, 16px);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    background: white;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-size: 0.875rem;
}

/* -----------------------------------------------------------------------------
   10. TABLAS
   ----------------------------------------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

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

th {
    background: linear-gradient(
        135deg,
        var(--primary-light) 0%,
        var(--secondary-light) 100%
    );
    color: var(--secondary);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

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

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* -----------------------------------------------------------------------------
   11. BADGES & STATS
   ----------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.badge-secondary {
    background: var(--secondary-light);
    color: var(--secondary);
}
.badge-success {
    background: var(--success-light);
    color: #065f46;
}
.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}
.badge-error {
    background: var(--error-light);
    color: #991b1b;
}
.badge-info {
    background: var(--info-light);
    color: #1e40af;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 1.75rem;
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 100%
    );
    color: white;
}

.stat-content h3 {
    font-size: 1.75rem;
    margin: 0;
    color: var(--secondary);
    font-weight: 700;
    line-height: 1;
}

.stat-content p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* -----------------------------------------------------------------------------
   12. LOGIN
   ----------------------------------------------------------------------------- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        135deg,
        #faf7f5 0%,
        var(--secondary-light) 50%,
        #f9fafb 100%
    );
    min-height: 100dvh;
    overflow: hidden;
}

body.login-page::before {
    content: "";
    position: fixed;
    top: -30%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(
        circle,
        rgba(202, 185, 170, 0.2) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

body.login-page::after {
    content: "";
    position: fixed;
    bottom: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(
        circle,
        rgba(157, 133, 98, 0.12) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + var(--safe-bottom));
    position: relative;
    z-index: 1;
    animation: fadeUp 0.5s ease both;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow:
        0 20px 60px rgba(157, 133, 98, 0.15),
        0 4px 16px rgba(202, 185, 170, 0.12);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 100%
    );
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    position: relative;
}

.login-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 24px;
    background: white;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.logo-mark {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-header h1 {
    color: white;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
}

.login-body {
    padding: 2rem 2rem 2.5rem;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.login-body input[type="email"],
.login-body input[type="password"] {
    padding-left: 2.75rem;
    font-size: max(1rem, 16px);
    border-width: 1.5px;
    background: #fafafa;
}

.login-body input.is-invalid {
    border-color: var(--error);
    background: var(--error-light);
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 400;
}

.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--secondary);
    padding: 0;
    font-size: inherit;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

.btn-login {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 100%
    );
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    touch-action: manipulation;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(157, 133, 98, 0.35);
}

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

.login-footer {
    padding: 1rem 2rem;
    background: #f9fafb;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* -----------------------------------------------------------------------------
   13. UTILIDADES
   ----------------------------------------------------------------------------- */
.text-muted {
    color: var(--text-secondary);
}
.text-primary {
    color: var(--primary);
}
.text-secondary {
    color: var(--secondary);
}
.small {
    font-size: 0.875rem;
}

.sidebar-header .logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0;
    gap: 0.25rem;
}

.logo-wordmark {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.875rem; /* 30px — legible en sidebar */
    font-weight: 600;
    letter-spacing: 0.18em;
    line-height: 1;
    color: white;
}

.logo-tagline {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.6875rem; /* 11px */
    font-weight: 300;
    letter-spacing: 0.22em;
    text-transform: none;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1;
}

/* --- Login: logo dentro del login-header (mismo fondo degradado) --- */
.login-header .logo-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding-bottom: 0.5rem; /* compensa la curva blanca del ::after */
}

/* En login el wordmark puede ser más grande */
.login-header .logo-wordmark {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 2.5rem; /* 40px */
    font-weight: 600;
    letter-spacing: 0.2em;
    line-height: 1;
    color: white;
}

.login-header .logo-tagline {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.8125rem; /* 13px */
    font-weight: 300;
    letter-spacing: 0.25em;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1;
}

/* -----------------------------------------------------------------------------
   14. ANIMACIONES
   ----------------------------------------------------------------------------- */
@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

/* -----------------------------------------------------------------------------
   15. ACCESIBILIDAD
   ----------------------------------------------------------------------------- */
*:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   16. RESPONSIVE — Tablet (≤ 992px)
   ----------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .container {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .top-bar-date {
        display: none;
    }
}

/* -----------------------------------------------------------------------------
   17. RESPONSIVE — Mobile (≤ 768px)
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        padding-top: var(--safe-top);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .mobile-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .top-bar {
        padding-left: 4.5rem;
        padding-right: 1rem;
        padding-top: calc(1rem + var(--safe-top));
    }

    .page-title {
        font-size: 1.125rem;
    }

    .container {
        padding: 1rem;
    }

    .btn-logout-top .btn-logout-name {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.8125rem;
    }

    th,
    td {
        padding: 0.625rem 0.75rem;
    }

    .actions {
        flex-direction: column;
    }
    .actions .btn {
        width: 100%;
        justify-content: center;
    }

    .login-wrapper {
        padding: 1rem;
    }
    .login-header {
        padding: 2rem 1.5rem 1.75rem;
    }
    .login-body {
        padding: 1.5rem;
    }
}

/* -----------------------------------------------------------------------------
   18. RESPONSIVE — Mobile pequeño (≤ 375px)
   ----------------------------------------------------------------------------- */
@media (max-width: 375px) {
    .page-title {
        font-size: 1rem;
    }
    .top-bar {
        padding-left: 4rem;
    }
    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .logo-wordmark {
        font-size: 1.625rem;
    }
    .login-header .logo-wordmark {
        font-size: 2rem;
    }
}
