:root {
  --green-900: #082a18;
  --green-800: #0d3b23;
  --green-700: #14502f;
  --green-100: #e6efe9;
  --green-50: #f2f7f3;
  --gold-600: #b8862f;
  --gold-500: #c99a3b;
  --gold-400: #ddb560;
  --gold-100: #f6ecd6;
  --ink: #13261b;
  --muted: #6b7a70;
  --line: #e4e8e3;
  --bg: #f5f2ea;
  --card: #ffffff;
  --danger: #b4412f;
  --radius-lg: 32px;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(8, 42, 24, .04), 0 12px 32px -12px rgba(8, 42, 24, .14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  /* восьмиконечная звезда — мотив из логотипа */
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(201, 154, 59, .16), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(13, 59, 35, .10), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23b8862f' stroke-opacity='.07' stroke-width='1.2'%3E%3Crect x='30' y='30' width='36' height='36'/%3E%3Crect x='30' y='30' width='36' height='36' transform='rotate(45 48 48)'/%3E%3Ccircle cx='48' cy='48' r='6'/%3E%3Cpath d='M0 48h22M74 48h22M48 0v22M48 74v22'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed, fixed, scroll;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; color: inherit; }

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(8, 42, 24, .05);
}

/* ---------- header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { display: block; width: 38px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; letter-spacing: .18em; color: var(--green-800); font-size: 17px; }
.brand-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-600); margin-top: 3px; }
.header-contacts { display: flex; align-items: center; gap: 28px; font-weight: 500; font-size: 16px; }
.header-contacts a { text-decoration: none; transition: color .15s; }
.header-contacts a:not(.wa-round):hover { color: var(--gold-600); }
.header-contacts .phone { font-weight: 700; color: var(--green-800); }

/* ---------- layout ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.grid > * { min-width: 0; }

/* ---------- hero: заголовок прямо на фоне, без карточки ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center; gap: 20px 48px;
  padding: 20px 16px 32px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(30px, 3.3vw, 42px);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--green-900);
  text-wrap: balance;
}
.lead { margin: 0 0 16px; font-size: 18px; color: #3c4d42; }
/* преимущества — плашки в ряд */
.perks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.perks li {
  background: #fff;
  border: 1px solid rgba(8, 42, 24, .07);
  color: var(--green-700);
  font-size: 14px; font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 60px; padding: 0 24px;
  border: 0; border-radius: 999px;
  font-size: 17px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--green-800);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(13, 59, 35, .55);
}
.btn-primary:hover { background: var(--green-700); }
.btn-ghost { background: var(--gold-100); color: var(--green-800); }
.btn-ghost:hover { background: #f1e2c1; }
.btn-wide { width: 100%; }
.wa-icon { flex: none; width: 22px; height: 22px; margin-right: 10px; }
.wa-round {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--green-800); color: #fff;
  transition: background .15s, transform .1s;
}
.wa-round:hover { background: var(--green-700); color: #fff; }
.wa-round:active { transform: translateY(1px); }
.wa-round:focus-visible { outline: 3px solid rgba(201, 154, 59, .55); outline-offset: 2px; }
.wa-round .wa-icon { width: 20px; height: 20px; margin: 0; }
.btn:focus-visible, .tab:focus-visible,.threshold:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(201, 154, 59, .55);
  outline-offset: 2px;
}

/* ---------- calculator ---------- */
.calc { padding: 32px 40px 34px; }
.calc h2, .result h2 {
  margin: 0 0 18px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--green-900);
}
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--green-50);
  padding: 6px; border-radius: 999px;
  margin-bottom: 26px;
}
.tab {
  height: 52px; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
  font-size: 16px; font-weight: 600; color: #3c4d42;
  transition: background .2s, color .2s, box-shadow .2s;
  white-space: nowrap; padding: 0 8px;
}
.tab:hover { color: var(--green-800); }
.tab.is-active {
  background: var(--green-800); color: #fff;
  box-shadow: 0 6px 16px -6px rgba(13, 59, 35, .5);
}

