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

html {
    overflow-x: clip;
    max-width: 100%;
}

body {
    margin:0;
    overflow-x: clip;
    max-width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 35%, #0f3460 70%, #164e63 100%);
    background-attachment: fixed;
    color: #cbd5e1;
    min-height: 100vh;
}

.app {
    display:flex;
    position: relative;
}

.sidebar {
    width:220px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(148, 163, 184, 0.15);
    color:white;
    height:100vh;
    padding:20px;
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: 0;
    align-self: flex-start;
    transition: width 0.3s ease, padding 0.3s ease;
    box-sizing: border-box;
}

html[data-sidebar-collapsed="true"] .sidebar,
.sidebar.collapsed {
    width: 80px;
    padding: 20px 10px;
}

.sidebar-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

html[data-sidebar-collapsed="true"] .sidebar-header,
.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    font-size: 16px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    color:white;
    text-decoration:none;
    padding:12px;
    margin:5px 0;
    border-radius:5px;
    transition: all 0.2s;
}

.sidebar a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar a span {
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed a span {
    display: none;
}

.sidebar.collapsed a {
    justify-content: center;
    padding: 12px;
}

.sidebar a:hover {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
}

.content {
    flex:1;
    min-width: 0;
    padding:20px;
}

/* DASHBOARD */

.title {
    font-size: 32px;
    margin-bottom: 20px;
    color: #f1f5f9;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 40px 0 15px 0;
}

.section-title:first-of-type {
    margin-top: 0;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: 32px;
    color: #f1f5f9;
}

.btn-icon-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0369a1, #0e7490);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(14, 116, 144, .35);
    transition: all 0.2s;
    font-size: 18px;
}

.btn-icon-add:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(14, 116, 144, .45);
}

.date-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    transition: all 0.2s;
}

.date-filter-btn:hover {
    background: rgba(15, 23, 42, 0.7);
    border-color: #38bdf8;
}

.date-filter-btn i {
    font-size: 12px;
    color: #94a3b8;
}

.date-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}

.date-modal-content {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.date-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.date-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #f1f5f9;
}

.date-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.date-modal-close:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #f1f5f9;
}

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.estado-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.estado-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #94a3b8;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease, transform .15s ease, box-shadow .2s ease;
}

.estado-filter-btn i {
    font-size: 13px;
    opacity: 0.8;
}

.estado-filter-btn:hover {
    border-color: rgba(56, 189, 248, 0.5);
    color: #e2e8f0;
    transform: translateY(-1px);
}

.estado-filter-btn.active {
    background: linear-gradient(135deg, #0369a1, #0e7490);
    border-color: rgba(56, 189, 248, 0.6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(14, 116, 144, .35);
}

.estado-filter-btn.active i {
    opacity: 1;
}

.table.table-fading {
    opacity: 0.35;
}

.filters select,
.filters input[type="date"],
.filters button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(2, 6, 23, 0.5);
    color: #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
    cursor: pointer;
}

.date-filter-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    padding: 0 25px;
    padding-top: 20px;
}

.filters span {
    color: #94a3b8;
    font-size: 14px;
}

.date-quick-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.date-quick-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    color: #cbd5e1;
    transition: background 0.2s;
}

.date-quick-options label:hover {
    background: rgba(148, 163, 184, 0.12);
}

.date-quick-options input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.date-custom-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.date-custom-range input[type="date"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(2, 6, 23, 0.5);
    color: #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.date-custom-range span {
    color: #94a3b8;
    font-size: 14px;
}

.date-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin-top: 20px;
}

.date-modal-actions button {
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.date-modal-actions button[type="button"] {
    background: rgba(2, 6, 23, 0.4);
    color: #cbd5e1;
}

.date-modal-actions button[type="button"]:hover {
    background: rgba(2, 6, 23, 0.6);
}

.date-modal-actions button[type="submit"] {
    background: linear-gradient(135deg, #0369a1, #0e7490);
    color: white;
    border-color: rgba(56, 189, 248, 0.4);
}

.date-modal-actions button[type="submit"]:hover {
    filter: brightness(1.15);
}

.filters select,
.filters input:not([type="date"]):not([type="radio"]) {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(2, 6, 23, 0.5);
    color: #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

.card {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    min-width: 0;
}

.card span {
    font-size: 14px;
    color: #94a3b8;
}

.card strong {
    display: block;
    margin-top: 10px;
    font-size: 26px;
}

.ingreso strong { color: #4ade80; }
.egreso strong { color: #f87171; }
.gastos-fijos strong { color: #c084fc; }
.gastos-operativos strong { color: #fb923c; }
.utilidad strong { color: #38bdf8; }

.card-percentage {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    font-weight: normal;
}

.distribution-row {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.distribution {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    flex: 1;
}

.distribution ul {
    list-style: none;
    padding: 0;
}

.distribution li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}

.distribution li:last-child {
    border-bottom: none;
}

.chart-card {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    margin-top: 30px;
}

.chart-card h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #f1f5f9;
}

.chart-card canvas {
    max-height: 400px;
    max-width: 100%;
}

/* FIN DASHBOARD */

/* TABLAS */

.table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    margin-top: 20px;
    transition: opacity .15s ease;
}

.table th {
    background: rgba(255, 255, 255, 0.04);
    text-align: left;
    padding: 14px;
    font-weight: 600;
    font-size: 14px;
    color: #cbd5e1;
}

.table th.sortable {
    user-select: none;
}

.table th.sortable:hover {
    background: rgba(255, 255, 255, 0.08);
}

.table th.sortable i {
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.5;
}

.table th.sortable:hover i {
    opacity: 1;
}

.table td {
    padding: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    font-size: 15px;
    color: #e2e8f0;
}

.table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table input[type="number"],
.table input[type="text"] {
    width: 100%;
    max-width: 130px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.5);
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
}

.table input[type="number"]:focus,
.table input[type="text"]:focus {
    outline: none;
    border-color: #38bdf8;
}

.table td:last-child {
    white-space: nowrap;
}

.table a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    margin-right: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    position: relative;
}

.table a i {
    font-size: 14px;
}

/* Botón de factura - Verde */
.table a[href*="factura"] {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #fff;
}

.table a[href*="factura"]:hover {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46,204,113,.3);
}

/* Botón de historial - Azul claro */
.table a[href*="historial"] {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
}

.table a[href*="historial"]:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52,152,219,.3);
}

/* Botón de ver/detalle - Azul oscuro */
.table a[href*="ver"]:not([href*="historial"]) {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: #fff;
}

.table a[href*="ver"]:not([href*="historial"]):hover {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52,73,94,.3);
}

