@font-face {
  font-family: Inter;
  src: url("assets/inter-cyrillic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: Inter;
  src: url("assets/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20A0-20AB,U+20AD-20C0,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
  --paper: #f4f4ee;
  --surface: #fffefa;
  --ink: #212820;
  --muted: #535e50;
  --line: #d7dcd2;
  --accent: #334d38;
  --accent-text: #fff;
  --soft: #e8eee4;
  --red: #963830;
  color-scheme: light;
}
*,*::before,*::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 14px/1.45 Inter, system-ui, sans-serif; }
h1,h2,h3,p { margin: 0; }
button,input,select,textarea { font: inherit; color: inherit; }
button:not(:disabled), label[for="import-project"] { cursor: pointer; }
button:disabled { cursor: default; opacity: .49; }
a { color: inherit; text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #427357; outline-offset: 3px; }
.visually-hidden,.skip:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip:focus { position: fixed; z-index: 9; left: 8px; top: 8px; padding: 10px; background: var(--surface); }
#workspace { width: min(calc(100% - 44px), 1660px); margin-inline: auto; }
.app-header {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 67px;
  padding-inline: max(22px, calc((100% - 1660px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: inline-flex; align-items: center; justify-content: flex-start; gap: 9px; min-width: 0; text-decoration: none; letter-spacing: -.05em; font-size: 23px; }
.brand-symbol {
  display: block;
  flex: 0 0 23px;
  height: 23px;
  border: 2px solid var(--accent);
  background: linear-gradient(90deg, var(--accent) 0 43%, transparent 43% 57%, var(--accent) 57%) top left / 100% 48% no-repeat,
    linear-gradient(90deg, var(--accent) 0 67%, transparent 67%) bottom left / 100% 40% no-repeat;
}
.product { border-left: 1px solid var(--line); padding-left: 16px; color: var(--muted); font-size: 13px; }
.header-actions,.project-actions,.camera-controls,.editor-actions { display: flex; align-items: center; gap: 7px; }
.header-actions { margin-left: auto; }
.button,.square-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  text-align: center;
  transition: background-color .16s ease, border-color .16s ease;
}
.square-button { min-width: 42px; padding: 4px 7px; font-size: 20px; line-height: 1; }
.button-main { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button-quiet { background: transparent; }
.button:not(.button-main):hover,.square-button:hover:not(:disabled) { background: var(--soft); }
.button-main:hover { filter: brightness(1.12); }
.header-actions:focus-within label:has(+ input:focus-visible) { outline: 2px solid #427357; outline-offset: 3px; }

.project-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 18px; }
h1 { font-size: clamp(25px, 2.35vw, 34px); font-weight: 770; line-height: 1.04; letter-spacing: -.055em; }
.project-bar p { margin-top: 5px; color: var(--muted); font-size: 13px; }
select,input[type=number] {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid #afb9aa;
  border-radius: 6px;
  background: var(--surface);
  font-size: 14px;
}
.template-picker select { width: auto; max-width: 180px; min-height: 42px; padding-inline: 8px; font-size: 13px; font-weight: 580; }

.workspace-grid { display: grid; grid-template-columns: minmax(216px, .31fr) minmax(0, 1fr) minmax(235px, .34fr); grid-template-areas: "catalog stage project"; gap: 12px; height: clamp(560px, calc(100dvh - 191px), 840px); }
.panel,.stage { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 11px; }
.panel { display: flex; flex-direction: column; background: var(--surface); }
.library-panel { grid-area: catalog; overflow: hidden; }
.project-panel { grid-area: project; overflow: auto; scrollbar-width: thin; }
.tabs { display: flex; align-items: stretch; padding: 5px 5px 0; border-bottom: 1px solid var(--line); }
.tabs button { min-width: 0; flex: 1; min-height: 43px; padding: 5px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 680; }
.tabs button[aria-selected=true] { border-color: var(--accent); color: var(--ink); }
.tabs button:focus-visible { outline-offset: -3px; }
.library-section { min-height: 0; overflow: auto; scrollbar-width: thin; padding: 15px 12px 12px; }
.panel-intro { padding-inline: 3px; }
.panel-intro h2,.project-panel h2 { font-size: 16px; font-weight: 750; letter-spacing: -.027em; }
.panel-intro p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 3px; margin: 10px 0 8px; }
.filters button { min-height: 36px; padding: 4px 7px; background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--muted); font-size: 11px; font-weight: 640; }
.filters button[aria-pressed=true] { background: var(--soft); color: var(--ink); border-color: #d5e1d4; }
.catalog-list,.finish-list { display: grid; gap: 6px; }
.catalog-item {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 38px;
  align-items: center;
  gap: 7px;
  min-height: 63px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.catalog-text { min-width: 0; }
.catalog-text b,.module-copy b { display: block; font-size: 12px; line-height: 1.22; }
.catalog-text span,.module-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.add-module { min-height: 38px; min-width: 38px; border: 1px solid #c0cbbf; border-radius: 6px; background: var(--soft); color: var(--accent); font-size: 20px; line-height: 1; }
.add-module:hover { background: var(--accent); color: var(--accent-text); }
.module-thumb { position: relative; height: 44px; border-radius: 5px; background: #edece4; }
.module-thumb::before {
  position: absolute; content: ""; width: 22px; height: 24px; left: 10px; bottom: 8px;
  border: 1px solid #73776c; border-top: 3px solid #635c4e;
  background: linear-gradient(90deg,#a7ad98 47%,#74786c 47% 52%,#b8bcac 52%);
  box-shadow: 2px 2px #b6b2a2;
}
.module-thumb[data-kind=drawers]::before { background: repeating-linear-gradient(0deg,#a3ab98 0 6px,#666d61 6px 7px); }
.module-thumb[data-kind=upper]::before { height: 19px; bottom: 14px; border-top-width: 1px; background: #d2c5ab; }
.module-thumb:is([data-kind=tall],[data-kind=fridge])::before { width: 18px; left: 12px; height: 33px; bottom: 5px; border-top-width: 1px; }
.module-thumb:is([data-kind=oven],[data-kind=fridge])::after,.module-thumb[data-kind=sink]::after { content: ""; position: absolute; width: 14px; height: 9px; background: #3a403b; left: 14px; bottom: 14px; border-radius: 1px; }
.module-thumb[data-kind=fridge]::after { left: 14px; bottom: 27px; width: 10px; height: 2px; }
.module-thumb[data-kind=sink]::after { bottom: 29px; height: 4px; background: #727a77; }
.finish-list { margin-top: 12px; }
.finish-option { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 56px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: left; font-size: 13px; font-weight: 650; }
.finish-option[aria-pressed=true] { border-color: var(--accent); background: var(--soft); }
.finish-sample { display: flex; flex: 0 0 46px; height: 29px; border: 1px solid #7a837462; border-radius: 4px; overflow: hidden; }
.finish-sample span { flex: 1; }

.stage { grid-area: stage; position: relative; background: #e6e8e2; overflow: hidden; isolation: isolate; }
.scene-host,.plan-viewport { position: absolute; inset: 0; }
.scene-host canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-top,.stage-bottom { position: absolute; z-index: 2; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; gap: 6px 10px; pointer-events: none; }
.stage-top { top: 13px; }
.stage-bottom { bottom: 13px; align-items: end; }
.view-switch,.camera-controls { display: flex; flex: 0 0 auto; border-radius: 8px; background: var(--surface); pointer-events: auto; }
.view-switch { padding: 3px; border: 1px solid #d3dbcf; }
.view-switch button { min-height: 35px; padding: 6px 11px; border: 0; border-radius: 5px; background: transparent; font-size: 12px; font-weight: 670; }
.view-switch button[aria-pressed=true] { color: var(--accent-text); background: var(--accent); }
.camera-controls { gap: 0; border: 1px solid var(--line); overflow: hidden; }
.camera-controls button { border: 0; border-radius: 0; min-height: 40px; min-width: 40px; }
.camera-controls button + button { border-left: 1px solid var(--line); }
.camera-controls button:focus-visible { outline-offset: -3px; }
.stage-material,.stage-help { padding: 5px 8px; background: #fffefaed; border: 1px solid #dfe1d8; border-radius: 5px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.stage-material { text-align: right; }
.editor-shortcut { display: none; }
.plan-viewport { display: grid; place-items: center; }
.plan-room {
  position: relative;
  border: 2px solid #556a51;
  background-color: #fcfbf5;
  background-image: linear-gradient(#a4b6a63d 1px,transparent 1px), linear-gradient(90deg,#a4b6a63d 1px,transparent 1px);
  background-size: 20px 20px;
}
.plan-module { position: absolute; overflow: hidden; display: grid; place-items: center; border: 1px solid #3c5746; border-radius: 2px; background: #b5c7b0; padding: 1px; color: #203628; font-size: 10px; font-weight: 760; line-height: 1; touch-action: none; }
.plan-module[data-layer=upper] { z-index: 1; background: #eddfc2e8; border-style: dashed; }
.plan-module[aria-pressed=true] { z-index: 2; border: 2px solid #233c2a; background: #486d50; color: #fff; }
.dimension { position: absolute; font-size: 11px; color: #405444; white-space: nowrap; }
.dimension-width { top: -22px; left: 50%; transform: translateX(-50%); }
.dimension-depth { left: -12px; top: 50%; transform: translate(-100%,-50%) rotate(-90deg); transform-origin: 100% 50%; }

.project-panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 14px 13px; border-bottom: 1px solid var(--line); }
.module-count { min-width: 25px; text-align: center; padding: 3px 5px; border-radius: 5px; background: var(--soft); color: var(--accent); font-size: 12px; font-weight: 740; }
.module-list { flex: 0 1 auto; min-height: 85px; overflow: auto; scrollbar-width: thin; padding: 5px 8px; }
.module-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; text-align: left; gap: 5px; width: 100%; min-height: 43px; padding: 6px; border: 1px solid transparent; border-radius: 5px; background: var(--surface); }
.module-row:not(:last-child) { border-bottom-color: #e7eae4; }
.module-row[aria-pressed=true] { background: var(--soft); border-color: #a7baa6; }
.module-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.empty-note { padding: 12px 5px; color: var(--muted); font-size: 13px; }
.settings { display: grid; gap: 9px; margin-top: 13px; }
.settings label { display: grid; gap: 4px; min-width: 0; font-size: 12px; font-weight: 610; }
.module-editor { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); background: #f5f7f2; }
.module-editor h3 { font-size: 14px; letter-spacing: -.02em; }
.settings-split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
.form-error { color: var(--red); font-size: 12px; }
.form-error:empty { display: none; }
.delete-button { color: var(--red); }
.estimate { margin-top: auto; padding: 14px 13px; background: var(--accent); color: var(--accent-text); }
.estimate-title { font-size: 12px; }
.estimate-total { display: block; margin: 2px 0 9px; font-size: clamp(23px,2.25vw,32px); font-weight: 760; letter-spacing: -.045em; line-height: 1.18; }
.estimate .button { width: 100%; font-size: 12px; }
.app-footer { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 5px 15px; padding: 10px 0 14px; color: var(--muted); font-size: 12px; }
.app-footer a { min-height: 33px; }

.specification { width: min(calc(100% - 22px), 630px); max-height: calc(100dvh - 38px); padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 70px #202b2460; }
.specification::backdrop { background: #1d241f88; }
.dialog-heading,.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px; }
.dialog-heading h2 { font-size: 22px; }
.dialog-heading p { color: var(--muted); font-size: 13px; }
.dialog-actions { border-top: 1px solid var(--line); }
.spec-scroll { max-height: 45dvh; overflow: auto; }
.specification table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.specification td,.specification th { padding: 8px 10px; border-top: 1px solid var(--line); }
.specification th { background: var(--soft); }
.specification td:last-child,.specification th:last-child { text-align: right; }
.toast { position: fixed; display: block; z-index: 5; left: 50%; bottom: 16px; max-width: min(510px,calc(100% - 22px)); width: max-content; transform: translateX(-50%); padding: 10px 14px; border-radius: 7px; background: #263a2c; color: #fff; font-size: 13px; }
.toast:empty { display: none; }
.noscript { margin: 15px; padding: 8px; background: var(--surface); }
.is-embedded #workspace { width: calc(100% - 24px); }
.is-embedded .app-header { min-height: 55px; padding-inline: 12px; }
.is-embedded .app-footer a { display: none; }
@media (max-width: 1040px) {
  .workspace-grid { grid-template-columns: 216px minmax(0,1fr); grid-template-areas: "catalog stage" "project project"; height: auto; }
  .library-panel,.stage { min-height: 530px; }
  .library-section { max-height: 490px; }
  .module-list { max-height: 200px; }
  .editor-shortcut { display: inline-flex; min-height: 40px; pointer-events: auto; }
  .stage:has(.editor-shortcut:not([hidden])) .stage-help { display: none; }
}
@media (max-width: 680px) {
  #workspace { width: calc(100% - 20px); }
  .app-header { padding-inline: 10px; gap: 7px; min-height: 58px; }
  .brand { font-size: 20px; max-width: 36%; overflow-wrap: anywhere; }
  .brand-symbol { flex-basis: 20px; height: 20px; }
  .product,.desktop-label { display: none; }
  .header-actions { gap: 4px; }
  .button { min-height: 44px; padding-inline: 8px; font-size: 12px; }
  .project-bar { padding-block: 12px; align-items: start; }
  .project-bar p { font-size: 11px; }
  .project-actions { gap: 4px; }
  .project-actions .square-button { min-width: 32px; min-height: 38px; }
  .template-picker select { min-height: 38px; max-width: 106px; font-size: 12px; padding-inline: 4px; }
  .workspace-grid { display: grid; grid-template-columns: minmax(0,1fr); grid-template-areas: "stage" "catalog" "project"; gap: 8px; }
  .stage { min-height: clamp(340px, 116vw, 460px); }
  .library-panel { min-height: 0; }
  .library-section { max-height: 375px; }
  .stage-top,.stage-bottom { left: 8px; right: 8px; }
  .stage-top { top: 8px; }
  .stage-bottom { bottom: 8px; }
  .stage-help { max-width: 50%; }
  .stage-material { max-width: 51%; }
  .camera-controls button { min-width: 34px; min-height: 36px; }
  .catalog-item { grid-template-columns: 42px minmax(0,1fr) 44px; }
  .add-module { min-height: 44px; min-width: 44px; }
  input[type=number],select { font-size: 16px; }
  .app-footer { line-height: 1.4; }
}
@media (max-width: 355px) {
  .project-bar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
