/* Golos Text (SIL OFL 1.1, see fonts/OFL.txt) is self-hosted from /fonts —
   the site makes zero external requests (privacy guarantee). Variable font,
   weight axis 400-900, split by unicode subset. */
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/golos-text-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F,
    U+FE2E-FE2F;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/golos-text-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/golos-text-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/golos-text-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* #EFE9DF is the design-canvas backdrop; the page itself is #FAF6EF */
  --bg: #FAF6EF;
  --surface: #FAF6EF;
  --surface-2: #FFFFFF;
  --text: #3E3548;
  --muted: #8B8296;
  --line: #F0E7DA;
  --line-2: #EFE4D6;
  --accent: #EE7B5C;
  --accent-dark: #B84A2C;
  --green: #3E8E63;
  --green-bg: #E7F3E9;
  --green-text: #5C6B5F;
  --purple: #8A79C9;
  --purple-bg: #EFEAF8;
  --red: #C75B45;
  --red-bg: #FCE9E2;
  --chart-price: #D98A7B;
  --chart-power: #5FA37F;
  --yellow-bg: #FBF1DA;
  --yellow-text: #9A7B2E;
  /* Darker shades of the same hues for the 12 px «ВАШ ОТВЕТ» eyebrow only
     (≥ 4.5:1 on --green-bg / --yellow-bg / --red-bg: 4.99, 5.38, 5.21). */
  --green-strong: #2F7350;
  --yellow-strong: #7A5F18;
  --red-strong: #A8402C;
  /* Body text on the yellow and red answer cards (≥ 6:1 on both). */
  --answer-text: #5C5466;
  --shadow: 0 4px 24px rgba(62, 53, 72, 0.08);
  --shadow-lg: 0 16px 48px rgba(62, 53, 72, 0.12);
  --blue: var(--purple);

  font-family: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1, h2, h3, p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: 2.75rem;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -0.5px;
}

h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  font-weight: 800;
}

h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 800;
}

/* ─── HEADER ─── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
  padding: 14px 0;
}

/* Legacy header layout for investments.html */
.page-header__copy {
  min-width: 0;
}

.page-header__summary {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.lead {
  max-width: 700px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* ─── BRAND ─── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* The mark itself (coral tile + white «К») lives in icons/icon.svg — the box
   here only reserves space so the header does not shift while it loads. */
.brand__icon {
  width: 36px;
  height: 36px;
  display: block;
  flex-shrink: 0;
}

.brand__name {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}

/* ─── TAB NAV ─── */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px;
}

.tab-nav__tab {
  display: block;
  padding: 9px 20px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tab-nav__tab[aria-current="page"],
.tab-nav__tab--active {
  background: var(--text);
  color: #FFF;
  font-weight: 700;
}

/* Legacy nav (investments.html) */
.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.page-nav a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 16px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.page-nav a[aria-current="page"] {
  background: var(--text);
  color: #fff;
}

/* ─── FOOTER ─── */
/* Same markup on every page; only the aria-current link differs. Width tracks
   .page-header__inner so header and footer share one gutter. */
.page-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.page-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
  padding: 24px 0 28px;
}

.page-footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.page-footer__nav a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.page-footer__nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.page-footer__nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}

/* ─── PAGE LAYOUT ─── */
.page-inner {
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
  padding: 32px 0 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tool-section {
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
  padding: 24px 0;
}

.content-width {
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
}

.page-headline {
  max-width: 760px;
}

.page-headline-block {
  padding-bottom: 0;
}

.page-headline-block h1 {
  margin-bottom: 8px;
}

.page-headline-block .lead {
  margin: 0;
}

/* ─── TOOL GRID ─── */
.tool-grid {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 24px;
  align-items: start;
}

/* ─── FORM PANEL ─── */
.form-panel {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.panel {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.form-section-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 18px;
}

/* ─── FIELDS ─── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

.field-row .field {
  margin-bottom: 0;
}

.field-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.field-badge--green {
  background: var(--green-bg);
  color: var(--green);
}

.field-badge--purple {
  background: var(--purple-bg);
  color: var(--purple);
}

.field-badge--red {
  background: var(--red-bg);
  color: var(--red);
}

/* Legacy hint (used by app.js down-payment-percent) */
.field-hint {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.field-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.45;
}

.field-note--after-field {
  margin-top: -8px;
}

.field-group__title {
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.field-group__title:first-of-type {
  margin-top: 0;
}

/* ─── INPUT SHELL ─── */
.input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 50px;
  border-radius: 16px;
  background: var(--surface);
  border: 1.5px solid transparent;
  overflow: hidden;
  transition: border-color 0.15s;
}

.input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(238, 123, 92, 0.14);
}

.input-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 11px 16px;
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 800;
  outline: 0;
}

