:root {
  --bg: #f5f6f3;
  --surface: #ffffff;
  --text: #1a2320;
  --muted: #5a6662;
  --border: #dbe0dc;
  --accent: #0f5f58;
  --accent-hover: #0a4a44;
  --accent-text: #ffffff;
  --focus: #2a8f84;
  --ok: #1d6f46;     --ok-bg: #e6f3ec;
  --act: #0f5f58;    --act-bg: #e3f1ef;
  --wait: #845400;   --wait-bg: #fbf0d9;
  --neutral: #47525c; --neutral-bg: #eceff1;
  --error: #9b2c22;  --error-bg: #fbe9e6;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615;
    --surface: #1a201e;
    --text: #e6ebe8;
    --muted: #9aa6a1;
    --border: #2c3532;
    --accent: #3fb3a5;
    --accent-hover: #5cc6b9;
    --accent-text: #0b1312;
    --focus: #5cc6b9;
    --ok: #6fcf9b;      --ok-bg: #16281f;
    --act: #5cc6b9;     --act-bg: #132826;
    --wait: #e7b55c;    --wait-bg: #2a2214;
    --neutral: #aab4bd; --neutral-bg: #1f2529;
    --error: #f08f84;   --error-bg: #2d1916;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main, .footer { max-width: 780px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: clamp(24px, 4.6vw, 34px); font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 24px; font-weight: 650; }
h3 { font-size: 18px; font-weight: 650; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* --- проверка --- */
.hero { padding: 56px 0 24px; }
.check__label { display: block; font-size: 14px; color: var(--muted); margin: 20px 0 6px; }
.check__row { display: flex; gap: 8px; }
.check input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 19px;
  padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.check input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
button {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
  padding: 14px 22px;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.6; cursor: progress; }
.check__hint { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* --- статус --- */
.status {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px; margin-bottom: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.status p { margin: 0; }
.status--error { background: var(--error-bg); border-color: transparent; color: var(--error); }
.spinner {
  flex: none; width: 20px; height: 20px; margin-top: 3px;
  border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* --- результат --- */
.result {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 48px;
}
.verdict { border-left: 4px solid var(--v); padding: 4px 0 4px 16px; margin-bottom: 24px; --v: var(--neutral); }
.verdict__label {
  display: inline-block; font-size: 14px; font-weight: 650;
  color: var(--v); background: var(--v-bg, var(--neutral-bg));
  padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.verdict__domain { font-size: 26px; margin-bottom: 8px; overflow-wrap: anywhere; }
.verdict__text { font-size: 18px; margin: 0; }
.verdict--ok { --v: var(--ok); --v-bg: var(--ok-bg); }
.verdict--act { --v: var(--act); --v-bg: var(--act-bg); }
.verdict--wait { --v: var(--wait); --v-bg: var(--wait-bg); }
.verdict--neutral { --v: var(--neutral); --v-bg: var(--neutral-bg); }

.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  margin: 0 0 24px;
}
.fact { background: var(--surface); padding: 10px 14px; }
.fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fact dt { font-size: 13px; color: var(--muted); }
.fact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.fact .warn { color: var(--wait); font-size: 14px; display: block; }

.block { margin-bottom: 24px; }
.steps { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 8px; }
.steps li::marker { color: var(--muted); font-weight: 600; }

.offers { display: grid; gap: 10px; }
.offer {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: baseline;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
}
.offer__title { font-weight: 600; }
.offer__price { font-size: 20px; font-weight: 650; white-space: nowrap; text-align: right; }
.offer__urgent { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.btn-primary { width: 100%; font-size: 18px; padding: 16px 22px; }

.order { border-top: 1px solid var(--border); padding-top: 20px; margin-bottom: 16px; }
.order label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.order input[type="text"] {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.order input[type="text"]:focus { border-color: var(--focus); outline: none; }
.order__offers { border: 0; padding: 0; margin: 0 0 12px; }
.order__offers legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.order .order__offers label, .order .order__urgent {
  display: flex; gap: 10px; align-items: baseline;
  color: var(--text); font-size: 16px; margin-bottom: 8px;
}
.order input[type="radio"], .order input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; flex: none; transform: translateY(3px); }
.order__total { font-size: 18px; font-weight: 650; }
.order__status { margin: 12px 0 0; }
.order__status--ok { color: var(--ok); }
.order__status--error { color: var(--error); }
.order .order__consent { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--muted); }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* --- кто проверяет --- */
.who { padding: 8px 0 40px; }
.who__card { display: flex; gap: 24px; align-items: flex-start; }
.who__photo { flex: none; width: 160px; height: 160px; border-radius: 50%; object-fit: cover; background: var(--neutral-bg); }
.who__name { font-size: 22px; font-weight: 650; margin-bottom: 4px; }
.who__links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.who__links a { font-weight: 600; }

/* --- цены --- */
.prices-section { padding-bottom: 40px; }
.h2-sub { margin-top: 36px; }
.table-wrap { overflow-x: auto; }
.prices { width: 100%; border-collapse: collapse; font-size: 15px; }
.prices th, .prices td { text-align: left; vertical-align: top; padding: 12px 10px; border-bottom: 1px solid var(--border); }
.prices thead th { font-size: 13px; color: var(--muted); font-weight: 600; }
.prices tbody th { font-weight: 400; width: 40%; }
.svc { display: block; font-weight: 650; }
.cell-note { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.price { font-weight: 650; white-space: nowrap; }
.price-notes { color: var(--muted); font-size: 15px; padding-left: 20px; margin: 16px 0 0; }
.price-notes li { margin-bottom: 6px; }

.tariffs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tariff { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-size: 15px; }
.tariff h3 { margin-bottom: 4px; }
.tariff__price { font-size: 20px; margin-bottom: 8px; }

/* --- вопрос и подвал --- */
.assistant { border-top: 1px solid var(--border); padding: 32px 0 24px; }
.btn-secondary { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-secondary:hover { background: var(--act-bg); color: var(--accent-hover); }
.footer { color: var(--muted); font-size: 14px; padding-top: 16px; padding-bottom: 48px; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }
.doc { padding-top: 32px; padding-bottom: 32px; }
.doc h1 { font-size: clamp(24px, 4vw, 30px); }
.doc h2 { font-size: 20px; margin-top: 28px; }
.doc ul { padding-left: 22px; }
.doc li { margin-bottom: 8px; }

/* --- чат-ассистент --- */
.chat {
  display: flex; flex-direction: column;
  margin-top: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.chat__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat__title { font-weight: 650; margin: 0; }
.chat__sub { font-size: 13px; color: var(--muted); margin: 0; }
.chat__close { background: transparent; color: var(--muted); padding: 4px 8px; font-size: 14px; font-weight: 500; }
.chat__close:hover { background: var(--neutral-bg); color: var(--text); }
.chat__log {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px; min-height: 120px; max-height: 320px; overflow-y: auto;
  overscroll-behavior: contain;
}
.msg {
  max-width: 88%; padding: 9px 13px; border-radius: 14px;
  font-size: 15.5px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere;
}
.msg--assistant { align-self: flex-start; background: var(--act-bg); border-bottom-left-radius: 4px; }
.msg--user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg--user a { color: inherit; }
.msg--typing { align-self: flex-start; color: var(--muted); background: var(--neutral-bg); font-size: 14px; }
.msg--note { align-self: stretch; max-width: none; background: var(--error-bg); color: var(--error); font-size: 14px; }
.chat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; }
.chat__chips:not(:empty) { padding-bottom: 10px; }
.chip {
  font-size: 14px; font-weight: 500; padding: 6px 12px;
  background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px;
}
.chip:hover { background: var(--act-bg); }
.chat__form { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.chat__row { display: flex; gap: 8px; align-items: flex-end; }
.chat__input {
  flex: 1; min-width: 0; resize: none;
  font: inherit; font-size: 16px; line-height: 1.4;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.chat__input:focus { border-color: var(--focus); outline: none; }
.chat__send { padding: 11px 16px; font-size: 15px; }
.chat__consent { display: flex; gap: 8px; align-items: baseline; margin-top: 8px; font-size: 13px; color: var(--muted); }
.chat__consent input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; transform: translateY(2px); }
.chat__consent--need { color: var(--error); }

.chat--floating {
  position: fixed; z-index: 40; left: 8px; right: 8px; bottom: 8px; margin: 0;
  height: min(82vh, 640px);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.22);
}
.chat--floating .chat__log { flex: 1; max-height: none; }

.ask-fab {
  position: fixed; z-index: 30; right: 16px; bottom: 16px;
  border-radius: 999px; padding: 13px 22px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
}
.ask-fab--unread::after {
  content: ""; position: absolute; top: 4px; right: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--wait); border: 2px solid var(--surface);
}
.ask-peek {
  position: fixed; z-index: 30; right: 16px; bottom: 76px;
  max-width: min(320px, calc(100vw - 32px)); padding: 12px 14px; text-align: left;
  font-size: 15px; font-weight: 400; line-height: 1.4;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.15);
}
.ask-peek:hover { background: var(--surface); }
.ask-peek__text { display: block; }
.ask-peek__cta { display: block; margin-top: 6px; color: var(--accent); font-weight: 600; }

@media (min-width: 640px) {
  .chat--floating { left: auto; right: 16px; bottom: 16px; width: 400px; }
}
/* Широкий экран: чат закреплён справа от колонки страницы и всегда на виду */
@media (min-width: 1260px) {
  body.has-chat { --page-left: max(16px, calc((100vw - 1212px) / 2)); }
  body.has-chat main, body.has-chat .footer { margin-left: var(--page-left); margin-right: auto; }
  body.has-chat .assistant-slot .chat {
    position: fixed; top: 16px; bottom: 16px; margin: 0;
    left: calc(var(--page-left) + 812px + 16px); width: 384px;
  }
  body.has-chat .assistant-slot .chat__log { flex: 1; max-height: none; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding-top: 32px; }
  .check__row { flex-direction: column; }
  .result { padding: 18px 16px; }
  .facts { grid-template-columns: 1fr; }
  .who__card { flex-direction: column; gap: 16px; }
  .who__photo { width: 112px; height: 112px; }
  .tariffs { grid-template-columns: 1fr; }
  .prices thead { display: none; }
  .prices, .prices tbody, .prices tr, .prices th, .prices td { display: block; width: auto; }
  .prices tr { border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; margin-bottom: 10px; background: var(--surface); }
  .prices tbody th { width: auto; padding: 10px 0; }
  .prices td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 12px; padding: 8px 0; }
  .prices td::before { content: attr(data-label); color: var(--muted); font-size: 13px; flex: 1; }
  .prices tr > :last-child { border-bottom: 0; }
  .prices td .cell-note { flex-basis: 100%; text-align: right; }
}
