/* ==========================================
   TABLET GLOBAL LAYOUT OVERRIDES
   Target: 768px – 1023px
   ========================================== */

@media screen and (min-width: 768px) and (max-width: 1023px) {
    /* 1. Main Container & Frame Adjustments */
    .neo-tabs-container,
    .neo-calc-header,
    .neo-frame-top-bar,
    .nav-content {
        padding: 0 1.25rem !important;
    }

    .pane-padded-content {
        padding: 1.8rem 1.25rem;
    }

    /* 2. Responsive Dashboard Grid - Rebalanced for Tablet */
    .neo-merged-dashboard {
        display: grid;
        grid-template-columns: minmax(248px, 268px) minmax(0, 1fr) !important;
        gap: 1.25rem !important;
        padding: 1.8rem 1.25rem 6rem 1.25rem !important;
        align-items: start;
    }

    /* 3. Panel & Column Sizing */
    .neo-left-column {
        width: auto !important;
        min-width: 0;
    }

    .neo-input-panel, 
    .neo-onboarding-panel,
    .neo-template-panel {
        padding: 1.25rem !important;
        min-width: 0;
    }

    /* 4. Typography Scalings - Unified */
    .neo-title-group h1 {
        font-size: 2.8rem !important;
        white-space: normal !important;
    }

    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }

    /* 5. Feature Grids - Override global 900px wrap to 1-col */
    .results-grid,
    .saved-inputs-grid,
    .home-features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem !important;
    }

    /* 6. Mini-Game Scalings for Tablet */
    .memory-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.75rem !important;
    }

    .memory-card {
        height: auto !important;
        aspect-ratio: 1 / 1.3 !important;
    }

    .bubble-game-score {
        font-size: 1.5rem !important;
    }

    .neo-results-panel {
        padding: 0 0.5rem;
        min-width: 0;
        overflow: visible !important;
    }

    .neo-schedule-container.layout-top {
        min-width: 0;
    }

    .neo-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1rem !important;
    }

    .neo-onboarding-header h3 {
        white-space: normal;
    }

    .neo-onboarding-header p,
    .neo-placeholder-summary p,
    .exec-section-disclaimer {
        text-align: justify !important;
    }

    .preset-panel-toolbar {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
    }

    .neo-input-panel .neo-label-row {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.55rem;
    }

    .neo-input-panel .neo-label-row > label {
        flex: 1 1 100%;
        min-width: 0;
    }

    .neo-input-panel .neo-tenure-toggle,
    .neo-input-panel .neo-repayment-toggle,
    .neo-input-panel .neo-period-toggle,
    .neo-input-panel .neo-fee-toggle {
        margin-left: auto;
    }

    .dropdown-trigger {
        min-height: 46px;
        padding: 0.8rem 0.95rem;
    }

    .dropdown-options,
    .multiselect-content {
        max-height: 300px !important;
        overflow-y: auto !important;
    }

    .neo-table-area,
    .neo-table-wrapper {
        overflow-x: auto;
    }

    .neo-table-wrapper table {
        min-width: 640px;
    }

    /* 7. Modal Fixes for Tablet - Prevention of Overflow */
    .neo-modal-content {
        width: 95% !important;
        max-width: 800px !important;
        height: auto !important;
        max-height: 90vh !important;
        flex-direction: column !important;
        border-radius: 20px !important;
    }

    .neo-modal-promo {
        padding: 2rem !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
        align-items: center !important;
        text-align: center !important;
        min-height: auto !important;
    }

    .neo-modal-promo h1 {
        font-size: 2.2rem !important;
        margin-bottom: 1rem !important;
    }

    .neo-modal-info-side {
        padding: 2rem !important;
        flex: 1 !important;
        max-height: 50vh !important; /* Scrollable internal area */
    }

    .neo-modal-close-icon {
        top: 1.5rem !important;
        right: 1.5rem !important;
        left: auto !important;
    }

    /* Adjust Guidelines Table for Tablet */
    .neo-guidelines-table td {
        padding: 1rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
}