.field { margin-bottom: 22px; }
.calc .field:last-child { margin-bottom: 0; }
.field-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 0 4px 10px;
}
.field-head label, .field-head .label { font-size: 15px; color: #4b5b50; font-weight: 500; }
.hint { font-size: 14px; color: var(--muted); text-align: right; }

.input-wrap {
  display: flex; align-items: center; gap: 8px;
  height: 60px; padding: 0 22px;
  background: var(--green-50);
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
}
.input-wrap:focus-within { border-color: var(--gold-400); background: #fff; }
.input-wrap input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 22px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.input-wrap input:focus-visible { outline: none; }
.suffix { font-size: 20px; color: var(--muted); font-weight: 500; }
.badge {
  flex: none;
  font-size: 13px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px;
  background: var(--gold-100); color: var(--gold-600);
}
.badge:empty { display: none; }

.range {
  -webkit-appearance: none; appearance: none;
  width: calc(100% - 40px); margin: 16px 20px 0;
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--gold-500) var(--p, 0%), var(--line) var(--p, 0%));
  outline: none; cursor: pointer;
}
/* ползунок с отметкой порога «выгоднее» */
.range-wrap { position: relative; margin: 16px 20px 0; --thumb: 26px; }
.range-wrap .range {
  display: block; width: 100%; margin: 0;
  /* --t — позиция порога с учётом ширины бегунка; правее неё зона подсвечена зелёным */
  background:
    linear-gradient(to right, var(--gold-500) var(--p, 0%), transparent var(--p, 0%)),
    linear-gradient(to right, var(--line) var(--t, 100%), #cfe3d5 var(--t, 100%));
}
.range-wrap.has-threshold { padding-bottom: 30px; }
.threshold {
  position: absolute;
  top: 3px;
  left: var(--t);
  transform: translateX(-1px);
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit;
}
.threshold::before { /* засечка под дорожкой */
  content: '';
  position: absolute; left: 0; top: 0;
  width: 2px; height: 12px; border-radius: 2px;
  background: var(--green-700);
  opacity: .55;
}
.threshold-label {
  position: absolute; top: 14px; left: 0;
  white-space: nowrap;
  font-size: 12.5px; font-weight: 700;
  color: var(--green-700);
  padding: 2px 0;
}
.threshold:hover .threshold-label { text-decoration: underline; text-underline-offset: 3px; }
.threshold.is-reached::before { opacity: 1; }
.threshold.is-reached .threshold-label { color: var(--green-800); cursor: default; text-decoration: none; }
.threshold.is-reached .threshold-label::before {
  content: '✓'; margin-right: 5px;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gold-500);
  box-shadow: 0 2px 8px rgba(8, 42, 24, .18);
  transition: transform .1s;
}
.range::-webkit-slider-thumb:active { transform: scale(1.1); }
.range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gold-500);
  box-shadow: 0 2px 8px rgba(8, 42, 24, .18);
}

/* срок: значение + ползунок */
.input-static { gap: 10px; }
.static-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.input-static .suffix { font-size: 18px; }

