/* --- Variables de Marca --- */
:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #3498db;
    --success: #27ae60;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --whatsapp: #25d366;
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --sidebar-width: 260px;
}

/* --- Resets y Estilos Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--secondary);
}

/* --- Layout Principal --- */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary);
    color: var(--white);
    padding: 20px;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px;
}

.sidebar nav a, .sidebar nav button {
    display: block;
    width: 100%;
    padding: 12px 15px;
    color: var(--white);
    text-decoration: none;
    margin-bottom: 5px;
    border-radius: 5px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.sidebar nav a:hover, .sidebar nav button:hover {
    background-color: var(--secondary);
}

/* --- Área de Contenido --- */
.content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 30px;
}

/* --- Cards de Estadísticas (Grid) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-top: 4px solid var(--accent);
}

.card h3 { font-size: 0.9rem; color: #7f8c8d; }
.card .monto { font-size: 1.8rem; font-weight: bold; margin-top: 10px; }

/* --- Tablas Modernas --- */
.table-container {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th { background-color: #f8f9fa; font-weight: 600; }

/* --- Badges de Estado --- */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}
.recibido { background: #d1ecf1; color: #0c5460; }
.en_proceso { background: #fff3cd; color: #856404; }
.terminado { background: #d4edda; color: #155724; }
.entregado { background: #e2e3e5; color: #383d41; }

/* --- Ventanas Modales --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

/* --- Botones --- */
.btn-primary { background: var(--accent); color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; }
.btn-wa { background: var(--whatsapp); color: white; text-decoration: none; padding: 5px 10px; border-radius: 4px; font-size: 0.8rem; }


.table-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-x: auto; /* Importante para celulares */
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 0.9em;
    min-width: 400px;
}

.styled-table th {
    background-color: #2c3e50;
    color: #ffffff;
    text-align: left;
    padding: 12px 15px;
}

.styled-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dddddd;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

.badge.ingreso { background: #d4edda; color: #155724; }
.badge.egreso { background: #f8d7da; color: #721c24; }
.badge.retiro { background: #fff3cd; color: #856404; }

.balance-badge {
    background: var(--primary);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}