.input-shell span {
  padding: 0 16px 0 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.input-with-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

/* ─── SECTION HEADING (legacy) ─── */
.section-heading {
  margin-bottom: 14px;
}

/* ─── DETAILS BLOCK (new collapsible in form) ─── */
.details-block {
  border-top: 1px dashed var(--line);
  margin-top: 8px;
}

.details-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  list-style: none;
}

.details-block summary::-webkit-details-marker {
  display: none;
}

.details-block summary::after {
  content: 'Развернуть ▾';
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
}

.details-block[open] summary::after {
  content: 'Свернуть ▴';
}

.details-block__content {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 8px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

/* Value tiles: label on top, big bold value + unit below */
.details-grid .field {
  margin-bottom: 0;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
  gap: 6px;
  transition: box-shadow 0.15s;
}

.details-grid .field:focus-within {
  box-shadow: 0 0 0 3px rgba(238, 123, 92, 0.18);
}

.details-grid .field > span:first-child {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.details-grid .input-shell {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.details-grid .input-shell:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.details-grid .input-shell input {
  width: auto;
  field-sizing: content;
  min-width: 2ch;
  max-width: calc(100% - 4ch);
  padding: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.details-grid .input-shell span {
  padding: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

/* ─── DERIVED METRICS ─── */
.derived-metrics {
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.derived-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--muted);
}

.derived-metric strong {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

.derived-metric strong[data-value-tone="positive"] { color: var(--green); }
.derived-metric strong[data-value-tone="negative"] { color: var(--red); }

/* legacy */
.form-derived-metric {
  display: grid;
  grid-template-columns: minmax(140px, 0.48fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-derived-metric strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.form-derived-metric strong[data-value-tone="positive"] { color: var(--green); }
.form-derived-metric strong[data-value-tone="negative"] { color: var(--red); }

/* ─── CURRENCY PICKER ─── */
.currency-picker {
  margin: 0 0 14px;
  border: 0;
  padding: 0;
}

.currency-picker legend {
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

.currency-picker__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.currency-picker label {
  position: relative;
}

.currency-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.currency-picker span {
  display: block;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.currency-picker input:checked + span {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(62, 53, 72, 0.1);
}

.currency-picker input:focus-visible + span {
  outline: 3px solid rgba(238, 123, 92, 0.3);
}

/* ─── ASSUMPTION CARD ─── */
.assumption-card {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--purple);
  border-radius: 14px;
  background: var(--purple-bg);
  padding: 12px 14px;
}

.assumption-card strong {
  font-size: 0.9rem;
  font-weight: 800;
}

.assumption-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Whose numbers the form shows: «Пример — все числа можно изменить», or
   «Ваши числа · Вернуть пример» with the inline reset (renderExampleState in
   the page scripts). */
.assumption-card__state {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 0;
}

/* `.assumption-card p` mutes its text; the label keeps the card's colour. */
.assumption-card__state strong {
  color: var(--text);
}

.assumption-card__state .text-button {
  padding: 0;
}

#example-state-reset::before,
#comparison-example-state-reset::before {
  content: "· ";
  color: var(--muted);
}

.assumption-card__summary {
  border-top: 1px solid rgba(138, 121, 201, 0.2);
  padding-top: 7px;
  color: var(--text) !important;
  font-weight: 800;
}

.assumption-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

.assumption-card__links a {
  color: var(--purple);
  text-decoration: none;
}

.assumption-card__links a:hover {
  text-decoration: underline;
}

.assumption-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
}

.assumption-facts div {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(138, 121, 201, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  padding: 6px 12px;
}

.assumption-facts dt {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.assumption-facts dt::after {
  content: ":";
}

.assumption-facts dd {
  margin: 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}

/* ─── SCENARIO EDITOR ─── */
.field-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.details-settings.field-group,
.scenario-editor.field-group,
.forecast-options.field-group {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
}

.details-settings summary,
.scenario-editor summary,
.forecast-options summary {
  padding: 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.details-settings[open] summary,
.scenario-editor[open] summary,
.forecast-options[open] summary {
  margin-bottom: 4px;
}

.details-settings .assumption-card {
  margin: 14px 0;
}

.details-settings .form-actions {
  margin-top: 14px;
}

/* .scenario-editor__rate is still generated by the investments rate-plan editor */
.scenario-editor__rate {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.scenario-editor__rate input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  color: var(--text);
  outline: 0;
}

.scenario-editor__rate span {
  padding-right: 10px;
}

.scenario-editor__rate:focus-within {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(238, 123, 92, 0.14);
}

.scenario-editor__rate:has(input[aria-invalid="true"]) {
  border-color: var(--red);
}

/* ─── RATES EDITOR (Детали расчёта, main page) ─── */
.rates-editor {
  margin-top: 14px;
}

.rates-editor__title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.rates-table {
  background: var(--surface);
  border-radius: 14px;
  padding: 4px 14px;
}

.rates-table__head,
.rates-table__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 80px;
  gap: 8px;
  align-items: center;
  padding: 10px 2px;
}

.rates-table__head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  /* The rate columns are fixed and narrow — a long label must wrap, not spill
     over the next column. */
  overflow-wrap: anywhere;
}

.rates-table__row {
  border-top: 1px solid var(--line);
}

.rates-table__name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rates-table__name .scenario-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 0;
}

.rates-table__name input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.rates-table__rate {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.rates-table__rate input {
  width: 5.5ch;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: inherit;
  font: inherit;
}

.rates-table input[type="number"]::-webkit-outer-spin-button,
.rates-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rates-table input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.rates-table input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 6px;
}

.rates-table input[aria-invalid="true"] {
  color: var(--red);
  box-shadow: 0 1.5px 0 var(--red);
}

.rates-editor__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.rates-editor__actions .text-button {
  padding: 9px 16px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s;
}

.rates-editor__actions .text-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ─── RESULT CARDS (инвестиции vs покупка) ─── */
.metric-card__sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
  padding: 20px 24px;
}

.result-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.result-card__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill--green,
.pill[data-tone="positive"] {
  background: var(--green-bg);
  color: var(--green-text);
}

.pill[data-tone="negative"] {
  background: var(--red-bg);
  color: var(--red);
}

/* The best-option pill carries data-dependent text («Через 1 год · без долга
   через 6 лет 11 месяцев») — at 375px it must wrap instead of widening the
   card and the whole column past the viewport. */
.result-card__head .pill {
  flex-wrap: wrap;
  max-width: 100%;
  white-space: normal;
}

.inline-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 0;
}

.inline-metrics div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.inline-metrics dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.inline-metrics dd {
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 800;
}

.inline-metrics dd[data-value-tone="positive"] { color: var(--green); }
.inline-metrics dd[data-value-tone="negative"] { color: var(--red); }

.inline-metrics dd small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Savings badge follows the derived status tone */
.field-badge--savings {
  background: var(--green-bg);
  color: var(--green-text);
}

.field-badge--savings:has([data-value-tone="neutral"]) {
  background: var(--surface);
  color: var(--muted);
}

.field-badge--savings:has([data-value-tone="negative"]) {
  background: var(--red-bg);
  color: var(--red);
}

/* ─── BUTTONS ─── */
.calc-button {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 15px 0;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #FFF;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}

.calc-button:hover {
  background: var(--accent-dark);
}

.calc-button--secondary {
  margin-top: 10px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
}

.calc-button--secondary:hover {
  background: var(--line);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 10px 20px;
  border: 0;
  background: var(--accent);
  color: #FFF;
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 10px 20px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 6px 0;
  color: var(--purple);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
}

.form-error {
  min-height: 1.3em;
  margin: 8px 0 2px;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-warning {
  min-height: 1.3em;
  margin: 6px 0 0;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

/* The link warning is set once at load and cleared on the first input, so it
   does not reserve a blank line under the assumption card like the input
   warning does above the buttons. */
#link-warning:empty,
#comparison-link-warning:empty {
  display: none;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
}

/* ─── RESULT PANEL ─── */
.result-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── ANSWER CARD (ВАШ ОТВЕТ) ─── */
.availability-card {
  background: var(--green-bg);
  border-radius: 24px;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background 0.2s;
}

/* Answer states: «Да» (now) green, «Пока нет» (later) yellow, «Нет»
   (out-of-range) red. The title's first word and the icon say the same, so
   colour is never the only signal. */
.availability-card[data-status="later"] {
  background: var(--yellow-bg);
}

.availability-card[data-status="out-of-range"] {
  background: var(--red-bg);
}

.availability-card[data-status="invalid"] {
  background: var(--surface);
}

.answer-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.answer-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--green-strong);
  text-transform: uppercase;
}

.availability-card[data-status="later"] .answer-eyebrow {
  color: var(--yellow-strong);
}

.availability-card[data-status="out-of-range"] .answer-eyebrow {
  color: var(--red-strong);
}

.availability-card[data-status="invalid"] .answer-eyebrow {
  color: var(--muted);
}

.availability-card h2,
.availability-card h3 {
  margin: 0;
  font-size: 2.35rem;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.5px;
}

.availability-text {
  margin: 0;
  max-width: 560px;
  font-size: 1rem;
  color: var(--green-text);
  line-height: 1.5;
}

.availability-card[data-status="invalid"] .availability-text {
  color: var(--muted);
}

.availability-card[data-status="later"] .availability-text,
.availability-card[data-status="out-of-range"] .availability-text {
  color: var(--answer-text);
}

.answer-headline {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.answer-icon {
  display: none;
  flex: none;
  width: 44px;
  height: 44px;
  margin-top: 1px;
  border-radius: 50%;
  color: #fff;
  place-items: center;
}

.answer-icon svg {
  display: none;
  width: 24px;
  height: 24px;
}

.availability-card[data-status="now"] .answer-icon,
.availability-card[data-status="later"] .answer-icon,
.availability-card[data-status="out-of-range"] .answer-icon {
  display: grid;
}

.availability-card[data-status="now"] .answer-icon {
  background: var(--green);
}

.availability-card[data-status="later"] .answer-icon {
  background: var(--yellow-text);
}

.availability-card[data-status="out-of-range"] .answer-icon {
  background: var(--red);
}

.availability-card[data-status="now"] .answer-icon__now,
.availability-card[data-status="later"] .answer-icon__later,
.availability-card[data-status="out-of-range"] .answer-icon__out {
  display: block;
}

/* «Ваш бюджет»: fill = budget, black tick = price; the right end is the
   larger of the two (see buildBudgetView in app.js). */
.budget-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
}

.budget-bar[hidden] {
  display: none;
}

.budget-bar__track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(62, 53, 72, 0.1);
}

.budget-bar__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--budget-fill, 0%);
  border-radius: 999px;
  background: var(--green);
  transition: width 0.25s ease;
}

.availability-card[data-status="later"] .budget-bar__fill {
  background: var(--yellow-text);
}

.availability-card[data-status="out-of-range"] .budget-bar__fill {
  background: var(--red);
}

.budget-bar__goal {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: var(--budget-goal, 100%);
  width: 3px;
  margin-left: -3px;
  border-radius: 2px;
  background: var(--text);
}

.budget-bar__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--answer-text);
}

