:root {
  --ink: #1b1f24;
  --muted: #68707a;
  --line: #e2e5e9;
  --bg: #f7f8fa;
  --card: #ffffff;
  --accent: #1f5eff;
  --accent-dark: #1747c4;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 650;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
}

.steps { display: flex; gap: 6px; }

.step {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  display: grid;
  place-items: center;
}

.step.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

.hero h1 {
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.lead { color: var(--muted); font-size: 17px; margin: 0 0 32px; max-width: 640px; }

.upload { display: grid; gap: 16px; max-width: 520px; }

.dropzone {
  display: grid;
  gap: 6px;
  place-items: center;
  padding: 40px 24px;
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}

.dropzone:hover { border-color: var(--accent); background: #fbfcff; }
.dropzone input { display: none; }
.dropzone-title { font-weight: 600; }
.dropzone-hint { color: var(--muted); font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--muted); }

.tips { margin-top: 32px; max-width: 520px; color: var(--muted); font-size: 14px; }
.tips summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.tips ol { padding-left: 20px; }

.footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.footer p { margin: 0 auto; max-width: 720px; }

/* ---------- выбранные материалы ---------- */
.step-head { margin-bottom: 24px; }
.step-head h2 { font-size: 24px; margin: 0 0 6px; }
.step-head p { color: var(--muted); margin: 0; }

.group { margin-bottom: 32px; }
.group h3 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 12px;
}

/* Подзаголовок подтипа внутри блока: «Кирпич», «Планкен», «Имитация бруса»… */
.subhead {
  font-size: 14px;
  font-weight: 600;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.subhead:first-of-type { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}

.card:hover { transform: translateY(-1px); border-color: #c9d2e0; }
.card input { position: absolute; opacity: 0; pointer-events: none; }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

.card-name {
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.3;
}

.card input:checked + .card-inner {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.card-inner { display: block; }

.card-keep .card-inner {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.actions .spacer { flex: 1; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff8e6;
  border: 1px solid #f0dca6;
  color: #6b5312;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ---------- тип дома ---------- */
.preview { margin-bottom: 24px; max-width: 560px; }
.preview img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }

.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.type-card { cursor: pointer; }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-inner {
  display: grid; place-items: center; padding: 22px 12px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  font-weight: 600; transition: border-color .12s, background .12s;
}
.type-card input:checked + .type-inner { border-color: var(--accent); background: #f6f9ff; color: var(--accent); }

.hint { color: var(--muted); font-size: 14px; max-width: 640px; }

/* ---------- результаты ---------- */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.result { margin: 0; }
.result img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
  background: var(--card);
}
.result figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- движок ---------- */
.engines { display: grid; gap: 12px; margin-bottom: 28px; }
.engine-card { cursor: pointer; }
.engine-card input { position: absolute; opacity: 0; pointer-events: none; }
.engine-inner {
  display: grid; gap: 3px; padding: 16px 18px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  transition: border-color .12s, background .12s;
}
.engine-card input:checked + .engine-inner { border-color: var(--accent); background: #f6f9ff; }
.engine-note { color: var(--muted); font-size: 14px; }
.engine-price { color: var(--ink); font-size: 14px; font-weight: 600; margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: block; padding: 9px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px;
  transition: border-color .12s, background .12s;
}
.chip input:checked + span { border-color: var(--accent); background: #f6f9ff; color: var(--accent); font-weight: 600; }

.input {
  width: 100%; max-width: 380px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 15px;
  background: var(--card); font-family: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- оплата ---------- */
.summary {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 20px; max-width: 480px; margin-bottom: 20px;
}
.summary-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row span { color: var(--muted); }
.summary-row.total { font-size: 18px; }
.summary-row.total strong { color: var(--accent); }
.pay-note { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---------- админка ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 28px; }
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.admin-num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.admin-label { color: var(--muted); font-size: 14px; }
.sync-form { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; flex-wrap: wrap; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: #f2f4f7; font-weight: 600; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }

/* ---------- юридические страницы ---------- */
.legal-head { margin-bottom: 28px; }
.legal-head h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.02em; }
.legal-lead { color: var(--muted); font-size: 16px; margin: 0; max-width: 680px; }

.legal-wrap {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: start;
}

.legal-nav {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 2px;
  font-size: 14px;
}
.legal-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.legal-nav a:hover { background: var(--card); }
.legal-nav a.is-active { background: var(--card); color: var(--accent); font-weight: 600; border: 1px solid var(--line); }

.legal-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px 36px;
  min-width: 0;
}
.legal-body h2 { font-size: 20px; margin: 32px 0 12px; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body h3 { font-size: 16px; margin: 22px 0 8px; }
.legal-body p { margin: 0 0 12px; }
.legal-body a { color: var(--accent); }

.legal-list { margin: 0 0 14px; padding-left: 22px; }
.legal-list li { margin-bottom: 6px; }

.legal-table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 15px; }
.legal-table th, .legal-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-table th { width: 38%; color: var(--muted); font-weight: 500; }
.legal-table-price th, .legal-table-price td { width: auto; }
.legal-table-price thead th { color: var(--ink); font-weight: 600; background: var(--bg); }
.legal-table-price td { font-weight: 600; white-space: nowrap; }
.legal-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }

.legal-callout {
  background: #f6f9ff;
  border: 1px solid #d6e2ff;
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
}
.legal-callout p { margin: 0; }

.legal-note { color: var(--muted); font-size: 14px; }
.legal-hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
.legal-pre { white-space: pre-wrap; font-family: inherit; margin: 0 0 12px; }
.legal-doc p { text-align: justify; }

.tbd {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: #fff4e5;
  color: #a35a00;
  font-size: 13px;
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  margin: 0 0 14px;
  font-size: 14px;
}
.footer-links a { color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-contacts { margin: 0 0 10px; }
.footer-contacts a { color: var(--muted); }

@media (max-width: 760px) {
  .legal-wrap { grid-template-columns: 1fr; gap: 16px; }
  .legal-nav { position: static; grid-auto-flow: column; overflow-x: auto; }
  .legal-nav a { white-space: nowrap; }
  .legal-body { padding: 20px 18px 28px; }
  .legal-table th { width: 44%; }
}

.legal-accept {
  font-size: 14px;
  color: var(--muted);
  max-width: 560px;
  margin: 4px 0 20px;
}
.legal-accept a { color: var(--accent); }

/* ---------- статусы почты и сообщения ---------- */
.alert-ok { background: #effaf3; border-color: #bde5cb; color: #1c6b36; }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.tag-ok { background: #effaf3; border-color: #bde5cb; color: #1c6b36; }
.tag-bad { background: #fdf0ef; border-color: #f2c9c5; color: #a32a1f; cursor: help; }
.tag-warn { background: #fff8e8; border-color: #f0dfb0; color: #8a6100; cursor: help; }
