:root {
    --brand-orange: #ff6b00;
    --brand-dark: #1c1c1e;
    --brand-grey: #f3f4f6;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --p-bg: #ffffff;
    --p-text: #111827;
    --p-accent: #ff6b00;
    --p-font: 'Arial', sans-serif;
    --mobile-nav-height: 60px;
}

/* Match legacy resume-builder.php: body is a fixed-height flex column; main flexes between header and footer.
   Do NOT size .app-workspace with 100dvh − header — that ignores the footer and steals space from main,
   leaving a short workspace with the footer visible inside the “working” viewport. */
body.legacy-wpd.builder-page {
    background-color: #e5e5e5;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.site-header, .site-footer { flex-shrink: 0; }

/* Main Layout Grid — fill space allocated to main (viewport − header − footer), not full dvh */
.app-workspace {
    display: grid;
    grid-template-columns: 480px 1fr;
    grid-template-rows: minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    position: relative;
}

body.legacy-wpd.builder-page .app-workspace > .editor-panel,
body.legacy-wpd.builder-page .app-workspace > main.preview-panel {
    min-height: 0;
}

/* Processing Overlay */
#processing-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    backdrop-filter: blur(2px);
}
.spinner-lg {
    width: 50px;
    height: 50px;
    border: 5px solid #e5e7eb;
    border-top-color: var(--brand-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
#processing-msg {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--brand-dark);
}

/* ==========================================================================
   MOBILE OPTIMIZATION STYLES
   ========================================================================== */
@media (max-width: 1024px) {
    body.legacy-wpd.builder-page {
        min-height: 100dvh;
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .site-header {
        position: sticky;
        top: 0;
        z-index: 50;
    }

    /* Reserve space for fixed bottom tab bar (same intent as legacy calc − mobile-nav). */
    body.legacy-wpd.builder-page main.legacy-php-main {
        padding-bottom: var(--mobile-nav-height);
        box-sizing: border-box;
    }

    .app-workspace {
        display: block;
        flex: 1;
        min-height: 0;
        height: 100%;
        max-height: 100%;
        overflow: hidden;
        position: relative;
        width: 100%;
    }

    /* Panels become full width absolute layers */
    .editor-panel, 
    .preview-panel {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
        background: #f3f4f6; /* Ensure background covers underlying layer */
        padding-bottom: 80px; /* Space for FABs */
    }

    /* Editor is active by default (left 0) */
    .editor-panel {
        z-index: 10;
        transform: translateX(0);
        border-right: none;
    }

    /* Preview is hidden to the right by default */
    .preview-panel {
        z-index: 20;
        transform: translateX(100%);
        display: block !important; /* Override any previous none */
        background: #3f3f46; /* Dark background for preview context */
    }

    /* Active State Classes controlled by JS */
    .app-workspace.view-preview .editor-panel {
        transform: translateX(-20%); /* Parallax effect */
    }

    .app-workspace.view-preview .preview-panel {
        transform: translateX(0);
    }

    /* Mobile Resume Paper Scaling */
    #resume-paper {
        transform: scale(0.48);
        transform-origin: top center;
        margin-top: 20px;
        margin-bottom: 20px;
        width: 8.5in;
        min-height: auto;
    }

    /* Mobile page counter */
    #page-counter {
        bottom: 140px;
        right: 20px;
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Mobile Navigation Bar */
    .mobile-view-switcher {
        display: flex !important; /* Show on mobile */
    }

    /* Adjust FAB position on mobile */
    .fab-bar {
        bottom: 80px !important; /* Above nav bar */
        right: 16px !important;
    }

    /* Hide desktop-specific UI elements if necessary */
    .editor-toolbar h2 {
        font-size: 0.9rem;
    }
}

/* Mobile View Switcher (Hidden on Desktop) */
.mobile-view-switcher {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-nav-height);
    background: white;
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    justify-content: space-around;
    align-items: center;
}

.view-btn {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
}

.view-btn i { font-size: 1.1rem; }

.view-btn.active {
    color: var(--brand-orange);
    background: #fff7ed; /* Subtle orange tint */
    border-top: 2px solid var(--brand-orange);
}

/* Editor Panel Styling */
.editor-panel {
    background: white;
    border-right: 1px solid #d1d5db;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.editor-toolbar {
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.editor-toolbar h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--brand-dark);
}

.progress-pill {
    background: var(--brand-grey);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand-orange);
    border: 1px solid #e5e7eb;
}

/* Parsing Progress Bar */
.parsing-bar-container {
    width: 100%;
    height: 4px;
    background-color: #f3f4f6;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    display: none;
    overflow: hidden;
}

.parsing-bar-fill {
    height: 100%;
    background-color: var(--brand-orange);
    width: 30%;
    position: absolute;
    animation: parsingMove 1.5s infinite ease-in-out;
}

