/* ExpertHelper */
:root {
  color-scheme: light;
  --bg: #f5f6f6;
  --card: #ffffff;
  --card-2: #eef1f3;
  --text: #19232c;
  --muted: #52616d;
  --line: #d9dfe3;
  --accent: var(--accent-light, #0a5fa8);
  --accent-2: #177456;
  --accent-ink: #ffffff;
  --soft: var(--theme-selection);
  --theme-selection: color-mix(in srgb, var(--card), var(--accent) 14%);
  --edge: var(--line);
  --radius: 12px;
  --top-bg: var(--bg);
  --blur: none;
  --shadow: 0 2px 8px rgba(25, 35, 44, .04);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171b1e;
  --card: #20262b;
  --card-2: #292f34;
  --text: #edf1f3;
  --muted: #aebbc6;
  --line: #3a444c;
  --accent: var(--accent-dark, #8bc6ff);
  --accent-2: #83d9b6;
  --accent-ink: #14273a;
  --theme-selection: color-mix(in srgb, var(--card), var(--accent) 17%);
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171b1e;
    --card: #20262b;
    --card-2: #292f34;
    --text: #edf1f3;
    --muted: #aebbc6;
    --line: #3a444c;
    --accent: var(--accent-dark, #8bc6ff);
    --accent-2: #83d9b6;
    --accent-ink: #14273a;
    --theme-selection: color-mix(in srgb, var(--card), var(--accent) 17%);
    --shadow: none;
  }
}
:root[data-style="glass"] {
  --top-bg: color-mix(in srgb, var(--card) 78%, transparent);
  --blur: blur(16px);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 108px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { max-width: 1248px; margin: 0 auto; padding: 0 32px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 620px) { .wrap { padding-inline: 16px; } }
/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  background: var(--top-bg); border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 16px; min-height: 64px; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; color: var(--text); }
.mark {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.mark svg { width: 18px; height: 18px; }
.top nav { margin-left: auto; display: flex; gap: 24px; font-size: 14px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 620px) {
  .top-in { flex-wrap: wrap; gap: 8px 16px; }
  .top nav { order: 1; width: 100%; justify-content: space-between; flex-wrap: wrap; margin: 0; gap: 4px 12px; }
  .top nav a { padding-block: 4px; }
  .look { margin-left: auto; }
}

.look { position: relative; }
.look-btn {
  width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--edge); background: var(--card); color: var(--text);
}
.look-btn:hover, .look-btn[aria-expanded="true"] { background: var(--card-2); }
.look-btn svg { width: 18px; height: 18px; }
.look-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(316px, calc(100vw - 32px)); padding: 16px;
  max-height: calc(100dvh - 72px); overflow: auto;
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.theme-picker { min-inline-size: 0; margin: 0 0 16px; padding: 0; border: 0; }
.theme-picker legend { padding: 0; margin-bottom: 8px; color: var(--text); font-size: 13px; font-weight: 600; }
.theme-options { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.theme-option { position: relative; flex: 1 1 auto; min-width: 0; }
.theme-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.theme-caption {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 13px; line-height: 1.3;
}
.theme-colors .theme-caption { justify-content: flex-start; }
.theme-swatch { flex: 0 0 12px; height: 12px; border-radius: 50%; background: var(--swatch-light); background: light-dark(var(--swatch-light), var(--swatch-dark)); }
.theme-option:hover .theme-caption { background: var(--card-2); }
.theme-option input:checked + .theme-caption { border-color: var(--accent); background: var(--theme-selection); font-weight: 600; }
.theme-option input:focus-visible + .theme-caption { outline: 2px solid var(--accent); outline-offset: 2px; }
.look-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.seg {
  display: flex; padding: 3px; gap: 2px; border-radius: 11px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer; transition: background .2s, box-shadow .2s;
}
.seg button[aria-checked="true"] { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }

/* ---------- Первый экран ---------- */
header.hero {
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: center;
  gap: clamp(32px, 5vw, 72px); padding: 48px 0 64px; border-bottom: 1px solid var(--line);
}
h1 {
  max-width: 12em; margin: 0 0 24px; font-size: clamp(36px, 4.45vw, 64px);
  line-height: 1.06; letter-spacing: -.045em; font-weight: 600; text-wrap: balance;
}
.lead { margin: 0 0 32px; max-width: 32em; font-size: clamp(16px, 1.5vw, 20px); color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.btn, .bp-make {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  text-decoration: none; font-weight: 600;
}
.btn:hover, .bp-make:hover:enabled { filter: brightness(.92); }
.btn svg { width: 18px; height: 18px; }
.workspace-link { font-size: 15px; font-weight: 500; color: var(--text); }
.workspace-link span { color: var(--accent); margin-left: 4px; }
.meta { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.meta + .meta { margin-top: 4px; }
@media (max-width: 880px) {
  header.hero { grid-template-columns: minmax(0, 1fr); padding-block: 40px; gap: 24px; }
  h1 { max-width: 16em; text-wrap: initial; }
}
@media (max-width: 420px) {
  h1 { font-size: 34px; margin-bottom: 16px; }
  .lead { margin-bottom: 24px; }
  .actions { column-gap: 12px; }
}

/* ---------- Интерактивный чертёж ----------
   План квартиры в духе рабочего чертежа: стены, проёмы, размерные линии. Помещения и метки
   дефектов нажимаются; под планом — карточка помещения и сборка документов. */
.bp {
  --bp-wall: var(--text); --bp-ink: var(--muted); --bp-grid: var(--line); --bp-pin: var(--accent);
  position: relative; min-width: 0;
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.bp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 16px; flex-wrap: wrap; font-size: 16px; line-height: 1.35; }
.bp-head b { display: block; font-weight: 600; }
.bp-head small, .bp-total, .bp-instruction { color: var(--muted); font-size: 13px; }
.bp-total b { display: inline; color: var(--text); font-variant-numeric: tabular-nums; }
.bp-instruction { margin: 12px 0 4px; }
.bp-plan { display: block; width: 100%; height: auto; max-height: 348px; background: var(--card-2); border-radius: 4px; margin-bottom: 12px; user-select: none; -webkit-tap-highlight-color: transparent; }
.bp-plan text { font-family: inherit; fill: var(--bp-ink); }
.bp-walls { fill: var(--bp-wall); }
.bp-thin { fill: none; stroke: var(--bp-wall); stroke-width: .35; }
.bp-gridline { fill: none; stroke: var(--bp-grid); stroke-width: .15; }
.bp-leaf { stroke: var(--bp-wall); stroke-width: .6; }
.bp-tick { stroke: var(--bp-ink); stroke-width: .45; }
.bp-glass { stroke: var(--bp-wall); stroke-width: .3; }
.bp-swing { fill: none; stroke: var(--bp-ink); stroke-width: .3; stroke-dasharray: .9 .7; }
.bp-dim { stroke: var(--bp-ink); stroke-width: .25; }
.bp-dim-t { font-size: 2.6px; text-anchor: middle; letter-spacing: .05px; }
.bp-fixture { fill: none; stroke: var(--bp-ink); stroke-width: .3; opacity: .7; }

.bp-room-hit { fill: var(--accent); fill-opacity: 0; cursor: pointer; transition: fill-opacity .25s; outline: none; }
.bp-room-hit:hover { fill-opacity: .07; }
.bp-room-hit.on { fill-opacity: .14; }
.bp-room-hit:focus-visible { fill-opacity: .14; stroke: var(--accent); stroke-width: .6; }
.bp-label { pointer-events: none; text-anchor: middle; }
.bp-label .n { font-size: 3.5px; font-weight: 650; fill: var(--text); }
.bp-label .a { font-size: 2.9px; }
.bp-label.on .n { fill: var(--accent); }

.bp-pin { cursor: pointer; transition: opacity .3s; }
.bp-pin circle { fill: var(--card); stroke: var(--bp-pin); stroke-width: .45; transition: fill .2s, r .2s; }
.bp-pin text { font-size: 2.5px; font-weight: 700; text-anchor: middle; fill: var(--bp-pin); pointer-events: none; }
.bp-plan.has-on .bp-pin { opacity: .45; }
.bp-plan.has-on .bp-pin.in { opacity: 1; }
.bp-pin.in circle { fill: var(--bp-pin); }
.bp-pin.in text { fill: var(--accent-ink); }
.bp-pin.hot circle { r: 2.9; }

.bp-room { border-top: 1px solid var(--line); padding-top: 12px; min-height: 144px; }
.bp-room-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.bp-room h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.bp-nums { display: flex; gap: 4px 12px; flex-wrap: wrap; margin: 0; font-size: 13px; color: var(--muted); }
.bp-nums div { display: flex; gap: 4px; }
.bp-nums dd { margin: 0; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bp-defects { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.bp-defects li {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 10px; font-size: 14px; line-height: 1.3; cursor: pointer;
  transition: background .15s;
}
.bp-defects li:hover, .bp-defects li.hot { background: var(--soft); }
.bp-defects .no {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent);
}
.bp-defects small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.bp-empty { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

.bp-docs { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.bp-make { min-height: 40px; background: var(--card); color: var(--text); border-color: var(--edge); font-family: inherit; font-size: 14px; }
.bp-make:hover:enabled { background: var(--card-2); filter: none; }
.bp-make:disabled { opacity: .6; cursor: default; }
.bp-out { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.bp-out li {
  position: relative; overflow: hidden; padding: 4px 8px 4px 24px; border-radius: 4px; font-size: 12px;
  color: var(--muted);
}
.bp-out li i {
  position: absolute; left: 8px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--muted) 60%, transparent);
}
.bp-out li::before {
  content: ""; position: absolute; inset: 0; background: var(--soft); transform-origin: left; transform: scaleX(0); z-index: -1;
}
.bp-out li { isolation: isolate; }
.bp-out li.run::before { transition: transform .24s ease-out; transform: scaleX(1); }
.bp-out li.ok { color: var(--text); }
.bp-out li.ok i { border-color: var(--accent-2); background: var(--accent-2); }
.bp-out li.ok i::after {
  content: ""; position: absolute; left: 3px; top: 0; width: 3px; height: 6px;
  border: solid var(--card); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
@media (max-width: 480px) {
  .bp { padding: 12px; }
  .bp-room { min-height: 0; }
  .bp-defects li { grid-template-columns: 22px 1fr; }
  .bp-defects small { grid-column: 2; white-space: normal; margin-top: -4px; }
}

/* ---------- Секции ---------- */
section { padding: 56px 0 0; }
h2 { font-size: clamp(28px, 3.25vw, 44px); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; margin: 0 0 24px; }
.section-lead { color: var(--muted); margin: 0 0 24px; max-width: 52em; }
.bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; }
.card { background: var(--card); border: 1px solid var(--edge); border-radius: var(--radius); padding: 24px; }
.bento .card {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); align-content: start;
  gap: 8px 12px; background: transparent; padding: 20px 0;
  border: 0; border-top: 1px solid var(--line); border-radius: 0;
}
.card .ico { color: var(--muted); }
.card .ico svg { display: block; width: 18px; height: 18px; margin-top: 4px; }
.card h3 { margin: 0; font-size: 17px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.bento .card p { grid-column: 2; }
@media (max-width: 880px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  section { padding-top: 40px; }
  .bento { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}

/* ---------- Калькулятор ---------- */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 32px; align-items: start; }
@media (max-width: 820px) { .calc { grid-template-columns: 1fr; } }
.calc-inputs { display: grid; gap: 16px; }
.rng span { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.rng output { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; margin-left: auto; margin-right: 4px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; margin: 8px 0;
  background: linear-gradient(to right, var(--accent) var(--p, 50%), color-mix(in srgb, var(--text) 12%, transparent) var(--p, 50%));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .06);
}
input[type=range]::-moz-range-thumb {
  width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--soft), 0 2px 8px rgba(0, 0, 0, .25); }
.steppers { display: grid; gap: 8px; }
.stepper {
  display: grid; grid-template-columns: 1fr 40px 28px 40px; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 8px; background: var(--card-2);
}
.stepper span { font-size: 15px; }
.stepper small { display: block; color: var(--muted); font-size: 12px; }
.stepper output { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--edge); cursor: pointer; font-size: 20px; line-height: 1;
  background: var(--card); color: var(--accent);
}
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper button:active:not(:disabled) { transform: scale(.92); }
.calc-plan { background: var(--card-2); border-radius: 8px; padding: 12px; }
.calc-plan svg { display: block; width: 100%; height: auto; }
.calc-plan .opening { cursor: grab; outline: none; }
.calc-plan .opening:focus-visible .grip { stroke: color-mix(in srgb, var(--accent) 25%, transparent); }
.calc-plan svg.dragging, .calc-plan svg.dragging .opening { cursor: grabbing; }
.calc-plan svg { touch-action: none; }
.calc-plan .calc-hint { margin: 6px 4px 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.shape > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.shape .seg button { font-size: 13.5px; }
.rng[hidden] { display: none; }
.calc-out { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 12px; margin: 0; }
.calc-out div { padding: 12px 16px; border-top: 1px solid var(--line); }
.calc-out dt { font-size: 13px; color: var(--muted); }
.calc-out dd { margin: 2px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.calc-out dd small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.calc-out .hl { border-top-color: var(--accent); }
.calc-out .hl dd { color: var(--accent); }
.flash { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .5; } }

/* ---------- Шаги ---------- */
ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; }
ol.steps li { counter-increment: s; padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
ol.steps li::before {
  content: counter(s, decimal-leading-zero); display: block; margin-bottom: 8px;
  color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums;
}
ol.steps b { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }
@media (max-width: 880px) { ol.steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 440px) { ol.steps { grid-template-columns: 1fr; } }

/* ---------- Подвал ---------- */
footer {
  position: relative; margin-top: 56px; padding: 30px 0 64px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14.5px;
}
.foot-grid { display: flex; flex-wrap: wrap; gap: 18px 40px; align-items: flex-start; }
.foot-grid .who { color: var(--text); font-weight: 600; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-note { margin-top: 18px; font-size: 13.5px; }
/* Версия выложенной сборки — в правом нижнем углу подвала. */
.version { position: absolute; right: 0; bottom: 18px; color: var(--muted); font-size: 13px; letter-spacing: .04em; }
@media (max-width: 620px) { .version { position: static; display: block; margin-top: 12px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