.budget-bar__legend strong {
  color: var(--text);
  font-weight: 800;
}

.budget-bar__horizon {
  margin: 0;
  font-size: 0.9rem;
  color: var(--answer-text);
}

/* Insight tip */
.availability-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(62, 142, 99, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
}

.availability-insight::before {
  content: '→';
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.availability-insight[hidden] {
  display: none;
}

/* ─── SCENARIO TABS ─── */
.scenario-tabs {
  display: flex;
  gap: 3px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 4px;
  backdrop-filter: blur(4px);
}

.scenario-tab {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.scenario-tab--active {
  background: var(--text);
  color: #FFF;
}

/* ─── METRIC CARDS ─── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric-cards--three {
  grid-template-columns: repeat(3, 1fr);
}

.metric-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card__label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.metric-card__value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.metric-card__value--green {
  color: var(--green);
}

.metric-card__value[data-value-tone="positive"] { color: var(--green); }
.metric-card__value[data-value-tone="negative"] { color: var(--red); }

/* Legacy comparison highlights — kept for investments.html */
.comparison-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.comparison-highlights div {
  min-width: 0;
  padding: 12px 14px;
}

.comparison-highlights div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.comparison-highlights div:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.comparison-highlights--wide div:nth-child(n + 3):not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.comparison-highlights dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.comparison-highlights dd {
  display: grid;
  gap: 4px;
  margin: 0;
}

.comparison-highlights strong {
  color: var(--text);
  font-size: 1.18rem;
  line-height: 1.15;
  font-weight: 800;
}

.comparison-highlights span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
}

.comparison-highlights strong[data-value-tone="positive"] { color: var(--green); }
.comparison-highlights strong[data-value-tone="negative"] { color: var(--red); }

/* ─── NOW CARD (А если покупать сейчас?) ─── */
.now-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.now-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.now-card__header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.now-badge {
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--surface);
  color: var(--muted);
}

