:root {
    --primary: #4361ee;
    --secondary: #3a0ca3;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --info: #43aa8b;
    --profit: #10b981;
    --loss: #ef4444;
}

body {
    background: #f8fafc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

.navbar {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar {
    background: white;
    min-height: calc(100vh - 73px);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding: 0;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 600;
}

.nav-link {
    color: #555;
    padding: 12px 20px;
    border-left: 4px solid transparent;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.nav-link:hover, .nav-link.active {
    background: #f0f5ff;
    border-left: 4px solid var(--primary);
    color: var(--primary);
}

.nav-link i {
    width: 20px;
    margin-right: 10px;
    font-size: 1.1rem;
}

.main-content {
    padding: 20px;
    min-height: calc(100vh - 73px);
}

.content-header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    margin: 0;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.8rem;
}

.stat-card {
    padding: 20px;
    border-radius: 10px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card h3 {
    font-weight: bold;
    margin: 10px 0;
    font-size: 1.8rem;
}

.stat-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.profit-badge {
    background: linear-gradient(45deg, #10b981, #059669);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.loss-badge {
    background: linear-gradient(45deg, #ef4444, #dc2626);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #eef2f7;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 500;
}

.btn-profit {
    background: linear-gradient(45deg, #10b981, #059669);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 500;
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #dc3545, #e83e8c);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 500;
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 500;
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-weight: 500;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.875rem;
}

.table th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 10px;
    vertical-align: middle;
}

.table td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #eef2f7;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.badge {
    padding: 5px 10px;
    font-weight: 500;
    border-radius: 6px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f0f5ff;
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

#fileInput {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.form-control, .form-select {
    border-radius: 6px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.modal-header {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 10px 10px 0 0 !important;
    padding: 15px 20px;
}

.modal-title {
    font-weight: 600;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.search-box {
    max-width: 400px;
}

.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Estilos para Distribución de Ganancias */
.distribution-card {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.distribution-card h6 {
    color: var(--primary);
    font-weight: 600;
}

.prioridad-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: all 0.3s;
}

.prioridad-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
}

.prioridad-item .card-body {
    padding: 15px;
}

/* Historial de distribuciones */
.historial-item {
    background: white;
    border: 1px solid #eef2f7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.historial-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.historial-item .fecha {
    font-size: 0.9rem;
    color: #6c757d;
}

.historial-item .monto {
    font-weight: 600;
    font-size: 1.2rem;
}

/* Badges para estados */
.badge-completo {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.badge-incompleto {
    background: linear-gradient(45deg, #dc3545, #e83e8c);
    color: white;
}

/* Progress bar para distribución */
.distribution-progress {
    height: 10px;
    border-radius: 5px;
    background: #e9ecef;
    overflow: hidden;
    margin: 10px 0;
}

.distribution-progress-bar {
    height: 100%;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 5px;
}

/* Responsivo para la sección de distribución */
@media (max-width: 992px) {
    .distribution-card {
        margin-bottom: 10px;
    }
    
    .prioridad-item .row > div {
        margin-bottom: 10px;
    }
    
    .prioridad-item .row > div:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        position: relative;
    }
    
    .content-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .search-box {
        width: 100%;
        max-width: none;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}
/* ===== DISTRIBUCIÓN POR CATEGORÍAS - NUEVO DISEÑO ===== */
.cat-card {
    transition: box-shadow .15s;
}
.cat-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.12) !important;
}
.cat-card .card-header {
    user-select: none;
}
.cat-card .card-header:hover {
    filter: brightness(.97);
}
.cat-card .prov-row:last-child {
    border-bottom: none !important;
}
.inp-pct-card {
    font-size: .82rem;
    font-weight: 600;
    border-radius: 6px 0 0 6px !important;
}
.inp-pct-card:focus {
    box-shadow: 0 0 0 2px rgba(67,97,238,.25);
    border-color: #4361ee;
}
#contenedorTarjetasCat {
    max-height: 72vh;
    overflow-y: auto;
    padding-right: 2px;
}
#contenedorTarjetasCat::-webkit-scrollbar {
    width: 4px;
}
#contenedorTarjetasCat::-webkit-scrollbar-track {
    background: #f1f1f1;
}
#contenedorTarjetasCat::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
#resultadoCategorias {
    max-height: 80vh;
    overflow-y: auto;
}
#accionesCat {
    animation: fadeIn .3s ease;
}
@keyframes fadeIn {
    from { opacity:0; transform:translateY(-4px); }
    to   { opacity:1; transform:translateY(0); }
}
