/* ========================================================
   Modal Agregar/Editar Ingreso Fijo
   Scoped a #modalIngreso para no afectar otros modales.
   ======================================================== */

#modalIngreso.modal {
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

#modalIngreso .modal-content {
    background: var(--bg-elevated);
    width: min(95vw, 900px);
    max-width: min(95vw, 900px);
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

#modalIngreso .modal-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.05), transparent);
}

#modalIngreso .modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

#modalIngreso form {
    padding: 1.5rem;
}

/* ---------- Layout responsive (1 / 2 cols) ---------- */
.ingreso-form-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 720px) {
    .ingreso-form-layout {
        grid-template-columns: 1fr 1fr;
        gap: 1.75rem;
    }
}

.ingreso-form-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* ---------- Header de columna (icono + titulo) ---------- */
.ingreso-col-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.ingreso-col-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary-subtle);
    border: 1px solid var(--primary-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.ingreso-col-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.ingreso-col-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Form groups ---------- */
#modalIngreso .form-group {
    margin-bottom: 0;
}

#modalIngreso .form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#modalIngreso .form-group input,
#modalIngreso .form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    height: auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

#modalIngreso .form-group input:focus,
#modalIngreso .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
    outline: none;
}

/* ---------- Persona selector (select + boton agregar) ---------- */
#modalIngreso .persona-selector {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    min-width: 0;
}

#modalIngreso .persona-selector select {
    flex: 1;
    min-width: 0;
}

#modalIngreso .persona-selector .btn-small {
    flex-shrink: 0;
    padding: 0 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

#modalIngreso .persona-selector .btn-small:hover {
    background: var(--secondary-hover);
    border-color: var(--primary-border);
}

/* ---------- Form actions ---------- */
#modalIngreso .form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

#modalIngreso .btn-primary,
#modalIngreso .btn-secondary {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}

#modalIngreso .btn-primary {
    background: var(--primary);
    color: #08080a;
}

#modalIngreso .btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

#modalIngreso .btn-secondary {
    background: var(--secondary);
    color: var(--text-primary);
    border-color: var(--border);
}

#modalIngreso .btn-secondary:hover {
    background: var(--secondary-hover);
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
    #modalIngreso .modal-content {
        width: 98vw;
        max-width: 98vw;
        border-radius: var(--radius);
    }
    #modalIngreso form {
        padding: 1rem;
    }
}
