:root {
  /* Dark "trionn" theme — black canvas, white elements, green data accent */
  --bg: #08080a;
  --surface: #101013;
  --surface-2: #16161b;
  --text: #f4f5f7;
  --muted: #8b8d98;
  --faint: #5b5d68;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.26);
  --white: #ffffff;
  --black: #08080a;

  --green: #31ba96;
  --green-dark: #2aa886;
  --blue: #5b9bff;
  --gold: #ffd27a;
  --red: #ef4d5a;
  --amber: #ff9e2c;

  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 12px;
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Playfair Display", "Times New Roman", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-serif: var(--font-sans);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Убираем «залип»: рамку-обводку фокуса и overscroll-свечение у контейнеров/скроллов.
   Кнопки/ссылки сохраняют свой фокус-стиль — трогаем только обёртки и прокручиваемые зоны. */
.wizard, .step, .panel-grid, .panel-controls, .panel-offer, .results-layout,
.results-aside, .subviews, .subview, .table-wrap, .scenario-list, .subnav,
.toggle-stack, .seg-track { outline: none; }
.panel-controls, .subviews, .table-wrap, body { overscroll-behavior: contain; }

html, body { height: 100%; }
/* Тёмный фон у корня — закрашивает ВЕСЬ вьюпорт (включая зону за тулбарами Safari под body),
   чтобы внизу не было резкого обрыва подложки в чёрное при height:100dvh у body. */
html { scroll-behavior: auto; background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 82% -12%, rgba(49, 186, 150, 0.1), transparent 46%),
    radial-gradient(circle at -12% 112%, rgba(91, 155, 255, 0.07), transparent 44%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.24) rgba(255, 255, 255, 0.05);
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { border-radius: 999px; background: rgba(255, 255, 255, 0.04); }
*::-webkit-scrollbar-thumb {
  border: 2px solid rgba(0, 0, 0, 0);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.36); background-clip: padding-box; }

/* Shared mono micro-label */
.eyebrow, .mag-eyebrow, .chapter b, .brand-word,
.field span, .segmented legend, .live-preview > span, .result-hero-label,
.result-hero-chips i, .metric-card span, .comp-tile span, .stats-grid dt,
.details-table th, .hero-footer, .scenario,
.btn-primary, .btn-secondary, .btn-ghost, .details-legend, .details-table summary {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============== APPBAR ============== */
.appbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 14px 28px 6px;
  background: transparent;
  border-bottom: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--white);
  color: #000;
  font-size: 17px;
  font-weight: 800;
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-word {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.brand-word sup { font-size: 0.55em; opacity: 0.7; }

/* ---- Full-width progress bar ---- */
.progress {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 18px;
}
.progress-rail {
  position: relative;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--line);
}
.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 20%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  box-shadow: 0 0 12px rgba(49, 186, 150, 0.6);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.1, 1);
}
.progress-steps {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.chapter {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.2s ease;
}
.chapter i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.6;
}
.chapter b { font-size: 11px; font-weight: 500; }
.chapter.is-done, .chapter.is-active { color: var(--text); }
.chapter.is-done i, .chapter.is-active i { color: var(--green); opacity: 1; }
.chapter.is-locked { opacity: 0.3; cursor: not-allowed; }
.chapter:not(.is-locked):hover { color: var(--text); }

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}
.pill-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 186, 150, 0.2);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.14), inset 0 0 12px rgba(255, 255, 255, 0.06);
}
.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============== WIZARD / STEPS ============== */
.wizard {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 26px 32px;
  overflow: hidden;
}

.step {
  display: none;
  position: relative;
  height: 100%;
  padding: 4px 6px;
  overflow: hidden;
  animation: stepIn 0.34s cubic-bezier(0.4, 0, 0.1, 1) both;
}
.step.is-active { display: block; }
.step:not(.step-1) { padding-bottom: 80px; }

@keyframes stepIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Контент въезжает слева→направо (по ходу прогресса). transform — только на контенте,
   НЕ на .step, иначе ловится fixed-фон. */
@keyframes contentInX {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.hero-offer, .panel-grid, .results-aside {
  animation: contentInX 0.55s cubic-bezier(0.34, 0.2, 0.1, 1) both;
}

.step-head { margin-bottom: 20px; }

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 500;
}

h1, h2, h3, h4 { margin: 0; color: var(--text); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 700; letter-spacing: -0.015em; }

.step-head h2 {
  margin-top: 10px;
  font-size: clamp(28px, 2.9vw, 44px);
  line-height: 1.04;
}
.step-sub {
  margin: 12px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}

/* ============== 01 — COVER (full-bleed, trionn-style) ============== */
/* opacity-only animation (НЕ transform): transform на .step ловит position:fixed видео-слой */
.cover { padding: 0; animation: coverIn 0.5s ease both; }
@keyframes coverIn { from { opacity: 0; } to { opacity: 1; } }

.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-lines { width: 100%; height: 100%; display: block; animation: linesDrift 36s linear infinite; }
@keyframes linesDrift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-14px, 8px, 0); }
}

/* center 3D figure */
.hero-figure {
  position: fixed;
  inset: 0;
  z-index: 0;
  margin: 0;
  display: grid;
  place-items: center;
  perspective: 1500px;
  background: var(--bg);   /* сплошная тёмная подложка — без «просветов» по краям видео */
}
/* overflow:hidden обрезает крайние пиксели видео (texture-bleed), scale прячет паразитные полоски по бокам */
.cover-videos { position: absolute; inset: 0; z-index: 1; opacity: 0; overflow: hidden; transition: opacity 0.8s ease; }
.cover-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.09);
  transition: opacity 0.8s ease;   /* совпадает с FADE в initCoverVideos() */
  will-change: opacity;
}
.cover-video.is-active { opacity: 1; }
.cover-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  background:
    linear-gradient(90deg, rgba(8, 8, 10, 0.92) 0%, rgba(8, 8, 10, 0.5) 38%, rgba(8, 8, 10, 0) 66%),
    linear-gradient(0deg, rgba(8, 8, 10, 0.7) 0%, rgba(8, 8, 10, 0) 32%);
}
.hero-figure.has-video .cover-videos,
.hero-figure.has-video .cover-scrim { opacity: 1; }
/* Плейсхолдер (линии/бары/частицы/glow) скрыт по умолчанию → бесшовно сразу чёрный→видео.
   Показываем только как фолбэк, если видео не загрузилось (.show-fallback ставит JS). */