/* Decision box data-status styling */
.now-card[data-status="calculated"][data-comfort="positive"] .now-badge {
  background: var(--green-bg);
  color: var(--green);
}

.now-card[data-status="calculated"][data-comfort="negative"] .now-badge {
  background: var(--red-bg);
  color: var(--red);
}

.now-card[data-status="noMortgage"] .now-badge {
  background: var(--green-bg);
  color: var(--green);
}

.now-card__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Legacy decision box */
.decision {
  border-left: 4px solid var(--purple);
  background: var(--purple-bg);
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.decision[data-status="noMortgage"] {
  border-color: var(--green);
  background: var(--green-bg);
}

.decision[data-status="calculated"][data-comfort="positive"] {
  border-color: var(--green);
  background: var(--green-bg);
}

.decision[data-status="calculated"][data-comfort="negative"] {
  border-color: var(--red);
  background: var(--red-bg);
}

.decision[data-status="invalid"] {
  border-color: var(--red);
  background: var(--red-bg);
}

.decision__status {
  margin: 0 0 4px;
  font-weight: 900;
}

.decision__text {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

/* ─── NOW METRICS ─── */
.now-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
}

.now-metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.now-metrics dt {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.now-metrics dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.now-metrics dd[data-value-tone="positive"] { color: var(--green); }
.now-metrics dd[data-value-tone="negative"] { color: var(--red); }

/* ─── METRICS TABLE (legacy) ─── */
.metrics {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line);
}

.metrics div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metrics dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.metrics dd {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  text-align: right;
}

.metrics dd[data-value-tone="positive"] { color: var(--green); }
.metrics dd[data-value-tone="negative"] { color: var(--red); }

td[data-value-tone="positive"] { color: var(--green); }
td[data-value-tone="negative"] { color: var(--red); }

/* ─── RECOMMENDATION ─── */
.recommendation {
  margin-top: 4px;
}

.recommendation p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ─── CHART ─── */
.chart-wrap {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-header h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.chart-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot--price { background: var(--chart-price); }
.legend-dot--power { background: var(--chart-power); }

.chart-frame {
  border-radius: 14px;
  overflow: hidden;
}

.chart-frame svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-grid-line {
  stroke: var(--line);
  stroke-width: 1.5;
}

.chart-axis-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Golos Text', system-ui, sans-serif;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-line--price { stroke: var(--chart-price); }
.chart-line--power { stroke: var(--chart-power); }

.chart-marker-line {
  stroke: var(--text);
  stroke-dasharray: 4 5;
  stroke-width: 1.5;
}

.chart-marker-dot {
  fill: var(--text);
}

/* Legacy chart card */
.chart-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 24px;
}

.chart-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chart-card__header .eyebrow {
  margin-bottom: 4px;
}

/* ─── TABLES ─── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.comparison-table-wrap table {
  min-width: 880px;
}

/* ─── PURCHASE POINTS CARD (Когда покупать) ─── */
.purchase-points-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-2);
  padding: 24px 28px 20px;
}