/* ---------- итог: отдельная зелёная карточка ---------- */
.result {
  display: flex; flex-direction: column;
  padding: 32px 40px 30px;
  background: var(--green-800); border-color: transparent; color: #fff;
}
.result h2 { color: #fff; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.tile span { font-size: 14px; color: rgba(255, 255, 255, .74); }
.tile em { font-style: normal; color: var(--gold-400); font-weight: 700; }
.tile strong {
  font-size: 21px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-main { grid-column: 1 / -1; background: none; padding: 0 0 12px; border-radius: 0; }
.tile-main span { font-size: 16px; }
.tile-main strong { font-size: clamp(36px, 4.2vw, 54px); line-height: 1.12; letter-spacing: -.02em; font-variant-numeric: normal; }

.result .btn-primary { margin-top: auto; background: var(--gold-400); color: var(--green-900); box-shadow: none; }
.result .btn-primary:hover { background: #e8c67c; }

/* разбивка спрятана под «Подробнее» */
.more { margin: 14px 0 20px; }
.more summary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 4px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 600; color: #fff;
  border-radius: 8px;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after {
  content: ''; width: 7px; height: 7px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s;
}
.more[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.more summary:hover { color: var(--gold-400); }
.more summary:focus-visible { outline: 3px solid rgba(201, 154, 59, .55); outline-offset: 2px; }
.more .breakdown { margin: 6px 0 0; }
.breakdown {
  margin: 14px 0 20px; padding: 6px 4px;
  display: grid; grid-template-columns: 1fr; gap: 2px;
}
.breakdown div { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.breakdown div:last-child { border-bottom: 0; }
.breakdown dt { color: rgba(255, 255, 255, .74); }
.breakdown dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.error {
  background: #fbeeea; color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 14px; font-weight: 600;
  margin-bottom: 10px;
}
.is-invalid .tiles, .is-invalid .breakdown { opacity: .35; }

.note { margin: 14px 4px 0; font-size: 13px; color: rgba(255, 255, 255, .68); }

/* ---------- footer ---------- */
.footer { text-align: center; padding: 28px 0 0; color: var(--muted); font-size: 15px; }
.footer-links { display: flex; justify-content: center; gap: 32px; flex-wrap: wrap; margin-bottom: 10px; }
.footer-links a { color: var(--green-700); text-decoration: none; }
.footer-links a:hover { color: var(--gold-600); }

/* ---------- закреплённая полоска (только телефон) ---------- */
.sticky-bar { display: none; }

/* ---------- две колонки: разбивка всегда раскрыта ---------- */
@media (min-width: 1021px) {
  .grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }
  .more summary { display: none; }
  .hero { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 20px; padding: 8px 0 28px 16px; }
  .lead { font-size: 17px; margin-bottom: 12px; text-wrap: balance; }
  .perks { gap: 6px; }
  .perks li { font-size: 13px; padding: 7px 12px; white-space: nowrap; }
  /* компактнее, чтобы калькулятор и итог помещались на один экран */
  .calc { padding: 26px 36px 34px; display: flex; flex-direction: column; }
  .calc .field:not(:last-child) { flex: 1 0 auto; } /* поля делят свободную высоту */
  .result { padding: 26px 36px 24px; }
  .calc h2, .result h2 { margin-bottom: 14px; font-size: 26px; }
  .tabs { margin-bottom: 20px; }
  .tab { height: 46px; }
  .field { margin-bottom: 18px; }
  .field-head { padding-bottom: 8px; }
  .input-wrap { height: 54px; }
  .breakdown div { padding: 8px 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 12px 8px 24px; }
}
@media (max-width: 640px) {
  .page { padding: 12px 12px calc(92px + env(safe-area-inset-bottom)); }
  .sticky-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) 18px;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -12px rgba(8, 42, 24, .25);
    transition: transform .25s ease, opacity .25s ease;
  }
  .sticky-bar.is-hidden { transform: translateY(110%); opacity: 0; pointer-events: none; }
  .sticky-sum { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .sticky-sum span { font-size: 12px; color: var(--muted); }
  .sticky-sum strong { font-size: 21px; font-weight: 700; color: var(--green-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .sticky-bar .btn { height: 50px; padding: 0 20px; font-size: 16px; flex: none; }
  .sticky-bar .wa-icon { width: 20px; height: 20px; margin-right: 8px; }
  .header { padding: 12px 18px; border-radius: 24px; flex-wrap: wrap; }
  .header-contacts { gap: 14px; font-size: 14px; }
  .header-contacts a[data-bind="email"] { display: none; }
  .brand-name { font-size: 15px; }
  .hero { padding: 8px 8px 22px; gap: 12px; }
  .hero h1 { font-size: clamp(24px, 7.6vw, 30px); }
  .perks { gap: 6px; }
  .perks li { font-size: 13px; padding: 7px 11px; }
  .calc, .result { padding: 26px 20px; }
  .tile { padding: 14px 12px; }
  .tile strong { font-size: clamp(15px, 4.5vw, 20px); }
  .tile-main strong { font-size: 36px; }
  .tile-main { padding: 0 0 10px; }
  .card { border-radius: 26px; }
  .tab { font-size: 13px; height: 46px; white-space: normal; line-height: 1.1; padding: 0 4px; }
  .calc h2, .result h2 { font-size: 26px; margin-bottom: 16px; }
  .field-head { flex-wrap: wrap; }
  .breakdown { grid-template-columns: 1fr; }
  .input-wrap input { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sticky-bar { transition: none; }
}