.hero-bg, .fig-glow, .fig-stage, .fig-particles { display: none; }
.cover.show-fallback .hero-bg,
.cover.show-fallback .fig-glow,
.cover.show-fallback .fig-stage,
.cover.show-fallback .fig-particles { display: block; }
.fig-glow {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(49, 186, 150, 0.24), rgba(255, 210, 122, 0.1) 42%, transparent 70%);
  filter: blur(46px);
  animation: glowPulse 6.5s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.65; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
.fig-stage {
  position: relative;
  transform-style: preserve-3d;
  animation: figSway 13s ease-in-out infinite;
}
@keyframes figSway {
  0%, 100% { transform: rotateY(-18deg) translateY(0); }
  50% { transform: rotateY(18deg) translateY(-12px); }
}
.fig-rig {
  position: relative;
  width: 330px;
  height: 300px;
  transform-style: preserve-3d;
  transform: rotateX(10deg);
}
.bar3d {
  position: absolute;
  bottom: 0;
  width: 46px;
  border-radius: 9px 9px 4px 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(49, 186, 150, 0.12) 38%, rgba(12, 12, 16, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 34px rgba(49, 186, 150, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.bar3d::after {
  content: "";
  position: absolute;
  top: -3px; left: 0; right: 0;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--green-dark), var(--green), var(--gold));
  box-shadow: 0 0 18px rgba(49, 186, 150, 0.85);
}
.bar3d.b1 { left: 0;    height: 96px;  transform: translateZ(42px); }
.bar3d.b2 { left: 68px;  height: 152px; transform: translateZ(-12px); }
.bar3d.b3 { left: 136px; height: 212px; transform: translateZ(32px); }
.bar3d.b4 { left: 204px; height: 258px; transform: translateZ(-18px); }
.bar3d.b5 { left: 272px; height: 300px; transform: translateZ(22px); }

.fig-particles { position: absolute; inset: 0; pointer-events: none; }
.fig-particles i {
  position: absolute;
  bottom: 12%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 210, 122, 0.9);
  box-shadow: 0 0 10px rgba(255, 210, 122, 0.7);
  animation: figRise linear infinite;
}
@keyframes figRise {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(-320px) scale(1); opacity: 0; }
}
.fig-particles i:nth-child(1) { left: 40%; animation-duration: 7s; animation-delay: 0s; }
.fig-particles i:nth-child(2) { left: 46%; animation-duration: 9s; animation-delay: 1.6s; background: rgba(49,186,150,0.9); box-shadow: 0 0 10px rgba(49,186,150,0.7); }
.fig-particles i:nth-child(3) { left: 52%; animation-duration: 6.5s; animation-delay: 3s; }
.fig-particles i:nth-child(4) { left: 57%; animation-duration: 8.5s; animation-delay: 0.7s; }
.fig-particles i:nth-child(5) { left: 49%; animation-duration: 10s; animation-delay: 2.3s; background: rgba(49,186,150,0.85); box-shadow: 0 0 10px rgba(49,186,150,0.6); }
.fig-particles i:nth-child(6) { left: 44%; animation-duration: 7.5s; animation-delay: 4s; }
.fig-particles i:nth-child(7) { left: 54%; animation-duration: 9.5s; animation-delay: 1.1s; }
.fig-particles i:nth-child(8) { left: 60%; animation-duration: 8s; animation-delay: 2.8s; background: rgba(49,186,150,0.85); box-shadow: 0 0 10px rgba(49,186,150,0.6); }

/* top-left offer */
.hero-offer {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  max-width: 50%;
}
.hero-kicker {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 4.6vw, 82px);
  font-weight: 600;
  line-height: 1.0;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hero-title em { font-style: italic; font-weight: 500; }
.hero-sub {
  margin: 22px 0 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
}

.scenario-list {
  display: flex;
  flex-direction: column;
  margin-top: 34px;
  max-width: 440px;
}
.scenario {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 6px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: padding 0.22s ease, color 0.2s ease, background 0.2s ease;
}
.scenario:last-child { border-bottom: 1px solid var(--line); }
.scenario i { font-style: normal; color: var(--faint); font-size: 11px; min-width: 18px; }
.scenario b { flex: 1; font-weight: 500; }
.scenario u {
  text-decoration: none;
  color: var(--muted);
  font-size: 16px;
  transition: transform 0.22s ease, color 0.2s ease;
}
.scenario:hover { padding-left: 14px; background: rgba(255, 255, 255, 0.02); }
.scenario:hover u { transform: translateX(6px); color: var(--green); }
.scenario:hover i { color: var(--green); }

/* bottom-right info card */
.hero-card {
  position: absolute;
  right: 6px;
  bottom: 8px;
  z-index: 3;
  max-width: 320px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(16, 16, 19, 0.6);
  backdrop-filter: blur(6px);
}
.hero-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}
.hero-card-badge span { color: var(--green); font-size: 13px; }
.hero-card p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.5; }

.hero-footer {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
}
.hero-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.hero-footer a:hover { color: var(--green); border-color: var(--green); }

/* Глобальный кредит студии — на каждой странице, низ по центру */
.site-credit {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 36;
  margin: 0;
  color: var(--faint);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}
