body.admin-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--ts-gray-50);
    color: var(--ts-text);
}

.admin-wrapper {
    min-height: 100dvh;
    display: flex;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f766e 0%, #0369a1 100%);
    color: #ecfeff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.admin-brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}

.admin-brand-badge {
    font-size: 0.65rem;
    opacity: 0.75;
    font-weight: 500;
}

.admin-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: #ecfeff;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.2rem;
    opacity: 0.9;
    transition: background 0.15s ease;
}

.admin-nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.admin-nav-link:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    opacity: 1;
}

.admin-nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
}

.admin-nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.admin-nav-section {
    display: block;
    padding: 1rem 1rem 0.4rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.55;
    font-weight: 600;
}

.admin-nav-soon {
    margin-left: auto;
    font-size: 0.6rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.admin-sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-footer .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.45);
    color: #ecfeff;
    font-size: 0.85rem;
}

.admin-sidebar-footer .btn-outline-light:hover,
.admin-sidebar-footer .btn-outline-light:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff;
}

/* Cerrar sesión — acción secundaria visible al pie del sidebar */
.admin-sidebar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: #ecfeff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.admin-sidebar-logout-btn i {
    color: inherit;
    opacity: 1;
}

.admin-sidebar-logout-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
}

.admin-sidebar-logout-btn:focus,
.admin-sidebar-logout-btn:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    outline: none;
}

.admin-sidebar-logout-btn:active {
    color: #fff;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.85);
}

/* Content area */
.admin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--ts-white);
    border-bottom: 1px solid var(--ts-gray-100);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ts-gray-100);
    border-radius: 10px;
    background: var(--ts-white);
    color: var(--ts-text);
    font-size: 1.25rem;
    cursor: pointer;
}

.admin-topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--ts-text);
}

.admin-topbar-subtitle {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
    margin: 0;
}

.admin-topbar-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ts-blue);
    background: var(--ts-sky);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

.admin-main {
    padding: 1.5rem;
    flex: 1;
}

/* Metric cards */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-stat-card {
    background: var(--ts-white);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid rgba(2, 132, 199, 0.08);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.admin-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ts-teal), var(--ts-blue-light));
}

.admin-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--ts-sky);
    color: var(--ts-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.admin-stat-label {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
    font-weight: 500;
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ts-teal);
    line-height: 1;
}

.admin-stat-hint {
    font-size: 0.72rem;
    color: var(--ts-gray-400);
}

/* Module cards */
.admin-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.admin-module-card {
    background: var(--ts-white);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid var(--ts-gray-100);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.admin-module-card:not(.disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.1);
}

.admin-module-card.disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--ts-gray-50);
}

.admin-module-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--ts-sky) 0%, #ecfeff 100%);
    color: var(--ts-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.admin-module-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--ts-text);
}

.admin-module-desc {
    font-size: 0.78rem;
    color: var(--ts-text-muted);
    margin: 0;
    line-height: 1.4;
}

.admin-module-soon {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ts-blue);
    background: var(--ts-sky);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.admin-card {
    background: var(--ts-white);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--ts-gray-100);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.admin-alert-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #ecfeff 0%, #f0f9ff 100%);
    border: 1px solid rgba(2, 132, 199, 0.15);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--ts-gray-600);
}

.admin-alert-info i {
    color: var(--ts-blue);
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* Mobile sidebar overlay */
.admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 998;
}

@media (max-width: 991.98px) {
    .admin-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

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

    .admin-sidebar-overlay.open {
        display: block;
    }

    .admin-main {
        padding: 1rem;
    }

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

@media (min-width: 992px) {
    .admin-modules-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Login administrativo */
.admin-guest-body {
    background: linear-gradient(135deg, #0f766e 0%, #0369a1 100%);
}

.admin-guest-shell .admin-brand-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
}

.admin-guest-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}

/* Tablas admin */
.admin-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ts-gray-500);
    border-bottom-width: 1px;
    white-space: nowrap;
}

.admin-module-card:not(.disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
