:root {
    --border: #e5e5e5;
    --text: #373435;
    --muted: #666;
    --bg: #f7f7f7;
    --white: #fff;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Lato", Arial, sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
}

/* ---------------- Topbar (mobile) ---------------- */
.topbar {
    display: none;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 10px;
    position: sticky;
    top: 0;
    z-index: 1100;
}

.hamburger {
    display: none;
    border: 1px solid var(--border);
    background: var(--white);
    padding: 6px 10px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
}

/* ---------------- App layout ---------------- */
.app {
    display: grid;
    grid-template-columns: 112px 1fr; /* compact sidebar */
    height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.close-btn {
    display: none;
    border: 1px solid var(--border);
    background: var(--white);
    padding: 6px 10px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    font-size: 16px;
    line-height: 1;
    align-self: flex-end;
    cursor: pointer;
}

/* tile card: icon ABOVE label */
.tab {
    width: 100%;
    min-height: 86px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.02) inset;
    font-size: 12px;
    text-align: center;
    color: #6a6a6a;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s,
    color 0.15s;
}

.tab:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.03) inset;
}

.tab.active {
    background: #d4d4d4;
    border: 1px solid #e6e6e6;
    font-weight: 600;
    color: #373435;
}

#glbProgress {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: #eee;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .15);
    display: none;

}

/* small rounded icon tile */
.tab .ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: #fff;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 24px 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px #ececec inset;
    display: inline-block;
    filter: grayscale(1) contrast(0.95) brightness(1.05);
    opacity: 0.9;
}

.tab.active .ico {
    filter: none;
    opacity: 1;
}

/* map PNGs */
.tab[data-icon="layout"] .ico {
    background-image: url("images/Frame 46.png");
}

.tab[data-icon="ceiling"] .ico {
    background-image: url("images/Frame 46-1.png");
}

.tab[data-icon="walls"] .ico {
    background-image: url("images/Frame 46-2.png");
}

.tab[data-icon="floor"] .ico {
    background-image: url("images/Frame 46-3.png");
}

.tab[data-icon="door"] .ico {
    background-image: url("images/Frame 46-4.png");
}

.tab[data-icon="ui"] .ico {
    background-image: url("images/Frame 46-5.png");
}

.tab[data-icon="accessories"] .ico {
    background-image: url("images/Frame 46-6.png");
}

.tab[data-icon="gallery"] .ico {
    background-image: url("images/photo.png");
}

/* ---------------- Main ---------------- */
.main {
    display: grid;
    grid-template-columns: 460px 1fr;
    height: 100%;
    background: #fff;
}

/* ---------------- Left pane ---------------- */
.left-pane {
    background: var(--white);
    padding: 20px;
    overflow: auto;
    max-height: 100vh;
}

.section {
    margin-bottom: 24px;
}

.section_style {
    margin-bottom: 24px;
    background-color: var(--bg);
    padding: 5px 10px 20px;
    border-radius: 20px;
}

.pane-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
}

.group {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.group + .group {
    margin-top: 16px;
}

.group h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.chips {
    display: flex;
    gap: 16px;
    flex-wrap: nowrap; /* keep one line */
    justify-content: flex-start;
    align-items: stretch;
}

/* ---- Sample car dimensions (non-active matches parent background) ---- */
.chip {
    width: 140px;
    min-height: 96px;
    padding: 12px 10px;
    border-radius: 12px;
    background: transparent; /* ← same as the group's background */
    box-shadow: none; /* no elevation for non-active */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
}

.chip.active {
    background: #fff; /* only active is white */
    border-color: #d9d9d9;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    font-weight: normal; /* keep weight normal */
}

.chip img {
    width: 58px;
    height: 36px;
    object-fit: contain;
    display: block;
    margin: 0 auto 6px;
}

/* ---- Entrances (same treatment) ---- */
/* === Entrances panel — match reference (image 2) === */
.group:has(.entrance) {
    background: #f6f6f6; /* pale grey panel */
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 16px;
}

/* rows (non-active blend into the panel) */
.entrance {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: transparent; /* same as panel */
    box-shadow: none;
    font-size: 13px;
    color: #333;
}

.entrance + .entrance {
    margin-top: 10px;
}

/* small left icon like the mock */
.entrance img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    opacity: 0.8; /* faint on non-active */
}

/* only active row is white with a soft lift */
.entrance.active {
    background: #ffffff !important; /* ensure white only for active */
    border-color: #e2e2e2;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
}

.entrance.active img {
    opacity: 1;
}

/* subtle hover—optional */
.entrance:not(.active):hover {
    background: rgba(255, 255, 255, 0.5);
}

