/* Цифровой паспорт: приложение-документ. Слева — навигация по разделам, справа — страница раздела;
   чертежи на «бумаге», цифры моноширинным; акцент — оранжевая строительная разметка со скана. */
:root {
  --paper: #f4f5f2; --card: #ffffff; --ink: #1a221f; --muted: #5d6a64; --line: #d8ddd6; --soft: #eceee9;
  --accent: #c9501c; --accent-ink: #ffffff; --cool: #2c6b6f; --ok: #2f7d4f; --bad: #b4372b; --warn: #a86b00;
  --side: #1a201e; --side-ink: #dfe6e2; --side-muted: #8e9b95;
  --f-display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --f-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #101412; --card: #181e1b; --ink: #e5ebe7; --muted: #98a59f; --line: #2a3330; --soft: #1e2522;
  --accent: #f07a45; --accent-ink: #1a0d06; --cool: #73b4b7; --ok: #6cc08f; --bad: #f08a7e; --warn: #e3b04b;
  --side: #0b0e0d; --side-ink: #dfe6e2; --side-muted: #7f8c86; color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #101412; --card: #181e1b; --ink: #e5ebe7; --muted: #98a59f; --line: #2a3330; --soft: #1e2522;
  --accent: #f07a45; --accent-ink: #1a0d06; --cool: #73b4b7; --ok: #6cc08f; --bad: #f08a7e; --warn: #e3b04b;
  --side: #0b0e0d; --side-ink: #dfe6e2; --side-muted: #7f8c86; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--f-body); }
a { color: var(--cool); }
a:focus-visible, button:focus-visible, input:focus-visible, label:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 16px; display: grid; align-content: start; gap: 22px; }
.brand { display: grid; gap: 4px; }
.brand b { font: 700 17px/1.2 var(--f-display); letter-spacing: -.01em; }
.brand span { font: 500 11px/1.4 var(--f-mono); color: var(--side-muted); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 2px; }
.nav .grp { font: 500 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 6px; color: var(--side-ink); text-decoration: none; font-size: 14.5px; }
.nav a small { font: 500 11px/1 var(--f-mono); color: var(--side-muted); }
.nav a:hover { background: rgba(255, 255, 255, .06); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
.nav a.on small { color: inherit; opacity: .8; }
.side .foot { font-size: 12px; color: var(--side-muted); line-height: 1.5; }
.topbar { display: none; }

main { min-width: 0; padding-inline: 40px; padding-block: 36px 72px; }
.page { max-width: 1060px; display: grid; gap: 34px; }
.page > header { display: grid; gap: 12px; }
.eyebrow { font: 500 12px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
h1, h2 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 4.4vw, 46px); line-height: 1.07; }
h2 { font-size: clamp(19px, 2.4vw, 24px); line-height: 1.2; }
h3 { font: 600 16px/1.35 var(--f-body); margin: 0; }
p { margin: 0; max-width: 70ch; }
.muted { color: var(--muted); }
.lead { font-size: 17px; max-width: 72ch; }
.block { display: grid; gap: 14px; }

.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fig { background: var(--card); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.fig b { font: 500 clamp(19px, 2.4vw, 24px)/1.15 var(--f-mono); font-variant-numeric: tabular-nums; }
.fig span { font-size: 13px; color: var(--muted); }

.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: stretch; }
.hero img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; background: #14181d; min-height: 240px; }
.stages { display: grid; gap: 10px; counter-reset: st; }
.stage { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.stage::before { counter-increment: st; content: counter(st); font: 500 13px/1 var(--f-mono); color: var(--accent); border: 1.5px solid var(--accent); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; }
.stage:hover { border-color: var(--accent); }
.stage em { font-style: normal; font: 500 12px/1 var(--f-mono); color: var(--muted); white-space: nowrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; border: 0; cursor: pointer; font-family: inherit; font-size: 15px; justify-self: start; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

figure { margin: 0; display: grid; gap: 8px; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; overflow-x: auto; }
.sheet img { display: block; width: 100%; min-width: 600px; height: auto; }
figcaption { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }
figcaption a { white-space: nowrap; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }

.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 11.5px/1.3 var(--f-body); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--soft); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
table.num td:not(:first-child), table.num th:not(:first-child) { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.pill { display: inline-block; font: 600 11px/1 var(--f-mono); padding: 4px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.points { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.points li { padding-left: 18px; position: relative; max-width: 74ch; }
.points li::before { content: ""; position: absolute; left: 0; top: .72em; width: 9px; height: 2px; background: var(--accent); }
.note { font-size: 14px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 12px; max-width: 76ch; }

/* документы */
.docs { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.doc { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; background: var(--card); }
.doc .ext { font: 600 11px/1 var(--f-mono); text-transform: uppercase; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 8px 0; text-align: center; }
.doc b { font-weight: 600; }
.doc p { font-size: 13px; color: var(--muted); }
.doc .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.doc .acts a { font-size: 13.5px; text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); white-space: nowrap; }
.doc .acts a:hover { border-color: var(--accent); }
.md { display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.md h1 { font-size: 26px; } .md h2 { font-size: 19px; margin-top: 10px; }
.md table { font-size: 13px; }

/* 3D */
#model-box { display: grid; grid-template-columns: minmax(0, 1fr) 280px; height: min(78vh, 780px); min-height: 460px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #14181d; }
#model-box:fullscreen { height: 100vh; border-radius: 0; }
#stage { position: relative; min-width: 0; }
#stage canvas { display: block; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: 500 11px/1.2 var(--f-body); padding: 2px 6px; border-radius: 4px; background: rgba(10, 14, 12, .72); color: #f1f5f2; }
.tag.room { font-weight: 600; font-size: 12px; }
.tag.fix { color: #cbd5e1; }
.tag.ruler { background: #ff7a3d; color: #1a0d06; font-weight: 700; }
#v-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #b7c3bd; font-size: 14px; }
.panel { background: #1b2120; color: #dfe6e2; padding: 16px; overflow-y: auto; display: grid; align-content: start; gap: 16px; font-size: 14px; }
.panel h3 { font: 500 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: #8e9b95; }
.panel .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.panel input[type=range] { width: 100%; accent-color: #f07a45; grid-column: 1 / -1; }
.panel label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.panel input[type=checkbox] { accent-color: #f07a45; width: 16px; height: 16px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { background: #262e2c; color: #dfe6e2; border: 1px solid #334039; border-radius: 6px; padding: 7px 11px; cursor: pointer; font: inherit; font-size: 13.5px; }
.seg button.on { border-color: #f07a45; color: #f07a45; }
.sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; }
.hint { color: #8e9b95; font-size: 12.5px; line-height: 1.5; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-105%); transition: transform .2s; height: 100%; }
  body.menu-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--side); color: var(--side-ink); padding: 10px 16px; }
  .topbar button { background: none; border: 1px solid #3a4541; color: inherit; border-radius: 6px; padding: 6px 10px; font: inherit; }
  .topbar b { font: 700 14px/1 var(--f-display); }
  main { padding-inline: 16px; padding-block: 22px 56px; }
  .hero, .two { grid-template-columns: 1fr; }
  #model-box { grid-template-columns: 1fr; grid-template-rows: 62vh auto; height: auto; }
  .doc { grid-template-columns: 48px minmax(0, 1fr); }
  .doc .acts { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