@keyframes parsingMove {
    0% { left: -30%; }
    100% { left: 100%; }
}

/* Tabs Styling */
.editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #f9fafb;
    flex-shrink: 0;
}

.editor-tab {
    flex: 1;
    text-align: center;
    padding: 0.8rem 0.5rem; /* Increased touch target */
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    border-right: 1px solid #e5e7eb;
    color: #6b7280;
    transition: 0.15s;
    user-select: none;
}

.editor-tab:last-child { border-right: none; }

.editor-tab:hover { background: #f3f4f6; }

.editor-tab.active {
    background: white;
    color: var(--brand-dark);
    border-bottom: 3px solid var(--brand-orange); /* More visible active state */
}

.editor-content {
    padding: 1.2rem 1.5rem 6rem 1.5rem; /* Extra padding for mobile nav/fab */
}

/* Notifications */
.notification-area {
    position: fixed;
    top: 90px; /* Below header */
    right: 20px;
    z-index: 2000; /* Highest z-index */
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    width: 90%; /* Mobile responsive width */
}

.notification {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideIn 0.3s ease;
    word-break: break-word;
    background: white; /* Fallback */
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.notification.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notification.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.notification.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.notification-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    font-size: 1.1rem;
    flex-shrink: 0;
    padding: 4px; /* Touch target */
}

/* Accordion System */
.accordion-group {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.accordion-header {
    padding: 1rem;
    background: #f9fafb;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.15s;
    user-select: none;
    font-size: 0.9rem;
}

.accordion-header:hover {
    background: #f3f4f6;
    color: var(--brand-orange);
}

.accordion-body {
    display: none;
    padding: 1.2rem;
    border-top: 1px solid var(--border-color);
}

.accordion-body.open { display: block; }

/* Form Styling */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 0.85rem; /* Larger for touch */
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem; /* Prevent iOS zoom on focus */
    transition: 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(255,107,0,0.12);
}

.form-control:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.helper-text {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* Chip Elements */
.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chip {
    font-size: 0.8rem;
    background: #e0f2fe;
    color: #0369a1;
    padding: 6px 12px; /* Larger touch target */
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid #bae6fd;
    transition: 0.15s;
    user-select: none;
}

.chip:hover, .chip:active {
    background: #0369a1;
    color: white;
}

/* Repeater Items */
.repeater-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    position: relative;
}

.btn-trash {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #ef4444;
    background: white;
    border: 1px solid #fee2e2;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-trash:hover { background: #fef2f2; color: #b91c1c; }

/* Button System */
.btn-add {
    width: 100%;
    padding: 0.9rem;
    border: 2px dashed #d1d5db;
    background: #fff;
    color: #6b7280;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
    font-size: 0.9rem;
}

.btn-add:hover {
    border-color: var(--brand-orange);
    color: var(--brand-orange);
    background: #fff7ed;
}

.btn-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand-orange);
    color: white;
    border: none;
    padding: 0.9rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.95rem;
}

.btn-primary:hover { background: #e55f00; }

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.inline-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Persona Pills */
.persona-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.persona-pill {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    transition: 0.15s;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persona-pill:hover { background: #e5e7eb; }

.persona-pill.active {
    background: var(--brand-orange);
    color: white;
    border-color: var(--brand-orange);
}

/* Preview Panel Logic */
.preview-panel {
    background: #3f3f46;
    padding: 3rem 2rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
}

#resume-paper {
    background: var(--p-bg);
    color: var(--p-text);
    width: 8.5in;
    min-height: auto;
    padding: 0.5in 0.5in 0.6in 0.5in;
    box-shadow: 0 18px 45px rgba(0,0,0,0.35);
    font-family: var(--p-font);
    position: relative;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

/* Page counter badge */
#page-counter {
    position: fixed;
    bottom: 100px;
    right: 90px;
    background: var(--brand-dark);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 101;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

#page-counter i {
    font-size: 11px;
    opacity: 0.8;
}

/* Share modal */
#share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

#share-modal.active {
    display: flex;
}

.share-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--brand-dark);
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    line-height: 1;
}

.share-modal-close:hover {
    color: var(--brand-dark);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    color: var(--brand-dark);
}

.share-btn:hover {
    background: var(--brand-grey);
    border-color: var(--brand-orange);
}

.share-btn i {
    font-size: 24px;
}

