:root {
  /* светлая тема приглушена и контрастнее (01.10.2026): фон темнее, линии и вторичный текст плотнее */
  --bg: #e3e3e0;
  --surface: #ffffff;
  --ink: #1d1f22;
  --muted: #565a61;
  --line: #d0d0ca;
  /* Основной цвет — корпоративный #5851E1 (01.10.2026). */
  --accent: #5851e1;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfc;
  --danger: #b3261e;
  --ok: #1f7a4a;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #222428;
    --surface: #2b2d32;
    --ink: #e9e9e6;
    --muted: #9b9fa6;
    --line: #44474e;
    --accent: #8e89f2;
    --accent-ink: #12111f;
    --accent-soft: #35335e;
    --danger: #f28b82;
    --ok: #6fcf97;
    color-scheme: dark;
  }
}
/* 01.10.2026 тёмная тема посветлее (фон #17181a → #222428). Тёмная тема выбрана вручную (переключатель на заглушке, theme.js) —
   те же значения, что у системной тёмной выше. */
:root[data-theme="dark"] {
  --bg: #222428;
  --surface: #2b2d32;
  --ink: #e9e9e6;
  --muted: #9b9fa6;
  --line: #44474e;
  --accent: #8e89f2;
  --accent-ink: #12111f;
  --accent-soft: #35335e;
  --danger: #f28b82;
  --ok: #6fcf97;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0; }
button { font: inherit; color: inherit; }

/* ── каркас ── */
.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

/* ── шаги ── */
.steps { position: sticky; top: 24px; }
.brand { font-weight: 600; margin-bottom: 16px; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); transition: width .2s; }
.step-count { display: none; color: var(--muted); font-size: 14px; margin-top: 8px; }
.steps ol { list-style: none; margin: 16px 0 0; padding: 0; }
.step {
  display: flex; gap: 10px; align-items: center;
  width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px;
  padding: 7px 8px; cursor: pointer; color: var(--muted);
}
.step:hover:not(:disabled) { background: var(--accent-soft); }
.step:disabled { cursor: default; opacity: .55; }
.step.visited { color: var(--ink); }
.step.current { color: var(--ink); font-weight: 600; background: var(--accent-soft); }
.num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.step.current .num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ── поля ── */
.intro { color: var(--muted); margin: 0 0 8px; }
.field { padding: 20px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: 0; }
.field-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.label { font-weight: 600; }
.req { color: var(--danger); }
.hint { color: var(--muted); font-size: 14px; margin-top: 2px; }
.field > .input, .field > .with-unit, .field > textarea, .choices, .table-wrap, .number-ranges { margin-top: 10px; }

.input {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px;
}
.input:focus, .option:focus-within, .step:focus-visible, .btn:focus-visible, .unknown:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea.input { resize: vertical; }
.input:disabled { opacity: .5; }
.with-unit { position: relative; max-width: 220px; }
.with-unit .input { width: 100%; padding-right: 52px; font-variant-numeric: tabular-nums; }
.unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* Число с диапазонами: чипы в ряд, под ними — поле «Своего числа» */
.number-ranges { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 14px; color: var(--ink); cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
}
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
.chip:disabled { cursor: default; opacity: .5; }

.unknown {
  flex: none; font-size: 13px; cursor: pointer;
  background: none; border: 1px dashed var(--line); border-radius: 999px;
  padding: 2px 10px; color: var(--muted);
}
.unknown.on { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.is-unknown .choices, .is-unknown .table-wrap { opacity: .5; }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.option {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; cursor: pointer;
}
.option:hover { border-color: var(--accent); }
.option.checked { border-color: var(--accent); background: var(--accent-soft); }
.option input { margin: 4px 0 0; accent-color: var(--accent); }
.option-text { display: flex; flex-direction: column; }
.note { color: var(--muted); font-size: 13px; }
.choices.wide { grid-template-columns: 1fr; }
.choices .other { grid-column: 1 / -1; }

.has-error .input, .has-error .option { border-color: var(--danger); }
.error { color: var(--danger); font-size: 14px; margin-top: 6px; }
.error.block { margin: 16px 0 0; padding: 10px 12px; border: 1px solid var(--danger); border-radius: 8px; }

/* ── таблица зданий ── */
.table-wrap { overflow-x: auto; }
table.rows { width: 100%; border-collapse: collapse; }
table.rows th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 6px 6px; }
table.rows td { padding: 4px 6px; vertical-align: middle; }
table.rows .col-number .input { width: 84px; }
table.rows .col-check { text-align: center; }
table.rows tfoot th, table.rows tfoot td { padding: 8px 6px; font-weight: 600; border-top: 1px solid var(--line); text-align: left; }
.icon-btn {
  background: none; border: 0; cursor: pointer; font-size: 20px; line-height: 1;
  color: var(--muted); padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }

