html, body {
    /* Remove overflow-x hidden to prevent content cutting off */
    /* overflow-x: hidden !important; */
}

:root {
    --room-selected-green: #15803d;
    --room-selected-green-dark: #166165;
    --room-selected-green-bg: #dcfce7;
}

.room-items-list {
    background: #f5f7fa !important;
    padding: 24px !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07) !important;
    /* Removed fixed max-height to allow natural flow */
    /* max-height: 600px !important; */
    overflow-y: visible !important;
    overflow-x: visible !important;
    width: 100% !important;
    max-width: none !important;
    margin: 24px 0 !important;
    box-sizing: border-box !important;
    list-style: none;
}

.room-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto;
    gap: 12px;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 18px;
    border-left: 3px solid var(--primary-color);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, background 0.2s;
    padding: 12px 16px;
    overflow: visible;
    list-style: none;
}

.room-item.selected {
    background: linear-gradient(90deg, #e6f0ff 80%, #dbeafe 100%);
    border-left: 4px solid #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
}

.room-item-name {
    font-size: 1.05rem;
    color: #222;
    font-weight: 600;
    word-break: break-word;
    letter-spacing: 0.01em;
    grid-column: 2;
    grid-row: 1;
}

.room-item-controls {
    grid-column: 1;
    grid-row: 1;
}

.multi-stop-office-inventory .room-item {
    justify-content: flex-start !important;
    gap: 12px !important;
}
.room-item.selected {
    background: #e6f0ff !important;
    border-left: 4px solid #2563eb !important;
}
/* Quantity Controls - Inline with item */
.room-item-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.room-item-quantity-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #2563eb;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #2563eb;
    transition: all 0.2s ease;
    font-weight: bold;
}

.room-item-quantity-btn:hover {
    background: #eff6ff;
    border-color: #174bbd;
}

.room-item-quantity-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #2563eb;
    font-size: 1rem;
}

/* Robust sticky behavior for generated floor inventory blocks */
#house-removal-inventory-section .floor-inventory-block {
    overflow: visible !important;
}

#house-removal-inventory-section .floors-inventory-container .floor-inventory-block:first-child {
    margin-top: 28px !important;
}

/* Keep step section in normal flow and slightly higher on step 3 */
body[data-form-step="3"] .form-stepper,
body[data-current-step="3"] .form-stepper {
    position: static !important;
    z-index: auto !important;
    margin-top: 0 !important;
    transform: none;
}

#house-removal-inventory-section .floor-inventory-block > .inventory-block-header {
    position: sticky !important;
    top: 78px !important;
    z-index: 90 !important;
    background: #f9fafb !important;
    padding-top: 8px !important;
}

#house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
#house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
    position: sticky !important;
    top: 132px !important;
    z-index: 89 !important;
    background: #fff !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08) !important;
}

/* Strong selected-room contrast for house-removal tabs */
#house-removal-inventory-section .inventory-tab.active,
#house-removal-inventory-section .inventory-tab:focus,
#house-removal-inventory-section .inventory-tab:focus-visible {
    color: #2563eb !important;
    background: #eff6ff !important;
    box-shadow: inset 0 -3px 0 #2563eb;
}

#house-removal-inventory-section .inventory-tab.active svg,
#house-removal-inventory-section .inventory-tab:focus svg,
#house-removal-inventory-section .inventory-tab:focus-visible svg {
    color: #2563eb !important;
    fill: #2563eb !important;
}

#house-removal-inventory-section .inventory-tab.has-items {
    color: #166534 !important;
    background: #ecfdf5 !important;
    box-shadow: inset 0 -2px 0 #22c55e;
    font-weight: 700;
}

#house-removal-inventory-section .inventory-tab.has-items svg {
    color: #16a34a !important;
    fill: #16a34a !important;
}

#house-removal-inventory-section .inventory-tab.has-items.active,
#house-removal-inventory-section .inventory-tab.has-items:focus,
#house-removal-inventory-section .inventory-tab.has-items:focus-visible {
    color: #2563eb !important;
    background: #eff6ff !important;
    box-shadow: inset 0 -3px 0 #2563eb;
}

#house-removal-inventory-section .inventory-tab.has-items.active svg,
#house-removal-inventory-section .inventory-tab.has-items:focus svg,
#house-removal-inventory-section .inventory-tab.has-items:focus-visible svg {
    color: #2563eb !important;
    fill: #2563eb !important;
}

/* Let the page scroll (not inner list scroll) so sticky headers/tabs can follow naturally */
#house-removal-inventory-section .floor-inventory-block > .room-items-list {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
}

/* Reserve viewport-safe space for fixed Manage/Next buttons so bottom content
   (media list and actions) can scroll above them instead of being covered. */
#house-removal-inventory-section .floors-inventory-container {
    padding-bottom: 170px;
}

@media (max-width: 900px) {
    #house-removal-inventory-section .floor-inventory-block > .inventory-block-header {
        top: 70px !important;
    }

    #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
        top: 118px !important;
    }

    #house-removal-inventory-section .floors-inventory-container {
        padding-bottom: 220px;
    }
}

/* Step 3 inventory sticky title + room navbar (including multi-floor blocks) */
body[data-form-step="3"] #house-removal-inventory-section > .inventory-floor-title {
    position: sticky;
    top: 78px;
    z-index: 70;
    background: #f9fafb;
    margin: 0;
    padding: 8px 0 10px;
}

body[data-current-step="3"] #house-removal-inventory-section > .inventory-floor-title {
    position: sticky;
    top: 78px;
    z-index: 70;
    background: #f9fafb;
    margin: 0;
    padding: 8px 0 10px;
}

