/* Tema moderno para admin_v2 basado en variables CSS y colores del logo */

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

/* Variables por defecto (pueden ser sobrescritas por logo-colors.php) */
:root {
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-primary-light: #5dade2;
    --color-secondary: #2c3e50;
    --color-secondary-dark: #1a252f;
    --color-accent: #27ae60;
    --color-accent-dark: #229954;
    --color-header: var(--color-secondary);
    --color-background: #f5f6fa;
    --color-background-light: #ffffff;
    --color-text: #2c3e50;
    --color-text-light: #6c757d;
    --color-border: #e0e4eb;
    --color-shadow: rgba(0, 0, 0, 0.08);
    --color-shadow-strong: rgba(0, 0, 0, 0.12);
    --border-radius-sm: 6px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 1.75rem auto 2rem;
    padding: 0 24px;
}

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

a:hover {
    color: var(--color-primary-dark);
}

/* Header tipo barra superior (estilo SIGED) */
.header {
    background: #e1e3e8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    height: 100%;
    margin-right: 1.5rem;
}

.logo-link {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo-img {
    max-height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.55));
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--color-text);
    background: #f0f2f5;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-icon:hover {
    background-color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.nav-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    cursor: pointer;
}

.nav-dropdown-arrow {
    font-size: 0.7rem;
    margin-left: 0.25rem;
    opacity: 0.7;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    left: auto;
    min-width: 190px;
    background: #ffffff;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0;
    display: none;
    z-index: 1050;
}

.nav-dropdown-menu.open {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.nav-dropdown-item:hover {
    background: #f5f5f7;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu {
    position: relative;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #f0f2f5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text);
}

.user-chip-initials {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-chip-name {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-chip-arrow {
    font-size: 0.65rem;
    opacity: 0.7;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    min-width: 160px;
    padding: 0.25rem 0;
    background: #fff;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: none;
    z-index: 1100;
}

.user-menu-dropdown.open {
    display: block;
}

.user-menu-item {
    display: block;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    color: var(--color-text);
}

.user-menu-item:hover {
    background: #f5f5f7;
}

.card {
    background-color: var(--color-background-light);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px var(--color-shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
}

.card-body {
    padding: 1rem;
}

/* Layout específico para tarjetas de filtros */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-column-gap: 1rem;
    grid-row-gap: 0.75rem;
    align-items: end;
}

.filters-grid .filter-span-4 {
    grid-column: span 4;
}

.filters-grid .filter-span-6 {
    grid-column: span 6;
}

.filters-grid .filter-span-3 {
    grid-column: span 3;
}

.filters-grid .filter-span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .filters-grid .filter-span-4,
    .filters-grid .filter-span-3,
    .filters-grid .filter-span-2,
    .filters-grid .filter-span-6 {
        grid-column: span 12;
    }
}

.filters-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Variante: centrar botones de acciones */
.filters-actions-center {
    justify-content: center !important;
}

@media (max-width: 1024px) {
    /* En anchos medios, que el bloque de botones ocupe toda la fila */
    .filters-grid .filters-actions:not(.filters-actions-center) {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .filters-actions:not(.filters-actions-center) {
        justify-content: stretch;
    }
    .filters-actions:not(.filters-actions-center) .btn {
        flex: 1 1 50%;
    }
}

/* Cards de tablas: altura estable */
.card-table-fixed .card-body {
    min-height: 260px;
}

.small-box-modern {
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.25rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 10px var(--color-shadow-strong);
    height: 100%;
}

.small-box-modern h3 {
    margin: 0;
    font-size: 1.6rem;
}

.small-box-modern p {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.95rem;
}

.small-box-modern-footer {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Dashboard: igualar ancho/alto y tipografía */
.dashboard-title {
    margin: 1rem 0 1.25rem;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
}

.dashboard-small-box {
    width: 100%;
    height: 150px; /* Más anchos visualmente y menos altura */
    min-height: 150px;
    padding: 0.85rem 1rem;
}

/* Evita que el h3 (número + paréntesis) rompa en 2 líneas y cambie la altura */
.dashboard-small-box h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.dashboard-small-box .small-box-modern-footer {
    margin-top: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color var(--transition-normal), transform var(--transition-fast), box-shadow var(--transition-normal);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    box-shadow: 0 2px 6px var(--color-shadow-strong);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding-inline: 0.7rem;
}

.table-modern {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed;
}

/* Scroll horizontal: evita columnas aplastadas / solapadas en pantallas estrechas */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.35rem;
}

.table-modern th,
.table-modern td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    height: 52px;
    vertical-align: middle;
}

/* Primera columna: permitir saltos de línea para evitar desbordes */
.table-modern td:first-child {
    white-space: normal;
}

/* Última columna (Opciones): ancho fijo y sin salto */
.table-modern th:last-child,
.table-modern td:last-child {
    width: 72px;
    white-space: nowrap;
    text-align: right;
}

/* Botones compactos en columnas de acciones */
.table-modern td:last-child .btn,
.table-modern td:nth-last-child(2) .btn {
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
}

/* Columna de curso en tablas: truncar con puntos suspensivos */
.table-modern td.col-curso {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chips de estado en tablas de pagos */
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: default;
}

.status-chip-success {
    background-color: #27ae60;
    color: #fff;
}

.status-chip-danger {
    background-color: #e74c3c;
    color: #fff;
    cursor: pointer;
}

.table-modern td.col-status {
    text-align: center;
}

/* Columna acciones: encabezado sin texto, centrado */
.table-modern th.col-actions {
    text-align: center;
}

.btn-trash .icon-trash {
    font-size: 1.05rem;
    line-height: 1;
}

/* Modal simple */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.modal-dialog-simple {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    max-width: 380px;
    width: 90%;
    padding: 1.25rem 1.5rem;
}

.modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.modal-text {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Filas alternas y efecto hover para tablas */
.table-modern tbody tr:nth-child(even) {
    background-color: #f8f9fb;
}

.table-modern tbody tr:hover {
    background-color: #eef3ff;
}

/* Inputs / selects básicos */
.form-control {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--color-text);
    background-color: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.12);
}

/* Select2 integración */
.select2-container .select2-selection--single {
    height: auto;
    min-height: 34px;
    padding: 0.2rem 0.4rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--color-text);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
}

