.bp-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #f3f4f5;
}

.bp-app,
.bp-app * {
    box-sizing: border-box;
}

.bp-app {
    --bp-red: #aa0000;
    --bp-red-dark: #7d0000;
    --bp-text: #242424;
    --bp-muted: #697079;
    --bp-line: #d7dade;
    --bp-panel: #ffffff;
    max-width: 1680px;
    margin: 0 auto;
    padding: 24px;
    color: var(--bp-text);
    font-family: Arial, Helvetica, sans-serif;
}

.bp-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
}

.bp-editor-title { margin: 0; font-size: 26px; line-height: 1.2; }

.bp-eyebrow {
    margin: 0 0 5px;
    color: var(--bp-red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.bp-toolbar h1 {
    margin: 0;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.05;
}

.bp-subtitle {
    max-width: 720px;
    margin: 8px 0 0;
    color: var(--bp-muted);
    font-size: 14px;
}

.bp-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.bp-btn,
.bp-catalog button,
.bp-view-tabs button,
.bp-swatches button {
    appearance: none;
    border: 0;
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}

.bp-btn {
    min-height: 42px;
    padding: 10px 16px;
    font-weight: 700;
}

.bp-btn-primary {
    background: var(--bp-red);
    color: #fff;
}

.bp-btn-primary:hover,
.bp-btn-primary:focus-visible {
    background: var(--bp-red-dark);
}

.bp-btn-secondary {
    border: 1px solid var(--bp-line);
    background: #fff;
    color: var(--bp-text);
}

.bp-btn-secondary:hover,
.bp-btn-secondary:focus-visible {
    border-color: #a7adb4;
    background: #f8f8f8;
}

.bp-full {
    width: 100%;
}

.bp-status {
    min-height: 38px;
    margin-bottom: 12px;
    padding: 9px 12px;
    border: 1px solid #dfe2e5;
    border-radius: 8px;
    background: #fff;
    color: var(--bp-muted);
    font-size: 13px;
}

.bp-status.is-error {
    border-color: #d9a8a8;
    color: #7c1515;
}

.bp-status.is-success {
    border-color: #9dc9a8;
    color: #246532;
}

.bp-workspace {
    display: grid;
    grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
    min-height: 720px;
    overflow: visible;
    border: 1px solid var(--bp-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
}

.bp-sidebar {
    position: sticky;
    top: 16px;
    align-self: start;
    overflow-y: auto;
    width: 100%;
    max-height: max(420px, calc(100vh - 260px));
    border-right: 1px solid var(--bp-line);
    border-radius: 12px 0 0 12px;
    background: #f8f8f8;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.bp-panel {
    padding: 18px;
    border-bottom: 1px solid var(--bp-line);
}

.bp-panel h2 {
    margin: 0 0 14px;
    font-size: 15px;
}

.bp-panel.bp-accordion {
    padding: 0;
}

.bp-accordion > summary {
    position: relative;
    padding: 18px 42px 18px 18px;
    cursor: pointer;
    list-style: none;
    font-size: 15px;
    font-weight: 800;
}

.bp-accordion > summary::-webkit-details-marker {
    display: none;
}

.bp-accordion > summary::after {
    position: absolute;
    top: 50%;
    right: 18px;
    content: '+';
    transform: translateY(-50%);
    color: var(--bp-red);
    font-size: 22px;
}

.bp-accordion[open] > summary::after {
    content: '−';
}

.bp-accordion[open] > summary {
    border-bottom: 1px solid var(--bp-line);
}

.bp-panel-content {
    padding: 16px 18px 18px;
}

.bp-add-partition {
    margin-top: 8px;
}

.bp-field-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.bp-field-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
}

.bp-field-grid label,
.bp-properties label,
.bp-select-label {
    display: grid;
    gap: 5px;
    color: #555c63;
    font-size: 12px;
    font-weight: 700;
}

.bp-field-grid label span {
    color: #93999f;
    font-weight: 400;
}

.bp-app input,
.bp-app select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cfd3d7;
    border-radius: 6px;
    background: #fff;
    padding: 7px 8px;
    color: var(--bp-text);
    font: inherit;
    font-size: 13px;
}

.bp-app input:focus,
.bp-app select:focus {
    outline: 2px solid rgba(160, 0, 0, .16);
    border-color: var(--bp-red);
}

.bp-catalog {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.bp-catalog button {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid #d8dbde;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.bp-catalog button:hover,
.bp-catalog button:focus-visible {
    border-color: var(--bp-red);
    color: var(--bp-red);
}

.bp-catalog-openings button {
    text-align: center;
}

.bp-properties {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #ccd0d4;
}

.bp-inspector {
    position: fixed;
    z-index: 10020;
    top: max(18px, calc(env(safe-area-inset-top) + 12px));
    right: auto;
    left: max(24px, calc((100vw - 1680px) / 2 + 24px));
    width: min(330px, calc(100vw - 48px));
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    border: 2px solid var(--bp-red);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

.bp-inspector-header {
    position: sticky;
    z-index: 2;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--bp-line);
    background: #fff;
}

.bp-inspector-header h2 {
    margin: 2px 0 0;
    font-size: 20px;
}

.bp-inspector-kicker {
    color: var(--bp-red);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.bp-inspector-close {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid #d5d8dc;
    border-radius: 50%;
    background: #f7f7f7;
    color: #34383c;
    cursor: pointer;
    font-size: 27px;
    line-height: 1;
}

.bp-inspector > .bp-properties {
    margin: 0;
    padding: 16px;
    border: 0;
}

.bp-properties label span {
    color: #8a9096;
    font-weight: 400;
}

.bp-property-help {
    grid-column: 1 / -1;
    margin: 2px 0;
    color: var(--bp-muted);
    font-size: 12px;
    line-height: 1.45;
}

.bp-result {
    position: fixed;
    z-index: 10030;
    inset: 0;
    display: grid;
    padding: 18px;
    place-items: center;
    background: rgba(20, 22, 24, .72);
}

.bp-result-card {
    width: min(1500px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .4);
}

.bp-result-card img {
    display: block;
    width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    background: #e8eaec;
}

.bp-result-card > .bp-btn {
    display: block;
    width: fit-content;
    margin: 14px auto;
    text-decoration: none;
}

.bp-result-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 16px; }
.bp-result-comparison figure { margin: 0; }
.bp-result-comparison figcaption { padding: 10px 0; font-size: 14px; font-weight: 700; }
.bp-result-note { margin: 12px 16px; font-size: 14px; line-height: 1.5; color: #4b5563; }
@media (max-width: 760px) { .bp-result-comparison { grid-template-columns: 1fr; } }

.bp-btn:disabled {
    cursor: wait;
    opacity: .58;
}

.bp-properties .bp-property-title,
.bp-properties .bp-property-actions {
    grid-column: 1 / -1;
}

.bp-property-title {
    font-size: 12px;
    font-weight: 800;
}

.bp-property-actions {
    display: flex;
    gap: 7px;
}

.bp-property-actions button {
    flex: 1;
    min-height: 36px;
    border: 1px solid #d5d8dc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.bp-property-actions button[data-danger] {
    color: #8e1111;
}

.bp-note {
    margin: -4px 0 12px;
    color: var(--bp-muted);
    font-size: 11px;
    line-height: 1.45;
}

.bp-select-label {
    margin-bottom: 10px;
}

.bp-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.bp-swatches button {
    height: 36px;
    border: 2px solid #fff;
    outline: 1px solid #c9cdd1;
}

.bp-swatches button:nth-child(1) { background: #d7d2c8; }
.bp-swatches button:nth-child(2) { background: #b8b8b4; }
.bp-swatches button:nth-child(3) { background: #e8e4db; }
.bp-swatches button:nth-child(4) { background: #8f9395; }

.bp-swatches button.is-active {
    outline: 2px solid var(--bp-red);
}

.bp-editor-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    overflow: hidden;
    border-radius: 0 12px 12px 0;
    background: #eef0f2;
}

.bp-view-tabs {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 56px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--bp-line);
    background: #fff;
}

.bp-view-tabs button {
    min-width: 110px;
    min-height: 38px;
    padding: 8px 14px;
    background: #eceeef;
    color: #43484d;
    font-weight: 800;
}

.bp-view-tabs button.is-active {
    background: var(--bp-red);
    color: #fff;
}

.bp-view-hint {
    margin-left: auto;
    color: var(--bp-muted);
    font-size: 11px;
}

.bp-editor-view {
    position: relative;
    display: none;
    min-height: 620px;
    overflow: hidden;
}

.bp-editor-view.is-active {
    display: block;
}

.bp-editor-view canvas[data-floorplan] {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 620px;
    touch-action: none;
    background-color: #eef0f2;
    background-image: linear-gradient(#e2e5e7 1px, transparent 1px), linear-gradient(90deg, #e2e5e7 1px, transparent 1px);
    background-size: 24px 24px;
}

.bp-empty-hint {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    max-width: calc(100% - 30px);
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .93);
    color: #697079;
    font-size: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
    pointer-events: none;
}

.bp-three-host {
    position: absolute;
    inset: 0;
    background: linear-gradient(#dde5eb, #f7f7f5 62%, #d5d5d0 62%);
    touch-action: none;
}

.bp-editor-view.is-interior { min-height: 0; aspect-ratio: 3 / 2; }

.bp-three-host[data-camera-error]:not([data-camera-error=""])::after {
    content: attr(data-camera-error);
    position: absolute;
    inset: 35% 10%;
    padding: 20px;
    background: #fff;
    color: #a00000;
}

.bp-interior-controls:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f4f1eb;
    font-size: 13px;
}

.bp-interior-controls select { padding: 8px; max-width: 100%; }
.bp-interior-controls span { flex: 1 1 260px; }

.bp-three-host canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.bp-three-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 8px;
    padding: 20px;
    color: #5d646b;
    text-align: center;
}

.bp-three-placeholder span {
    font-size: 12px;
}

.bp-three-error {
    position: absolute;
    inset: 20px;
    display: grid;
    place-content: center;
    color: #7c1515;
    text-align: center;
}

.bp-editor-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 11px 14px;
    border-top: 1px solid var(--bp-line);
    background: #fff;
    color: var(--bp-muted);
    font-size: 11px;
}

.bp-hidden {
    display: none !important;
}

@media (max-width: 1050px) {
    .bp-app {
        padding: 14px;
    }

    .bp-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .bp-toolbar-actions {
        justify-content: flex-start;
    }

    .bp-workspace {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .bp-sidebar {
        max-height: max(420px, calc(100vh - 220px));
    }

    .bp-inspector {
        left: 14px;
        width: min(260px, calc(100vw - 28px));
    }

    .bp-view-hint {
        display: none;
    }
}

@media (max-width: 760px) {
    .bp-app {
        padding: 10px;
    }

    .bp-toolbar-actions .bp-btn {
        flex: 1 1 160px;
    }

    .bp-workspace {
        display: block;
        border-radius: 8px;
    }

    .bp-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr;
        max-height: none;
        border-right: 0;
        border-radius: 8px 8px 0 0;
        border-bottom: 1px solid var(--bp-line);
    }

    .bp-panel {
        padding: 14px;
    }

    .bp-editor-view,
    .bp-editor-view canvas[data-floorplan] {
        min-height: 480px;
    }

    .bp-view-tabs {
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .bp-editor-footer {
        flex-direction: column;
    }

    .bp-inspector {
        top: auto;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        max-height: min(68vh, 620px);
    }
}
