/* =================================================================
    1. VARIABLES GLOBALES
================================================================= */
:root {
    /* Paleta principal */
    --primary-color: #3A1078;
    --primary-hover: #4E31AA;
    --accent-color: #3795BD;

    /* Fondos */
    --background-color: #F7F7F8;
    --card-bg: #ffffff;
    --sidebar-bg: #3A1078;

    /* Texto */
    --text-dark: #2c2352;
    --text-light: #ffffff;

    /* Bordes y sombras */
    --border-color: #e0dff1;
    --shadow-color: rgba(0, 0, 0, 0.07);
    --shadow-1: 0 10px 30px rgba(16, 24, 40, .12);
    --shadow-2: inset 0 1px 0 rgba(255, 255, 255, .5), 0 14px 38px rgba(2, 6, 23, .18);

    /* Bordes redondeados */
    --border-radius-sm: 0.3rem;
    --border-radius-md: 0.5rem;
    --radius-xl: 18px;
    --radius-lg: 14px;
    --radius-md: 12px;

    /* Colores adicionales */
    --highlight-color: #5aa8d3;
    --muted-color: #b7b2cc;
    --hover-overlay: rgba(58, 16, 120, 0.08);

    /* UI */
    --ui-bg: #f6f7fb;
    --ui-card: #ffffff;
    --ui-glass: rgba(255, 255, 255, 0.85);
    --ui-border: rgba(16, 24, 40, .08);
    --ui-text: #0f172a;

    /* Gradientes */
    --grad-green: linear-gradient(135deg, #22c55e, #16a34a);
    --grad-yellow: linear-gradient(135deg, #f59e0b, #f97316);
    --grad-red: linear-gradient(135deg, #ef4444, #dc2626);
    --grad-cyan: linear-gradient(135deg, #22d3ee, #06b6d4);
    --grad-violet: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

/* Transición más rápida y suave para evitar "flicker" */
#sidebar,
.modern-sidebar,
#sidebar *,
.modern-sidebar * {
    transition-duration: 0.2s !important;
}

/* Asegurar que el contenido no se mueva bruscamente */
#content,
.topbar {
    will-change: margin-left, left;
    transition: margin-left 0.2s ease, left 0.2s ease;
}

/* =================================================================
    2. ESTILOS BASE
================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-dark);
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
}

/* =================================================================
    SIDEBAR MODERNO
================================================================= */

#sidebar,
.modern-sidebar {
    width: 280px;
    min-width: 280px;
    background: linear-gradient(180deg, #3A1078 0%, #2d0d5f 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

/* Logo y Marca */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    margin-top: 56px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.brand-logo {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    object-fit: cover;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    transition: opacity 0.3s ease;
}

/* Menú Principal */
.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-footer {
    list-style: none;
    padding: 12px;
    margin: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(4px);
}

.menu-item.active .menu-link {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-item.active .menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: #3795BD;
    border-radius: 0 4px 4px 0;
}

.menu-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

.menu-link:hover i {
    transform: scale(1.1);
}

.menu-link span {
    flex: 1;
    transition: opacity 0.3s ease;
}

/* Submenú */
.submenu {
    list-style: none;
    padding: 0;
    margin: 4px 0 4px 0;
}

.submenu li {
    margin: 0;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 10px 48px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
}

.submenu-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.submenu li.active-submenu .submenu-link {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 500;
}

.submenu-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Logout Link */
/* =====================
   CLIENTES: RESPONSIVE FIXES
   ===================== */

/* Evitar desbordes horizontales del layout */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Topbar no debe desbordar en móviles */
.topbar {
    max-width: 100vw;
}

/* Header del módulo clientes */
.clientes-header {
    gap: 12px;
}

.clientes-header > a,
.clientes-header > form {
    align-self: stretch;
}

.clientes-header form {
    max-width: 400px;
}

@media (max-width: 768px) {
    .clientes-header {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .clientes-header > a,
    .clientes-header > form,
    .clientes-header form {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Paginación: contención y wrap */
.pagination {
    flex-wrap: wrap !important;
    justify-content: center !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .pagination {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Móviles pequeños: sólo Anterior | Actual | Siguiente */
@media (max-width: 480px) {
    .pagination .page-item-number {
        display: none !important;
    }
    .pagination .page-item.active {
        display: flex !important;
    }

    /* Acortar texto de Anterior/Siguiente a « » */
    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link {
        font-size: 0 !important; /* ocultar texto largo */
        padding: 0.35rem 0.5rem !important;
    }
    .pagination .page-item:first-child .page-link::after {
        content: '\00AB'; /* « */
        font-size: 0.9rem !important;
    }
    .pagination .page-item:last-child .page-link::after {
        content: '\00BB'; /* » */
        font-size: 0.9rem !important;
    }

    .pagination {
        width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}
.logout-link:hover {
    background: rgba(220, 53, 69, 0.15);
    color: #ff6b6b;
}

/* Scrollbar Personalizado */
#sidebar .sidebar-menu::-webkit-scrollbar,
.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

#sidebar .sidebar-menu::-webkit-scrollbar-track,
.sidebar-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

#sidebar .sidebar-menu::-webkit-scrollbar-thumb,
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

#sidebar .sidebar-menu::-webkit-scrollbar-thumb:hover,
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =================================================================
   SIDEBAR - OCULTAR/MOSTRAR COMPLETAMENTE (DESKTOP)
================================================================= */

/* Desktop: Sidebar se oculta completamente con .hidden */
@media (min-width: 769px) {

    #sidebar.hidden,
    .modern-sidebar.hidden {
        transform: translateX(-280px);
    }

    /* Contenido ocupa todo el ancho cuando sidebar está oculto */
    body.sidebar-hidden #content {
        margin-left: 0 !important;
    }

    /* Topbar también se expande cuando sidebar está oculto */
    body.sidebar-hidden .topbar {
        left: 0 !important;
        width: 100% !important;
    }
}

/* =================================================================
    TOPBAR
================================================================= */

.topbar {
    display: flex;
    background-color: #ffffff;
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-toggle {
    background: rgba(70, 0, 136, 0.589);
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 24px;
    padding: 0;
}

.btn-toggle:hover {
    background: rgba(162, 0, 255, 0.315);
    transform: scale(1.05);
}

.btn-toggle:active {
    transform: scale(0.95);
}

.topbar-user {
    color: #130029;
    font-size: 16px;
}

.topbar-greeting {
    font-weight: 500;
}

/* =================================================================
    LAYOUT PRINCIPAL
================================================================= */

.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    padding-top: 56px;
}

#content {
    flex: 1;
    min-width: 0;
    padding: 25px;
    margin-left: 280px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =================================================================
    RESPONSIVE - MÓVIL
================================================================= */

@media (max-width: 768px) {
    .topbar {
        left: 0 !important;
        padding-left: 16px;
        width: 100% !important;
    }

    #sidebar,
    .modern-sidebar {
        transform: translateX(-100%) !important;
        width: 280px !important;
        min-width: 280px !important;
    }

    #sidebar.active,
    .modern-sidebar.active {
        transform: translateX(0) !important;
        z-index: 1002;
    }

    /* Alternativa robusta: mostrar si el body indica sidebar abierto */
    body.sidebar-open #sidebar,
    body.sidebar-open .modern-sidebar {
        transform: translateX(0) !important;
        z-index: 1002;
    }

    .sidebar-brand {
        margin-top: 0 !important;
    }

    /* Overlay oscuro */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    body.sidebar-open {
        overflow: hidden;
    }

    /* IMPORTANTE: Sidebar NO ocupa espacio en móvil */
    #content {
        margin-left: 0 !important;
        padding: 15px;
        width: 100%;
    }

    /* Wrapper ocupa todo el ancho en móvil */
    .wrapper {
        margin-left: 0 !important;
        width: 100%;
    }
}

/* =================================================================
    DESKTOP
================================================================= */

@media (min-width: 769px) {

    /* Desktop: visible por defecto */
    #sidebar,
    .modern-sidebar {
        transform: translateX(0);
    }
}

/* =================================================================
    6. COMPONENTES DE BOOTSTRAP PERSONALIZADOS
================================================================= */
.card {
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s ease;
    background-color: var(--card-bg);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.table {
    border-color: var(--border-color);
}

/* =================================================================
    7. DASHBOARD - TARJETAS DE ESTADÍSTICAS
================================================================= */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 18px;
    border-radius: 18px;
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
    min-height: 120px;
    transition: transform .12s ease, box-shadow .12s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .18);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .18);
    backdrop-filter: blur(2px);
    font-size: 32px;
}

.stat-content {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.stat-label {
    font-size: .95rem;
    opacity: .9;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .3px;
}

.stat-desc {
    font-size: .85rem;
    opacity: .9;
}

.stat-green {
    background: linear-gradient(135deg, #1cc88a, #0ea86b);
}

.stat-blue {
    background: linear-gradient(135deg, #36a3f7, #0d6efd);
}

.stat-purple {
    background: linear-gradient(135deg, #9b6bd6, #6f42c1);
}

.stat-orange {
    background: linear-gradient(135deg, #f6a146, #fd7e14);
}

/* =================================================================
    8. MÉTRICAS Y SECCIONES
================================================================= */
.section-card {
    background: var(--ui-card);
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-1);
}

.metric {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    color: #fff;
    box-shadow: var(--shadow-1);
    border: 0;
}

.metric .icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .2);
    display: grid;
    place-items: center;
    font-size: 18px;
}

.metric .value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.metric .label {
    font-size: 13px;
    opacity: .9;
    margin-top: 2px;
}

.metric--green {
    background: var(--grad-green);
}

.metric--yellow {
    background: var(--grad-yellow);
}

.metric--red {
    background: var(--grad-red);
}

.metric--cyan {
    background: var(--grad-cyan);
}

.metric--violet {
    background: var(--grad-violet);
}

/* =================================================================
    9. TABLAS
================================================================= */
.neo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-1);
}

.neo-table thead th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 13px;
    color: #334155;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ui-border);
}

.neo-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ui-border);
}

.neo-table tbody tr:last-child td {
    border-bottom: 0;
}

.badge-soft {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #e0e7ff;
}

/* =================================================================
    10. FORMULARIOS Y FILTROS
================================================================= */
.form-card {
    background: var(--ui-card);
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-1);
    padding: 16px;
}

.input-soft {
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}

.input-soft:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, .25);
}

.btn-gradient {
    background: var(--grad-violet);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    box-shadow: var(--shadow-1);
    transition: all 0.2s ease;
}

.btn-gradient:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
}

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.pill {
    border: 1px solid var(--ui-border);
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease;
    color: inherit;
    text-decoration: none;
}

.pill.is-active,
.pill:hover {
    background: #f3e8ff;
    border-color: #a78bfa;
    box-shadow: var(--shadow-1);
    transform: translateY(-1px);
    color: inherit;
    text-decoration: none;
}

/* =================================================================
    11. FULLCALENDAR
================================================================= */
#calendar-container {
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    max-width: 900px;
    margin: auto;
}

.fc .fc-button-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.fc .fc-button-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.fc .fc-button-primary:disabled {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.fc .fc-daygrid-day.fc-day-today {
    background-color: transparent !important;
}

.fc-toolbar-title {
    font-size: 1.6rem;
    font-weight: 600;
}

.fc .fc-scrollgrid,
.fc .fc-col-header-cell {
    border-color: var(--border-color) !important;
}

.fc-event {
    border: none !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 5px 8px !important;
    color: #000000 !important;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.fc-event:hover {
    filter: brightness(85%);
    cursor: pointer;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
    color: inherit;
    text-decoration: none;
}

.fc .fc-daygrid-day-number:hover {
    text-decoration: none;
}

.fc-day-today .fc-daygrid-day-number {
    color: var(--text-dark) !important;
}

/* =================================================================
    12. HELPERS Y UTILIDADES
================================================================= */
.chart-card {
    background: var(--ui-card);
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-1);
    padding: 16px;
}

.side-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.side-card-link .section-card {
    transition: transform .12s ease, box-shadow .12s ease;
}

.side-card-link:hover .section-card {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
}

.side-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ui-border, #eaeaea);
}