.site-credit a {
  pointer-events: auto;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.site-credit a:hover { color: var(--green); border-color: var(--green); }

/* ============== ШАГИ 02–03 — ПАНЕЛЬ (текст слева, стеклянные ползунки справа) ============== */
.step.panel.is-active { display: flex; flex-direction: column; }

.panel-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  /* мягко гасим блобы у левого/правого края — чтобы их свечение не давало «полосы» по бокам
     (и на десктопе, и на мобиле — консистентно) */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 13%, #000 87%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 13%, #000 87%, transparent 100%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.45; will-change: transform; }
.blob-a { width: 46vmin; height: 46vmin; top: -8%; left: 0%; background: radial-gradient(circle, rgba(49, 186, 150, 0.55), transparent 70%); animation: blobFloat 19s ease-in-out infinite; }
.blob-b { width: 40vmin; height: 40vmin; bottom: -12%; right: 6%; background: radial-gradient(circle, rgba(255, 210, 122, 0.4), transparent 70%); animation: blobFloat 24s ease-in-out infinite reverse; }
.blob-c { width: 34vmin; height: 34vmin; top: 36%; left: 30%; background: radial-gradient(circle, rgba(91, 155, 255, 0.34), transparent 70%); animation: blobFloat 17s ease-in-out infinite; }
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, -6%) scale(1.1); }
}

.panel-grid {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 56px;
  align-items: stretch;
}
.panel-offer { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.panel-offer h2 { font-family: var(--font-display); font-size: clamp(38px, 4.4vw, 76px); font-weight: 600; line-height: 1.04; letter-spacing: -0.015em; }
.panel-sub { margin: 20px 0 0; max-width: 30ch; color: var(--muted); font-size: 16px; font-weight: 400; line-height: 1.5; text-wrap: balance; }
.panel-offer .live-preview { display: block; margin-top: 34px; border: 0; background: transparent; padding: 0; }
.panel-offer .live-preview > span { display: block; margin-bottom: 8px; color: var(--green); }
.panel-offer .live-mini { margin: 0; max-width: 28ch; color: var(--text); font-size: 17px; font-weight: 600; line-height: 1.45; text-wrap: balance; }

.panel-controls { display: flex; flex-direction: column; justify-content: center; gap: clamp(16px, 3.2vh, 32px); min-width: 0; }

.control { display: grid; gap: 12px; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.control-top span { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; font-size: 12px; color: var(--muted); }
.control-value {
  width: auto;
  max-width: 60%;
  text-align: right;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  outline: none;
}
.control-value:focus { color: var(--white); }
.control-value:disabled { color: var(--faint); }
.control-value::-webkit-inner-spin-button, .control-value::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.control-value { -moz-appearance: textfield; }

.control .range-control { height: 30px; }
.control .range-control::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--green) 0 var(--range-progress, 0%), rgba(255, 255, 255, 0.14) var(--range-progress, 0%) 100%); }
.control .range-control::-webkit-slider-thumb {
  width: 30px; height: 30px;
  margin-top: -13px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background:
    radial-gradient(120% 130% at 50% 18%, rgba(255, 255, 255, 0.96) 0%, rgba(234, 246, 242, 0.82) 44%, rgba(186, 220, 210, 0.78) 100%);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(49, 186, 150, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -5px 10px rgba(30, 55, 50, 0.4);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: grab;
  appearance: none;
}
.control .range-control:active::-webkit-slider-thumb { cursor: grabbing; }
.control .range-control::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.control .range-control::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--green); }
.control .range-control::-moz-range-thumb {
  width: 30px; height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: radial-gradient(120% 130% at 50% 18%, rgba(255, 255, 255, 0.96), rgba(234, 246, 242, 0.82) 44%, rgba(186, 220, 210, 0.78) 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), 0 0 24px rgba(49, 186, 150, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

.control-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin-top: 4px; padding-top: 22px; border-top: 1px solid var(--line); }
.toggle-stack { display: flex; flex-direction: column; gap: 12px; }

/* ============== 04 — ИТОГ (результат + разбор, объединено, скролл) ============== */
.results-scroll { position: relative; z-index: 1; height: 100%; overflow-y: auto; overflow-x: hidden; padding-right: 6px; }
.results-scroll > * + * { margin-top: 14px; }
.results .result-layout { min-height: 0; }
.details-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}
.details-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- Итог: боковая пагинация + один активный фрейм ---- */
.results-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: 48px;
  height: 100%;
  align-items: stretch;
}
.results-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  min-width: 0;
  padding-right: 30px;
  border-right: 1px solid var(--line);
}
.results-aside .step-head { margin-bottom: 0; }
.results-aside .panel-sub { margin-top: 14px; max-width: 34ch; }

.subnav { display: flex; flex-direction: column; }
.subnav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 6px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: padding 0.22s ease, color 0.2s ease, background 0.2s ease;
}
.subnav-item:last-child { border-bottom: 1px solid var(--line); }
.subnav-item i { font-style: normal; color: var(--faint); font-size: 11px; min-width: 18px; }
.subnav-item b { flex: 1; font-weight: 500; }
.subnav-item u { text-decoration: none; color: var(--green); font-size: 16px; opacity: 0; transform: translateX(-6px); transition: opacity 0.2s ease, transform 0.2s ease; }
.subnav-item:hover { padding-left: 14px; color: var(--text); background: rgba(255, 255, 255, 0.02); }
.subnav-item.is-active { color: var(--white); }
.subnav-item.is-active i { color: var(--green); }
.subnav-item.is-active u, .subnav-item:hover u { opacity: 1; transform: translateX(0); }

