/* === Mobile Responsive Improvements === */
@media (max-width: 768px) {

    /* Compact Header for Mobile */
    .header {
        padding: var(--spacing-xs) 0;
    }

    .logo-icon {
        width: 50px;
        height: 50px;
        min-width: 50px;
        /* Prevent collapse */
    }

    .logo-icon img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .logo {
        font-size: var(--font-size-large);
    }

    /* Ensure Hero text isn't hidden behind fixed header */
    .hero {
        padding-top: 120px;
        /* Header height + spacing */
        padding-bottom: var(--spacing-xl);
        align-items: flex-start;
        /* Align closer to top */
    }

    .hero h1 {
        font-size: 32px;
        /* Enforce smaller title on mobile */
        margin-top: var(--spacing-md);
    }

    /* Improve spacing for "separated" feel */
    .grid-3,
    .grid-2 {
        gap: var(--spacing-lg);
        /* Slightly reduced gap */
    }

    .form-section {
        padding: var(--spacing-xl) 0;
    }

    /* === Mobile Budget Table Optimization === */
    /* === Mobile Budget Table Optimization === */
    /* Stack modal header and prevent overlap */
    #budgetModal .modal-content>div:nth-child(3) {
        flex-direction: column;
        align-items: center !important;
        /* Center everything */
        gap: 15px;
        margin-top: 20px;
        /* Space from close button */
    }

    #budgetModal .modal-content>div:nth-child(3) h3 {
        text-align: center;
        width: 100%;
        margin-bottom: 5px;
    }

    #budgetModal .modal-content>div:nth-child(3) button {
        width: auto;
        /* Allow button to size itself */
        min-width: 200px;
        justify-content: center;
    }

    /* Ensure close button stays on top right */
    .modal-close {
        top: 10px;
        right: 15px;
        z-index: 100;
        background: rgba(0, 0, 0, 0.5);
        /* Better visibility on overlay */
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        color: white;
    }

    /* Hide redundant Category column */
    .budget-table th:nth-child(2),
    .budget-table td:nth-child(2) {
        display: none;
    }

    /* Compact Layout */
    .budget-table th,
    .budget-table td {
        padding: 8px 4px !important;
        font-size: 0.8rem !important;
    }

    /* Concepto column adjustment */
    .budget-table td:first-child {
        max-width: 110px;
        white-space: normal;
        line-height: 1.2;
    }

    /* Compact inputs */
    .budget-table input {
        width: 45px !important;
        padding: 4px 2px !important;
        font-size: 13px !important;
        /* >16px prevents iOS zoom, but we want compact. Let's try 13px */
        text-align: center;
    }

    /* Compact Pax Input */
    .budget-input-pax {
        width: 35px !important;
    }

    /* Modal content padding */
    .modal-content {
        padding: 15px !important;
        width: 95% !important;
    }
}