.table-modern th {
    text-align: left;
    font-weight: 600;
    background-color: #f0f3f8;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

.badge-success {
    background-color: #27ae60;
    color: #fff;
}

.badge-warning {
    background-color: #f1c40f;
    color: #333;
}

.badge-secondary {
    background-color: #95a5a6;
    color: #fff;
}

/* Paginación DataTables moderna */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 0.75rem;
    text-align: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 0.25rem 0.55rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #f0f2f5;
    color: var(--color-text) !important;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--color-primary);
    color: #fff !important;
    border-color: var(--color-primary-dark);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #ffffff;
    color: var(--color-primary-dark) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #f5f5f7;
    color: var(--color-text-light) !important;
    border-color: rgba(0, 0, 0, 0.03);
    box-shadow: none;
    cursor: default;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* Paginación vanilla para listados */
.pagination-vanilla {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.pagination-vanilla-inner {
    display: flex;
    align-items: center;
}

.pagination-vanilla-inner button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 0.25rem 0.55rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #f0f2f5;
    color: var(--color-text);
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
}

.pagination-vanilla-inner button:hover:not(.is-disabled):not(.is-current) {
    background: #ffffff;
}

.pagination-vanilla-inner button.is-current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary-dark);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.pagination-vanilla-inner button.is-disabled {
    background: #f5f5f7;
    color: var(--color-text-light);
    border-color: rgba(0, 0, 0, 0.03);
    cursor: default;
    box-shadow: none;
}

.pagination-info {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* Footer */
.footer-main {
    border-top: 1px solid rgba(0,0,0,0.08);
    background: #e1e3e8;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
    width: 100%;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.45rem 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

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

.footer-logo-link {
    display: flex;
    align-items: center;
}

.footer-logo-img {
    max-height: 26px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
}

.footer-left-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.footer-text-strong {
    font-weight: 600;
    color: var(--color-text);
}

.footer-text-muted {
    color: var(--color-text-light);
}

.footer-link-strong {
    color: var(--color-primary-dark);
    font-weight: 600;
}

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

.footer-right {
    text-align: right;
}

.app-footer {
    padding: 0.75rem 1.5rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

/* Toasts simples */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-message {
    min-width: 260px;
    max-width: 360px;
    padding: 0.6rem 0.9rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 10px var(--color-shadow-strong);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

.toast-success {
    /* Verde fijo para éxito, independiente de los colores del logo */
    background-color: #27ae60;
}

.toast-error {
    background-color: #e74c3c;
}

.toast-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding-left: 0.75rem;
}

/* ——— Cabecera: bloque izquierdo (hamburguesa + logo) ——— */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    min-width: 0;
}

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: var(--border-radius-sm);
    background: #f0f2f5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    color: var(--color-text);
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background: #ffffff;
}

.mobile-menu-toggle-bars,
.mobile-menu-toggle-bars::before,
.mobile-menu-toggle-bars::after {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
}

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

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

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

body.mobile-nav-open .mobile-menu-toggle-bars {
    background: transparent;
}

body.mobile-nav-open .mobile-menu-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
}

