:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-alt: #fafafa;
    --border: #d2d2d7;
    --border-light: #e8e8ed;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --accent: #1d1d1f;
    --accent-hover: #000000;
    --accent-contrast: #ffffff;
    --danger: #d9342b;
    --danger-bg: #fdecea;
    --danger-border: #f3c6c2;
    --success: #1c7c34;
    --success-bg: #e8f5ea;
    --warning: #9a6a00;
    --warning-bg: #fdf3dc;

    /* Sidebar tones — derived from the same palette, just applied as a dark panel */
    --sidebar-bg: #1d1d1f;
    --sidebar-surface: #2a2a2d;
    --sidebar-border: rgba(255, 255, 255, .09);
    --sidebar-text: rgba(255, 255, 255, .62);
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(255, 255, 255, .1);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05), 0 1px 1px rgba(0,0,0,.04);
    --shadow-md: 0 8px 20px rgba(0,0,0,.10);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
}

/* ---------- Layout ---------- */

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

.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.menu-toggle {
    display: none;
    background: var(--sidebar-surface);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    line-height: 1;
    color: var(--sidebar-text-hover);
    cursor: pointer;
}

.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--sidebar-text-hover);
    border-radius: 2px;
}

.menu-toggle-bars {
    position: relative;
}

.menu-toggle-bars::before,
.menu-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.menu-toggle-bars::before {
    top: -6px;
}

.menu-toggle-bars::after {
    top: 6px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 0 6px;
}

.logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--sidebar-surface);
    padding: 3px;
}

.logo span {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--sidebar-text-hover);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px 0;
}

.sidebar a {
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    padding: 9px 12px 9px 13px;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.sidebar a:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
}

.sidebar a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
    border-left-color: var(--sidebar-text-hover);
    font-weight: 600;
}

.logout {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--sidebar-border);
    text-align: center;
    color: var(--sidebar-text) !important;
    border-left: none !important;
}

.logout:hover {
    color: var(--danger) !important;
    background: rgba(217, 52, 43, .15);
}

.content {
    flex: 1;
    padding: 34px 42px;
    max-width: 1440px;
}

.topbar {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 18px 24px;
    margin-bottom: 26px;
}

.topbar h1 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.topbar p {
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
}

.topbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.clock {
    text-align: right;
    flex-shrink: 0;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
}

.clock-time {
    display: block;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.clock-date {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* ---------- Alerts ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--text-tertiary);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-left-color: var(--success);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-left-color: var(--danger);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-left-color: var(--warning);
}

/* ---------- Cards & panels ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent);
    padding: 18px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease, transform .15s ease;
}

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

.card h3 {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
}

.card p {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-top: 3px solid var(--text);
    padding: 22px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.panel h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--accent);
    color: var(--accent-contrast);
    text-decoration: none;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(.98);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #b8241c;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-alt);
    border-color: var(--text-tertiary);
}

/* ---------- Forms ---------- */

.form-box {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-top: 3px solid var(--text);
    padding: 22px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

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

label {
    font-weight: 700;
    font-size: 10.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(0,0,0,.07);
}

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

th, td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    font-size: 13.5px;
}