.side-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #f1f5ff;
    color: #4f46e5;
    font-size: 16px;
}

.grid {
    display: grid;
    gap: 14px;
}

/* Avoid children forcing horizontal overflow inside grids */
.grid > * {
    min-width: 0;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* =================================================================
    FIX RESPONSIVE PARA FINANZAS
================================================================= */

/* Grid responsive: móvil 1 col, tablet 2 cols */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Asegurar que las tarjetas de métricas se vean bien en móvil */
@media (max-width: 768px) {

    /* Grid de métricas en móvil: 1 columna */
    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* Tarjetas de métricas más compactas */
    .metric {
        padding: 14px 16px;
        gap: 12px;
    }

    .metric .icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .metric .value {
        font-size: 20px;
    }

    .metric .label {
        font-size: 12px;
    }

    /* Filtros en móvil */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-bar .pill {
        text-align: center;
        padding: 10px 14px;
    }

    .input-soft {
        width: 100%;
    }

    .btn-gradient {
        width: 100%;
        padding: 12px 16px;
    }

    /* Formulario de registro de egreso */
    .form-card .d-flex,
    .form-card form>div {
        flex-direction: column;
        gap: 10px;
    }

    .form-card .d-flex>*,
    .form-card input,
    .form-card select,
    .form-card textarea,
    .form-card button {
        width: 100% !important;
        flex: 1 1 100%;
        max-width: 100%;
    }

    /* Section cards: ocupa todo el ancho */
    .section-card {
        padding: 14px;
        border-radius: 14px;
        margin-bottom: 12px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    /* Gráfico responsive */
    .chart-card {
        padding: 12px;
        overflow-x: auto;
    }

    .chart-card canvas {
        min-height: 250px !important;
        max-height: 300px !important;
    }

    /* Tablas en móvil con scroll horizontal */
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .neo-table {
        min-width: 600px;
        width: 100%;
    }

    /* Ajustar títulos */
    h2 {
        font-size: 1.4rem;
        margin-bottom: 12px;
    }

    h3 {
        font-size: 1.2rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    /* Lista de ganancias por manicurista */
    .section-card ul {
        padding-left: 0;
        list-style: none;
    }

    .section-card ul li {
        padding: 10px 0;
        border-bottom: 1px solid var(--ui-border);
    }

    .section-card ul li:last-child {
        border-bottom: none;
    }
}

/* Tablet: 2 columnas para las métricas principales, 1 para secciones */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Desktop: mantener 2 columnas para las secciones laterales */
@media (min-width: 1025px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Fix para que los pills de filtro se vean bien */
@media (max-width: 576px) {
    .filter-bar {
        gap: 6px;
    }

    .pill {
        font-size: 13px;
        padding: 8px 12px;
        flex: 1;
        min-width: 0;
        text-align: center;
    }

    /* Asegurar que los inputs de fecha sean full width */
    .filter-bar input[type="date"],
    .filter-bar input[type="text"] {
        width: 100%;
    }
}

/* Asegurar que los rows de Bootstrap también se ajusten */
@media (max-width: 768px) {
    .row {
        margin-left: 0;
        margin-right: 0;
    }

    .row>[class*='col-'] {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 12px;
    }
}

/* ===== RESPONSIVE PARA TABLAS Y MÓDULOS ===== */

/* Mejoras responsive para móviles */
@media (max-width: 768px) {

    /* Header de módulos con botones y búsqueda */
    .d-flex.justify-content-between,
    .d-flex.justify-content-between.align-items-start {
        flex-direction: column !important;
        gap: 15px !important;
        align-items: stretch !important;
    }

    .d-flex.justify-content-between>a,
    .d-flex.justify-content-between>form {
        width: 100% !important;
        max-width: none !important;
    }

    .d-flex.justify-content-between form {
        max-width: 100% !important;
    }

    .d-flex.justify-content-between form input {
        flex: 1 !important;
    }

    /* Tabla responsive mejorada */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 1rem !important;
    }

    .table {
        min-width: 600px !important;
        font-size: 0.85rem !important;
        margin-bottom: 0 !important;
    }

    .table th,
    .table td {
        white-space: nowrap !important;
        padding: 0.5rem !important;
        vertical-align: middle !important;
    }

    /* Botones de acción más compactos */
    .btn-sm,
    .btn-group-sm>.btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .btn-group {
        display: flex !important;
        flex-wrap: nowrap !important;
    }

    /* Paginación responsive */
    .pagination {
        flex-wrap: wrap !important;
        gap: 3px !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    .page-item {
        margin: 2px !important;
    }

    .page-link {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.8rem !important;
        min-width: auto !important;
    }

    /* Ocultar texto "Anterior/Siguiente" en móviles */
    .page-link .d-none.d-sm-inline {
        display: none !important;
    }

    .page-link .d-inline.d-sm-none {
        display: inline !important;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {

    /* Ocultar números de página intermedios */
    .pagination .page-item:not(:first-child):not(:last-child):not(.active) {
        display: none !important;
    }

    .table {
        font-size: 0.75rem !important;
    }

    .table th,
    .table td {
        padding: 0.35rem !important;
    }

    .btn-sm,
    .btn-group-sm>.btn {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.7rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }
}
