.ms-room[hidden], .ms-room [hidden], .ms-room-mode #furnitureConfigurator, .ms-room-mode #resetCurrent { display: none; }

.ms-topbar__inner:has(.ms-room-link) {
    grid-template-columns: minmax(126px, 170px) minmax(0, 1fr) auto auto;
}
.ms-topbar__inner:has(.ms-room-link) .ms-statusline { display: none; }
.ms-topbar__inner:has(.ms-room-link) .ms-tabs {
    display: flex;
    justify-self: start;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}
.ms-topbar__inner:has(.ms-room-link) .ms-tab { flex: 0 0 auto; padding-inline: 10px; white-space: nowrap; }
.ms-room-mode .ms-tabs [data-furniture] { display: none; }
body.ms-room-mode #tabs { width: fit-content; }
body.ms-room-mode #tabs .ms-tab:first-child { margin-inline-start: 0; }
.ms-room-link {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--brand-dark);
    border-radius: 7px;
    background: #e9f0e5;
    color: #284122;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}
.ms-room-link:hover, .ms-room-link[aria-pressed="true"] { background: #314b2b; color: white; }
.ms-room-link:disabled { opacity: .65; cursor: wait; }
.ms-room-mode { overflow: auto; }
.ms-room-mode .ms-topbar { position: sticky; top: 0; }
.ms-room {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(16px, 2vw, 30px) 0 30px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(290px, 380px);
    gap: 16px clamp(16px, 2.4vw, 32px);
    align-items: start;
}
.ms-room__heading { grid-column: 1 / -1; }
.ms-room__heading h1 { margin: 0; font-size: clamp(23px, 3.4vw, 42px); line-height: 1.1; letter-spacing: -.03em; }
.ms-room__heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.ms-room__preview { position: sticky; top: calc(var(--topbar) + 10px); min-width: 0; }
.ms-room__frame {
    position: relative;
    width: min(100%, calc(var(--room-height, 70dvh) * var(--room-aspect, 1.5)));
    margin-inline: auto;
    aspect-ratio: var(--room-aspect, 1.5);
    overflow: hidden;
    border-radius: 11px;
    isolation: isolate;
    background: #e4e0d7;
}
.ms-room__background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ms-room__loader {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--surface-soft);
    color: var(--ink);
    text-align: center;
    font-size: 15px;
    font-weight: 750;
}
.ms-room__spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--line-strong);
    border-top-color: var(--brand-dark);
    border-radius: 50%;
    animation: ms-room-spin .9s linear infinite;
}
@keyframes ms-room-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ms-room__spinner { animation: none; } }
.ms-room__notice {
    position: absolute;
    z-index: 2;
    inset: auto 10px 10px;
    margin: 0 auto;
    width: fit-content;
    max-width: calc(100% - 20px);
    padding: 8px 11px;
    border-radius: 6px;
    background: #222b20;
    color: white;
    font-size: 13px;
    pointer-events: none;
}
.ms-room__notice:empty, .ms-room__error:empty { display: none; }
.ms-room__caption { display: flex; align-items: center; justify-content: space-between; gap: 5px 12px; flex-wrap: wrap; padding: 7px 2px 0; font-size: 12px; color: var(--muted); }
.ms-room__caption span { font-weight: 800; color: var(--ink); }
.ms-room__caption a { display: inline-flex; align-items: center; text-decoration: none; }
.ms-room__controls { min-width: 0; display: grid; gap: 15px; }
.ms-room__original {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    cursor: zoom-in;
}
.ms-room__original:hover { border-color: var(--brand-dark); }
.ms-room__original img { width: 96px; height: 64px; object-fit: cover; border-radius: 5px; }
.ms-room__original span { display: grid; gap: 2px; }
.ms-room__original strong { font-size: 14px; }
.ms-room__original small { color: var(--muted); font-size: 12px; }
.ms-room__original-dialog {
    width: min(1180px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    padding: clamp(8px, 2vw, 18px);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-sizing: border-box;
    background: var(--surface);
    color: var(--ink);
}
.ms-room__original-dialog::backdrop { background: rgb(20 25 18 / 72%); }
.ms-room__original-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ms-room__original-bar h2 { margin: 0; font-size: clamp(15px, 2.5vw, 20px); }
.ms-room__original-dialog img { display: block; width: 100%; max-height: calc(100dvh - 115px); object-fit: contain; }
.ms-room__group { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ms-room__group:last-child { border: 0; }
.ms-room__group h2 { margin: 0 0 8px; font-size: 17px; line-height: 1.25; }
.ms-room__products, .ms-room__presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ms-room__presets { margin-top: 9px; }
.ms-room__product, .ms-room__preset, .ms-room__photo {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: var(--surface);
    text-align: left;
}
.ms-room__product:hover, .ms-room__preset:hover, .ms-room__photo:hover { border-color: var(--brand-dark); }
.ms-room__slot { position: relative; min-width: 0; }
.ms-room__product {
    min-height: 80px;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    align-content: start;
    gap: 3px;
    padding: 7px 8px 8px;
}
.ms-room__product img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 5px; background: #fff; }
.ms-room__product span, .ms-room__product small { font-size: 12px; color: var(--muted); }
.ms-room__product strong { font-size: 13px; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.ms-room__remove {
    position: absolute; top: 5px; right: 5px; width: 44px; height: 44px; display: grid; place-items: center;
    background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 7px;
}
.ms-room__remove:hover { border-color: var(--brand-dark); background: var(--brand-soft); }
.ms-room__frame[data-preview="empty"] {
    display: grid;
    place-items: center;
    min-height: 140px;
    aspect-ratio: 2.7;
    border: 1px dashed var(--line-strong);
    background: var(--surface-soft);
}
.ms-room__frame[data-preview="empty"] .ms-room__notice { position: static; background: transparent; color: var(--muted); text-align: center; }
.ms-room__frame[data-preview="loading"] { min-height: 140px; }
.ms-room__actions { display: grid; gap: 5px; }
.ms-room__actions .ms-room-link { width: 100%; }
.ms-room__actions .ms-room-link:disabled { cursor: default; }
.ms-room__preset { padding: 0; overflow: hidden; display: flex; flex-direction: column; align-items: stretch; }
.ms-room__preset img { width: 100%; aspect-ratio: 1.8; height: auto; object-fit: cover; }
.ms-room__preset span { flex: 1; padding: 6px 7px; font-size: 13px; line-height: 1.2; font-weight: 750; }
.ms-room__preset[aria-pressed="true"], .ms-room__photo[aria-pressed="true"] { border-color: #355e2c; outline: 1px solid #355e2c; background: #e9f0e5; }
.ms-room__upload { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.ms-room__photo { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 10px; font-size: 13px; font-weight: 750; }
.ms-room__upload .ms-room__photo:first-of-type:not([hidden]) { flex: 1; }
#interiorUpload { flex: 1; }
#interiorLayoutOpen { margin-top: 8px; }
.ms-room__layout {
    width: min(1120px, calc(100% - 20px));
    box-sizing: border-box;
    max-height: calc(100dvh - 20px);
    padding: clamp(10px, 2vw, 18px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    overscroll-behavior: contain;
}
.ms-room__layout::backdrop { background: rgb(20 25 18 / 72%); }
.ms-room__layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 310px); gap: 14px; align-items: start; }
.ms-room__layout-image { position: relative; align-self: start; min-width: 0; margin-inline: auto; }
.ms-room__layout-image img { display: block; max-width: 100%; max-height: 68dvh; height: auto; border-radius: 7px; }
.ms-room__layout-image canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.ms-room__layout-form, .ms-room__layout-fields label { display: grid; gap: 6px; min-width: 0; }
.ms-room__layout-fields { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.ms-room__layout-fields label { flex: 1; font-size: 13px; font-weight: 700; }
.ms-room__layout-fields legend { font-size: 13px; font-weight: 800; margin-bottom: 5px; }
.ms-room__layout-fields input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 16px; }
.ms-room__layout-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.ms-room__layout-check { display: flex; gap: 7px; align-items: center; min-height: 44px; font-size: 13px; }
.ms-room__layout-check input { width: 18px; height: 18px; }
@media (max-width: 700px) {
    .ms-room__layout-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
    .ms-room__layout-image { position: sticky; top: 0; z-index: 1; background: var(--surface); }
    .ms-room__layout-image img { max-height: 43dvh; }
}
.ms-room svg { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ms-room__hint, .ms-room__error { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.ms-room__error { color: #943127; }
.ms-room :focus-visible, .ms-room-link:focus-visible { outline: 2px solid #355e2c; outline-offset: 3px; }


@media (max-width: 920px) {
    .ms-topbar__inner:has(.ms-room-link) { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 7px; }
    .ms-topbar__inner:has(.ms-room-link) .ms-tabs { order: 5; min-width: 0; }
    .ms-topbar__inner:has(.ms-room-link) .ms-tab { min-height: 38px; }
    .ms-room-mode { --topbar: 60px; }
    .ms-room-mode .ms-topbar__inner { grid-template-rows: auto; gap: 5px; }
    body.ms-room-mode #tabs { grid-column: auto; order: 0; padding: 2px; }
    body.ms-room-mode #tabs .ms-tab { min-height: 44px; padding-inline: 8px; }
}
@media (min-width: 721px) and (max-width: 920px) {
    .ms-room { grid-template-columns: minmax(0, 1fr) minmax(275px, 42%); }
    body[data-room-enabled]:not(.ms-room-mode):not(.ms-booting) { overflow: hidden; }
    body[data-room-enabled] .ms-app {
        display: grid;
        grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
        height: calc(100dvh - var(--topbar));
        overflow: hidden;
    }
    body[data-room-enabled] .ms-stage { position: static; align-self: start; min-height: 0; margin: 0; }
    body[data-room-enabled] .ms-stage__image { height: min(40vw, 54dvh); }
    body[data-room-enabled] .ms-config { height: 100%; overflow-y: auto; overscroll-behavior-y: contain; }
    body[data-room-enabled] :is(.ms-table-finishes, .ms-chair-finishes) { --palette-top: 0px; }
    body[data-room-enabled] .ms-config .ms-choice { scroll-margin-top: 66px; }
}
@media (max-width: 720px) {
    .ms-room { width: calc(100% - 20px); grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .ms-room__preview { position: static; }
    .ms-room__frame { --room-height: 32dvh; }
    .ms-room__heading p { font-size: 13px; }
    .ms-room__caption { padding: 4px 1px 0; font-size: 11px; }
    .ms-room__controls { gap: 10px; }
    .ms-room__group { padding-bottom: 10px; }
    .ms-room__preset img { aspect-ratio: 2.1; }
}
@media (max-width: 720px) and (max-height: 540px) {
    .ms-room__preview { position: static; }
    .ms-room__frame { --room-height: 60dvh; }
}
@media (max-width: 360px) {
    .ms-topbar__inner:has(.ms-room-link) .ms-brand__logo { width: 92px; }
    .ms-room-link { padding-inline: 8px; }
    body.ms-room-mode #tabs .ms-tab { padding-inline: 6px; font-size: 12px; }
    .ms-room-mode .ms-room-link { font-size: 12px; }
}

.ms-room-link[data-count]:not([data-count=""])::after {
    content: attr(data-count) "/2";
    display: inline-grid;
    place-items: center;
    min-width: 27px;
    margin-inline-start: 5px;
    font-size: 11px;
    border: 1px solid currentColor;
    border-radius: 9px;
}
.ms-stage__footer:has(.ms-room-pick) { position: relative; }
.ms-room-pick[hidden], .ms-room-pick-status:empty { display: none; }
.ms-room-pick {
    flex-shrink: 0;
    min-height: 44px;
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid #54814c;
    border-radius: 7px;
    background: #e9f0e5;
    color: #305329;
    font-size: 13px;
    font-weight: 800;
}
.ms-room-pick svg {
    width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ms-room-pick[aria-pressed="true"] { color: white; background: #355e2c; border-color: #355e2c; }
.ms-room-pick:focus-visible { outline: 2px solid #355e2c; outline-offset: 2px; }
.ms-room-pick:disabled { opacity: .7; cursor: wait; }
.ms-room-pick-status {
    position: absolute; right: 0; bottom: 100%; z-index: 2;
    max-width: 210px; padding: 5px; background: white; color: #943127; font-size: 12px;
}
@media (hover: hover) and (pointer: fine) and (min-width: 921px) {
    .ms-room-pick:not([aria-pressed="true"]) { opacity: 0; pointer-events: none; }
    .ms-stage:hover .ms-room-pick, .ms-stage:focus-within .ms-room-pick { opacity: 1; pointer-events: auto; }
}
@media (max-width: 460px) {
    .ms-room-pick { font-size: 12px; padding-inline: 6px; gap: 4px; }
    .ms-room-mode .ms-room-link[data-count]:not([data-count=""])::after { display: none; }
}
