:root {
  --forest: #3f4b3b;
  --forest-deep: #2e382b;
  --forest-soft: #607058;
  --sage: #78846d;
  --sage-pale: #dce0d5;
  --cream: #f5f1e8;
  --paper: #fcfaf5;
  --warm-white: #fffdf8;
  --sand: #d9cdbb;
  --clay: #b98265;
  --ink: #262923;
  --muted: #777a70;
  --line: #e5e0d6;
  --danger: #a65348;
  --shadow: 0 16px 50px rgba(50, 57, 45, 0.12);
  --panel-shadow: 0 8px 30px rgba(37, 43, 32, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  background: var(--cream);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 216px 1fr; }

.rail {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 20px 20px;
  color: #f7f3e9;
  background:
    radial-gradient(circle at 10% 76%, rgba(180, 195, 159, .12), transparent 30%),
    linear-gradient(155deg, #3c4938 0%, #2b3529 100%);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 41px; height: 41px; border: 1px solid rgba(255,255,255,.4);
  color: #f7f0df; font-family: "Prata", serif; font-size: 22px;
}
.brand strong { display: block; font-family: "Prata", serif; font-size: 20px; letter-spacing: .14em; font-weight: 400; }
.brand small { display: block; margin-top: 2px; color: rgba(255,255,255,.6); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }

.project-mini { display: flex; gap: 11px; align-items: center; margin: 39px -4px 20px; padding: 11px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.045); }
.project-thumb { position: relative; width: 48px; height: 44px; overflow: hidden; background: #e9e0d0; }
.project-thumb::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: 4px; height: 17px; background: #829078; }
.project-thumb span { position: absolute; z-index: 1; bottom: 5px; width: 11px; height: 16px; border: 1px solid rgba(255,255,255,.5); }
.project-thumb span:nth-child(1) { left: 5px; }
.project-thumb span:nth-child(2) { left: 18px; }
.project-thumb span:nth-child(3) { left: 31px; }
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.rail .eyebrow { color: rgba(255,255,255,.45); font-size: 8px; }
.project-name { display: block; max-width: 130px; overflow: hidden; margin-top: 4px; padding: 0; border: 0; color: #fff; background: transparent; font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }

.steps { display: flex; flex-direction: column; gap: 3px; }
.step { display: grid; grid-template-columns: 29px 1fr 15px; gap: 10px; align-items: center; width: 100%; padding: 13px 10px; border: 0; border-left: 2px solid transparent; color: rgba(255,255,255,.62); background: transparent; text-align: left; cursor: pointer; transition: .2s ease; }
.step:hover { color: #fff; background: rgba(255,255,255,.04); }
.step.active { border-left-color: #cbd4b8; color: #fff; background: rgba(255,255,255,.085); }
.step-num { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; font-size: 10px; }
.step.active .step-num { color: var(--forest-deep); background: #d9dfcc; border-color: #d9dfcc; font-weight: 700; }
.step b, .step small { display: block; }
.step b { font-size: 11px; font-weight: 600; }
.step small { margin-top: 2px; color: rgba(255,255,255,.38); font-size: 9px; }
.step > svg { width: 14px; }

.rail-help { margin-top: auto; padding: 15px 12px 12px; border-top: 1px solid rgba(255,255,255,.11); }
.rail-help { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.help-icon { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid rgba(255,255,255,.23); border-radius: 50%; font-size: 11px; }
.rail-help b, .rail-help small { display: block; }
.rail-help b { font-size: 10px; }
.rail-help small { margin-top: 2px; color: rgba(255,255,255,.42); font-size: 8px; }
.rail-help button { grid-column: 2; justify-self: start; padding: 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.35); color: #dfe5d4; background: none; font-size: 9px; cursor: pointer; }
.rail-footer { display: flex; align-items: center; gap: 8px; padding: 19px 10px 0; color: rgba(255,255,255,.38); font-size: 8px; }
.rail-footer .icon-button { margin-right: auto; color: rgba(255,255,255,.55); }
.saved-dot { width: 5px; height: 5px; border-radius: 50%; background: #aebe91; box-shadow: 0 0 0 3px rgba(174,190,145,.1); }

.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--paper); }
.topbar { z-index: 5; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(255,253,248,.94); backdrop-filter: blur(14px); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.breadcrumbs svg { width: 12px; }
.breadcrumbs b { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.history-actions { display: flex; gap: 4px; }
.icon-button, .toolbar-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; transition: .2s; }
.icon-button:hover, .toolbar-button:hover { color: var(--forest); background: var(--cream); }
.icon-button:disabled { opacity: .25; pointer-events: none; }
.icon-button svg, .toolbar-button svg { width: 18px; }
.header-price { padding-left: 17px; border-left: 1px solid var(--line); text-align: right; }
.header-price span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .04em; }
.header-price strong { display: block; margin-top: 3px; font-size: 15px; font-weight: 700; }
.primary-button, .secondary-button { min-height: 40px; padding: 0 18px; border: 1px solid var(--forest); font-size: 11px; font-weight: 700; cursor: pointer; transition: .2s ease; }
.primary-button { color: #fff; background: var(--forest); box-shadow: 0 7px 18px rgba(63,75,59,.14); }
.primary-button:hover { background: var(--forest-deep); transform: translateY(-1px); }
.secondary-button { color: var(--forest); background: transparent; }
.secondary-button:hover { background: var(--cream); }
.mobile-brand { display: none; }

.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: 230px minmax(430px, 1fr) 260px; transition: grid-template-columns .2s ease; }
.workspace.catalog-collapsed { grid-template-columns: 0 minmax(430px, 1fr) 260px; }
.workspace.properties-collapsed { grid-template-columns: 230px minmax(430px, 1fr) 0; }
.workspace.catalog-collapsed.properties-collapsed { grid-template-columns: 0 minmax(430px, 1fr) 0; }
.workspace.catalog-collapsed .catalog-panel, .workspace.properties-collapsed .properties-panel { padding-inline: 0; border: 0; opacity: 0; pointer-events: none; }
.catalog-panel, .properties-panel { min-height: 0; overflow-x: hidden; overflow-y: auto; background: var(--warm-white); scrollbar-width: thin; scrollbar-color: var(--sand) transparent; }
.catalog-panel { z-index: 3; padding: 24px 20px 18px; border-right: 1px solid var(--line); }
.properties-panel { z-index: 3; padding: 24px 21px; border-left: 1px solid var(--line); }
.panel-heading { display: flex; justify-content: space-between; }
.panel-heading h1 { margin: 6px 0 0; font-family: "Prata", serif; font-size: 22px; font-weight: 400; }
.mobile-close { display: none; border: 0; background: none; font-size: 24px; }
.panel-copy { margin: 13px 0 18px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.search-box { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px; border: 1px solid var(--line); background: #fff; }
.search-box:focus-within { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(120,132,109,.09); }
.search-box svg { width: 15px; color: var(--muted); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 10px; }
.catalog-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0 12px; border-bottom: 1px solid var(--line); }
.catalog-tabs button { padding: 0 3px 9px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: none; font-size: 9px; cursor: pointer; }
.catalog-tabs button.active { border-bottom-color: var(--forest); color: var(--forest); font-weight: 700; }
.module-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.module-card { position: relative; min-height: 112px; padding: 8px 8px 10px; border: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; transition: .2s ease; }
.module-card:hover { z-index: 1; border-color: #aeb6a4; box-shadow: var(--panel-shadow); transform: translateY(-2px); }
.module-card-visual { position: relative; display: grid; place-items: center; height: 64px; margin-bottom: 7px; background: #f3f0e9; overflow: hidden; }
.module-card-visual::before { content: ""; width: var(--module-w, 39px); height: var(--module-h, 43px); border: 1px solid #788074; background: linear-gradient(105deg, #d9ddd2 0 72%, #c0c8b9 72%); box-shadow: 5px 3px 0 #a9b19f; }
.module-card[data-category="wall"] .module-card-visual::before { height: 33px; transform: translateY(-4px); }
.module-card[data-category="tall"] .module-card-visual::before { height: 53px; }
.module-card-visual::after { content: "+"; position: absolute; right: 6px; bottom: 5px; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: #fff; background: var(--forest); font-size: 13px; opacity: 0; transform: scale(.8); transition: .2s; }
.module-card:hover .module-card-visual::after { opacity: 1; transform: scale(1); }
.module-card b, .module-card small { display: block; }
.module-card b { overflow: hidden; font-size: 9px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.module-card small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.empty-list { grid-column: 1 / -1; padding: 28px 10px; color: var(--muted); text-align: center; font-size: 10px; }
.catalog-tip { display: flex; gap: 9px; margin-top: 14px; padding: 11px; color: #596354; background: #eef0e9; }
.catalog-tip svg { flex: 0 0 16px; width: 16px; }
.catalog-tip p { margin: 0; font-size: 8px; line-height: 1.55; }

.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #eeeae2; }
.stage::before { content: ""; position: absolute; inset: 0; opacity: .45; background-image: radial-gradient(#bdb9ae 0.7px, transparent 0.7px); background-size: 18px 18px; pointer-events: none; }
#plannerCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#plannerCanvas.dragging { cursor: grabbing; }
.panel-toggle { position: absolute; z-index: 4; top: 50%; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); color: var(--forest); background: rgba(255,253,248,.94); font-size: 12px; font-weight: 700; box-shadow: 0 5px 20px rgba(44,49,40,.10); cursor: pointer; writing-mode: vertical-rl; transform: translateY(-50%); }
.panel-toggle-left { left: 8px; transform: translateY(-50%) rotate(180deg); }
.panel-toggle-right { right: 8px; }
.stage-toolbar { position: absolute; z-index: 3; top: 18px; left: 50%; display: flex; align-items: center; gap: 4px; padding: 4px; background: rgba(255,253,248,.94); box-shadow: 0 5px 24px rgba(44,49,40,.11); transform: translateX(-50%); backdrop-filter: blur(10px); }
.view-switch, .layout-switch, .corner-direction { display: flex; }
.view-switch button, .layout-switch button, .corner-direction button { height: 30px; padding: 0 10px; border: 0; color: var(--muted); background: transparent; font-size: 8px; cursor: pointer; }
.view-switch button { min-width: 40px; }
.view-switch button.active, .layout-switch button.active, .corner-direction button.active { color: #fff; background: var(--forest); }
.corner-direction { margin-left: 3px; border-left: 1px solid var(--line); padding-left: 3px; }
.corner-direction[hidden] { display: none; }
.stage-toolbar .divider { width: 1px; height: 18px; margin: 0 3px; background: var(--line); }
.stage-toolbar .toolbar-button { width: 30px; height: 30px; font-size: 15px; }
.zoom-value { width: 38px; color: var(--muted); font-size: 8px; text-align: center; }
.scene-badge { position: absolute; z-index: 2; top: 64px; left: 20px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 40px); padding: 8px 10px; background: rgba(255,253,248,.88); box-shadow: 0 4px 16px rgba(44,49,40,.06); backdrop-filter: blur(8px); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 4px rgba(120,132,109,.12); }
.scene-badge b, .scene-badge small { display: block; }
.scene-badge b { font-size: 9px; }
.scene-badge small { color: var(--muted); font-size: 7px; }
.scene-controls { position: absolute; z-index: 2; right: 20px; bottom: 20px; display: grid; grid-template-columns: repeat(3, 37px); grid-template-rows: repeat(3, 37px); gap: 4px; }
.scene-controls button { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid rgba(218,213,201,.8); color: var(--muted); background: rgba(255,253,248,.9); cursor: pointer; backdrop-filter: blur(8px); }
.scene-controls svg { width: 16px; }
#orbitUp { grid-column: 2; grid-row: 1; }
#orbitLeft { grid-column: 1; grid-row: 2; }
#orbitRight { grid-column: 3; grid-row: 2; }
#orbitDown { grid-column: 2; grid-row: 3; }
.stage-hint { position: absolute; z-index: 2; bottom: 22px; left: 50%; display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--muted); background: rgba(255,253,248,.85); font-size: 8px; transform: translateX(-50%); backdrop-filter: blur(8px); }
.stage-hint span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--forest); background: var(--sage-pale); font-size: 11px; }
.mobile-add { display: none; }

.properties-title { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.properties-title h2 { margin: 5px 0 0; font-family: "Prata", serif; font-size: 18px; font-weight: 400; }
.properties-title .id { color: var(--muted); font-size: 8px; }
.prop-actions { display: flex; gap: 2px; }
.prop-actions button { width: 29px; height: 29px; }
.property-section { padding: 17px 0; border-bottom: 1px solid var(--line); }
.section-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.section-label b { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.section-label span { color: var(--muted); font-size: 8px; }
.dimension-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dimension-grid label { position: relative; display: block; }
.dimension-grid label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 8px; }
.dimension-grid input { width: 100%; height: 36px; padding: 0 23px 0 8px; border: 1px solid var(--line); outline: 0; background: #fff; font-size: 9px; }
.dimension-grid input:focus { border-color: var(--sage); }
.dimension-grid em { position: absolute; right: 7px; bottom: 11px; color: var(--muted); font-size: 7px; font-style: normal; pointer-events: none; }
.module-position { margin-top: 9px; padding: 8px 10px; color: var(--muted); background: var(--cream); font-size: 12px; line-height: 1.45; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; width: 30px; height: 30px; padding: 0; border: 2px solid var(--warm-white); border-radius: 50%; background: var(--texture, var(--swatch)); background-size: cover; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--forest); }
.swatch.active::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--check, #fff); font-size: 10px; font-weight: 700; }
.finish-name { margin-top: 10px; color: var(--muted); font-size: 8px; }
.select-field { width: 100%; height: 38px; padding: 0 32px 0 10px; border: 1px solid var(--line); outline: 0; color: var(--ink); background: #fff; font-size: 9px; }
.control-stack { display: grid; gap: 9px; }
.control-stack label > span, .control-row > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 8px; }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.option-chip { min-height: 33px; padding: 5px 7px; border: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 8px; cursor: pointer; }
.option-chip.active { border-color: var(--forest); color: var(--forest); background: #eef0e9; font-weight: 700; }
.reference-note { margin-top: 9px; padding: 9px; overflow-wrap: anywhere; color: #5f675b; background: #eef0e9; font-size: 7px; line-height: 1.55; }
.compact-note { display: flex; align-items: center; margin: 0; }
.transfer-button { width: 100%; margin-top: 9px; }
.construction-card { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.construction-card span { padding: 8px; background: var(--cream); }
.construction-card small, .construction-card b { display: block; }
.construction-card small { color: var(--muted); font-size: 7px; }
.construction-card b { margin-top: 3px; font-size: 8px; }
.locked-field { position: relative; }
.locked-field::after { content: ""; }
.locked-field input { padding-right: 32px; color: var(--muted); background: var(--cream); }
.inline-check { display: flex !important; align-items: center; gap: 7px; color: var(--ink) !important; font-size: 8px !important; }
.inline-check input { accent-color: var(--forest); }
.ceiling-check { grid-column: 1 / -1; min-height: 40px; padding: 9px 10px; background: var(--paper); border: 1px solid var(--line); }
.environment-check { grid-column: auto; }
.technical-status { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; color: #8c664f; font-size: 7px; }
.technical-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--clay); }
.price-box { margin-top: 17px; padding: 14px; color: #f8f5ec; background: var(--forest); }
.price-box > div { display: flex; justify-content: space-between; align-items: baseline; }
.price-box span { color: rgba(255,255,255,.6); font-size: 8px; }
.price-box strong { font-size: 17px; }
.price-box small { display: block; margin-top: 5px; color: rgba(255,255,255,.45); font-size: 7px; }
.project-actions { display: grid; gap: 8px; padding-top: 16px; }
.export-button { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 0 12px; border: 1px solid var(--forest); color: var(--forest); background: transparent; text-align: left; cursor: pointer; }
.export-button:hover { background: #eef0e9; }
.export-button b, .export-button small { display: block; }
.export-button b { font-size: 9px; }
.export-button small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.export-button svg { width: 16px; }
.delete-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; border: 0; color: var(--danger); background: transparent; font-size: 8px; cursor: pointer; }
.delete-button svg { width: 13px; }
.nothing-selected { padding-top: 18px; text-align: center; }
.nothing-selected .empty-illustration { position: relative; width: 110px; height: 88px; margin: 30px auto 20px; border-bottom: 2px solid var(--sand); }
.nothing-selected .empty-illustration::before, .nothing-selected .empty-illustration::after { content: ""; position: absolute; bottom: 0; border: 1px solid #9ba392; background: #e2e5dd; }
.nothing-selected .empty-illustration::before { left: 18px; width: 38px; height: 55px; }
.nothing-selected .empty-illustration::after { right: 18px; width: 32px; height: 38px; }
.nothing-selected h2 { font-family: "Prata", serif; font-size: 18px; font-weight: 400; }
.nothing-selected p { color: var(--muted); font-size: 9px; line-height: 1.6; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 25px; display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 11px 15px; color: #fff; background: var(--forest-deep); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .28s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast span { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: var(--forest-deep); background: #cbd6bb; font-size: 9px; }
.toast p { margin: 0; font-size: 9px; }

.modal { width: min(470px, calc(100vw - 32px)); padding: 0; border: 0; color: var(--ink); background: var(--warm-white); box-shadow: 0 25px 90px rgba(29,34,26,.3); }
.order-modal { width: min(650px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(29,34,26,.55); backdrop-filter: blur(4px); }
.modal form { position: relative; padding: 34px; }
.modal h2 { margin: 7px 0 10px; font-family: "Prata", serif; font-size: 26px; font-weight: 400; }
.modal p { margin: 0 0 22px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; color: var(--muted); background: none; font-size: 22px; cursor: pointer; }
.modal label { display: block; margin-top: 12px; color: var(--muted); font-size: 9px; }
.modal label input:not([type="checkbox"]), .modal label select, .modal label textarea { display: block; width: 100%; min-height: 43px; margin-top: 6px; padding: 0 12px; border: 1px solid var(--line); outline: 0; color: var(--ink); background: #fff; font-size: 10px; }
.modal label textarea { min-height: 72px; padding-block: 10px; resize: vertical; }
.modal label input[type="file"] { height: auto; padding: 10px; font-size: 8px; }
.modal label input:focus { border-color: var(--sage); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.field-grid label:last-child { grid-column: 1 / -1; }
.modal menu { display: flex; justify-content: flex-end; gap: 8px; margin: 22px 0 0; padding: 0; }
.modal-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 17px; color: #fff; background: var(--forest); font-family: "Prata", serif; font-size: 19px; }
.order-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 20px 0; background: var(--line); border: 1px solid var(--line); }
.order-summary span { padding: 13px; background: var(--cream); }
.order-summary small, .order-summary b { display: block; }
.order-summary small { color: var(--muted); font-size: 8px; }
.order-summary b { margin-top: 4px; font-size: 10px; }
.order-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin: 14px 0 4px; }
.order-flow span { position: relative; display: flex; align-items: center; gap: 5px; padding: 8px 5px; color: var(--muted); background: var(--cream); font-size: 7px; }
.order-flow b { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid var(--sand); border-radius: 50%; font-size: 7px; }
.order-flow .done { color: var(--forest); }
.order-flow .done b { color: #fff; border-color: var(--forest); background: var(--forest); }
.order-fields label:last-child { grid-column: auto; }
.file-field small { display: block; margin-top: 5px; color: var(--muted); font-size: 7px; }
.messenger-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.consent { display: flex !important; align-items: flex-start; gap: 8px; line-height: 1.45; }
.consent input { margin: 1px 0 0; accent-color: var(--forest); }
.wide { width: 100%; margin-top: 18px; }
.modal-note { display: block; margin-top: 10px; color: var(--muted); font-size: 7px; text-align: center; }
.export-pack { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); }
.export-pack b, .export-pack small { display: block; }
.export-pack b { font-size: 10px; }
.export-pack small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.export-pack > strong { color: var(--forest); font-size: 13px; }
.file-stack { position: relative; width: 45px; height: 42px; }
.file-stack span { position: absolute; display: grid; place-items: center; width: 30px; height: 38px; color: #fff; background: var(--sage); font-size: 7px; font-weight: 700; box-shadow: 2px 3px 0 rgba(49,57,45,.12); }
.file-stack span:last-child { left: 13px; top: 4px; background: var(--forest); }
.notice { margin: 15px 0 0; padding: 11px; color: #675c49; background: #f3ebdc; font-size: 8px; line-height: 1.55; }

body.dark { --paper: #262b25; --warm-white: #30362f; --cream: #242923; --ink: #eeeade; --muted: #b8bdb1; --line: #4b5248; --sand: #666c61; }
body.dark .stage { background: #32372f; }
body.dark .topbar, body.dark .stage-toolbar, body.dark .scene-badge, body.dark .stage-hint, body.dark .scene-controls button, body.dark .panel-toggle { color: var(--ink); background: rgba(47,53,46,.96); }
body.dark .module-card, body.dark .search-box, body.dark .dimension-grid input, body.dark .select-field, body.dark .modal label input:not([type="checkbox"]) { color: var(--ink); background: #353b33; }
body.dark .option-chip, body.dark .modal label select, body.dark .modal label textarea { background: #353b33; }
body.dark .module-card-visual { background: #2a3029; }
body.dark .stage::before { opacity: .13; }
body.dark .catalog-tip, body.dark .reference-note, body.dark .option-chip.active { color: #d5ddce; background: #3b4438; }
body.dark .construction-card span, body.dark .order-summary span, body.dark .order-flow span { background: #353b33; }
body.dark .module-position { background: #353b33; }
body.dark .notice { color: #e6d9c3; background: #493f32; }
body.dark .secondary-button:hover, body.dark .export-button:hover, body.dark .icon-button:hover, body.dark .toolbar-button:hover { background: #3a4238; }
body.dark .swatch { border-color: #30362f; }
body.dark .corner-direction { background: #30362f; }

/* Увеличенная типографика: интерфейс читается без мелкого «технического» шрифта. */
body { font-size: 17px; }
.brand small, .rail .eyebrow, .eyebrow { font-size: 12px; }
.project-name, .step b, .breadcrumbs, .primary-button, .secondary-button { font-size: 14px; }
.step small, .rail-help b, .rail-help button, .rail-footer, .header-price span { font-size: 12px; }
.rail-help small, .panel-copy, .search-box input, .catalog-tabs button, .empty-list { font-size: 13px; }
.module-card b, .module-card small, .catalog-tip p { font-size: 12px; line-height: 1.45; }
.view-switch button, .layout-switch button, .corner-direction button, .zoom-value, .scene-badge b, .scene-badge small, .stage-hint { font-size: 12px; }
.properties-title .id, .section-label b, .section-label span, .dimension-grid label > span, .dimension-grid input, .dimension-grid em, .finish-name, .select-field { font-size: 13px; }
.control-stack label > span, .control-row > span, .option-chip, .reference-note, .construction-card small, .construction-card b, .inline-check, .technical-status { font-size: 12px !important; }
.price-box span, .price-box small, .export-button b, .export-button small, .delete-button, .nothing-selected p, .toast p { font-size: 12px; }
.modal p, .modal label, .modal label input:not([type="checkbox"]), .modal label select, .modal label textarea, .order-summary b, .export-pack b { font-size: 14px; }
.order-summary small, .order-flow span, .order-flow b, .file-field small, .modal-note, .export-pack small, .notice { font-size: 12px; }
.locked-field::after { font-size: 11px; }
.module-card { min-height: 126px; }
#plannerCanvas.editor-3d { cursor: grab; }
#plannerCanvas.editor-3d.module-hover { cursor: ew-resize; }
#plannerCanvas.editor-3d.dragging { cursor: grabbing; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 208px 1fr; }
  .workspace { grid-template-columns: 232px minmax(360px, 1fr) 260px; }
  .rail { padding-inline: 14px; }
  .header-price { display: none; }
}

@media (max-width: 1060px) {
  .app-shell { display: block; }
  .rail { display: none; }
  .main { height: 100vh; }
  .topbar { min-height: 62px; padding: 0 16px; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; color: var(--forest); border-color: var(--forest); font-size: 17px; }
  .mobile-brand strong { font-family: "Prata", serif; letter-spacing: .1em; }
  .breadcrumbs { display: none; }
  .workspace { grid-template-columns: 220px minmax(320px, 1fr) 244px; }
}

@media (max-width: 760px) {
  .top-actions .history-actions { display: none; }
  .top-actions { gap: 8px; }
  .primary-button { padding-inline: 12px; }
  .workspace { display: block; position: relative; }
  .catalog-panel { position: absolute; z-index: 10; inset: 0 auto 0 0; width: min(320px, 88vw); box-shadow: 10px 0 35px rgba(31,36,28,.18); transform: translateX(-105%); transition: .25s ease; }
  .catalog-panel.open { transform: translateX(0); }
  .mobile-close { display: block; }
  .stage { height: calc(100vh - 62px); }
  .properties-panel { position: absolute; z-index: 9; right: 10px; bottom: 72px; width: 230px; max-height: 42vh; padding: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
  .property-section:nth-of-type(n+3), .project-actions, .price-box { display: none; }
  .mobile-add { position: absolute; z-index: 4; bottom: 20px; left: 16px; display: block; }
  .mobile-add button { min-height: 42px; padding: 0 16px; border: 0; color: #fff; background: var(--forest); font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
  .stage-hint { display: none; }
  .panel-toggle { display: none; }
  .scene-controls { bottom: 75px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid label:last-child { grid-column: auto; }
}

@media (max-width: 520px) {
  .topbar { padding-inline: 10px; }
  .top-actions .primary-button { font-size: 12px; }
  .properties-panel { right: 8px; bottom: 68px; width: 190px; max-height: 37vh; }
  .scene-badge { top: 74px; left: 10px; }
  .stage-toolbar { top: 10px; width: calc(100% - 16px); justify-content: center; }
  .layout-switch button { padding-inline: 6px; font-size: 11px; }
  .corner-direction { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); padding: 3px; border: 0; background: var(--warm-white); box-shadow: 0 4px 16px rgba(44,49,40,.08); }
  .stage-toolbar .toolbar-button, .zoom-value { display: none; }
  .scene-controls { right: 10px; }
  .modal form { padding: 28px 22px; }
  .order-summary { grid-template-columns: 1fr; }
  .export-pack { grid-template-columns: auto 1fr; }
  .export-pack > strong { grid-column: 2; }
  .order-flow { grid-template-columns: 1fr 1fr; }
  .messenger-actions { grid-template-columns: 1fr; }
}

/* 2026 visual refresh — a warm architectural studio around the 3D scene. */
:root {
  color-scheme: light;
  --forest: #435843;
  --forest-deep: #344735;
  --forest-soft: #6f826b;
  --sage: #83947c;
  --sage-pale: #e2e9de;
  --cream: #efede7;
  --paper: #f4f2ed;
  --warm-white: #fffefa;
  --sand: #d6d8cf;
  --clay: #aa765d;
  --ink: #202620;
  --muted: #5f695f;
  --line: #d9ddd5;
  --danger: #a24f46;
  --surface-subtle: #e8ebe5;
  --on-accent: #ffffff;
  --focus: #8faa7e;
  --control-height: 44px;
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --shadow: 0 18px 48px rgba(30, 38, 31, .13);
  --panel-shadow: 0 12px 34px rgba(30, 38, 31, .10);
}

body {
  font-size: 17px;
  line-height: 1.45;
  background: var(--cream);
}

button,
input,
select,
textarea {
  border-radius: var(--radius-sm);
}

button {
  letter-spacing: -.01em;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

.app-shell {
  grid-template-columns: 104px minmax(0, 1fr);
}

.rail {
  align-items: center;
  padding: 22px 10px 14px;
  background:
    radial-gradient(circle at 30% 12%, rgba(188, 206, 174, .17), transparent 25%),
    linear-gradient(165deg, #3f503d 0%, #273326 100%);
  box-shadow: 8px 0 32px rgba(27, 36, 27, .12);
}

.brand {
  justify-content: center;
}

.brand > span:last-child,
.project-mini {
  display: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border-color: rgba(255, 255, 255, .42);
  font-size: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.steps {
  width: 100%;
  margin-top: 38px;
  gap: 9px;
}

.step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 76px;
  padding: 9px 3px;
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: center;
}

.step > span:nth-child(2),
.step > svg {
  display: none;
}

.step::after {
  color: rgba(255, 255, 255, .62);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

.step:nth-child(1)::after { content: "Комната"; }
.step:nth-child(2)::after { content: "Модули"; }
.step:nth-child(3)::after { content: "Материалы"; }
.step:nth-child(4)::after { content: "Смета"; }

.step:hover {
  border-color: rgba(255, 255, 255, .08);
  border-left-color: rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .055);
}

.step.active {
  border-color: rgba(225, 235, 216, .18);
  border-left-color: rgba(225, 235, 216, .18);
  background: rgba(237, 244, 230, .12);
}

.step.active::after {
  color: #f5f7f1;
}

.step-num {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.step.active .step-num {
  color: #243023;
  background: #dce6d3;
  border-color: #dce6d3;
}

.rail-help {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 16px 0 12px;
}

.rail-help > div:nth-child(2),
.rail-help button {
  display: none;
}

.help-icon {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.rail-footer {
  justify-content: center;
  width: 100%;
  padding: 12px 0 0;
}

.rail-footer > span {
  display: none;
}

.rail-footer .icon-button {
  margin: 0;
}

.main {
  background: var(--paper);
}

.topbar {
  min-height: 68px;
  padding: 0 24px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--warm-white) 92%, transparent);
  box-shadow: 0 1px 0 rgba(44, 54, 45, .02);
}

.breadcrumbs {
  gap: 10px;
  font-size: 14px;
}

.breadcrumbs b {
  font-weight: 700;
}

.top-actions {
  gap: 14px;
}

.icon-button,
.toolbar-button {
  width: var(--control-height);
  height: var(--control-height);
  border-radius: 12px;
}

.icon-button:hover,
.toolbar-button:hover {
  color: var(--forest);
  background: var(--surface-subtle);
}

.header-price {
  padding-left: 18px;
}

.header-price span {
  font-size: 12px;
}

.header-price strong {
  margin-top: 1px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.primary-button,
.secondary-button {
  min-height: var(--control-height);
  padding-inline: 18px;
  border-radius: 11px;
  font-size: 14px;
}

.primary-button {
  color: var(--on-accent);
  background: var(--forest);
  box-shadow: 0 9px 22px rgba(55, 74, 56, .18);
}

.primary-button:hover {
  background: var(--forest-deep);
}

.workspace {
  grid-template-columns: 264px minmax(420px, 1fr) 316px;
  background: var(--paper);
}

.workspace.catalog-collapsed { grid-template-columns: 0 minmax(420px, 1fr) 316px; }
.workspace.properties-collapsed { grid-template-columns: 264px minmax(420px, 1fr) 0; }
.workspace.catalog-collapsed.properties-collapsed { grid-template-columns: 0 minmax(420px, 1fr) 0; }

.catalog-panel,
.properties-panel {
  background: var(--warm-white);
  scrollbar-color: var(--sand) transparent;
}

.catalog-panel {
  padding: 26px 20px 20px;
  border-right-color: var(--line);
}

.properties-panel {
  padding: 24px 22px;
  border-left-color: var(--line);
}

.panel-heading h1 {
  margin-top: 7px;
  font-size: 25px;
  line-height: 1.18;
}

.eyebrow,
.rail .eyebrow {
  font-size: 12px;
}

.panel-copy {
  margin: 14px 0 20px;
  font-size: 14px;
  line-height: 1.65;
}

.search-box {
  height: var(--control-height);
  gap: 10px;
  padding: 0 13px;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.search-box input {
  font-size: 14px;
}

.catalog-tabs {
  gap: 5px;
  margin: 18px 0 14px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-subtle);
}

.catalog-tabs button {
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  font-size: 13px;
}

.catalog-tabs button.active {
  border: 0;
  color: var(--forest);
  background: var(--warm-white);
  box-shadow: 0 4px 14px rgba(33, 43, 34, .08);
}

.module-list {
  gap: 10px;
}

.module-card {
  min-height: 138px;
  padding: 9px;
  border-color: var(--line);
  border-radius: 13px;
  background: var(--warm-white);
}

.module-card:hover {
  border-color: color-mix(in srgb, var(--forest) 40%, var(--line));
  box-shadow: var(--panel-shadow);
  transform: translateY(-2px);
}

.module-card-visual {
  height: 76px;
  margin-bottom: 9px;
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .7), transparent),
    var(--cream);
}

.module-card-visual::before {
  border-color: #7d8977;
  border-radius: 2px;
  background: linear-gradient(108deg, #dde3d8 0 72%, #bdc9b8 72%);
  box-shadow: 6px 4px 0 #a8b4a3, 0 9px 18px rgba(55, 68, 53, .08);
}

.module-card-visual::after {
  right: 7px;
  bottom: 7px;
  width: 24px;
  height: 24px;
  font-size: 16px;
}

.module-card b {
  font-size: 13px;
}

.module-card small {
  margin-top: 3px;
  font-size: 12px;
}

.catalog-tip {
  margin-top: 16px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--sage) 20%, transparent);
  border-radius: 12px;
  background: var(--sage-pale);
}

.catalog-tip p {
  font-size: 12px;
}

.stage {
  isolation: isolate;
  background: #e9e5dc;
}

.stage::before {
  z-index: 0;
  opacity: .22;
  background-image: radial-gradient(#a9a79e .7px, transparent .7px);
  background-size: 20px 20px;
}

#threeCanvas,
#plannerCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#threeCanvas {
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

#plannerCanvas {
  z-index: 2;
}

.stage.webgl-active #threeCanvas {
  opacity: 1;
}

.stage.webgl-active #plannerCanvas {
  opacity: 0;
}

.stage-toolbar {
  z-index: 5;
  top: 16px;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(207, 211, 202, .78);
  border-radius: 14px;
  background: rgba(255, 254, 250, .9);
  box-shadow: 0 12px 34px rgba(34, 42, 34, .12);
}

.view-switch,
.layout-switch,
.corner-direction {
  gap: 3px;
}

.view-switch button,
.layout-switch button,
.corner-direction button {
  min-width: 44px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
}

.view-switch button.active,
.layout-switch button.active,
.corner-direction button.active {
  color: var(--on-accent);
  background: var(--forest);
  box-shadow: 0 5px 14px rgba(55, 73, 56, .19);
}

.stage-toolbar .toolbar-button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  font-size: 17px;
}

.stage-toolbar .divider {
  height: 24px;
  margin-inline: 4px;
}

.zoom-value {
  width: 48px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.scene-badge {
  z-index: 4;
  top: 76px;
  left: 18px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(211, 214, 205, .7);
  border-radius: 13px;
  background: rgba(255, 254, 250, .86);
  box-shadow: 0 10px 26px rgba(38, 45, 37, .09);
}

.scene-badge b {
  font-size: 13px;
}

.scene-badge small {
  margin-top: 1px;
  font-size: 11px;
}

.render-badge {
  margin-left: 4px;
  padding: 5px 7px;
  border-radius: 7px;
  color: #3e5840;
  background: #e3eadf;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.panel-toggle {
  z-index: 6;
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 64px;
  padding: 0;
  border-radius: 11px;
  font-size: 0;
  writing-mode: horizontal-tb;
}

.panel-toggle::before {
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.panel-toggle-left {
  left: 10px;
  transform: translateY(-50%);
}

.panel-toggle-right {
  right: 10px;
}

.panel-toggle-left::before { content: "‹"; }
.panel-toggle-right::before { content: "›"; }
.workspace.catalog-collapsed .panel-toggle-left::before { content: "›"; }
.workspace.properties-collapsed .panel-toggle-right::before { content: "‹"; }

.scene-controls {
  z-index: 5;
  right: 18px;
  bottom: 18px;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 5px;
}

.scene-controls button {
  width: 42px;
  height: 42px;
  border-color: rgba(207, 211, 202, .82);
  border-radius: 11px;
  background: rgba(255, 254, 250, .9);
  box-shadow: 0 7px 20px rgba(39, 48, 39, .08);
}

.stage-hint {
  z-index: 4;
  bottom: 18px;
  max-width: calc(100% - 320px);
  padding: 10px 14px;
  border: 1px solid rgba(211, 214, 205, .68);
  border-radius: 12px;
  background: rgba(255, 254, 250, .86);
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(39, 48, 39, .07);
}

.stage-hint span {
  width: 22px;
  height: 22px;
  font-size: 13px;
}

.properties-title {
  position: sticky;
  z-index: 2;
  top: -24px;
  margin: -24px -22px 0;
  padding: 24px 22px 18px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--warm-white) 94%, transparent);
  backdrop-filter: blur(16px);
}

.properties-title h2 {
  margin-top: 6px;
  font-size: 21px;
}

.properties-title .id {
  font-size: 12px;
}

.prop-actions {
  gap: 4px;
}

.prop-actions button {
  width: 38px;
  height: 38px;
}

.property-section {
  padding: 19px 0;
  border-color: var(--line);
}

.section-label {
  margin-bottom: 12px;
}

.section-label b,
.section-label span {
  font-size: 13px;
}

.dimension-grid {
  gap: 8px;
}

.dimension-grid label > span,
.control-stack label > span,
.control-row > span {
  margin-bottom: 6px;
  font-size: 13px;
}

.dimension-grid input,
.select-field {
  height: var(--control-height);
  border-color: var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.dimension-grid em {
  bottom: 14px;
  font-size: 11px;
}

.option-grid {
  gap: 8px;
}

.option-chip {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--paper);
  font-size: 13px;
}

.option-chip.active {
  color: var(--forest);
  border-color: color-mix(in srgb, var(--forest) 55%, var(--line));
  background: var(--sage-pale);
}

.swatch {
  width: 36px;
  height: 36px;
  border-color: var(--warm-white);
}

.finish-name,
.module-position,
.reference-note,
.construction-card small,
.construction-card b,
.inline-check,
.technical-status {
  font-size: 12px !important;
}

.module-position,
.reference-note,
.construction-card span,
.ceiling-check {
  border-radius: 10px;
  background: var(--paper);
}

.price-box {
  padding: 17px;
  border-radius: 13px;
  background: linear-gradient(145deg, #435843, #314532);
  box-shadow: 0 12px 26px rgba(47, 65, 49, .18);
}

.price-box span,
.price-box small {
  font-size: 12px;
}

.price-box strong {
  font-size: 20px;
}

.export-button {
  min-height: 54px;
  border-radius: 11px;
}

.export-button b {
  font-size: 13px;
}

.export-button small,
.delete-button,
.nothing-selected p,
.toast p {
  font-size: 12px;
}

.toast {
  left: auto;
  right: 22px;
  bottom: 22px;
  min-width: 260px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 13px;
  transform: translateY(18px);
}

.toast.show {
  transform: translateY(0);
}

.modal {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--warm-white);
}

.modal form {
  padding: 36px;
}

.modal h2 {
  font-size: 28px;
}

.modal p,
.modal label,
.modal label input:not([type="checkbox"]),
.modal label select,
.modal label textarea {
  font-size: 14px;
}

.modal label input:not([type="checkbox"]),
.modal label select,
.modal label textarea {
  min-height: var(--control-height);
  border-color: var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
}

.order-summary,
.export-pack {
  overflow: hidden;
  border-radius: 12px;
}

.notice {
  border-radius: 10px;
  font-size: 12px;
}

body.dark {
  color-scheme: dark;
  --forest: #a7bd99;
  --forest-deep: #bad0ad;
  --forest-soft: #8ea282;
  --sage: #9fb493;
  --sage-pale: #334333;
  --cream: #151a16;
  --paper: #1b211c;
  --warm-white: #232a24;
  --sand: #48534a;
  --ink: #f0f2ec;
  --muted: #b9c1b7;
  --line: #3b463d;
  --surface-subtle: #2c352d;
  --on-accent: #172017;
  --focus: #bad7a5;
}

body.dark .main,
body.dark .catalog-panel,
body.dark .properties-panel,
body.dark .modal {
  background: var(--warm-white);
}

body.dark .topbar,
body.dark .stage-toolbar,
body.dark .scene-badge,
body.dark .stage-hint,
body.dark .scene-controls button,
body.dark .panel-toggle {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(35, 42, 36, .94);
}

body.dark .stage {
  background: #e9e5dc;
}

body.dark .module-card,
body.dark .search-box,
body.dark .dimension-grid input,
body.dark .select-field,
body.dark .option-chip,
body.dark .modal label input:not([type="checkbox"]),
body.dark .modal label select,
body.dark .modal label textarea,
body.dark .module-position,
body.dark .reference-note,
body.dark .construction-card span,
body.dark .order-summary span,
body.dark .order-flow span {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

body.dark .catalog-tabs {
  background: var(--surface-subtle);
}

body.dark .catalog-tabs button.active,
body.dark .properties-title {
  color: var(--ink);
  background: rgba(35, 42, 36, .96);
}

body.dark .module-card-visual {
  background: linear-gradient(145deg, rgba(255, 255, 255, .035), transparent), #1d241e;
}

body.dark .option-chip.active,
body.dark .catalog-tip {
  color: #e3ebdf;
  background: var(--sage-pale);
}

body.dark .primary-button {
  color: var(--on-accent);
  background: var(--forest);
}

body.dark .secondary-button,
body.dark .export-button {
  color: var(--forest);
  border-color: var(--forest);
}

body.dark .render-badge {
  color: #dce9d5;
  background: #354635;
}

body.dark .swatch {
  border-color: var(--warm-white);
}

body.dark .price-box {
  color: #f4f5ef;
  background: linear-gradient(145deg, #3c513d, #29392b);
}

body.dark .notice {
  color: #eadfc9;
  background: #463d31;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1360px) {
  .app-shell {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: 244px minmax(380px, 1fr) 290px;
  }

  .workspace.catalog-collapsed { grid-template-columns: 0 minmax(380px, 1fr) 290px; }
  .workspace.properties-collapsed { grid-template-columns: 244px minmax(380px, 1fr) 0; }
  .workspace.catalog-collapsed.properties-collapsed { grid-template-columns: 0 minmax(380px, 1fr) 0; }

  .catalog-panel {
    padding-inline: 16px;
  }

  .properties-panel {
    padding-inline: 18px;
  }

  .properties-title {
    margin-inline: -18px;
    padding-inline: 18px;
  }

  .layout-switch button,
  .corner-direction button {
    padding-inline: 9px;
  }
}

@media (max-width: 1160px) {
  .app-shell {
    display: block;
  }

  .rail {
    display: none;
  }

  .main {
    height: 100vh;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
  }

  .mobile-brand .brand-mark {
    width: 38px;
    height: 38px;
    color: var(--forest);
    border-color: var(--forest);
    border-radius: 11px;
    font-size: 19px;
  }

  .mobile-brand strong {
    font-family: "Prata", serif;
    letter-spacing: .1em;
  }

  .breadcrumbs {
    display: none;
  }

  .workspace {
    grid-template-columns: 248px minmax(340px, 1fr) 300px;
  }

  .workspace.catalog-collapsed { grid-template-columns: 0 minmax(340px, 1fr) 300px; }
  .workspace.properties-collapsed { grid-template-columns: 248px minmax(340px, 1fr) 0; }
  .workspace.catalog-collapsed.properties-collapsed { grid-template-columns: 0 minmax(340px, 1fr) 0; }

  .header-price {
    display: none;
  }

  .stage-toolbar {
    left: 14px;
    right: 14px;
    justify-content: center;
    transform: none;
  }

  .stage-hint {
    max-width: calc(100% - 210px);
  }
}

@media (max-width: 940px) {
  .topbar {
    min-height: 64px;
    padding-inline: 14px;
  }

  .workspace,
  .workspace.catalog-collapsed,
  .workspace.properties-collapsed,
  .workspace.catalog-collapsed.properties-collapsed {
    position: relative;
    display: block;
  }

  .stage {
    height: calc(100vh - 64px);
  }

  .catalog-panel {
    position: absolute;
    z-index: 10;
    inset: 0 auto 0 0;
    width: min(330px, calc(100vw - 56px));
    padding: 24px 20px;
    border-right: 1px solid var(--line);
    box-shadow: 16px 0 42px rgba(27, 35, 28, .18);
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-105%);
    transition: transform .24s ease;
  }

  .catalog-panel.open {
    transform: translateX(0);
  }

  .mobile-close {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    color: var(--muted);
    background: var(--paper);
  }

  .properties-panel {
    position: absolute;
    z-index: 9;
    inset: 12px 54px 12px auto;
    width: min(340px, calc(100vw - 72px));
    max-height: none;
    padding: 24px 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 1;
    pointer-events: auto;
    transition: opacity .2s ease, transform .2s ease;
  }

  .workspace.properties-collapsed .properties-panel {
    padding-inline: 20px;
    border: 1px solid var(--line);
    opacity: 0;
    pointer-events: none;
    transform: translateX(24px);
  }

  .properties-title {
    top: -24px;
    margin-inline: -20px;
    padding-inline: 20px;
    border-radius: 16px 16px 0 0;
  }

  .property-section:nth-of-type(n+3),
  .project-actions,
  .price-box {
    display: block;
  }

  .project-actions {
    display: grid;
  }

  .panel-toggle {
    display: grid;
  }

  .mobile-add {
    position: absolute;
    z-index: 6;
    bottom: 18px;
    left: 16px;
    display: block;
  }

  .mobile-add button {
    min-height: 46px;
    padding-inline: 17px;
    border: 0;
    border-radius: 12px;
    color: var(--on-accent);
    background: var(--forest);
    font-size: 14px;
    font-weight: 800;
    box-shadow: var(--shadow);
  }

  .stage-hint {
    display: none;
  }

  .scene-controls {
    bottom: 76px;
  }
}

@media (max-width: 680px) {
  .top-actions {
    gap: 7px;
  }

  .top-actions .history-actions {
    display: none;
  }

  .top-actions .primary-button {
    padding-inline: 13px;
    font-size: 13px;
  }

  .stage-toolbar {
    left: 10px;
    right: 10px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .stage-toolbar::-webkit-scrollbar {
    display: none;
  }

  .layout-switch,
  .view-switch,
  .corner-direction {
    flex: 0 0 auto;
  }

  .layout-switch button,
  .view-switch button,
  .corner-direction button {
    padding-inline: 9px;
    font-size: 12px;
  }

  .scene-badge {
    top: 74px;
    left: 10px;
    max-width: calc(100% - 64px);
  }

  .render-badge {
    display: none;
  }

  .scene-controls {
    right: 10px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    min-width: 0;
  }

  .modal form {
    padding: 30px 22px;
  }

  .field-grid,
  .order-summary,
  .messenger-actions {
    grid-template-columns: 1fr;
  }

  .field-grid label:last-child,
  .order-fields label:last-child {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  .mobile-brand strong {
    display: none;
  }

  .properties-panel {
    right: 50px;
    width: calc(100vw - 66px);
  }

  .stage-toolbar .divider,
  .stage-toolbar .toolbar-button,
  .zoom-value {
    display: none;
  }

  .scene-badge small {
    display: none;
  }

  .scene-controls {
    grid-template-columns: repeat(3, 39px);
    grid-template-rows: repeat(3, 39px);
  }

  .scene-controls button {
    width: 39px;
    height: 39px;
  }
}