body.mobile-nav-open .mobile-menu-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Escritorio: sin drawer ni botón */
@media (min-width: 901px) {
    .mobile-menu-toggle,
    .mobile-nav-backdrop,
    .mobile-nav-panel {
        display: none !important;
    }
}

/* Móvil / tablet estrecha: menú lateral */
@media (max-width: 900px) {
    html,
    body {
        overflow-x: hidden;
    }

    .header-content {
        padding: 0 12px;
        height: auto;
        min-height: 56px;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .nav-desktop {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .logo {
        margin-right: 0;
        flex: 1;
        min-width: 0;
        justify-content: flex-start;
    }

    .logo-img {
        max-height: 40px;
    }

    .user-chip-name {
        max-width: 72px;
    }

    .user-chip {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1001;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition-normal), visibility var(--transition-normal);
        pointer-events: none;
    }

    body.mobile-nav-open .mobile-nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .mobile-nav-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 88vw);
        max-width: 100%;
        z-index: 1002;
        background: #f5f6f8;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.mobile-nav-open .mobile-nav-panel {
        transform: translateX(0);
    }

    .mobile-nav-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--color-border);
        background: #e1e3e8;
        flex-shrink: 0;
    }

    .mobile-nav-panel-title {
        font-weight: 600;
        font-size: 1rem;
        color: var(--color-text);
    }

    .mobile-nav-close {
        width: 40px;
        height: 40px;
        border: none;
        border-radius: var(--border-radius-sm);
        background: #f0f2f5;
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        color: var(--color-text);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav-close:hover {
        background: #fff;
    }

    .mobile-nav-panel-inner {
        display: flex;
        flex-direction: column;
        padding: 0.5rem 0 1rem;
        gap: 0.15rem;
    }

    .mobile-nav-link {
        display: block;
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--color-text);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-link:hover {
        background: #fff;
        color: var(--color-primary-dark);
    }

    .mobile-nav-details {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-summary {
        list-style: none;
        cursor: pointer;
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--color-text);
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .mobile-nav-summary::-webkit-details-marker {
        display: none;
    }

    .mobile-nav-summary::after {
        content: '▾';
        font-size: 0.75rem;
        opacity: 0.65;
        flex-shrink: 0;
        transition: transform var(--transition-fast);
    }

    .mobile-nav-details[open] .mobile-nav-summary::after {
        transform: rotate(180deg);
    }

    .mobile-nav-sub {
        display: flex;
        flex-direction: column;
        padding: 0 0 0.35rem;
        background: rgba(255, 255, 255, 0.6);
    }

    .mobile-nav-sublink {
        display: block;
        padding: 0.5rem 1rem 0.5rem 1.35rem;
        font-size: 0.9rem;
        color: var(--color-text);
    }

    .mobile-nav-sublink:hover {
        background: #fff;
        color: var(--color-primary-dark);
    }

    .container {
        margin-top: 1rem;
        padding: 0 16px;
    }

    .dashboard-title {
        font-size: 1.45rem;
    }

    /* Tablas listado: últimas 2 columnas ocultas; fila extra con + (table-mobile-expand.js) */
    .table-responsive--mobile-expand {
        overflow-x: auto;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    /* auto + sin % forzados: evita cabeceras pegadas (Referencia+Curso) y texto encimado */
    .table-modern--mobile-expand {
        table-layout: auto;
        width: 100%;
        max-width: 100%;
    }

    .table-modern--mobile-expand thead th {
        width: auto !important;
        min-width: 0;
        max-width: 9.5rem;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        font-size: 0.7rem;
        line-height: 1.25;
        padding: 0.4rem 0.35rem;
        vertical-align: bottom;
    }

    .table-modern--mobile-expand thead th:nth-last-child(-n + 2),
    .table-modern--mobile-expand tfoot th:nth-last-child(-n + 2) {
        display: none;
    }

    .table-modern--mobile-expand tfoot th:not(:nth-last-child(-n + 2)) {
        width: auto !important;
        min-width: 0;
        max-width: 9.5rem;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        font-size: 0.68rem;
        line-height: 1.2;
        padding: 0.35rem 0.35rem;
    }

    .table-modern--mobile-expand tbody tr:not(.table-mobile-detail-row) td:nth-last-child(-n + 2) {
        display: none !important;
    }

    .table-modern--mobile-expand tbody tr:not(.table-mobile-detail-row) td {
        min-width: 0;
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        vertical-align: top;
        height: auto;
        min-height: 44px;
        padding: 0.4rem 0.35rem;
        font-size: 0.82rem;
        line-height: 1.35;
    }

    /* Primera columna: botón fuera del flujo del texto (emails largos ya no invaden la 2.ª) */
    .table-modern--mobile-expand tbody tr:not(.table-mobile-detail-row) td:first-child {
        position: relative;
        padding-left: 2.65rem;
        padding-top: 0.45rem;
    }

    .table-modern--mobile-expand tbody tr:not(.table-mobile-detail-row) td.col-curso {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .table-modern--mobile-expand tbody tr:not(.table-mobile-detail-row) td small {
        display: block;
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .table-modern--mobile-expand tbody tr:not(.table-mobile-detail-row) td a {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .table-modern--mobile-expand .table-mobile-expand-btn {
        position: absolute;
        left: 0.35rem;
        top: 0.4rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 2rem;
        height: 2rem;
        margin: 0;
        padding: 0;
        float: none;
        border: 1px solid rgba(0, 0, 0, 0.12);
        border-radius: var(--border-radius-sm);
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        font-size: 1.15rem;
        font-weight: 600;
        line-height: 1;
        color: var(--color-primary-dark);
        cursor: pointer;
    }

    .table-modern--mobile-expand .table-mobile-expand-btn:hover {
        background: #f0f3f8;
    }

    /* Fila desplegable: mismo ancho que la tabla, contenido contenido sin desbordar */
    .table-mobile-detail-row .table-mobile-detail-cell {
        padding: 0.55rem 0.45rem;
        background: #eef1f6;
        border-bottom: 1px solid var(--color-border);
        vertical-align: top;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .table-mobile-detail-inner {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.65rem 1rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .table-mobile-detail-block {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        min-width: 0;
        max-width: 100%;
        flex: 1 1 auto;
    }

    .table-mobile-detail-label {
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        color: var(--color-text-light);
    }

    .table-mobile-detail-block-body {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.35rem;
        max-width: 100%;
        min-width: 0;
    }

    .table-mobile-detail-block-body form {
        max-width: 100%;
    }

    .table-modern th,
    .table-modern td {
        height: auto;
        min-height: 48px;
    }

    .table-modern tfoot th {
        white-space: nowrap;
    }
}


/* Listados de pagos: compacto, sin scroll horizontal */
.table-pagos-wrap.table-responsive,
.table-pagos-wrap {
    overflow-x: hidden !important;
    max-width: 100%;
}
.table-pagos {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}
.table-pagos th,
.table-pagos td {
    height: auto !important;
    min-height: 0;
    white-space: normal;
    vertical-align: top;
    padding: 0.45rem 0.4rem !important;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.table-pagos th {
    font-size: 0.75rem;
    letter-spacing: 0;
    text-transform: none;
}
.table-pagos th.col-usuario,
.table-pagos td:nth-child(1) { width: 24%; }
.table-pagos th.col-pago,
.table-pagos td:nth-child(2) { width: 18%; }
.table-pagos th.col-monto,
.table-pagos td.col-monto {
    width: 13%;
    white-space: normal;
    font-variant-numeric: tabular-nums;
}
.table-pagos th.col-usd,
.table-pagos td.col-usd {
    width: 9%;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.table-pagos th.col-curso-h,
.table-pagos td.col-curso {
    width: 28%;
    white-space: normal;
    overflow: hidden;
}
.table-pagos th.col-actions,
.table-pagos td.col-actions-cell,
.table-pagos th:last-child,
.table-pagos td:last-child {
    width: 8% !important;
    min-width: 0 !important;
    max-width: 72px;
    text-align: center;
    white-space: nowrap;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
}
.table-pagos .monto-usd {
    font-weight: 700;
    color: var(--color-secondary);
}
.table-pagos .monto-tasa,
.table-pagos .monto-vacio {
    color: var(--color-text-light);
    font-size: 0.78rem;
}
.table-pagos .acciones-pagos {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
}
.table-pagos td small,
.table-pagos td a {
    word-break: break-all;
}
.table-pagos tfoot th {
    white-space: normal !important;
    font-size: 0.75rem;
    letter-spacing: 0;
    text-transform: none;
    padding: 0.4rem 0.35rem !important;
}
@media (max-width: 768px) {
    .table-pagos-wrap.table-responsive,
    .table-pagos-wrap {
        overflow-x: auto !important;
    }
}