th {
    background: var(--text);
    color: var(--accent-contrast);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

tbody tr:nth-child(even) {
    background: var(--surface-alt);
}

tbody tr:hover {
    background: var(--border-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    padding: 30px;
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13.5px;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(154,106,0,.2);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(28,124,52,.2);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(217,52,43,.2);
}

/* ---------- Calendario ---------- */

.calendario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.calendario-header h2 {
    font-size: 15px;
    font-weight: 700;
    border-bottom: none;
    padding-bottom: 0;
}

.calendario {
    table-layout: fixed;
}

.calendario th {
    text-align: center;
}

.dia-vacio {
    background: var(--surface-alt);
}

.dia-calendario {
    vertical-align: top;
    height: 86px;
    padding: 10px;
}

.dia-calendario a {
    display: block;
    height: 100%;
    text-decoration: none;
    color: var(--text);
}

.dia-calendario:hover {
    background: var(--surface-alt);
}

.dia-hoy {
    background: var(--bg);
    box-shadow: inset 0 0 0 2px var(--text);
}

.numero-dia {
    font-weight: 700;
    font-size: 12.5px;
    display: block;
    margin-bottom: 6px;
}

/* ---------- Auth pages (login / alta de dueño) ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-top: 4px solid var(--text);
    border-radius: var(--radius-md);
    padding: 38px 34px;
    box-shadow: var(--shadow-md);
}

.auth-card-wide {
    max-width: 560px;
}

.auth-logo-img {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 auto 14px;
    border-radius: var(--radius-sm);
}

.auth-logo {
    text-align: center;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 26px;
}

.auth-card h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding-top: 20px;
    margin-top: 4px;
    margin-bottom: 14px;
    border-top: 1px solid var(--border-light);
}

.auth-card h3:first-of-type {
    border-top: none;
    padding-top: 0;
}

.auth-card .btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

.auth-footer {
    text-align: center;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 20px;
}

/* ---------- Responsive (tablet / celular) ---------- */

@media (max-width: 860px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 12px 16px;
        position: relative;
        z-index: 100;
    }

    .sidebar-header {
        padding-bottom: 0;
        margin-bottom: 0;
        border-bottom: none;
    }

    .logo {
        margin: 0;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-panel {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--sidebar-bg);
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--sidebar-border);
        max-height: 0;
        overflow: hidden;
        flex: none;
        transition: max-height .2s ease;
    }

    .sidebar.open .sidebar-panel {
        max-height: 75vh;
        overflow-y: auto;
        padding: 12px 16px 20px;
    }

    .sidebar nav {
        gap: 3px;
    }

    .logout {
        margin-top: 14px;
    }

    .content {
        padding: 18px 16px;
    }

    .topbar {
        padding: 14px 16px;
        margin-bottom: 18px;
    }

    .topbar-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .topbar h1 {
        font-size: 19px;
    }

    .clock {
        text-align: left;
    }

    .clock-time {
        font-size: 17px;
    }

    .cards, .actions, .form-grid {
        grid-template-columns: 1fr;
    }

    .panel, .card, .form-box {
        padding: 16px;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    input, select, textarea {
        font-size: 16px;
    }
}

/* ---------- Animaciones de las pantallas de acceso ---------- */

.auth-page {
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 50%, #f5f5f7 100%);
    background-size: 220% 220%;
    animation: auth-fondo 14s ease-in-out infinite;
}

.auth-card {
    animation: auth-entrada .7s cubic-bezier(.2, .8, .2, 1) both;
}

.auth-logo-img {
    animation: auth-logo-entrada .8s cubic-bezier(.2, .8, .2, 1) .15s both,
               auth-flotar 4.5s ease-in-out 1s infinite;
}

.auth-logo,
.auth-subtitle {
    animation: auth-subir .6s ease .3s both;
}

.auth-card .alert {
    animation: auth-subir .5s ease .35s both;
}

.auth-card form > * {
    animation: auth-subir .5s ease both;
}

.auth-card form > *:nth-child(1) { animation-delay: .40s; }
.auth-card form > *:nth-child(2) { animation-delay: .45s; }
.auth-card form > *:nth-child(3) { animation-delay: .50s; }
.auth-card form > *:nth-child(4) { animation-delay: .55s; }
.auth-card form > *:nth-child(5) { animation-delay: .60s; }
.auth-card form > *:nth-child(6) { animation-delay: .65s; }
.auth-card form > *:nth-child(n+7) { animation-delay: .70s; }

.auth-card .btn {
    position: relative;
    overflow: hidden;
}

.auth-card .btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.28), transparent);
    transform: skewX(-20deg);
}

.auth-card .btn:hover::after {
    animation: auth-brillo .8s ease;
}

.auth-card input:focus {
    transform: translateY(-1px);
}

.auth-card a {
    transition: opacity .15s ease;
}

.auth-card a:hover {
    opacity: .6;
}