/* Botón de editar - Naranja */
.table a[href*="editar"] {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: #fff;
}

.table a[href*="editar"]:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(243,156,18,.3);
}

/* Botón de eliminar - Rojo */
.table a[href*="eliminar"],
.table a.delete {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}

.table a[href*="eliminar"]:hover,
.table a.delete:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231,76,60,.3);
}

/* Botón de toggle - Gris/Morado */
.table a[href*="toggle"] {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: #fff;
}

.table a[href*="toggle"]:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #5d6d7e 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(149,165,166,.3);
}

/* Efecto hover general para todos los botones */
.table a:hover {
    transform: translateY(-2px);
}

/* Tipos de Egresos con colores */
.table tr.egreso-gasto-fijo {
    border-left: 4px solid #e74c3c;
}

.table tr.egreso-empleado {
    border-left: 4px solid #3498db;
}

.table tr.egreso-viaticos {
    border-left: 4px solid #f39c12;
}

.table tr.egreso-otro {
    border-left: 4px solid #95a5a6;
}

.table tr.egreso-gasto-fijo:hover {
    background: rgba(231, 76, 60, 0.1);
}

.table tr.egreso-empleado:hover {
    background: rgba(52, 152, 219, 0.1);
}

.table tr.egreso-viaticos:hover {
    background: rgba(243, 156, 18, 0.1);
}

.table tr.egreso-otro:hover {
    background: rgba(255, 255, 255, 0.05);
}

.table-total {
    background: rgba(56, 189, 248, 0.08) !important;
    border-top: 2px solid #38bdf8;
    font-weight: 600;
}

.table-total td {
    padding: 14px;
    color: #f1f5f9;
}

.table-total:hover {
    background: rgba(56, 189, 248, 0.08) !important;
}

/* FIN TABLAS */

/* FORMS */

.form {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 25px;
    max-width: 480px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 14px;
    margin-bottom: 6px;
    color: #cbd5e1;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.5);
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(203, 213, 225, 0.5);
}

/* Ocultar las flechas de los inputs numéricos en toda la app */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea {
    outline: none;
    border-color: #38bdf8;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0369a1, #0e7490);
    color: #fff !important;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(14, 116, 144, .35);
    transition: all .2s ease;
    cursor: pointer;
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(14, 116, 144, .45);
}

/* FIN FORMS */

/* PAGINACIÓN */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination-link {
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    transition: all .2s ease;
}

.pagination-link:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: #38bdf8;
    color: #38bdf8;
}