.purchase-points-card__head {
  margin-bottom: 16px;
}

.purchase-points-card__head h2 {
  margin: 0 0 4px;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.2px;
}

.purchase-points-card__sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* The card supplies the frame; the inner wrap only scrolls if needed */
.purchase-points-card .comparison-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.purchase-points-card thead th {
  background: transparent;
  border-bottom: 1px solid var(--line);
}

.purchase-points-card tbody tr:last-child td {
  border-bottom: 0;
}

.purchase-points-card__note {
  margin: 14px 0 0;
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Best purchase point */
.comparison-table-wrap tr[data-best="true"] {
  background: var(--green-bg);
}

.comparison-table-wrap tr[data-best="true"] td {
  font-weight: 800;
}

.purchase-point__best {
  margin-left: 6px;
  color: var(--green);
  font-weight: 800;
  white-space: nowrap;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--surface);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.scenario-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

[data-tone="positive"] .scenario-swatch { background: var(--chart-power); }
[data-tone="neutral"] .scenario-swatch { background: var(--purple); }
[data-tone="negative"] .scenario-swatch { background: var(--chart-price); }

/* ─── FORECAST TABLE ─── */
.forecast-table-wrap {
  margin-top: 14px;
}

/* ─── SECTION WRAPPERS ─── */
.forecast-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.forecast-section h2 {
  font-size: 1.1rem;
}

.scenario-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scenario-section h2 {
  font-size: 1.1rem;
}

/* Pages without .page-inner (investments.html) space sections themselves */
body > main > .forecast-section,
body > main > .scenario-section,
body > main > .content-section,
body > main > .disclaimer-section {
  padding: 20px 0;
}

.scenario-section-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.scenarios-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

/* ─── RESULT BREAKDOWN (investments.html) ─── */
.result-breakdown {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
  overflow: hidden;
}

.result-breakdown__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.result-breakdown__header .eyebrow {
  margin-bottom: 4px;
}

.result-breakdown__header strong {
  color: var(--purple);
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: right;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.breakdown-grid div {
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.breakdown-grid div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.breakdown-grid div:last-child {
  grid-column: 1 / -1;
  border-bottom: 0;
  border-right: 0;
}

.breakdown-grid dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.breakdown-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
}

.breakdown-grid dd[data-value-tone="positive"] { color: var(--green); }
.breakdown-grid dd[data-value-tone="negative"] { color: var(--red); }

.breakdown-note {
  margin: 0;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

/* ─── RATE PLAN (investments.html) ─── */
.rate-assumptions__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}

.rate-assumptions h3 {
  margin: 0;
  font-size: 1rem;
}

.link-button {
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.link-button:hover {
  color: var(--accent-dark);
}

.link-button[disabled] {
  color: var(--muted);
  cursor: default;
}

/* Editable variant of the rates table: one row per rate breakpoint, each
   holding the rates that apply until the next one */
.rates-table--plan .rates-table__head,
.rates-table--plan .rates-table__row {
  grid-template-columns: minmax(0, 1fr) 96px 96px;
  padding: 8px 2px;
}

.rates-table__period {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.rate-plan-row__remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.rate-plan-row__remove:hover {
  background: var(--red-bg);
  color: var(--red);
}

.rate-plan-actions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.rate-plan-actions__hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.rate-assumptions__notice {
  margin: 10px 0 0;
  border-left: 3px solid var(--purple);
  padding: 7px 0 7px 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ─── OWNERSHIP STATUS ─── */
.ownership-status__content {
  display: grid;
  gap: 3px;
}

.ownership-status__content strong {
  font-size: 0.9rem;
}

.ownership-status__content small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}

/* ─── CONTENT / FAQ ─── */
.content-section {
  padding: 0;
}

.split-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  gap: 32px;
  align-items: start;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.split-content p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 12px;
}

.faq {
  display: grid;
  gap: 10px;
}

.faq h2 {
  margin-bottom: 4px;
}

details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 14px 16px;
}

summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.95rem;
}

details p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── ABOUT PAGE ─── */
/* Prose-only page: narrower column than the calculators, cards reuse
   .result-card so the surface matches the rest of the site. */
.about-page {
  max-width: 860px;
}

.about-card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.about-card p {
  margin: 0;
  line-height: 1.6;
}

.about-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-weight: 800;
}