body[data-form-step="3"] #house-removal-inventory-section > #room-tabs {
    position: sticky;
    top: 128px;
    z-index: 69;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

body[data-current-step="3"] #house-removal-inventory-section > #room-tabs {
    position: sticky;
    top: 128px;
    z-index: 69;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-block-header {
    position: sticky;
    top: 78px;
    z-index: 66;
    background: #f9fafb;
    padding-top: 8px;
}

body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-block-header {
    position: sticky;
    top: 78px;
    z-index: 66;
    background: #f9fafb;
    padding-top: 8px;
}

body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
    position: sticky;
    top: 132px;
    z-index: 65;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
    position: sticky;
    top: 132px;
    z-index: 65;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

@media (min-width: 901px) {
    body[data-form-step="3"] #house-removal-inventory-section > #room-tabs,
    body[data-current-step="3"] #house-removal-inventory-section > #room-tabs,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    body[data-form-step="3"] #house-removal-inventory-section .inventory-tab,
    body[data-current-step="3"] #house-removal-inventory-section .inventory-tab {
        flex: 0 0 clamp(120px, 11vw, 170px);
        min-width: clamp(120px, 11vw, 170px);
    }
}

@media (max-width: 900px) {
    body[data-form-step="3"] #house-removal-inventory-section > .inventory-floor-title,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-block-header {
        top: 70px;
    }

    body[data-form-step="3"] #house-removal-inventory-section > #room-tabs,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
        top: 118px;
    }
}

@media (max-width: 900px) {
    body[data-current-step="3"] #house-removal-inventory-section > .inventory-floor-title,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-block-header {
        top: 70px;
    }

    body[data-current-step="3"] #house-removal-inventory-section > #room-tabs,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky {
        top: 118px;
    }
}
/* House Removal Modal Styles */

.modal-large {
    max-width: 900px !important;
    max-height: 95vh !important;
    overflow-y: auto !important;
}

.house-removal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-top: 20px;
}

.form-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Room Tabs */
.room-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 8px;
}

.room-tabs.is-required {
    border: 1px solid #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.room-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid transparent;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.room-tab-btn:hover {
    background: #f0f0f0;
}

.room-tab-btn.active {
    border-color: var(--room-selected-green-dark);
    color: var(--room-selected-green-dark);
    background: var(--room-selected-green-bg);
}

.room-tab-btn.is-selected {
    border-color: var(--room-selected-green);
    color: var(--room-selected-green);
    background: #f0fdf4;
}

.room-empty-state {
    padding: 20px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    font-size: 0.9rem;
    text-align: center;
}

.room-tab-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
}

/* Custom Items Input */
.custom-items-input {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.custom-items-input textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.custom-items-input textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.custom-items-input label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Expandable Section */
.expandable {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
}

.expandable h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin: 0;
    padding: 0;
    border: none;
    margin-top: 0;
}

.expandable h3::after {
    content: '−';
    font-size: 1rem;
    color: var(--primary-color);
    transition: all 0.2s ease;
    font-weight: bold;
}

.expandable.collapsed h3::after {
    content: '+';
}

.expandable-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.expandable.collapsed .expandable-content {
    display: none;
}

.expandable-content label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Photo Upload Grid */
.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.photo-upload-box {
    padding: 24px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.photo-upload-box:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.photo-upload-box svg {
    color: var(--primary-color);
}

.photo-upload-box p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.photo-upload-box span {
    color: var(--primary-color);
    font-weight: 500;
}

/* Modal Adjustments */
.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-large {
        max-width: 95vw !important;
    }

    .room-tabs {
        grid-template-columns: repeat(4, 1fr);
    }

    .room-tab-btn {
        padding: 8px 4px;
        font-size: 0.7rem;
    }

    .room-tab-btn svg {
        width: 20px;
        height: 20px;
    }

    .photo-upload-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Removed max-height to allow natural flow */
    /* .room-items-list {
        max-height: 300px;
    } */

    .room-item {
        padding: 10px;
    }

    .room-item-name {
        font-size: 0.85rem;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .qty-display {
        min-width: 30px;
        height: 28px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .room-tabs {
        grid-template-columns: repeat(3, 1fr);
    }

    .photo-upload-grid {
        grid-template-columns: 1fr;
    }

    .room-tab-btn {
        padding: 8px 2px;
        font-size: 0.65rem;
    }

    .modal-content {
        padding: 16px;
    }
}

/* Step 3 mobile: use page scroll (not inner inventory scroll) */
@media (max-width: 768px) {
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-block-header,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-block-header,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block > .inventory-tabs-sticky,
    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block .inventory-sticky-track,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block .inventory-sticky-track {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        transform: none !important;
        box-shadow: none !important;
    }

    body[data-form-step="3"] #house-removal-inventory-section .floor-inventory-block .inventory-sticky-spacer,
    body[data-current-step="3"] #house-removal-inventory-section .floor-inventory-block .inventory-sticky-spacer {
        display: none !important;
        height: 0 !important;
    }

    body[data-form-step="3"] #house-removal-inventory-section .room-items-list,
    body[data-current-step="3"] #house-removal-inventory-section .room-items-list {
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: visible !important;
        -webkit-overflow-scrolling: auto;
        padding-bottom: 96px !important;
    }

    body[data-form-step="3"] #house-removal-inventory-section .inventory-items-list,
    body[data-current-step="3"] #house-removal-inventory-section .inventory-items-list {
        overflow: visible !important;
    }
}
