/* Макет «щиток»: разделы анкеты — автоматы на DIN-рейке в шапке, ниже одна колонка ~700px */
:root {
  --bg: #e4e7e4; /* корпус щита, близко к RAL 7035 */
  --surface: #f8f9f7;
  --field: #ffffff;
  --ink: #1a2125;
  --muted: #56636a;
  --line: #c3c9c5;
  --accent: #1c56a0; /* синий — как нулевой проводник N */
  --accent-ink: #ffffff;
  --live: #dda900; /* сигнальный жёлтый — автомат включён */
  --live-soft: #f5e2a0;
  --neg: #d6dbd8;
  --warn: #a3420f;
  --rail: #a3aca8;
  --slot: #d3d9d6;
  --lever: #38434a;
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body:
    "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141819;
    --surface: #1c2224;
    --field: #111516;
    --ink: #e6ece9;
    --muted: #9aa7ac;
    --line: #313a3d;
    --accent: #73a5ec;
    --accent-ink: #0c1829;
    --live: #f2c230;
    --live-soft: #4d4115;
    --neg: #2a3134;
    --warn: #f0a070;
    --rail: #3e484b;
    --slot: #2a3235;
    --lever: #c9d1cd;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141819;
  --surface: #1c2224;
  --field: #111516;
  --ink: #e6ece9;
  --muted: #9aa7ac;
  --line: #313a3d;
  --accent: #73a5ec;
  --accent-ink: #0c1829;
  --live: #f2c230;
  --live-soft: #4d4115;
  --neg: #2a3134;
  --warn: #f0a070;
  --rail: #3e484b;
  --slot: #2a3235;
  --lever: #c9d1cd;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] {
  display: none !important;
}
p {
  margin: 0;
}
h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}
.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Шапка с рейкой автоматов */
.head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px 4px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 14px/1 var(--font-display);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--accent);
}
.status {
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  text-align: right;
}
.status[data-kind="offline"],
.status[data-kind="rejected"] {
  color: var(--warn);
}

.rail {
  position: relative;
  display: flex;
  gap: 4px;
  padding-block: 6px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar {
  display: none;
}
.rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 2px);
  height: 12px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(
    90deg,
    var(--rail) 0 7px,
    transparent 7px 10px
  );
  opacity: 0.55;
  pointer-events: none;
}
.qf {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 60px;
  padding: 5px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font: 500 9px/1 var(--font-mono);
  letter-spacing: 0.02em;
  cursor: pointer;
}
.qf-led {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.2s;
}
.qf-slot {
  position: relative;
  width: 12px;
  height: 24px;
  border-radius: 2px;
  background: var(--slot);
}
.qf-lever {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 11px;
  border-radius: 2px;
  background: var(--lever);
  transition: bottom 0.2s ease;
}
.qf.on {
  color: var(--ink);
}
.qf.on .qf-lever {
  bottom: 12px;
}
.qf.on .qf-led {
  background: var(--live);
}
.qf[aria-current="step"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
}
.qf:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Шаги */
main {
  padding-block: 4px 32px;
}
.step {
  display: grid;
  gap: 24px;
  padding-block: 24px 8px;
}
.hero,
.step-head {
  display: grid;
  gap: 10px;
}
.eyebrow {
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  font: 700 clamp(26px, 6.4vw, 40px)/1.1 var(--font-display);
  letter-spacing: -0.015em;
}
h2 {
  font: 700 clamp(22px, 5vw, 30px)/1.15 var(--font-display);
  letter-spacing: -0.01em;
}
h3 {
  font: 600 17px/1.3 var(--font-body);
}
h1:focus,
h2:focus {
  outline: none;
}
.lead {
  font-size: 17px;
  color: var(--muted);
  max-width: 62ch;
}

.duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}
.unit {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.unit-tag {
  font: 500 11px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.unit p:last-child {
  color: var(--muted);
}
.how {
  display: grid;
  gap: 10px;
}
.how ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  max-width: 64ch;
}
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line);
}
.tag.tone-0 {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.tag.tone-1 {
  background: var(--live-soft);
  color: var(--ink);
}
.tag.tone-2 {
  background: var(--neg);
  color: var(--ink);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

/* Вопросы */
.qs {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.q {
  display: grid;
  gap: 10px;
  padding: 18px;
  min-width: 0;
}
.q + .q {
  border-top: 1px solid var(--line);
}
.q-label {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.35;
  max-width: 62ch;
}
.q-hint {
  font-size: 14px;
  color: var(--muted);
  margin-top: -4px;
  max-width: 62ch;
}

.opts-wrap {
  display: grid;
  gap: 8px;
}
.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}
.chip input,
.seg-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 14px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.chip span::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--muted);
}
.chip-radio span::before {
  border-radius: 50%;
}
.chip-checkbox span::before {
  border-radius: 3px;
}
.chip:hover span {
  border-color: var(--muted);
}
.chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.chip-radio input:checked + span::before {
  border-color: var(--accent-ink);
  background: radial-gradient(
    circle,
    var(--accent-ink) 0 3px,
    transparent 3.5px
  );
}
.chip-checkbox input:checked + span::before {
  border-color: var(--accent-ink);
  background: var(--accent-ink);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}
.field::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.field:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea.field {
  min-height: 96px;
  resize: vertical;
}
.money {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 420px;
}
.money .field {
  flex: 1 1 0;
}
.suffix {
  font: 500 13px/1 var(--font-mono);
  color: var(--muted);
}

/* Оценка функций: Сразу / Потом / Не надо */
.feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.feat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 18px;
  padding-block: 14px;
  border-top: 1px dashed var(--line);
}
.feat:first-child {
  border-top: 0;
  padding-top: 4px;
}
.feat-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.feat-title {
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.3;
}
.feat-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}
.seg {
  display: grid;
  grid-template-columns: repeat(3, auto);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--field);
}
.seg-opt {
  position: relative;
  display: flex;
}
.seg-opt + .seg-opt {
  border-left: 1px solid var(--line);
}
.seg-opt span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
}
.seg-opt.tone-0 input:checked + span {
  background: var(--accent);
  color: var(--accent-ink);
}
.seg-opt.tone-1 input:checked + span {
  background: var(--live-soft);
  color: var(--ink);
}
.seg-opt.tone-2 input:checked + span {
  background: var(--neg);
  color: var(--ink);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}
.seg-opt input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
@media (max-width: 560px) {
  .feat {
    grid-template-columns: 1fr;
  }
  .seg {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Нижняя панель и кнопки */
.bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bar-in {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-block: 10px;
}
#btn-save {
  flex: 1;
  min-width: 0;
}
#btn-next {
  margin-left: auto;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font: 600 15px/1.1 var(--font-body);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--muted);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.note {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
}
.copybox {
  min-height: 220px;
  font: 13px/1.45 var(--font-mono);
}
.err {
  color: var(--warn);
  font-size: 14px;
}

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