/* ── файлы ── */
.files { margin-top: 10px; }
.files-list { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.files-list li { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 12px; }
.files-list li + li { border-top: 1px solid var(--line); }
.files-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-size { flex: none; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
/* системное поле выбора прячем — нажимается подпись-кнопка */
.files-pick { display: inline-block; position: relative; cursor: pointer; margin-top: 0; }
.files-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.files-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── кнопки ── */
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.actions .primary:only-child { margin-left: auto; }
.btn {
  border-radius: 8px; padding: 10px 22px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 6px 12px; font-size: 14px; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

/* ── сводка ── */
.summary { border-top: 1px solid var(--line); padding: 16px 0; }
.summary-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.summary dl { margin: 0; }
.summary dl > div { display: grid; grid-template-columns: 40% 1fr; gap: 12px; padding: 4px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; }
.summary .summary-table { grid-template-columns: 1fr; }
.muted { color: var(--muted); font-style: italic; }
table.mini { border-collapse: collapse; font-size: 14px; }
table.mini th, table.mini td { text-align: left; padding: 3px 10px 3px 0; }
table.mini th { color: var(--muted); font-weight: 500; }
table.mini tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; cursor: pointer; }
.consent input { margin-top: 4px; accent-color: var(--accent); }

/* ── приветствие ── */
.welcome-eyebrow { color: var(--muted); font-size: 14px; letter-spacing: .02em; margin-bottom: 14px; }
.welcome h1 { font-size: 22px; margin-bottom: 20px; }
.welcome-footnote { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.welcome-text { margin: 0 0 18px; line-height: 1.6; }
.welcome .consent { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
/* колонка анкеты: лист и подпись под ним (согласие на приветствии) */
.main-col { min-width: 0; }
.consent-note { margin: 14px 8px 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ── сообщения ── */
.message {
  max-width: 560px; margin: 15vh auto 0; padding: 32px 16px; text-align: center;
}
.message p { color: var(--muted); }
.message.ok h1 { color: var(--ok); }

/* ── телефон ── */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; gap: 16px; padding-top: 16px; }
  .steps { position: static; }
  .steps ol { display: none; }
  .step-count { display: block; }
  .main { padding: 20px 16px; }
  h1 { font-size: 22px; }
  .welcome h1 { font-size: 20px; }
  .summary dl > div { grid-template-columns: 1fr; gap: 0; }

  /* Таблица зданий — карточками */
  table.rows thead { display: none; }
  table.rows, table.rows tbody, table.rows tr, table.rows td, table.rows tfoot { display: block; width: 100%; }
  table.rows tbody tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; position: relative; }
  table.rows td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
  table.rows td::before { content: attr(data-label); color: var(--muted); font-size: 14px; flex: none; }
  table.rows td.col-text .input, table.rows td.col-select .input { max-width: 65%; }
  table.rows td.row-actions { position: absolute; top: 2px; right: 2px; width: auto; }
  table.rows td.row-actions::before { content: none; }
  table.rows tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  table.rows tfoot th, table.rows tfoot td { border: 0; padding: 2px 0; width: auto; }
  table.rows tfoot td::before { margin-right: 6px; }
  table.rows tfoot td:empty { display: none; }
}
