:root {
  color-scheme: dark;
  --bg: #0a0d0b;
  --surface: #111512;
  --surface-2: #161b17;
  --line: #242b25;
  --line-soft: #1c221d;
  --text: #f2f5f1;
  --body: #c9d1c9;
  --muted: #8f9a91;
  --muted-2: #6b756d;
  --green: #4ade68;
  --green-soft: rgba(74, 222, 104, 0.12);
  --green-line: rgba(74, 222, 104, 0.35);
  --warn: #e0a458;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  /* страховка от случайного горизонтального скролла; источники overflow
     дополнительно устранены точечно (min-width:0, overflow-wrap) */
  overflow-x: clip;
}

img,
svg {
  max-width: 100%;
}

body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(74, 222, 104, 0.06), transparent 70%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(860px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(14px, 2.5vh, 24px) 0 clamp(20px, 3vh, 32px);
}

.app-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- шапка ---- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(18px, 4.5vh, 44px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1.5px solid var(--green);
  color: var(--green);
  display: grid;
  place-items: center;
  background: var(--green-soft);
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.brand-text {
  font-size: 14.5px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.login-link {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
  transition: color 0.15s ease;
}

.login-link:hover {
  color: var(--green);
}

/* ---- hero ---- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* report view: после анализа страница сворачивает hero в компактную шапку */
.is-report .hero-intro,
.is-report .stats {
  display: none;
}

.is-report .topbar {
  margin-bottom: 24px;
}

.is-report .search-shell {
  margin-top: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 15px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.hero-head {
  text-align: center;
  max-width: 760px;
  margin-top: clamp(12px, 2.5vh, 22px);
}

.hero-head h1 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.hero-head p {
  margin: 12px auto 0;
  max-width: 520px;
  color: var(--muted);
  font-size: clamp(15px, 1.7vw, 16.5px);
  line-height: 1.5;
}

/* ---- форма ---- */

.search-shell {
  margin-top: clamp(16px, 3vh, 26px);
  width: min(700px, 100%);
  display: grid;
  gap: 12px;
  justify-items: center;
}

.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mode-option {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-option.is-active {
  background: var(--green);
  color: #08130a;
}

.search-box {
  position: relative;
  width: 100%;
  min-width: 0;
}

.search-pill {
  width: 100%;
  min-height: 64px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 20px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* выпадающие подсказки адреса */
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.suggest li {
  padding: 11px 14px;
  border-radius: 9px;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.4;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.suggest li:hover,
.suggest li.is-active {
  background: var(--surface-2);
  color: var(--text);
}

.search-pill > svg {
  color: var(--muted-2);
  flex: 0 0 auto;
}

.search-pill:focus-within {
  border-color: var(--green-line);
  box-shadow: 0 0 0 4px rgba(74, 222, 104, 0.08);
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  min-height: 42px;
  color: var(--text);
  font-size: 16px;
}

.search-input:focus {
  outline: none;
}

.search-input::placeholder,
.note-input::placeholder {
  color: var(--muted-2);
}

/* Видимая подпись + невидимый нативный select поверх всей зоны:
   выпадающий список гарантированно открывается по клику в любом браузере. */
.intent-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 12px 12px 12px 16px;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.intent-current {
  color: var(--green);
  font-size: 14.5px;
  font-weight: 620;
  white-space: nowrap;
}

.intent-select-wrap > svg {
  color: var(--muted-2);
  transition: color 0.15s ease;
}

.intent-select-wrap:hover > svg,
.intent-select-wrap:focus-within > svg {
  color: var(--green);
}

.intent-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  cursor: pointer;
}

.intent-select option {
  background: var(--surface);
  color: var(--text);
}

.pill-submit {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 0;
  flex: 0 0 auto;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #08130a;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
  position: relative;
}

.pill-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.pill-submit:active {
  transform: translateY(0);
}

.pill-submit:disabled {
  cursor: progress;
  opacity: 0.7;
  transform: none;
}

.pill-submit.is-loading svg {
  visibility: hidden;
}

.pill-submit.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(8, 19, 10, 0.35);
  border-top-color: #08130a;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.search-pill[aria-invalid="true"] {
  border-color: #c25b3f;
  box-shadow: 0 0 0 4px rgba(194, 91, 63, 0.12);
}

.note-input {
  width: min(520px, 100%);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 10px 2px;
  text-align: center;
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.note-input:focus {
  outline: none;
  border-bottom-color: var(--green-line);
}

.status {
  color: var(--muted);
  font-size: 13px;
}

[data-tone="good"] {
  color: var(--green);
}

[data-tone="warn"] {
  color: var(--warn);
}

.disclaimer {
  margin: clamp(12px, 2vh, 18px) 0 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 13px;
}

.disclaimer svg {
  flex: 0 0 auto;
}

/* ---- статистика ---- */

.stats {
  margin-top: clamp(20px, 4.5vh, 42px);
  display: flex;
  gap: clamp(28px, 8vw, 84px);
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
}

.stats div {
  display: grid;
  gap: 5px;
}

.stats strong {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 740;
  color: var(--green);
  letter-spacing: -0.01em;
}

.stats span {
  color: var(--muted);
  font-size: 13.5px;
}

/* ---- стадии загрузки ---- */

.flow {
  width: min(680px, 100%);
  margin-top: 34px;
  display: grid;
  gap: 18px;
}

.progress {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.progress li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-2);
  font-size: 13px;
  transition: color 0.2s ease;
}

.progress li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  flex: 0 0 auto;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.progress li.is-active {
  color: var(--text);
}

.progress li.is-active::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.1s ease-in-out infinite;
}

.progress li.is-done {
  color: var(--muted);
}

.progress li.is-done::before {
  background: var(--green);
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

/* ---- консультация (report view) ---- */

.consult {
  text-align: left;
  display: grid;
  gap: 28px;
  min-width: 0;
  animation: fade-in 0.35s ease;
}

.consult-section,
.consult-section p,
.consult-section li {
  min-width: 0;
  overflow-wrap: anywhere;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.consult-hero {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 90% at 20% 0%, rgba(74, 222, 104, 0.07), transparent 60%),
    var(--surface);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.status-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: 0 0 auto;
}

.status-chip.is-ok::before {
  background: var(--green);
  box-shadow: 0 0 6px rgba(74, 222, 104, 0.6);
}

.status-chip.is-warn::before {
  background: var(--warn);
}

.status-chip.is-intent {
  border-color: var(--green-line);
  background: var(--green-soft);
  color: var(--green);
}

.status-chip.is-intent::before {
  background: var(--green);
}

.consult-address {
  margin: 0;
  font-size: clamp(21px, 3.2vw, 30px);
  font-weight: 740;
  letter-spacing: -0.015em;
  line-height: 1.2;
  min-width: 0;
  overflow-wrap: anywhere;
}

.verdict-line {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.verdict-pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 16px;
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
}

.verdict-line p {
  margin: 0;
  color: var(--body);
  font-size: clamp(15.5px, 2vw, 17px);
  line-height: 1.6;
  font-weight: 480;
  overflow-wrap: anywhere;
}

.consult-section {
  display: grid;
  gap: 10px;
}

.consult-section h3 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-2);
}

.consult-section h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 620;
  color: var(--muted);
}

.consult-section p {
  margin: 0;
  color: var(--body);
  font-size: 15.5px;
  line-height: 1.65;
}

.inline-label {
  color: var(--text);
  font-weight: 620;
}

.consult-section ul,
.consult-section ol {
  margin: 0;
  padding-left: 20px;
  color: var(--body);
  font-size: 15px;
  line-height: 1.6;
  display: grid;
  gap: 7px;
  align-content: start;
}

.consult-columns .consult-section {
  align-content: start;
}

.consult-section ol li::marker {
  color: var(--green);
  font-weight: 700;
}

.consult-section ul li::marker {
  color: var(--muted-2);
}

.facts {
  margin: 6px 0 0;
  display: grid;
  gap: 0;
}

.facts div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.facts div:first-child {
  border-top: 1px solid var(--line-soft);
}

.facts dt {
  color: var(--muted-2);
  font-size: 13px;
  flex: 0 0 auto;
}

.facts dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  text-align: right;
  overflow-wrap: anywhere;
}