/* option cards */
.option-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 14px;
}

.option-grid.full {
    display: block;
    grid-template-columns: none;
}

.option-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 10px;
    text-align: center;
    cursor: pointer;
}

.option-card.nostyle {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.option-card img.img-full {
    width: 60%;
    height: auto;
    border-radius: 10px;
}

.option-card.text-left {
    text-align: left;
}

.option-card.active {
    outline: 2px solid #000;
}

.border {
    border-bottom: 1px solid #d9d9d9;
    padding: 10px 0;
}

.sketch {
    height: 66px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.bar {
    width: 8px;
    height: 36px;
    background: #c9c9c9;
    border-radius: 4px;
}

.bar.h {
    width: 36px;
    height: 8px;
}

.option-name {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text);
}

/* fake select */
.select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
    font-size: 13px;
    cursor: pointer;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Native select styled like the screenshot */
.dd {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 40px 0 14px;
    font-size: 14px;
    color: #444;
    background: #fff;
    border: 1px solid #e7e7e7;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    appearance: none; /* hide default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;

    /* chevron at right, no extra markup */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

.dd:hover {
    border-color: #e0e0e0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.dd:focus {
    outline: 0;
    border-color: #2d2d2d;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.caret {
    font-size: 14px;
    color: #444;
}

/* material grids */
.material-group {
    margin-top: 12px;
}

.material-title {
    font-size: 13px;
    color: #444;
    margin: 5px 0;
}

.text-align-center {
    text-align: center;
}

/* ==== Fixed Bottom Gallery Drawer ==== */
#gallery-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-top: 2px solid #ccc;
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.25);
    border-radius: 12px 12px 0 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    z-index: 9999; /* ensure it’s above your canvas */
}

#gallery-container.open {
    max-height: 180px; /* total open height (150px content + bar) */
}

/* Top bar to toggle visibility */
#gallery-bar {
    background: #eee;
    padding: 10px 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid #ccc;
    user-select: none;
    color: #333;
}

/* Gallery list inside the drawer */
#gallery {
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    height: 150px;
    gap: 10px;
    background: #fff;
    scroll-behavior: smooth;
}

.gallery-card {
    position: relative;
    flex: 0 0 auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

.gallery-card img {
    height: 130px;
    width: auto;
    display: block;
    border-radius: 8px;
}

.gallery-card button.del {
    position: absolute;
    top: 3px;
    right: 4px;
    background: #ff4c4c;
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 18px;
}


.material-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 14px;
}

.material {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px;
    text-align: center;
    border: 3px solid #ffffffff;
}

.materialActive {

    border: 3px solid;
}

.buttonOptionsContainer {
    margin-top: 20px;
}

.tile {
    height: 70px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.name {
    margin-top: 6px;
    font-size: 11px;
    color: #333;
    text-align: center;
}

.gold {
    background-image: url(images/gold_frame.png);
}

.steel {
    background-image: url(images/steel_frame.png);
}

#finishOptionsContainer .material {
    cursor: pointer;
}

/* radios & directions */
/* CSS */
.radio-row-new {
    display: grid;
    gap: 12px;
}

.radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb; /* light grey border */
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); /* subtle elevation */
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    position: relative;
}

.radio-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.radio-card input {
    position: absolute;
    inset: 0; /* full card is clickable */
    opacity: 0;
    cursor: pointer;
}

.radio-card .control {
    width: 18px;
    height: 18px;
    border: 2px solid #cfd4dc;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    transition: border-color 0.15s;
}

.radio-card .control::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #111827; /* dark dot */
    transform: scale(0);
    transition: transform 0.15s ease-in-out;
}

/* Checked styles */
.radio-card:has(input:checked) {
    background: #fafafa;
    border-color: #d1d5db;
}

.radio-card:has(input:checked) .control {
    border-color: #111827;
}

.radio-card:has(input:checked) .control::after {
    transform: scale(1);
}