.subviews { position: relative; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.subview { display: none; }
.subview.is-active { display: flex; flex-direction: column; gap: 14px; animation: subIn 0.42s cubic-bezier(0.34, 0.2, 0.1, 1) both; }
@keyframes subIn {
  from { opacity: 0; transform: translateX(26px); }
  to   { opacity: 1; transform: translateX(0); }
}
.dyn-layout { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* детализация: таблица скроллится внутри фрейма */
.subview[data-sub="2"] .year-table .table-wrap { max-height: 300px; overflow: auto; }

/* итог: без «рамок» у блоков — чистая презентационная подача на тёмном фоне */
.subview .result-hero { border: 0; box-shadow: none; }
.subview .result-hero-spark { background: transparent; }
.subview .metric-card {
  display: flex; flex-direction: column; justify-content: center;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 2px 0;
}
.subview .metric-card:hover { transform: none; }
.subview .investor-summary { background: transparent; border: 0; padding: 6px 2px 0; }
.subview .chart-wrap { background: transparent; border: 0; padding: 0; }
.subview .details-table { background: transparent; border: 0; border-radius: 0; }
.subview .details-table-head { padding-left: 0; padding-right: 0; }
.subview .year-table .table-wrap { padding-left: 0; padding-right: 0; }

/* ============== CALC LOADER (псевдо-расчёт) ============== */
.calc-loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 38%, rgba(49, 186, 150, 0.12), transparent 55%), rgba(8, 8, 10, 0.97);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.calc-loader.is-on { opacity: 1; }
.calc-loader[hidden] { display: none; }
.cl-inner { width: min(540px, 88vw); text-align: center; }
.cl-label { margin: 0; color: var(--green); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; }
.cl-value {
  margin: 16px 0 24px;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(64px, 10vw, 124px);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.cl-value i { font-style: normal; color: var(--muted); font-size: 0.36em; font-weight: 700; margin-left: 6px; letter-spacing: 0; }
.cl-bar { height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.cl-bar span { display: block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--green-dark), var(--green)); box-shadow: 0 0 12px rgba(49, 186, 150, 0.65); transition: width 0.12s linear; }
.cl-status { margin: 18px 0 0; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }

/* ============== BOOT LOADER (первая загрузка) ============== */
.boot-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;     /* фолбэк */
  height: 100dvh;    /* видимая высота на iOS — иначе грид центрирует по layout-вьюпорту и контент уезжает вниз */
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  transition: opacity 0.5s ease;
}
.boot-loader.is-off { opacity: 0; pointer-events: none; }
.boot-loader[hidden] { display: none; }
.bl-inner { width: min(340px, 80vw); text-align: center; }
.bl-bars { display: flex; gap: 9px; justify-content: center; align-items: flex-end; height: 58px; margin-bottom: 22px; }
.bl-bars i {
  width: 11px; height: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--green), var(--green-dark));
  box-shadow: 0 0 16px rgba(49, 186, 150, 0.5);
}
/* Шрифт как у лого в шапке (.brand-word): моно, uppercase, letter-spacing 0.05em, 700 */
.bl-label { margin: 0 0 16px; font-family: var(--font-mono); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--white); font-size: 16px; }
.bl-label sup { font-size: 0.55em; opacity: 0.7; }
.bl-status { margin: 0; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 11px; }

/* ============== SPREAD (chapters 2 & 3) ============== */
.spread-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 44px;
  height: 100%;
  align-items: center;
}
.spread-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  min-width: 0;
  padding-right: 26px;
  border-right: 1px solid var(--line);
}
.spread-aside .step-head { margin-bottom: 0; }
.spread-aside .step-head h2 { font-size: clamp(26px, 2.4vw, 40px); }
.spread-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}

/* ============== FORM FIELDS ============== */
.step-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}
.field {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: transform 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}
.field:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: #14141a;
}
.field span { color: var(--muted); font-size: 11px; font-weight: 500; }
.field input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  outline: none;
}
.field input[type="number"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 186, 150, 0.22);
  background: #1a1a20;
}
.field input[type="number"]:disabled { color: var(--faint); background: #0e0e12; }

.range-control {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
  background: transparent;
  cursor: pointer;
  appearance: none;
}
.range-control::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green) 0 var(--range-progress, 0%), rgba(255, 255, 255, 0.16) var(--range-progress, 0%) 100%);
}
.range-control::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 14px rgba(0, 0, 0, 0.5);
  appearance: none;
}
.range-control::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); }
.range-control::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--green); }
.range-control::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.range-control:disabled { cursor: not-allowed; opacity: 0.5; }

[data-mode-field] { display: none; }
.mode-capital [data-mode-field="capital"],
.mode-contribution [data-mode-field="contribution"],
.mode-income [data-mode-field="income"] { display: grid; }

/* ============== TOGGLES & SEGMENTED ============== */
.toggles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.toggle input {
  position: absolute;
  z-index: 2;
  width: 44px;
  height: 26px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle > span {
  position: relative;
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease;
}
.toggle > span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 0.2s ease;
}
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(18px); }

/* Capitalization — borderless segmented control with an animated sliding thumb */
.segmented {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
}
.seg-cap {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
  white-space: nowrap;
}
.seg-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.seg-track label { position: relative; z-index: 1; display: block; cursor: pointer; }
.seg-track input { position: absolute; opacity: 0; pointer-events: none; }
.seg-track label > span {
  display: grid;
  place-items: center;
  height: 30px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.25s ease;
}
.seg-track label:hover > span { color: var(--text); }
.seg-track input:checked + span { color: #000; }
.seg-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  height: calc(100% - 8px);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.34s cubic-bezier(0.4, 0, 0.1, 1);
  z-index: 0;
}
.seg-track[data-active="quarterly"] .seg-thumb { transform: translateX(100%); }
.seg-track[data-active="yearly"] .seg-thumb { transform: translateX(200%); }
@media (prefers-reduced-motion: reduce) {
  .seg-thumb { transition: none; }
}

/* ============== LIVE PREVIEW ============== */
.live-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px dashed rgba(49, 186, 150, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(49, 186, 150, 0.08);
}
.live-preview > span { color: var(--green); font-size: 10px; font-weight: 500; }
.live-preview .live-mini { margin: 0; color: var(--text); font-size: 18px; font-weight: 600; line-height: 1.2; }