.share-btn.linkedin i { color: #0077B5; }
.share-btn.twitter i { color: #1DA1F2; }
.share-btn.facebook i { color: #4267B2; }
.share-btn.email i { color: #EA4335; }
.share-btn.whatsapp i { color: #25D366; }
.share-btn.copy i { color: #6b7280; }

.share-btn span {
    font-size: 11px;
    font-weight: 600;
}

.share-link-box {
    display: flex;
    gap: 8px;
}

.share-link-box input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
}

.share-link-box button {
    padding: 10px 16px;
    background: var(--brand-orange);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.share-link-box button:hover {
    background: #e55a00;
}

/* Resume Structure */
.res-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 4px solid var(--brand-dark);
    padding-bottom: 16px;
    margin-bottom: 22px;
}

.res-name {
    font-size: 34px;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 0.9;
    color: var(--brand-dark);
}

.res-role {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-orange);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.res-contact-line {
    font-size: 12px;
    color: #4b5563;
    margin-top: 4px;
    text-align: right;
}

.res-section-head {
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    border-bottom: 2px solid #e5e7eb;
    margin: 16px 0 10px 0;
    padding-bottom: 4px;
    color: var(--brand-dark);
}

.res-item { margin-bottom: 12px; }

.res-item-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 14px;
}

.res-item-sub {
    font-weight: 600;
    color: #555;
    font-size: 13px;
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
}

.res-item-body {
    font-size: 13px;
    color: #333;
    white-space: pre-line;
}

.res-skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.res-skill {
    background: #f3f4f6;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

/* Theme: Modern */
.theme-modern #resume-paper {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.theme-modern .res-header {
    text-align: center;
    border-bottom: none;
    margin-bottom: 26px;
    display: block;
}
.theme-modern .res-name {
    font-size: 40px;
    font-weight: 300;
    letter-spacing: 2px;
}
.theme-modern .res-role {
    font-size: 15px;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: 3px;
}
.theme-modern .res-contact-line {
    text-align: center;
    margin-top: 8px;
}
.theme-modern .res-section-head {
    font-size: 13px;
    font-weight: 700;
    color: #2563eb;
    border-bottom: 1px solid #2563eb;
    display: inline-block;
    margin: 18px 0 8px 0;
}

/* Theme: Classic */
.theme-classic #resume-paper {
    font-family: 'Georgia', serif;
    line-height: 1.6;
}
.theme-classic .res-header {
    text-align: center;
    border-bottom: 1px solid #000;
    display: block;
}
.theme-classic .res-name {
    font-size: 30px;
    font-weight: 700;
    text-transform: none;
}
.theme-classic .res-role {
    font-style: italic;
    font-size: 17px;
    color: #444;
}
.theme-classic .res-contact-line {
    text-align: center;
    margin-top: 6px;
}
.theme-classic .res-section-head {
    font-size: 15px;
    border-bottom: 1px solid #ccc;
    letter-spacing: 1px;
}

/* Floating Action Buttons (FAB) */
.fab-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: 0.18s;
}

.fab:hover { transform: scale(1.08); }
.fab:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* REMOVED: .fab-save class */
.fab-share { background: #6b7280; }
.fab-download { background: var(--brand-orange); }

.tooltip {
    position: absolute;
    right: 68px;
    background: #111827;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.15s;
}

.fab:hover .tooltip { opacity: 1; }

/* ATS Scoring Cards */
.ats-card {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f9fafb;
}

.ats-score-main {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--brand-dark);
}

.ats-score-main.score-high { color: var(--success-color); }
.ats-score-main.score-medium { color: var(--warning-color); }
.ats-score-main.score-low { color: var(--error-color); }

.ats-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    margin-right: 4px;
    margin-bottom: 6px;
    font-weight: 500;
}

.ats-badge.hit { background: #dcfce7; color: #166534; }
.ats-badge.miss { background: #fee2e2; color: #b91c1c; }
.ats-badge.technical { border: 1px solid #3b82f6; }
.ats-badge.soft { border: 1px solid #8b5cf6; }
.ats-badge.tool { border: 1px solid #06b6d4; }

.ats-suggestion {
    background: #fffbeb;
    border-left: 4px solid var(--warning-color);
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    border-radius: 0 4px 4px 0;
}

.ats-suggestion strong {
    color: var(--warning-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    display: block;
    margin-bottom: 4px;
}

/* AI Status Badge */
.ai-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ai-status-badge.enabled { background: #dcfce7; color: #166534; }
.ai-status-badge.disabled { background: #fee2e2; color: #b91c1c; }
.ai-status-badge.checking { background: #e0f2fe; color: #0369a1; }

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--brand-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Multi-page Resume Support */
.res-item {
    page-break-inside: avoid;
    break-inside: avoid;
}

.res-section {
    page-break-inside: avoid;
    break-inside: avoid;
}

.no-break {
    page-break-inside: avoid;
    break-inside: avoid;
}

/* Cloudflare shell: unbroken flex chain header → main → footer within 100dvh */
body.legacy-wpd.builder-page main.legacy-php-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

body.legacy-wpd.builder-page main.legacy-php-main > .rb-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Flash / one-off rows above the builder should not consume the flex workspace */
body.legacy-wpd.builder-page main.legacy-php-main > .wpd-flash-stack {
    flex-shrink: 0;
}