.pagination-link.active {
    background: linear-gradient(135deg, #0369a1, #0e7490);
    border-color: #38bdf8;
    color: #fff;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #64748b;
}

/* FIN PAGINACIÓN */

/* RESPONSIVE DESIGN */

/* Tablet y pantallas medianas (768px - 1024px) */
@media (max-width: 1024px) {
    .cards {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .distribution-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .date-filter-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .date-custom-range {
        min-width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .content {
        padding: 15px;
    }
    
    .page-header h1 {
        font-size: 28px;
    }
}

/* Móviles y pantallas pequeñas (hasta 768px) */
@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 15px;
        display: none;
    }
    
    .sidebar.mobile-open {
        display: block;
    }
    
    .sidebar-header {
        margin-bottom: 15px;
    }
    
    .sidebar a {
        padding: 10px;
        margin: 3px 0;
    }
    
    .content {
        width: 100%;
        padding: 15px 10px;
    }
    
    .page-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .page-header h1 {
        font-size: 24px;
        flex: 1;
        min-width: 200px;
    }
    
    .btn-icon-add {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }

    .card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .card {
        padding: 15px;
    }
    
    .card strong {
        font-size: 22px;
    }
    
    .distribution-row {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .distribution {
        padding: 20px;
    }
    
    .chart-card {
        padding: 15px;
        margin-top: 20px;
    }
    
    .chart-card h2 {
        font-size: 18px;
    }
    
    .chart-card canvas {
        max-height: 300px;
    }
    
    /* Tablas -> tarjetas apiladas en móvil, sin perder ninguna columna */
    .table,
    .table tbody {
        display: block;
        width: 100%;
        background: transparent;
        border: none;
        box-shadow: none;
        margin-top: 15px;
    }

    .table tr:first-child {
        display: none;
    }

    .table tr {
        display: block;
        width: 100%;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(148, 163, 184, 0.18);
        border-radius: 14px;
        margin-bottom: 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,.3);
        overflow: hidden;
    }

    .table tr.table-total {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 12px 14px;
        border-color: rgba(56, 189, 248, 0.4);
    }

    .table tr.table-total td {
        display: inline;
        position: static;
        width: auto;
        padding: 0;
        border: none;
        text-align: left;
    }

    .table td {
        display: block;
        width: 100%;
        position: relative;
        padding: 10px 14px 10px 42%;
        border-top: 1px solid rgba(148, 163, 184, 0.1);
        font-size: 14px;
        white-space: normal;
        text-align: right;
        word-break: break-word;
    }

    .table td:first-child {
        border-top: none;
    }

    .table td:last-child {
        white-space: normal;
    }

    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 14px;
        top: 10px;
        width: 38%;
        font-size: 12px;
        font-weight: 600;
        color: #94a3b8;
        text-align: left;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .table td:empty {
        display: none;
    }

    .table td[colspan] {
        padding: 20px 14px;
        text-align: center;
    }

    .table td[colspan]::before {
        content: none;
    }

    .table a {
        width: 34px;
        height: 34px;
        font-size: 13px;
        margin: 2px 4px 2px 0;
    }
    
    .filters {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .filters select,
    .filters input[type="date"],
    .filters input:not([type="date"]):not([type="radio"]),
    .filters button {
        width: 100%;
        padding: 10px;
    }

    .estado-filter-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 12px;
        font-size: 13px;
    }

    .form {
        max-width: 100%;
        padding: 20px 15px;
    }
    
    .date-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .date-filter-container {
        padding: 15px;
        gap: 15px;
    }
    
    .date-quick-options {
        min-width: 100%;
    }
    
    .date-custom-range {
        min-width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .date-modal-header {
        padding: 15px;
    }
    
    .date-modal-actions {
        flex-direction: column;
        padding: 15px;
    }
    
    .date-modal-actions button {
        width: 100%;
    }
    
    .pagination {
        gap: 6px;
        margin: 20px 0;
    }
    
    .pagination-link {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .title {
        font-size: 24px;
        margin-bottom: 15px;
    }
}

/* Móviles pequeños (hasta 480px) */
@media (max-width: 480px) {
    .mobile-header {
        height: 55px;
        padding: 0 12px;
    }
    
    .mobile-header h2 {
        font-size: 16px;
    }
    
    .mobile-menu-toggle {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .sidebar {
        top: 55px;
        height: calc(100vh - 55px);
    }
    
    .content {
        padding: 10px 8px;
        margin-top: 55px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .card {
        padding: 12px;
    }
    
    .card span {
        font-size: 12px;
    }
    
    .card strong {
        font-size: 20px;
        margin-top: 8px;
    }
    
    .card-percentage {
        font-size: 10px;
    }
    
    .distribution {
        padding: 15px;
    }
    
    .distribution li {
        padding: 8px 0;
        font-size: 14px;
    }
    
    .table td {
        padding: 9px 10px 9px 40%;
        font-size: 13px;
    }

    .table td::before {
        left: 10px;
        width: 36%;
        font-size: 11px;
    }

    .table a {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .form {
        padding: 15px 10px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .btn-primary {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .chart-card {
        padding: 12px;
    }
    
    .chart-card h2 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .chart-card canvas {
        max-height: 250px;
    }
    
    .date-modal-content {
        width: 98%;
    }
    
    .date-filter-container {
        padding: 10px;
    }
}

/* Header móvil */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    z-index: 1001;
    padding: 0 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: space-between;
}

.mobile-header h2 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* Botón de menú móvil */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle:active {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Ocultar botón de toggle del sidebar en móvil */
    .sidebar-toggle {
        display: none !important;
    }
    
    /* Asegurar que el sidebar siempre esté expandido en móvil */
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        z-index: 1000;
        height: calc(100vh - 60px);
        width: 280px !important;
        max-width: 85vw;
        padding: 20px !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.collapsed {
        width: 280px !important;
        padding: 20px !important;
    }
    
    .sidebar.collapsed a span {
        display: block !important;
    }
    
    .sidebar.collapsed a {
        justify-content: flex-start !important;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .content {
        margin-top: 60px;
        padding-top: 20px;
    }
    
    .page-header {
        margin-top: 0;
    }
}

/* Overlay para móvil cuando el sidebar está abierto */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}