@keyframes auth-fondo {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes auth-entrada {
    from { opacity: 0; transform: translateY(28px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-logo-entrada {
    from { opacity: 0; transform: scale(.6) rotate(-8deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes auth-flotar {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

@keyframes auth-subir {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes auth-brillo {
    from { left: -80%; }
    to   { left: 130%; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page,
    .auth-card,
    .auth-logo-img,
    .auth-logo,
    .auth-subtitle,
    .auth-card .alert,
    .auth-card form > * {
        animation: none !important;
    }
}

/* ---------- Menú lateral: íconos y refinamiento ---------- */

.sidebar {
    width: 260px;
    box-shadow: 1px 0 0 rgba(255, 255, 255, .04);
}

.sidebar nav {
    gap: 2px;
    padding: 10px 0;
}

.sidebar nav a,
.sidebar .logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border-left: none;
    position: relative;
    letter-spacing: .005em;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: .75;
    transition: opacity .15s ease, transform .15s ease;
}

.sidebar a:hover .nav-icon {
    opacity: 1;
    transform: translateX(1px);
}

.sidebar a.active {
    background: var(--sidebar-active-bg);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.sidebar a.active .nav-icon {
    opacity: 1;
}

.sidebar a.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-text-hover);
}

.sidebar .logout {
    justify-content: center;
    margin-top: 14px;
    border-top: 1px solid var(--sidebar-border);
    border-radius: var(--radius-md);
    padding-top: 14px;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

@media (max-width: 860px) {
    .sidebar a.active::before { left: 0; }
}

/* ============================================================
   Login: animación mejorada (reemplaza a la anterior)
   ============================================================ */

.auth-page {
    position: relative;
    overflow: hidden;
    background: radial-gradient(1200px 700px at 50% -10%, #ffffff 0%, #eceef4 60%, #e4e6ee 100%);
    animation: none;
}

/* Luces de fondo en el azul del logo */
.auth-page::before,
.auth-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .45;
    pointer-events: none;
}

.auth-page::before {
    width: 460px;
    height: 460px;
    background: #40409a;
    top: -140px;
    left: -120px;
    animation: auth-orbe-a 16s ease-in-out infinite;
}

.auth-page::after {
    width: 380px;
    height: 380px;
    background: #1d1d1f;
    opacity: .22;
    bottom: -140px;
    right: -100px;
    animation: auth-orbe-b 19s ease-in-out infinite;
}

.auth-card {
    position: relative;
    overflow: hidden;
    z-index: 1;
    border-top: 1px solid var(--border-light);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    box-shadow: 0 30px 60px -20px rgba(29, 29, 31, .35), 0 0 0 1px rgba(255, 255, 255, .6);
    animation: auth-card-in .9s cubic-bezier(.16, 1, .3, 1) both;
}

/* Barra superior con degradé que se desplaza */
.auth-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1d1d1f, #40409a, #1d1d1f, #40409a);
    background-size: 300% 100%;
    animation: auth-barra 5s linear infinite;
}

/* Logo: entra girando y emite pulsos */
.auth-logo-img {
    border-radius: 50%;
    background: #fff;
    animation:
        auth-logo-spin 1.1s cubic-bezier(.16, 1, .3, 1) .15s both,
        auth-pulso 2.8s ease-out 1.3s infinite,
        auth-flotar 5s ease-in-out 1.3s infinite;
}

.auth-logo,
.auth-subtitle {
    animation: auth-subir .7s cubic-bezier(.16, 1, .3, 1) .45s both;
}

.auth-subtitle { animation-delay: .55s; }

.auth-card .alert {
    animation: auth-subir .5s ease .2s both;
}

.auth-card .alert-danger {
    animation: auth-subir .4s ease .1s both, auth-temblor .5s ease .5s;
}

.auth-card form > * {
    animation: auth-subir .6s cubic-bezier(.16, 1, .3, 1) both;
}

.auth-card form > *:nth-child(1) { animation-delay: .65s; }
.auth-card form > *:nth-child(2) { animation-delay: .70s; }
.auth-card form > *:nth-child(3) { animation-delay: .75s; }
.auth-card form > *:nth-child(4) { animation-delay: .80s; }
.auth-card form > *:nth-child(5) { animation-delay: .85s; }
.auth-card form > *:nth-child(6) { animation-delay: .90s; }
.auth-card form > *:nth-child(n+7) { animation-delay: .95s; }

.auth-card input {
    transition: border-color .2s ease, box-shadow .25s ease, transform .2s ease;
}

.auth-card input:focus {
    border-color: #40409a;
    box-shadow: 0 0 0 4px rgba(64, 64, 154, .14);
    transform: translateY(-1px);
}

.auth-card .btn {
    transition: transform .15s ease, box-shadow .25s ease, background .2s ease;
}

.auth-card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px -8px rgba(29, 29, 31, .55);
}

.auth-card .btn:active {
    transform: translateY(0) scale(.99);
}

/* Estado de carga del botón al enviar */
.auth-card .btn.cargando {
    pointer-events: none;
    opacity: .85;
}

.auth-card .btn.cargando::before {
    content: "";
    width: 15px;
    height: 15px;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-girar .7s linear infinite;
}

.auth-footer,
.auth-card > a {
    animation: auth-subir .6s ease 1.05s both;
}

@keyframes auth-orbe-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(140px, 90px) scale(1.2); }
}

@keyframes auth-orbe-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-130px, -80px) scale(1.15); }
}

@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(40px) scale(.95); filter: blur(6px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes auth-barra {
    from { background-position: 0% 0; }
    to   { background-position: 300% 0; }
}

@keyframes auth-logo-spin {
    from { opacity: 0; transform: scale(.3) rotate(-270deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes auth-pulso {
    0%   { box-shadow: 0 0 0 0 rgba(64, 64, 154, .35); }
    100% { box-shadow: 0 0 0 22px rgba(64, 64, 154, 0); }
}

@keyframes auth-temblor {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes auth-girar {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page::before,
    .auth-page::after,
    .auth-card::before,
    .auth-card,
    .auth-logo-img,
    .auth-footer,
    .auth-card > a,
    .auth-card .alert-danger {
        animation: none !important;
    }
}

/* ============================================================
   Login dividido: logo a media pantalla + formulario
   ============================================================ */

.login-split {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* ----- Mitad izquierda: logo ----- */

.login-brand {
    position: relative;
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
    background: radial-gradient(900px 600px at 30% 20%, #ffffff 0%, #eef0f8 55%, #dfe2f1 100%);
    animation: login-brand-in 1.1s cubic-bezier(.16, 1, .3, 1) both;
}

.login-orbe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

.login-orbe-a {
    width: 460px;
    height: 460px;
    background: #40409a;
    opacity: .32;
    top: -120px;
    left: -120px;
    animation: auth-orbe-a 15s ease-in-out infinite;
}

.login-orbe-b {
    width: 380px;
    height: 380px;
    background: #1d1d1f;
    opacity: .16;
    bottom: -120px;
    right: -80px;
    animation: auth-orbe-b 18s ease-in-out infinite;
}

.login-logo-wrap {
    position: relative;
    width: min(56%, 460px);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.login-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 30px 70px -20px rgba(64, 64, 154, .55), 0 0 0 10px rgba(255, 255, 255, .7);
    animation:
        login-logo-in 1.4s cubic-bezier(.16, 1, .3, 1) .35s both,
        auth-flotar 6s ease-in-out 1.8s infinite;
}

/* Anillos que giran y se expanden alrededor del logo */
.login-anillo {
    position: absolute;
    inset: -6%;
    border-radius: 50%;
    border: 2px dashed rgba(64, 64, 154, .45);
    animation: login-anillo-in 1.2s ease .6s both, auth-girar 28s linear 1.8s infinite;
}

.login-anillo-2 {
    inset: -14%;
    border: 1px solid rgba(64, 64, 154, .25);
    animation: login-anillo-in 1.4s ease .8s both, login-onda 3.4s ease-out 2s infinite;
}

.login-marca {
    margin-top: 44px;
    z-index: 1;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: auth-subir .8s cubic-bezier(.16, 1, .3, 1) 1.1s both;
}

.login-lema {
    z-index: 1;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 15px;
    letter-spacing: .12em;
    text-transform: uppercase;
    animation: auth-subir .8s cubic-bezier(.16, 1, .3, 1) 1.25s both;
}

/* ----- Mitad derecha: formulario ----- */

.login-panel {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--surface);
    animation: login-panel-in 1.1s cubic-bezier(.16, 1, .3, 1) both;
}

.login-form {
    width: 100%;
    max-width: 380px;
}

.login-form h1 {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: auth-subir .7s cubic-bezier(.16, 1, .3, 1) .7s both;
}

.login-sub {
    color: var(--text-secondary);
    margin: 4px 0 28px;
    animation: auth-subir .7s cubic-bezier(.16, 1, .3, 1) .8s both;
}

.login-campo {
    margin-bottom: 18px;
    animation: auth-subir .7s cubic-bezier(.16, 1, .3, 1) both;
}

.login-campo:nth-of-type(1) { animation-delay: .9s; }
.login-campo:nth-of-type(2) { animation-delay: 1s; }

.login-form input {
    padding: 12px 14px;
    transition: border-color .2s ease, box-shadow .25s ease, transform .2s ease;
}

.login-form input:focus {
    border-color: #40409a;
    box-shadow: 0 0 0 4px rgba(64, 64, 154, .14);
    transform: translateY(-1px);
}

.login-form .btn {
    width: 100%;
    padding: 13px;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
    animation: auth-subir .7s cubic-bezier(.16, 1, .3, 1) 1.1s both;
    transition: transform .15s ease, box-shadow .25s ease;
}

.login-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px -8px rgba(29, 29, 31, .55);
}

.login-form .btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.28), transparent);
    transform: skewX(-20deg);
}

.login-form .btn:hover::after {
    animation: auth-brillo .8s ease;
}

.login-form .btn.cargando {
    pointer-events: none;
    opacity: .85;
}

.login-form .btn.cargando::before {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: auth-girar .7s linear infinite;
}

.login-form .alert {
    animation: auth-subir .4s ease .1s both;
}

.login-form .alert-danger {
    animation: auth-subir .4s ease .1s both, auth-temblor .5s ease .5s;
}

.login-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    animation: auth-subir .7s ease 1.3s both;
}

.login-links a {
    transition: opacity .15s ease;
}

.login-links a:hover {
    opacity: .6;
}

@keyframes login-brand-in {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

@keyframes login-panel-in {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes login-logo-in {
    from { opacity: 0; transform: scale(.2) rotate(-360deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes login-anillo-in {
    from { opacity: 0; transform: scale(.6); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes login-onda {
    0%   { transform: scale(.95); opacity: .6; }
    100% { transform: scale(1.18); opacity: 0; }
}

/* Celular / pantallas angostas: el logo queda arriba */
@media (max-width: 860px) {
    .login-split {
        flex-direction: column;
    }

    .login-brand {
        flex: none;
        min-height: 300px;
        padding: 28px 20px;
        animation-name: auth-subir;
    }

    .login-logo-wrap {
        width: 150px;
    }

    .login-marca {
        margin-top: 24px;
        font-size: 22px;
    }

    .login-lema {
        font-size: 12px;
    }

    .login-panel {
        flex: 1;
        padding: 32px 20px;
        animation-name: auth-subir;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-brand,
    .login-panel,
    .login-logo,
    .login-anillo,
    .login-orbe,
    .login-marca,
    .login-lema,
    .login-form h1,
    .login-sub,
    .login-campo,
    .login-form .btn,
    .login-links,
    .login-form .alert {
        animation: none !important;
    }
}

/* ============================================================
   Estilo profesional de dashboards, paneles y tablas
   (se aplica a todos los dashboards y listados)
   ============================================================ */

.content {
    padding: 28px 40px 48px;
    max-width: 1480px;
}

/* Encabezado de página */
.topbar {
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px 26px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    position: relative;
    overflow: hidden;
}

.topbar::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #1d1d1f, #40409a);
}

.topbar h1 {
    font-size: 22px;
    letter-spacing: -0.02em;
}

.topbar p {
    margin-top: 2px;
}

/* Tarjetas de indicadores */
.cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    position: relative;
    border: 1px solid var(--border-light);
    border-left: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px 22px 22px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.card::before {
    content: "";
    display: block;
    width: 30px;
    height: 4px;
    border-radius: 4px;
    background: #1d1d1f;
    margin-bottom: 14px;
}

.card:nth-child(4n+2)::before { background: #40409a; }
.card:nth-child(4n+3)::before { background: var(--success); }
.card:nth-child(4n+4)::before { background: var(--warning); }

.card::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(64,64,154,.07), transparent 70%);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px -14px rgba(29,29,31,.28);
    border-color: var(--border);
}

.card h3 {
    font-size: 11px;
    letter-spacing: .07em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card p {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

/* Paneles */
.panel,
.form-box {
    border: 1px solid var(--border-light);
    border-top: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 24px 26px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.panel h2,
.form-box h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.panel h2::before,
.form-box h2::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 3px;
    background: linear-gradient(180deg, #1d1d1f, #40409a);
}

/* Tarjetas dentro de paneles: más compactas */
.panel .cards {
    margin: 18px 0 0;
}

.panel .card {
    box-shadow: none;
    background: var(--surface-alt);
}

/* Tablas */
table {
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: none;
}

th {
    background: #f1f2f6;
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: .07em;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 13px 16px;
    font-size: 14px;
}

tbody tr:nth-child(even) {
    background: transparent;
}

tbody tr {
    transition: background .15s ease;
}

tbody tr:hover {
    background: #f6f7fb;
}

.empty-state {
    border-radius: 12px;
    border: 1px dashed var(--border);
    background: var(--surface-alt);
    padding: 36px;
}

/* Botones de acceso rápido */
.actions .btn,
.btn-secondary {
    border-radius: 10px;
}

.actions .btn {
    padding: 13px 18px;
    justify-content: flex-start;
}

/* Etiquetas de estado */
.badge {
    border-radius: 999px;
}

@media (max-width: 860px) {
    .content { padding: 16px 14px 40px; }
    .topbar { padding: 16px 18px; }
    .card p { font-size: 24px; }
}

/* ---------- Menú lateral agrupado por secciones ---------- */

.nav-seccion {
    margin: 16px 0 4px;
    padding: 0 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .34);
}

.sidebar nav .nav-seccion:first-of-type {
    margin-top: 6px;
}