.about-links a {
  color: var(--accent);
  text-decoration: none;
}

.about-links a:hover {
  text-decoration: underline;
}

/* ─── DISCLAIMER ─── */
.disclaimer-section {
  padding-bottom: 28px;
}

.disclaimer-section p {
  margin: 0;
  padding-top: 8px;
  color: #B4ACBE;
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: center;
}

/* ─── SAVINGS SLIDERS ─── */
/* The thumb's centre travels from thumb/2 to 100% − thumb/2, so the fill, the
   mark and its caption use the same calc() as the thumb. --range-pos and
   --range-mark (0…1) are written by src/range-slider.js. */
.range-field {
  --range-thumb: 22px;
  --range-pos: 0;
  --range-mark: 0;
  --range-track: rgba(62, 53, 72, 0.14);
  display: flex;
  flex-direction: column;
}

.range-field__track {
  position: relative;
}

/* The caption space is reserved for good on the slider that can carry a mark,
   so the mark appearing never shifts what is below. */
.range-field--markable .range-field__track {
  margin-bottom: 14px;
}

.range-field__input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.range-field__input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.range-field__input:focus {
  outline: none;
}

.range-field__input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent)
      calc(var(--range-thumb) / 2 + (100% - var(--range-thumb)) * var(--range-pos)),
    var(--range-track) 0
  );
}