/* ============== STEP NAV & BUTTONS ============== */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.step-nav-right { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.step:not(.step-1) .step-nav { position: absolute; left: 6px; right: 6px; bottom: 8px; z-index: 3; }

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--white); color: #000; }
.btn-primary:hover { background: #e7e7ea; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--white); background: rgba(255, 255, 255, 0.05); }
.btn-secondary svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

/* ============== 04 — RESULT ============== */
.result-step { overflow: hidden; }
.step[data-step="4"] .step-head, .step[data-step="5"] .step-head { margin-bottom: 8px; }
.step[data-step="4"] .step-head h2 { font-family: var(--font-display); font-size: clamp(32px, 3.2vw, 56px); line-height: 1.02; font-weight: 600; letter-spacing: -0.015em; }
.step[data-step="4"] .step-sub, .step[data-step="5"] .step-sub { font-size: 13px; line-height: 1.35; }

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.94fr);
  gap: 14px;
  align-items: start;
  min-height: clamp(250px, 42vh, 390px);
}
.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  grid-template-areas: "main spark" "chips spark";
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 18% 0%, rgba(49, 186, 150, 0.18), transparent 52%),
    linear-gradient(135deg, #131318 0%, #0a0a0c 100%);
  color: var(--white);
  box-shadow: var(--shadow);
}
.result-hero-main { grid-area: main; display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; }
.result-hero-label { display: block; color: rgba(255, 255, 255, 0.6); font-size: 11px; font-weight: 500; }
.result-hero-value {
  display: block;
  margin: 8px 0 4px;
  font-family: var(--font-sans);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.result-hero-sub { margin: 0; color: rgba(255, 255, 255, 0.7); font-size: 13px; font-weight: 500; }
.result-hero-chips { grid-area: chips; display: flex; gap: 8px; flex-wrap: wrap; align-content: end; margin-top: 0; }
.result-hero-chips span {
  display: grid; gap: 4px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
}
.result-hero-chips b { font-size: 14px; font-weight: 700; font-family: var(--font-sans); }
.result-hero-chips i { font-style: normal; color: rgba(255, 255, 255, 0.55); font-size: 9px; font-weight: 500; }
.result-hero-spark { grid-area: spark; display: flex; align-items: flex-end; padding: 12px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); }
.result-hero-spark svg { display: block; width: 100%; height: auto; }

.metrics-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  grid-auto-rows: minmax(80px, 1fr);
}
.metric-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: transform 0.24s ease, border-color 0.24s ease;
}
.metric-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.metric-card span { display: block; color: var(--muted); font-size: 10px; font-weight: 500; }
.metric-card strong { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 18px; font-weight: 700; line-height: 1.15; color: var(--text); }

.investor-summary {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}
.result-step .step-nav { margin-top: 14px; }

/* ============== 05 — DETAILS ============== */
.mag-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.mag-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 2px; }

.details-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.78fr) minmax(0, 0.92fr);
  gap: 14px;
  align-items: start;
}
.details-layout .mag-section { margin-top: 0; padding-top: 0; border-top: 0; }
.details-side { display: grid; gap: 12px; }
.details-real { grid-column: 1 / -1; margin-top: 2px; }

.mag-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.mag-eyebrow { margin: 0 0 6px; color: var(--green); font-size: 11px; font-weight: 500; }
.mag-section-head h3 { font-size: 20px; font-weight: 700; line-height: 1.15; color: var(--text); }

.details-legend { display: flex; gap: 16px; color: var(--muted); font-size: 10px; font-weight: 500; }
.details-legend span { display: inline-flex; align-items: center; gap: 8px; }
.details-legend i { width: 22px; height: 4px; border-radius: 999px; display: inline-block; }
.legend-nominal { background: var(--green); }
.legend-real { background: var(--blue); }