/* Focus ring for a11y */
.radio-card:has(input:focus-visible) {
    outline: 2px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

.radio-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-column {
    flex-direction: row;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.radio-column .radio-option {
    width: 50%;
}

.dot {
    width: 14px;
    height: 14px;
    border: 2px solid #999;
    border-radius: 50%;
}

.radio-option.active .dot {
    background: #111;
    border-color: #111;
}

.dir-grid {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.dir {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.dir .btn {
    width: 44px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    font-weight: 700;
}

/* accordions */
.accordion {
    border-radius: 12px;
    background: #fff;
}

.acc-item {
    background-color: #f7f7f7;
    margin-bottom: 15px;
    padding: 12px 14px 8px;
    border-radius: 10px;
}

.acc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.acc-body {
    padding: 0;
    display: none;
}

.acc-item.open .acc-body {
    display: block;
    margin-top: 15px;
}

/* Chevron icon */
.acc-head .dd-ico {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    color: #666; /* sets stroke via currentColor */
    opacity: .9;
}

/* CLOSED = angle-down */
.acc-item .acc-head .dd-ico {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* OPEN = angle-up */
.acc-item.open .acc-head .dd-ico {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 15l-6-6-6 6'/%3E%3C/svg%3E");
    color: #333; /* optional darker when open */
}

/* ---------------- Right pane / preview ---------------- */
.right-pane {
    background: #fff;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 10px;
}

.btnBackTop {
    display: block;
}

.btnBackBottom {
    display: none;
}

/* whole preview card */
.preview-box {
    flex: 1;
    border: 1px solid #e5e9ee;
    border-radius: 12px;
    background: #fcfcfd;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* header INSIDE the card (like ref) */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.preview-surface {
    position: relative;
    flex: 1;
    padding: 20px;
}

.preview-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-header-left button {
    border: none;
    background: none;
    cursor: pointer;
}

.preview-header-actions {
    display: flex;
    gap: 15px; /* Space between buttons */
}

.preview-header-actions button {
    display: flex;
    align-items: center; /* Vertically center */
    justify-content: center; /* Horizontally center */
    gap: 6px; /* Space between icon and text */
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    font-family: "Lato", Arial, sans-serif;
    font-weight: 400;
    font-style: normal;
    color: var(--text);
    font-size: 15px;
}

.preview-header-actions button img {
    height: 18px;
}

.preview-header-actions .primary {
    background: #000;
    color: #fff;
    border: none;
}

.tool {
    width: 34px;
    height: 34px;
    border: 1px solid #e1e6ec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.tool img {
    width: 18px;
    height: auto;
}

.tool-gear {
    position: absolute;
    top: 16px;
    right: 16px;
}

.tool-stack {
    position: absolute;
    right: 16px;
    top: 0px;
    display: grid;
    gap: 10px;
}

.elevator-wrap {
    position: relative;
    width: min(640px, 62%); /* size similar to ref */
    margin: 0 auto; /* centered */
}

.elevator-img {
    width: 100%;
    height: auto;
    display: block;
}

/* black selection frame + 8 handles */
.bbox {
    pointer-events: none;
    position: absolute;
    inset: -6px; /* small offset like ref */
    border: 1.4px solid #111;
}

.hdl {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #111;
    border-radius: 1px;
}

.hdl.tl {
    top: -4px;
    left: -4px;
}

.hdl.tr {
    top: -4px;
    right: -4px;
}

.hdl.bl {
    bottom: -4px;
    left: -4px;
}

.hdl.br {
    bottom: -4px;
    right: -4px;
}

.hdl.mt {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
}

.hdl.mb {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
}

.hdl.ml {
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
}

.hdl.mr {
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
}

/* gray rounded canvas like screenshot 1 */
.preview-content {
    flex: 1;
    margin: 12px;
    border-radius: 10px;
    border: 1px solid #cfd6de;
    background: linear-gradient(180deg, #e9eff4 0%, #f6fbff 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
}

/* (placeholder) 3D object */
.elevator {
    width: min(60%, 520px);
    aspect-ratio: 1/1.1;
    border: 1px solid #cfcfcf;
    border-radius: 10px;
    background: linear-gradient(180deg, #dfe7ec, #eef4f8);
    box-shadow: inset 0 0 0 2px #c8d2d9;
}

/* zoom rail + gear inside canvas */
.zoom {
    position: absolute;
    top: 50%;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateY(-50%);
}

.zoom button,
.gear {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.gear {
    position: absolute;
    top: 16px;
    right: 16px;
}

/* feedback inside preview bottom-right */
.feedback {
    position: absolute;
    right: 16px;
    bottom: 16px;
}

/* Mobile: keep tools usable */
@media (max-width: 900px) {
    .tool-stack {

        z-index: 98;
        right: 12px;
    }

    #glbProgress{
        top:25%;
    }

    .tool,
    .tool-gear {
        width: 32px;
        height: 32px;
    }

    .tool img {
        width: 16px;
        height: 16px;
    }

    .elevator-wrap {
        width: 90%;
    }
}

/* ---------------- Overlay (mobile) ---------------- */
.overlay {
    display: none;
}

.overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
}

/* ---------------- Sub-views ---------------- */
.pill-tabs {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    justify-content: space-between;
}

.pill {
    padding: 10px 16px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 15px;
    width: 50%;
}

.pill.active {
    background: #373435;
    color: #fff;
    border-color: #373435;
    font-weight: 600;
}

.pane.hidden {
    display: none;
}

.floor-sticky {
    margin-top: 16px;
    position: sticky;
    bottom: 8px;
    background: #2b2b2b;
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* ===== LAYOUT PANE — pixel-match overrides (scoped) ===== */
.layout-pane .group {
    background: #f6f6f7;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 16px 16px 18px;
}

.layout-pane .chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.layout-pane .chip {
    flex: 0;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: none;
    background: #fff;
    text-align: center;
}

.layout-pane .chip.active {
    border: 2px solid #111;
    background: #fff;
}

.layout-pane .chip img {
    width: 64px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: 0 auto 8px;
}

.layout-pane .chip div {
    line-height: 1.15;
    font-size: 12px;
}

.layout-pane .entrance {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.layout-pane .entrance img {
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 0 0 1px #f3f3f3;
}

.layout-pane .entrance span {
    font-size: 13px;
    color: #333;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .main {
        grid-template-columns: 1fr;
    }

    .left-pane {
        border-right: none;
    }

    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        z-index: 98;
    }

    .topbar {
        display: block;
    }

    body {
        overflow: hidden;
    }

    .hamburger {
        display: inline-block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -220px;
        width: 200px;
        height: 100%;
        background: var(--white);
        border-right: 1px solid var(--border);
        transition: left 0.3s ease;
        padding: 12px;
        z-index: 1201;
    }

    .sidebar.open {
        left: 0;
    }

    .close-btn {
        display: block;
        margin: 4px 0 8px auto;
    }

    .material-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

.segmented-radio {
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 14px;
    background: #f5f6f8; /* light grey like in your image */
    width: 100%;
}

/* Each option looks like a mini card */
.segmented-option {
    position: relative;
    display: flex;
    width: 50%;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

/* Make the whole label clickable */
.segmented-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Radio visuals */
.segmented-option .control {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    border: 2px solid #cfd4dc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.segmented-option .control::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #111827;
    transform: scale(0);
    transition: transform 0.15s;
}

/* Checked state */
.segmented-option:has(input:checked) {
    border-color: #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    background: #ffffff;
}

.segmented-option:has(input:checked) .control {
    border-color: #111827;
}

.segmented-option:has(input:checked) .control::after {
    transform: scale(1);
}

/* Focus ring for keyboard users */
.segmented-option:has(input:focus-visible) {
    outline: 2px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

/* Optional: stack on small screens */
@media (max-width: 480px) {
    .segmented-radio {
        flex-wrap: wrap;
    }
}

/* ===== Force visible, horizontal sidebar on mobile ===== */
@media (max-width: 768px) {
    .app {
        display: block;
    }

    .preview-surface {
        padding: 0;
    }

    /* Make sidebar a sticky, horizontal tab bar */
    #sidebar.sidebar {
        position: sticky;
        top: 0;
        z-index: 100;

        display: flex !important; /* override any 'display:none' */
        flex-direction: row;
        align-items: center;
        gap: 8px;

        width: 100%;
        height: auto;
        padding: 8px;

        background: var(--white);
        border-right: 0;
        border-bottom: 1px solid var(--border);

        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;

        /* kill any slide-out transforms from old burger JS */
        transform: none !important;
        translate: none !important;
        left: auto !important;
    }

    .btnBackTop {
        display: none;
    }

    .btnBackBottom {
        display: block;
    }

    .btnBackBottom span {
        display: none;
    }

    .left-pane {
        border-right: none;
        position: absolute;
        height: 100vh;
        width: 99%;
        z-index: 99;
    }


    .dnone {
        display: none;
    }

    /* Compact pill tabs */
    #sidebar .tab {
        width: auto;
        min-height: auto;
        padding: 8px 12px;
        flex-direction: row; /* icon left, label right */
        gap: 8px;
        border-radius: 9999px;
        white-space: nowrap;
        box-shadow: none;
        border: 1px solid transparent;
        font-size: 13px;
    }

    #sidebar .tab.active {
        background: #f5f7fb;
        border-color: #e6e6e6;
        color: #373435;
    }

    #sidebar .tab .ico {
        width: 20px;
        height: 20px;
        border-radius: 6px;
        background-size: 16px 16px;
        box-shadow: none;
    }

    /* Hide burger/close/overlay on mobile */
    .topbar, .hamburger, #closeSidebar, .overlay {
        display: none !important;
    }

    /* If your JS adds these classes, still show the bar */
    .sidebar.open,
    .sidebar.is-open,
    .sidebar.hidden,
    .sidebar.collapsed {
        display: flex !important;
        transform: none !important;
    }
}