.range-field__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--range-thumb);
  height: var(--range-thumb);
  margin-top: calc((6px - var(--range-thumb)) / 2);
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(62, 53, 72, 0.2);
}

.range-field__input::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--range-track);
}

.range-field__input::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.range-field__input::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--range-thumb);
  height: var(--range-thumb);
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(62, 53, 72, 0.2);
}

.range-field__input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(238, 123, 92, 0.35);
}

.range-field__input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(238, 123, 92, 0.35);
}

.range-field__mark,
.range-field__mark-label {
  position: absolute;
  left: calc(var(--range-thumb) / 2 + (100% - var(--range-thumb)) * var(--range-mark));
  pointer-events: none;
}

.range-field__mark {
  top: 50%;
  width: 3px;
  height: 18px;
  margin: -9px 0 0 -1.5px;
  border-radius: 2px;
  background: var(--green);
}

.range-field__mark-label {
  top: calc(50% + 12px);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--green);
  white-space: nowrap;
  transform: translateX(-50%);
}

.range-field__mark-label[data-align="start"] {
  transform: none;
}

.range-field__mark-label[data-align="end"] {
  transform: translateX(-100%);
}

.range-field__mark[hidden],
.range-field__mark-label[hidden] {
  display: none;
}

.range-field__scale {
  display: flex;
  justify-content: space-between;
  margin-top: -6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* ─── STICKY RESULT ON DESKTOP ─── */
@media (min-width: 900px) {
  .result-panel {
    position: sticky;
    top: 80px;
  }

  .table-wrap th:first-child,
  .table-wrap td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface-2);
    box-shadow: 8px 0 12px -12px rgba(62, 53, 72, 0.25);
  }

  .table-wrap th:first-child {
    z-index: 2;
  }
}

/* ─── TABLET ─── */
@media (max-width: 1100px) {
  .tool-grid {
    grid-template-columns: 380px 1fr;
  }

  .metric-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .availability-card h2,
  .availability-card h3 {
    font-size: 1.85rem;
  }
}