.chart-wrap {
  overflow-x: auto;
  padding: 8px 12px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
#yearChart { display: block; width: 100%; min-width: 740px; height: auto; max-height: 280px; }
.axis-text { fill: rgba(255, 255, 255, 0.5); font-size: 12px; font-weight: 600; font-family: var(--font-mono); }

.composition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.details-side .composition-grid { grid-template-columns: 1fr; gap: 8px; }
.comp-tile { display: grid; gap: 8px; min-width: 0; }
.comp-tile span { color: var(--muted); font-size: 10px; font-weight: 500; }
.comp-tile strong { font-size: 30px; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -0.02em; }
.bar { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.bar span { display: block; width: 0%; height: 100%; border-radius: inherit; background: var(--green); transition: width 0.3s ease; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.stats-grid > div { display: grid; gap: 8px; min-width: 0; }
.stats-grid dt { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.3; }
.stats-grid dd { margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.15; color: var(--text); }

.details-table {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.details-table summary { padding: 12px 16px; cursor: pointer; font-size: 11px; font-weight: 500; list-style: none; color: var(--text); }
.details-table summary::-webkit-details-marker { display: none; }
.details-table summary::after { content: "▾"; margin-left: 8px; color: var(--muted); transition: transform 0.2s ease; display: inline-block; }
.details-table[open] summary::after { transform: rotate(180deg); }
.details-table .table-wrap { padding: 0 16px 10px; max-height: 170px; overflow: auto; }
.details-table table { width: 100%; min-width: 720px; border-collapse: collapse; }
.details-table th, .details-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.details-table th:first-child, .details-table td:first-child,
.details-table th:nth-child(2), .details-table td:nth-child(2) { text-align: left; }
.details-table th { color: var(--muted); font-size: 9px; font-weight: 500; }
.details-table td { font-size: 13px; font-weight: 600; color: var(--text); }
.details-table-head { margin: 0; padding: 13px 16px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; color: var(--muted); }
.year-table .table-wrap { padding: 4px 16px 12px; max-height: none; overflow-x: auto; }

@media (min-width: 981px) {
  .step[data-step="4"], .step[data-step="5"] { overflow: hidden; }
}

/* ============== GUIDE MODAL ============== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease both;
}
.modal[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;            /* шапка закреплена, скроллится только сетка плиток */
  padding: 26px 26px 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 18, 24, 0.72);              /* liquid glass */
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  backdrop-filter: blur(30px) saturate(1.4);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: modalIn 0.22s ease both;
}
.modal-card-wide { width: min(820px, 100%); }
@keyframes modalIn { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Шапка (eyebrow + заголовок + описание + крестик) всегда видна */
.modal-close { position: absolute; top: 16px; right: 16px; z-index: 2; }
.modal-card .eyebrow, .modal-card h3, .modal-sub { flex: 0 0 auto; }
.modal-card .eyebrow, .modal h3 { padding-right: 44px; }
.modal h3 { margin-top: 8px; font-size: 24px; font-weight: 700; }
.modal-sub { margin: 12px 0 20px; color: var(--muted); font-size: 14px; font-weight: 400; line-height: 1.55; }
.modal-sub b { color: var(--text); }

/* Только сетка плиток-обоснований прокручивается; блоки — без рамок, разделены полосками (как в «итогах») */
.guide-grid {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px;
  padding-right: 4px;
}
.guide-grid article { padding: 15px 2px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.guide-grid h4 { font-size: 14px; font-weight: 700; color: var(--text); }
.guide-grid p { margin: 6px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.5; }

/* ============== TOAST ============== */
/* Toasts dock under the header «?» (top-right) so they never cover the footer credit */
.toast-area { position: fixed; top: 70px; right: 22px; left: auto; z-index: 80; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast {
  max-width: 320px;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(20, 20, 26, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  animation: toastIn 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  pointer-events: auto;
}
.toast.is-success { border-color: rgba(49, 186, 150, 0.5); }
.toast.is-warn { border-color: rgba(255, 158, 44, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============== PDF DOC (off-screen, A4 — stays LIGHT for print) ============== */
.pdf-doc { position: absolute; left: -10000px; top: 0; }
.pdf-page {
  width: 794px;
  height: 1123px;
  padding: 56px 64px;
  background: #fff;
  color: #13162a;
  /* СИСТЕМНЫЕ шрифты для PDF: html2canvas ненадёжно рендерит веб-шрифты (Google Fonts)
     на мобиле/деплое — растягивает пробелы. Системные шрифты рисуются стабильно везде. */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pdf-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid #dde3ef; }
.pdf-head .pdf-brand { display: flex; align-items: center; gap: 12px; }
.pdf-mark { width: 36px; height: 36px; display: grid; place-items: center; background: #0c0d14; color: #fff; border-radius: 9px; font-size: 17px; font-weight: 800; }
.pdf-mark svg { width: 22px; height: 22px; }
/* PDF держит ту же иерархию, но НА СИСТЕМНЫХ шрифтах: серив-заголовок · санс-текст · моно-лейблы */
.pdf-body h1, .pdf-body h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.pdf-eyebrow, .pdf-head .pdf-meta p, .pdf-head .pdf-meta span, .pdf-foot,
.pdf-brand span, .pdf-hero-block span, .pdf-chip span, .pdf-comp-tile span,
.pdf-chart-legend { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; }
.pdf-brand p { margin: 0; font-size: 14px; font-weight: 800; }
.pdf-brand span { font-size: 11px; color: #697088; }
.pdf-head .pdf-meta { text-align: right; }
.pdf-head .pdf-meta p { margin: 0; font-size: 11px; font-weight: 700; color: #697088; }
.pdf-head .pdf-meta span { color: #159375; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }

.pdf-body { flex: 1; min-height: 0; padding-top: 32px; }
.pdf-foot { padding-top: 18px; border-top: 1px solid #dde3ef; display: flex; justify-content: space-between; color: #697088; font-size: 10px; }

.pdf-eyebrow { margin: 0; color: #159375; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.pdf-body h1 { margin: 8px 0 0; font-size: 32px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.1; color: #13162a; }
.pdf-body h2 { margin: 0 0 14px; font-size: 18px; font-weight: 800; color: #13162a; }
.pdf-lede { margin: 16px 0 32px; max-width: 580px; color: #697088; font-size: 14px; font-weight: 600; line-height: 1.6; }

.pdf-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
.pdf-hero-block { padding: 26px; border-radius: 14px; background: linear-gradient(135deg, #1a1d2c, #0f1018); color: #fff; }
.pdf-hero-block.alt { background: #f4f6fa; color: #13162a; border: 1px solid #dde3ef; }
.pdf-hero-block span { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.pdf-hero-block strong { display: block; margin: 12px 0 6px; font-size: 32px; font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.pdf-hero-block p { margin: 0; font-size: 12px; opacity: 0.65; }

.pdf-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.pdf-chip { padding: 16px; border: 1px solid #dde3ef; border-radius: 10px; background: #fbfcfe; }
.pdf-chip span { display: block; color: #697088; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.pdf-chip strong { display: block; margin-top: 6px; font-size: 17px; font-weight: 800; color: #13162a; }

.pdf-params-table { width: 100%; border-collapse: collapse; }
.pdf-params-table td { padding: 10px 0; border-bottom: 1px solid #dde3ef; font-size: 13px; }
.pdf-params-table td:first-child { color: #697088; font-weight: 700; }
.pdf-params-table td:last-child { font-weight: 800; text-align: right; }

.pdf-summary-block { margin-top: 28px; padding: 20px 22px; border-left: 4px solid #31ba96; background: #f4f9f7; border-radius: 0 10px 10px 0; }
.pdf-summary-block h2 { margin-bottom: 8px; }
.pdf-summary-block p { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.65; }

.pdf-chart-host { padding: 18px; border: 1px solid #dde3ef; border-radius: 12px; background: #fafbfd; }
.pdf-chart-host svg { display: block; width: 100%; height: auto; }
.pdf-chart-host .axis-text { fill: #6f768d; font-family: inherit; }
.pdf-chart-legend { display: flex; gap: 18px; margin-bottom: 14px; color: #697088; font-size: 11px; font-weight: 800; }
.pdf-chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.pdf-chart-legend i { width: 20px; height: 4px; border-radius: 999px; display: inline-block; }

.pdf-comp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 26px; }
.pdf-comp-tile { display: grid; gap: 8px; }
.pdf-comp-tile span { color: #697088; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.pdf-comp-tile strong { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; color: #13162a; }
.pdf-comp-tile .bar { height: 6px; background: #e7ebf2; border-radius: 999px; overflow: hidden; }
.pdf-comp-tile .bar span { display: block; height: 100%; background: #31ba96; border-radius: inherit; }

.pdf-table { width: 100%; border-collapse: collapse; }
.pdf-table th, .pdf-table td { padding: 8px 6px; border-bottom: 1px solid #dde3ef; font-size: 11px; text-align: right; color: #13162a; }
.pdf-table th { color: #697088; font-weight: 800; text-transform: uppercase; font-size: 9px; letter-spacing: 0.04em; }
.pdf-table th:first-child, .pdf-table td:first-child,
.pdf-table th:nth-child(2), .pdf-table td:nth-child(2) { text-align: left; }
.pdf-table tbody tr:nth-child(even) { background: #fafbfd; }

/* ============== REDUCED MOTION ============== */
@media (prefers-reduced-motion: reduce) {
  .hero-lines, .fig-glow, .fig-stage, .fig-particles i, .step { animation: none !important; }
}

/* ============== RESPONSIVE ============== */
@media (max-width: 1180px) {
  .wizard { padding: 22px 22px; }
  #yearChart { max-height: 250px; min-width: 640px; }
}

@media (max-width: 1080px) {
  .hero-offer { max-width: 60%; }
  .hero-card { max-width: 260px; }
  .fig-rig { transform: rotateX(10deg) scale(0.82); }
}

/* Мобильный «один активный фрейм»: страница не скроллится, скролл только внутри
   тела активного шага; шапка и навигация компактные и закреплены. */
@media (max-width: 980px) {
  /* Декоративный фон (блобы) на мобилке ВКЛючён, как на десктопе; от «полос» по бокам
     защищает горизонтальная маска у .panel-bg (см. базовое правило). */
  body { overflow: hidden; }
  /* dvh = видимая высота с учётом тулбаров Safari (иначе низ — кнопки/капитализация — уходит под тулбар) */
  html, body { height: 100dvh; }
  /* без горизонтального паддинга — контент шагов сам задаёт боковые отступы, чтобы не было «охранных полос» */
  .wizard { padding: 14px 0 40px; overflow: hidden; }

  /* Шапка в одну строку: лого+текст слева · прогресс-бар по центру · «?» справа */
  .appbar { min-height: 54px; padding: 10px 16px; gap: 12px; flex-wrap: nowrap; }
  .brand { flex: 0 0 auto; }
  .brand-word { display: inline; font-size: 12px; }
  .progress { margin: 0; justify-content: center; }
  .progress-steps { display: none; }   /* на мобильном — только сам бар (рейка), без 01–04 */

  /* Активный шаг = колонка во весь экран */
  .step { height: 100%; padding: 0; }
  .step:not(.step-1) { padding-bottom: 0; }
  .step.is-active,
  .step.panel.is-active { display: flex; flex-direction: column; }

  /* Навигация шага закреплена снизу фрейма (не absolute) */
  .step:not(.step-1) .step-nav {
    position: static; left: auto; right: auto; bottom: auto;
    margin: 0; padding: 12px 16px 0; flex-shrink: 0; flex-wrap: nowrap;
  }
  /* Кредит-подвал виден на мобильном; кнопки шага приподняты над ним (padding-bottom у .wizard) */
  .site-credit { bottom: 12px; font-size: 9px; z-index: 38; }

  /* ----- 01 Обложка: во всю ширину (без боковых «охранных» полос), текст сверху, сценарии снизу ----- */
  .cover { height: 100%; }   /* full-bleed естественно: у .wizard нет бокового паддинга */
  .hero-bg { display: none; }
  .hero-figure { position: fixed; inset: 0; height: auto; margin: 0; }
  .cover-scrim {
    background: linear-gradient(180deg,
      rgba(8, 8, 10, 0.95) 0%, rgba(8, 8, 10, 0.74) 24%, rgba(8, 8, 10, 0.15) 44%,
      rgba(8, 8, 10, 0.15) 54%, rgba(8, 8, 10, 0.7) 72%, rgba(8, 8, 10, 0.97) 100%);
  }
  .hero-offer {
    position: relative; top: auto; left: auto;
    flex: 1; display: flex; flex-direction: column;
    margin: 0; max-width: none; width: 100%; padding: 2px 0 0;
  }
  .hero-title { font-size: clamp(38px, 11.5vw, 62px); padding: 0 16px; }
  .hero-sub { margin-top: 14px; max-width: none; font-size: 14px; line-height: 1.5; padding: 0 16px; }
  .scenario-list { margin-top: auto; max-width: none; }   /* сценарии прижаты к низу — к подвалу */
  .scenario { padding: 15px 16px; font-size: 14px; }      /* линии-разделители во всю ширину, контент с отступом */
  /* ховер как на десктопе: весь блок (номер+текст) уезжает вбок (padding-left 16→24) + стрелка + подсветка */
  .scenario:hover { padding-left: 24px; background: rgba(255, 255, 255, 0.03); }
  .scenario:hover u { transform: translateX(6px); }

  /* ----- 02/03 Панели: заголовок+прогноз закреплены, контролы — компактно, без скролла ----- */
  .panel-grid {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    grid-template-columns: none; gap: 8px;
  }
  .panel-offer { flex: 0 0 auto; padding-left: 16px; padding-right: 16px; }
  .panel-offer h2 { font-size: clamp(22px, 5.8vw, 32px); line-height: 1.05; }
  .panel-sub { max-width: none; font-size: 13px; margin-top: 5px; line-height: 1.4; }
  .panel-offer .live-preview { margin-top: 16px; }
  .live-preview .live-mini { font-size: 16px; }
  .panel-controls {
    flex: 1; min-height: 0; overflow-y: auto; justify-content: flex-start;
    gap: 6px; margin-top: 2px; padding: 2px 16px 4px;
  }
  .panel-controls .control { gap: 5px; }
  .control-value { font-size: 19px; max-width: 48%; }
  /* компактнее ползунки на мобиле (бегунок 30→24) — экономим высоту, чтобы влезали все настройки */
  .control .range-control { height: 24px; }
  .control .range-control::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -10px; }
  .control .range-control::-moz-range-thumb { width: 24px; height: 24px; }

  /* Доп. контролы (тумблеры + капитализация) в колонку, капитализация во всю ширину */
  .control-extra { flex-direction: column; align-items: stretch; gap: 9px; padding-top: 9px; }
  .toggle-stack { gap: 8px; }
  .segmented { margin-left: 0; align-items: stretch; width: 100%; }
  .seg-track { width: 100%; }

  /* ----- 04 Итог: заголовок+табы закреплены, активный фрейм скроллится ----- */
  .results-layout {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    grid-template-columns: none; gap: 14px; height: auto;
  }
  .results-aside {
    flex: 0 0 auto;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 0 16px 10px; gap: 10px; justify-content: flex-start;
  }
  .results-aside .step-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0; }
  .results-aside .panel-sub { display: none; }   /* подзаголовок прячем — табы задают структуру, экономим высоту */
  .step[data-step="4"] .step-head h2 { font-size: clamp(24px, 7vw, 34px); }

  /* subnav → 3 равные пилюли-таба без бокового скролла (номера 01–03 скрыты) */
  .subnav { flex-direction: row; gap: 6px; overflow: visible; }
  .subnav-item {
    flex: 1 1 0; min-width: 0; justify-content: center; gap: 0;
    border: 1px solid var(--line); border-radius: 999px; padding: 8px 4px; font-size: 11px;
  }
  .subnav-item i { display: none; }
  .subnav-item b { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .subnav-item:last-child { border-bottom: 1px solid var(--line); }
  .subnav-item:hover { padding-left: 4px; background: transparent; }
  .subnav-item.is-active { background: var(--white); color: #000; border-color: var(--white); }
  .subnav-item u { display: none; }

  /* Разделы 0/1 умещаются без скролла; на Детализации (data-active="2") скроллится только таблица */
  .subviews { flex: 1; min-height: 0; overflow: hidden auto; justify-content: flex-start; scrollbar-width: none; padding-left: 16px; padding-right: 16px; }
  .subviews::-webkit-scrollbar { display: none; }
  .subviews[data-active="2"] { overflow: hidden; }

  /* 01 Общий итог — текст слева, график справа, чипы снизу; компактно, в один экран */
  .result-hero {
    grid-template-columns: minmax(0, 1fr) 37%;
    grid-template-areas: "main spark" "chips chips";
    gap: 8px 10px; padding: 12px;
  }
  .result-hero-label { font-size: 10px; }
  .result-hero-value { font-size: 26px; margin: 3px 0 2px; }
  .result-hero-sub { font-size: 12px; }
  .result-hero-spark { padding: 4px; align-items: center; }
  .result-hero-spark svg { max-height: 88px; }
  .result-hero-chips { gap: 6px; margin-top: 2px; flex-wrap: nowrap; }
  .result-hero-chips span { padding: 5px 8px; min-width: 0; }
  .result-hero-chips b { font-size: 12px; }
  .result-hero-chips i { font-size: 8px; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 10px; grid-auto-rows: auto; }
  .subview .metric-card { padding: 8px 2px 0; }
  .metric-card span { font-size: 9px; }
  .metric-card strong { font-size: 15px; }
  .investor-summary { font-size: 11.5px; padding: 6px 2px 0; line-height: 1.38; }

  /* 02 Динамика — график вписан по ширине, состав в 3 компактных столбца; без скролла */
  .dyn-layout { gap: 12px; }
  .chart-wrap { overflow: hidden; padding: 6px 8px; }
  #yearChart { min-width: 0; width: 100%; max-height: 184px; }
  .axis-text { font-size: 15px; }   /* SVG ужимается по ширине — подписи укрупнены, но влезают в левое поле */
  .mag-section-head { margin-bottom: 6px; }
  .mag-section-head h3 { font-size: 16px; }
  .mag-eyebrow { margin-bottom: 4px; }
  .composition-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .comp-tile strong { font-size: 22px; }

  /* 03 Детализация — статы компактно; таблица урезана по колонкам → только вертикальный скролл */
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
  .stats-grid dd { font-size: 15px; }
  .subview[data-sub="2"].is-active { height: 100%; display: flex; flex-direction: column; gap: 10px; }
  .subview[data-sub="2"] .mag-section { flex: 0 0 auto; }
  .subview[data-sub="2"] .details-table.year-table {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-top: 0;
  }
  .subview[data-sub="2"] .details-table-head { flex: 0 0 auto; }
  .subview[data-sub="2"] .year-table .table-wrap {
    flex: 1 1 auto; min-height: 0; max-height: none; overflow-x: hidden; overflow-y: auto;
  }
  /* оставляем Год · Этап · Капитал · В сегодняшних ₽ — таблица влезает по ширине */
  .subview[data-sub="2"] .details-table table { min-width: 0; width: 100%; }
  .subview[data-sub="2"] .details-table th { white-space: normal; line-height: 1.15; }
  .subview[data-sub="2"] .details-table th,
  .subview[data-sub="2"] .details-table td { padding: 9px 4px; font-size: 12px; }
  .subview[data-sub="2"] .details-table th:nth-child(3),
  .subview[data-sub="2"] .details-table td:nth-child(3),
  .subview[data-sub="2"] .details-table th:nth-child(6),
  .subview[data-sub="2"] .details-table td:nth-child(6),
  .subview[data-sub="2"] .details-table th:nth-child(7),
  .subview[data-sub="2"] .details-table td:nth-child(7),
  .subview[data-sub="2"] .details-table th:nth-child(8),
  .subview[data-sub="2"] .details-table td:nth-child(8) { display: none; }

  /* Тосты — широкие, под шапкой */
  .toast-area { top: 60px; right: 12px; left: 12px; justify-items: stretch; }
  .toast { max-width: none; }

  /* Гид */
  .guide-grid { grid-template-columns: 1fr; }
  .modal-card { padding: 22px; }
}

@media (max-width: 480px) {
  .wizard { padding: 12px 0 38px; }
  .hero-title { font-size: clamp(34px, 12.5vw, 52px); }
  .hero-sub { font-size: 13.5px; }
  .panel-offer h2 { font-size: clamp(28px, 9vw, 40px); }
  .control-value { font-size: 20px; }
  .result-hero-value { font-size: 26px; }
  .stats-grid dd { font-size: 14px; }
  .comp-tile strong { font-size: 20px; }
  .btn-primary, .btn-secondary, .btn-ghost { padding: 0 15px; min-height: 44px; font-size: 11px; }
  .step-nav, .step-nav-right { gap: 8px; }
}
