:root {
    --primary-color: #10b981;
    --primary-hover: #059669;
    --bg-color: #f8fafc;
    --text-color: #334155;
    --label-color: #64748b;
    --border-color: #e2e8f0;
    --white: #ffffff;
    --row-even: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
/* Contenedor con scroll para reportes largos */
.reporte-scroll-container {
    max-height: 500px; /* Altura ajustable según prefieras */
    overflow: auto;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    margin-top: 1rem;
}

/* Tabla comprimida */
.table-compact {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem; /* Fuente más pequeña */
}

.table-compact th, 
.table-compact td {
    padding: 4px 6px; /* Padding muy reducido */
    border: 1px solid #e2e8f0;
    white-space: nowrap; /* Evita que el texto salte de línea */
}

.table-compact thead th {
    background-color: #f1f5f9;
    position: sticky; /* Cabecera fija al hacer scroll */
    top: 0;
    z-index: 10;
}

.table-compact tfoot td {
    background-color: #f8fafc;
    font-weight: bold;
}

/* Estilos específicos para impresión (PDF) */
@media print {
    .header-sistema, .form-filtros, .btn-export {
        display: none !important;
    }
    .reporte-scroll-container {
        max-height: none !important;
        overflow: visible !important;
    }
    body { background: white; }
    .container { max-width: 100%; margin: 0; padding: 0; }
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 10px 20px; 
    font-size: 14px;
    line-height: 1.5;
}

/* CONTENEDOR PRINCIPAL */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.container-lg {
    max-width: 1400px;
}

/* HEADER SISTEMA */
.header-sistema {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem; 
    background: var(--white);
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.header-sistema h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.header-icon {
    text-decoration: none;
    font-size: 1.2rem;
}

/* FORMULARIOS Y GRIDS */
form {
    padding: 1.5rem 2rem; 
}

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

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--label-color);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* INPUTS Y SELECTS */
input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: #ffffff;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* TABLAS (Unificadas para Gastos y Listados) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
}

table th {
    background-color: var(--row-even);
    color: var(--label-color);
    text-align: left;
    padding: 12px 15px;
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
}

table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

table tr:nth-child(even) {
    background-color: var(--row-even);
}

table tr:hover {
    background-color: #f1f5f9;
}

/* BOTONES */
.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* ALERTAS */
.alert {
    margin: 1rem 2rem;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.alert-success { background-color: #dcfce7; color: #166534; border-color: #bbf7d0; }
.alert-danger { background-color: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background-color: #fef9c3; color: #854d0e; border-color: #fef08a; }

/* UTILIDADES */
.text-right { text-align: right; }
.text-red { color: #ef4444; font-weight: 600; }
.text-green { color: #10b981; font-weight: 600; }

/* MENÚ PRINCIPAL (Index) */
.menu-group {
    margin-bottom: 1.5rem;
    padding: 0 1.5rem;
}
.menu-group .section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--label-color);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}
.menu-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-decoration: none;
    color: #1e293b;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.menu-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.menu-item .icon { font-size: 1.5rem; }
.menu-item .label { font-size: 0.8rem; font-weight: 500; }

/* LOGIN */
.login-body {
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
}

/* FILTROS */
.form-filtros {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.filtros-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filtros-row:last-child {
    margin-bottom: 0;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

/* REPORTE */
.reporte-result {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.reporte-result h3 {
    margin: 0 0 1rem;
    color: var(--primary-color);
}

.reporte-cliente {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.cliente-header {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.cliente-totales {
    display: flex;
    gap: 2rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    font-weight: 500;
}

.totales-row {
    background: var(--bg-secondary);
}