@media (max-width: 860px) {
  .page-header__inner,
  .page-footer__inner {
    width: min(100% - 40px, 860px);
  }

  /* Compact mobile header only — the footer keeps its name, otherwise the
     brand there is a lone icon with no text beside it. */
  .page-header .brand__name {
    display: none;
  }

  .tab-nav__tab {
    padding: 8px 14px;
    font-size: 13px;
  }

  .page-inner {
    width: min(100% - 40px, 860px);
    padding: 24px 0 40px;
    gap: 20px;
  }

  .tool-section,
  .content-width {
    width: min(100% - 40px, 860px);
  }

  h1 {
    font-size: 2rem;
  }

  .tool-grid,
  .split-content {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .form-panel {
    padding: 22px 20px;
  }
}

/* ─── MOBILE ─── */
@media (max-width: 600px) {
  .page-header__inner {
    width: min(100% - 28px, 640px);
    padding: 12px 0;
  }

  .page-footer__inner {
    width: min(100% - 28px, 640px);
  }

  .tab-nav__tab {
    padding: 7px 10px;
    font-size: 12px;
  }

  .page-inner {
    width: min(100% - 28px, 640px);
    padding: 20px 0 32px;
    gap: 16px;
  }

  .tool-section,
  .content-width {
    width: min(100% - 28px, 640px);
  }

  h1 {
    font-size: 1.65rem;
  }

  .form-panel {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .answer-card,
  .availability-card {
    border-radius: 22px;
    padding: 24px 22px;
  }

  .metric-cards--three {
    grid-template-columns: 1fr;
  }

  .availability-card h2,
  .availability-card h3 {
    font-size: 1.7rem;
  }

  .answer-headline {
    gap: 10px;
  }

  .answer-icon {
    width: 34px;
    height: 34px;
  }

  .answer-icon svg {
    width: 20px;
    height: 20px;
  }

  .now-card {
    border-radius: 18px;
    padding: 18px;
  }

  .chart-wrap {
    border-radius: 18px;
    padding: 18px;
  }

  .scenario-tabs {
    flex-wrap: wrap;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .rates-table {
    padding: 2px 8px;
  }

  .rates-table__head,
  .rates-table__row {
    grid-template-columns: minmax(0, 1fr) 50px 74px;
    gap: 6px;
  }

  /* Keeps the column labels on one line inside the 50/66px rate tracks. */
  .rates-table__head {
    font-size: 0.72rem;
  }

  /* The plan rows hold bordered inputs, so they need real width even here */
  .rates-table--plan .rates-table__head,
  .rates-table--plan .rates-table__row {
    grid-template-columns: minmax(0, 1fr) 78px 78px;
  }

  .rates-table--plan .rates-table__period {
    font-size: 0.84rem;
  }

  .rates-table--plan .scenario-editor__rate input {
    padding: 7px 6px;
    font-size: 0.86rem;
  }

  .rates-table--plan .scenario-editor__rate span {
    padding-right: 6px;
    font-size: 0.86rem;
  }

  .rates-table__name {
    gap: 6px;
  }

  .rates-table__name input,
  .rates-table__rate {
    font-size: 0.82rem;
  }

  .input-with-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .field-hint {
    align-self: flex-end;
  }

  .chart-frame {
    height: 220px;
    overflow: hidden;
  }

  .chart-frame svg {
    height: 100%;
  }

  .now-metrics {
    gap: 12px;
  }

  /* Section shells that hold a stacked table read as one padded card. */
  .forecast-table-wrap,
  .scenario-section .table-wrap,
  .purchase-points-card {
    border: 0;
    border-radius: 18px;
    padding: 18px 16px 16px;
  }

  .purchase-points-card__head h2 {
    font-size: 1.15rem;
  }

  /* The comparison table sits inside .purchase-points-card, so its own
     wrapper stays flat rather than nesting a second card. */
  .comparison-table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  /* Wide tables become stacked cards; every cell past the first needs a
     data-label, otherwise its stacked row loses its column name. */
  .stacked-table-wrap table {
    min-width: 0;
  }

  .stacked-table-wrap thead {
    display: none;
  }

  .stacked-table-wrap tbody {
    display: grid;
    gap: 10px;
  }

  .stacked-table-wrap tr {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-2);
    padding: 14px;
  }

  .stacked-table-wrap td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 0;
    text-align: right;
  }

  .stacked-table-wrap td:first-child {
    justify-content: flex-start;
    font-size: 1rem;
    font-weight: 800;
    text-align: left;
  }

  .stacked-table-wrap td:not(:first-child)::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
    text-align: left;
  }

  .comparison-table-wrap .ownership-status__content {
    min-width: 0;
    text-align: right;
  }

  .form-actions {
    display: grid;
  }

  .comparison-highlights {
    grid-template-columns: 1fr;
  }

  .comparison-highlights div:nth-child(odd) {
    border-right: 0;
  }

  .comparison-highlights div {
    border-bottom: 1px solid var(--line);
    padding-inline: 0;
  }

  .comparison-highlights div:last-child {
    border-bottom: 0;
  }

  .result-breakdown__header {
    display: grid;
  }

  .result-breakdown__header strong {
    text-align: left;
  }

  .breakdown-grid {
    grid-template-columns: 1fr;
  }

  .breakdown-grid div,
  .breakdown-grid div:nth-child(odd),
  .breakdown-grid div:last-child {
    grid-column: auto;
    border-right: 0;
  }

  .breakdown-grid div:last-child {
    border-bottom: 0;
  }

  /* page-header on mobile */
  .page-header__inner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .page-header__copy h1 {
    font-size: 1.4rem;
  }

  .page-header__summary {
    grid-column: 1 / -1;
  }

  .page-header .lead {
    display: none;
  }

  .page-header .eyebrow {
    display: none;
  }

  .page-headline-block .lead {
    font-size: 0.9rem;
  }
}

/* ─── LINKS ─── */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* ─── TOAST («Ссылка скопирована») ─── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: #FFF;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

/* [hidden] must win over any display set by component classes */
[hidden] {
  display: none !important;
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