.cadastre-warnings {
  color: var(--muted-2) !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.unconfirmed {
  margin-top: 4px;
}

.market-note {
  color: var(--warn) !important;
  font-size: 13.5px !important;
}

.market-ranges {
  color: var(--text) !important;
  font-weight: 560;
}

.consult-scenario {
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.risk-list {
  list-style: none;
  padding-left: 0 !important;
}

.risk-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.risk-cat {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  position: relative;
  top: -1px;
}

.consult-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
}

.advice {
  margin: 0;
  border-left: 2px solid var(--green);
  padding: 4px 0 4px 18px;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.6;
  font-style: italic;
}

.cta-row {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding-top: 6px;
}

.cta-button {
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #08130a;
  font-size: 15px;
  font-weight: 680;
  padding: 14px 34px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cta-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.cta-note {
  color: var(--muted);
  font-size: 13px;
}

.reset-button {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.15s ease;
}

.reset-button:hover {
  color: var(--green);
}

/* ---- футер ---- */

.footer {
  margin-top: clamp(24px, 4vh, 44px);
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 13px;
}

.toplinks {
  display: flex;
  gap: 18px;
}

.toplinks a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.toplinks a:hover {
  color: var(--green);
}

/* ---- документы (privacy / consent) ---- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 5px 12px;
}

.doc {
  max-width: 720px;
  margin: 0 auto;
}

.doc h1 {
  font-size: clamp(28px, 4vw, 38px);
  margin: 14px 0 10px;
  letter-spacing: -0.01em;
}

.doc > p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.doc section {
  margin-top: 28px;
}

.doc h2 {
  font-size: 19px;
  margin: 0 0 8px;
}

.doc p,
.doc li {
  color: var(--body);
  line-height: 1.65;
  font-size: 15px;
}

.doc ul {
  margin: 0;
  padding-left: 20px;
}

/* Мобильная строка поиска: всегда одна строка — input сжимается (min-width:0),
   селектор и кнопка не переносятся (flex-shrink:0). */
@media (max-width: 620px) {
  .topbar {
    margin-bottom: 34px;
  }

  .search-pill {
    padding: 6px 6px 6px 12px;
    gap: 7px;
  }

  .search-icon {
    display: none;
  }

  .search-input {
    font-size: 15px;
  }

  .intent-select-wrap {
    padding: 10px 8px 10px 10px;
    gap: 4px;
  }

  .intent-current {
    font-size: 13px;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pill-submit {
    width: 44px;
    height: 44px;
  }

  .stats {
    gap: 26px;
  }

  .facts div {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .facts dd {
    text-align: left;
  }

  .consult-hero {
    padding: 16px;
  }
}
