/* ============================================================
   main.css — page styles using globals.css design tokens
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Spacing system (single source of truth) ──────────────── */
:root {
  --space-page-x: 32px;
  --space-page-x-sm: 16px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 20px;
  --space-5: 28px;
  --space-6: 40px;
  --space-section-y: 44px;
  --space-section-header-gap: 28px;
  --space-grid-gap: 14px;
  --space-card-pad: 18px;

  /* Typography system (single source of truth) */
  --type-card-title-size: 15px;
  --type-card-title-weight: 700;
  --type-card-body-size: 13px;
  --type-card-body-line: 1.5;
  --type-card-muted-size: 12px;
  --type-card-muted-line: 1.35;
}

body {
  font-family: var(--bp-font-body, var(--font-sans, 'Inter', system-ui, sans-serif));
  background: var(--bp-bg, #f8f9fb);
  color: var(--bp-text, #1a2533);
  line-height: 1.6;
  font-size: 15px;
  padding-top: 52px;
}

/* ── Layout ─────────────────────────────────────────────── */
.page-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-page-x);
}
@media (max-width: 900px) { .page-wrap { padding: 0 var(--space-page-x-sm); } }

/* ── Nav ─────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bp-surface, #ffffff) 92%, transparent);
  border-bottom: 1px solid var(--bp-border, #e2e8f0);
  padding: 0 var(--space-page-x);
}
@media (max-width: 900px) { .site-nav { padding: 0 var(--space-page-x-sm); } }
.site-nav.is-scrolled {
  border-bottom-color: color-mix(in srgb, var(--bp-border, #e2e8f0) 70%, transparent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}
.site-nav__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav__inner::-webkit-scrollbar { display: none; }
.site-nav__spacer {
  flex: 1 1 auto;
  min-width: 12px;
}
.site-nav__logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--bp-primary, #2d5f8a);
  white-space: nowrap;
  margin-right: 16px;
}
.site-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--bp-text-muted, #64748b);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  position: relative;
  transition:
    background 0.22s ease,
    color 0.22s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease;
}
/* Accent line — grows from center */
.site-nav a::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--bp-primary, #6885a1) 88%, transparent);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
  pointer-events: none;
}
.site-nav a:hover {
  color: var(--bp-primary, #6885a1);
  background: color-mix(in srgb, var(--bp-primary-soft, #e8eef4) 55%, var(--bp-surface, #fff));
  transform: translateY(-1px);
  box-shadow:
    0 4px 16px color-mix(in srgb, var(--bp-primary, #6885a1) 14%, transparent),
    0 1px 0 color-mix(in srgb, var(--bp-border, #d6d1c6) 40%, transparent);
}
.site-nav a:hover::after {
  transform: scaleX(1);
  opacity: 1;
}
.site-nav a:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--bp-primary, #6885a1) 10%, transparent);
  transition-duration: 0.08s;
}
.site-nav a:focus-visible {
  outline: none;
  box-shadow: var(--bp-focus-ring, 0 0 0 3px rgba(104, 133, 161, 0.35));
  background: color-mix(in srgb, var(--bp-primary, #6885a1) 10%, transparent);
  color: var(--bp-primary, #6885a1);
}
.site-nav a:focus-visible::after {
  transform: scaleX(1);
  opacity: 1;
}

/* ── Language switch (RU | EN) ───────────────────────────── */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--bp-border, #e2e8f0) 75%, transparent);
  background: color-mix(in srgb, var(--bp-surface, #ffffff) 92%, transparent);
  flex: 0 0 auto;
}
.lang-switch__btn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--bp-text-muted, #64748b);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
  line-height: 1;
}
.lang-switch__btn:hover {
  color: var(--bp-primary, #6885a1);
  background: color-mix(in srgb, var(--bp-primary-soft, #e8eef4) 65%, transparent);
  transform: translateY(-1px);
}
.lang-switch__btn[aria-pressed="true"] {
  color: var(--bp-primary-contrast, #fff);
  background: var(--bp-primary, #6885a1);
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
  transform: translateY(-1px);
}
.lang-switch__btn:focus-visible {
  outline: none;
  box-shadow: var(--bp-focus-ring, 0 0 0 3px rgba(104, 133, 161, 0.35));
}
.lang-switch__sep {
  color: color-mix(in srgb, var(--bp-text-muted, #64748b) 70%, transparent);
  font-weight: 700;
  font-size: 12px;
  user-select: none;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  padding: var(--space-6) 0 var(--space-4);
  text-align: center;
}
.hero__eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bp-primary, #2d5f8a);
  background: color-mix(in srgb, var(--bp-primary, #2d5f8a) 10%, transparent);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: var(--space-4);
}
.hero h1 {
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 800;
  line-height: 1.2;
  max-width: 800px;
  margin: 0 auto var(--space-3);
  color: var(--bp-text, #1a2533);
  text-wrap: balance;
}
.hero__sub {
  font-size: 16px;
  color: var(--bp-text-muted, #64748b);
  max-width: 720px;
  margin: 0 auto;
  text-wrap: balance;
}

@media (max-width: 600px) {
  .hero { padding: 32px 0 18px; }
  .hero__sub { font-size: 15px; }
}

/* Tighten the transition from hero → first section only */
#overview.section { padding-top: 28px; }
@media (max-width: 600px) { #overview.section { padding-top: 24px; } }

/* ── Section headings ────────────────────────────────────── */
.section { padding: var(--space-section-y) 0; }
.section + .section { border-top: 1px solid var(--bp-border, #e2e8f0); }
.section__header { margin-bottom: var(--space-section-header-gap); }
.section__label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bp-primary, #2d5f8a);
  margin-bottom: var(--space-2);
}
.section__title {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  color: var(--bp-text, #1a2533);
  margin-bottom: var(--space-2);
}
.section__desc {
  font-size: 14px;
  color: var(--bp-text-muted, #64748b);
  max-width: none;
}

/* Reduce gap between Overview and Optimizes */
#optimizes.section { padding-bottom: 28px; }

/* Roles + charts: shared header lives in #roles; charts continue without a second section divider */
#roles.section + #charts.section.section--charts-after-roles {
  border-top: none;
  padding-top: var(--space-5);
}

/* ── 5-col grid ──────────────────────────────────────────── */
.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-grid-gap);
}
@media (max-width: 1200px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 780px)  { .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .grid-5 { grid-template-columns: 1fr; } }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bp-surface, #ffffff);
  border: 1px solid var(--bp-border, #e2e8f0);
  border-radius: 12px;
  padding: var(--space-card-pad);
  position: relative;
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
  transform: translateY(0);
}
.card:hover {
  box-shadow: 0 18px 46px rgba(0,0,0,.12);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--bp-border, #e2e8f0) 65%, var(--bp-primary, #2d5f8a));
}
.card:active { transform: translateY(-2px); }
.card--featured {
  border-color: var(--bp-primary, #2d5f8a);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bp-primary, #2d5f8a) 20%, transparent);
}
.card__accent {
  height: 4px;
  border-radius: 4px 4px 0 0;
  position: absolute;
  top: 0; left: 0; right: 0;
}
.card__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--bp-primary, #2d5f8a);
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.card__icon {
  width: 34px;
  height: 34px;
  margin-bottom: var(--space-2);
  color: #2d5f8a;
}
.card__icon svg,
.card__icon img {
  width: 34px;
  height: 34px;
  display: block;
}

/* Some inline icons read visually smaller due to stroke geometry */
[data-cat-id="outsourcing"] svg,
[data-cat-id="outsourcing"] img {
  transform: scale(1.22);
  transform-origin: center;
}
.card__title {
  font-size: var(--type-card-title-size);
  font-weight: var(--type-card-title-weight);
  color: var(--bp-text, #1a2533);
  margin-bottom: 2px;
  line-height: 1.25;
  /* Reserve space so divider aligns even if title wraps */
  min-height: calc(2 * 1.25em);
}
.card__focus {
  font-size: var(--type-card-body-size);
  color: var(--bp-text, #1a2533);
  line-height: var(--type-card-body-line);
  /* Reserve space so divider aligns across cards */
  min-height: calc(2 * 1.5em);
}
.card__divider {
  height: 0;
  border-top: 1px solid var(--bp-border, #e2e8f0);
  margin: var(--space-3) 0 var(--space-2);
}
.card__examples {
  font-size: 13px;
  color: var(--bp-text-muted, #64748b);
  line-height: var(--type-card-muted-line);
  /* Reserve space for up to 3 lines so cards don't jump */
  min-height: calc(3 * 1.35em);
}
.card__examples strong {
  font-weight: 700;
  color: var(--bp-text, #1a2533);
}
.card__examples span { color: var(--bp-text, #1a2533); }

/* ── Optimizes cards ─────────────────────────────────────── */
.opt-card { padding: var(--space-card-pad); }
.opt-card__icon { width: 30px; height: 30px; margin-bottom: var(--space-2); color: #2d5f8a; }
.opt-card__icon svg,
.opt-card__icon img {
  width: 30px;
  height: 30px;
  display: block;
}
.opt-card__title {
  font-size: var(--type-card-title-size);
  font-weight: var(--type-card-title-weight);
  color: var(--bp-text, #1a2533);
  margin-bottom: var(--space-2);
  line-height: 1.25;
  /* Reserve space so divider aligns even if title wraps */
  min-height: calc(2 * 1.25em);
}
.opt-card__text {
  font-size: var(--type-card-body-size);
  color: var(--bp-text, #1a2533);
  line-height: var(--type-card-body-line);
  /* Reserve space so dividers align across cards */
  min-height: calc(8 * 1.5em);
}
.opt-card__divider {
  height: 0;
  border-top: 1px solid var(--bp-border, #e2e8f0);
  margin: var(--space-4) 0 var(--space-3);
}

/* ── Pros & Cons lists (used inside optimizes cards) ───────── */
.pc-list { list-style: none; margin-bottom: var(--space-3); }
.pc-list li {
  font-size: var(--type-card-body-size);
  padding: 3px 0 3px 24px;
  position: relative;
  color: var(--bp-text, #1a2533);
  line-height: 1.45;
}
.pc-list li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}
.pc-list--pros li::before { content: '✓'; color: #16a34a; }
.pc-list--cons li::before { content: '✕'; color: #dc2626; }

/* ── Roles table ─────────────────────────────────────────── */
.roles-table-wrap { overflow-x: auto; }
.roles-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
  /* 1st col (320) + 5 score cols (140) = 1020 */
  min-width: 1020px;
}
.roles-table th {
  background: var(--bp-surface, #fff);
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--bp-text-muted, #64748b);
  border-bottom: 2px solid var(--bp-border, #e2e8f0);
  white-space: normal;
}
.roles-table th:first-child {
  /* Slightly narrower first column so scores read larger. */
  width: 320px;
  padding-left: 12px;
  padding-right: 10px;
}
.roles-table th:not(:first-child) {
  width: 140px;
}
.roles-table th.featured-col { color: var(--bp-primary, #2d5f8a); }
.cat-col-head{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 0;
  max-width: 140px;
  margin: 0 auto;
}
.cat-col-head__icon{
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: block;
  color: #2d5f8a;
}
.cat-col-head__icon svg,
.cat-col-head__icon img{
  width: 24px;
  height: 24px;
  display: block;
}
.cat-col-head__label{
  display: inline-block;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  max-width: 140px;
  overflow-wrap: anywhere;
}
.roles-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--bp-border, #e2e8f0);
  vertical-align: middle;
}
.roles-table td:first-child {
  width: 320px;
  padding-left: 12px;
  padding-right: 10px;
}
.roles-table td:not(:first-child) {
  width: 140px;
}
.roles-table td:not(:first-child) {
  text-align: center;
}
.roles-table tr:last-child td { border-bottom: none; }
.roles-table tr:hover td { background: var(--bp-bg, #f8f9fb); }
.role-desc { font-size: 11px; color: var(--bp-text-muted, #64748b); margin-top: 2px; }

/* ── Score cells ─────────────────────────────────────────── */
.score-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: default;
  position: relative;
}
/*
 * Шкала 1–5: края как в пай — #c0392b → #1f4d3a.
 * Жёлтая середина — референс #f2d06b; s2 = 50% к ней от красного; s4 = к зелёному от неё.
 */
.s1 { background: #c0392b; color: #fdfbf6; }
.s2 { background: #d9854b; color: #2d2818; }
.s3 { background: #f2d06b; color: #2d2818; }
.s4 { background: color-mix(in srgb, #f2d06b 28%, #1f4d3a 72%); color: #ecf6ee; }
.s5 { background: #1f4d3a; color: #ecf5f0; }

/* ── Tooltip ─────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:focus-visible::after,
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: normal;
  width: min(260px, calc(100vw - 24px));
  z-index: 200;
  pointer-events: none;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

/* ── Stage cards ─────────────────────────────────────────── */
.stage-grid { display: block; }

.stages-widget {
  position: relative;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--space-4);
  align-items: start;
  --stage-connector-y: 44px;
}
@media (max-width: 900px) {
  .stages-widget {
    grid-template-columns: 1fr;
  }
}

.stage-tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
}
@media (max-width: 900px) {
  .stage-tabs {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .stage-tabs::-webkit-scrollbar { display: none; }
}

.stage-tab {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--bp-border, #e2e8f0);
  background: var(--bp-surface, #fff);
  color: inherit;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
  min-width: 260px;
}
@media (max-width: 900px) { .stage-tab { min-width: 280px; } }
.stage-tab:hover {
  border-color: color-mix(in srgb, var(--bp-border, #e2e8f0) 65%, var(--bp-primary, #2d5f8a));
  background: var(--bp-primary, #2d5f8a);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0,0,0,.10);
}
.stage-tab:hover .stage-tab__title {
  color: #ffffff;
}
.stage-tab:active { transform: translateY(-1px); }
.stage-tab:focus-visible {
  outline: none;
  box-shadow: var(--bp-focus-ring, 0 0 0 3px rgba(104, 133, 161, 0.35));
}
.stage-tab.is-active,
.stage-tab[aria-selected="true"] {
  /* Keep selected state consistent with hover */
  border-color: color-mix(in srgb, var(--bp-border, #e2e8f0) 65%, var(--bp-primary, #2d5f8a));
  background: var(--bp-primary, #2d5f8a);
  color: #ffffff;
  box-shadow: 0 14px 32px rgba(0,0,0,.10);
  transform: translateY(-2px);
}
.stage-tab.is-active .stage-tab__title,
.stage-tab[aria-selected="true"] .stage-tab__title {
  color: #ffffff;
}

/* Visual connector (desktop): active tab → panel */
@media (min-width: 901px) {
  .stages-widget::before {
    content: '';
    position: absolute;
    left: 360px;
    right: 0;
    top: var(--stage-connector-y);
    height: 1px;
    background: linear-gradient(
      90deg,
      color-mix(in srgb, var(--bp-primary, #2d5f8a) 55%, transparent),
      color-mix(in srgb, var(--bp-primary, #2d5f8a) 12%, transparent),
      transparent
    );
    pointer-events: none;
    opacity: .9;
  }

  .stages-widget::after {
    content: '';
    position: absolute;
    left: calc(360px - 7px);
    top: calc(var(--stage-connector-y) - 6px);
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--bp-surface, #fff);
    border: 2px solid color-mix(in srgb, var(--bp-primary, #2d5f8a) 65%, #ffffff);
    box-shadow: 0 10px 24px rgba(0,0,0,.10);
    pointer-events: none;
  }

  .stage-panel::before {
    content: '';
    position: absolute;
    left: -10px;
    top: calc(var(--stage-connector-y) - 10px);
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--bp-primary, #2d5f8a) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--bp-primary, #2d5f8a) 22%, transparent);
    transform: rotate(45deg);
    pointer-events: none;
  }
}
.stage-tab__title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--bp-text, #1a2533);
  text-wrap: balance;
}
.stage-tab__inner{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.stage-tab__icon{
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: .92;
}
.stage-tab__icon svg{
  width: 18px;
  height: 18px;
  display: block;
}

.stage-panel { min-width: 0; position: relative; }
.stage-card {
  background: var(--bp-surface, #fff);
  border: 1px solid var(--bp-border, #e2e8f0);
  border-radius: 12px;
  padding: calc(var(--space-card-pad) + 2px);
}
.stage-card--active {
  border-color: color-mix(in srgb, var(--bp-border, #e2e8f0) 55%, var(--bp-primary, #2d5f8a));
  box-shadow: 0 22px 52px rgba(0,0,0,.12);
  animation: stageIn .22s ease-out both;
}
@keyframes stageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stage-card__title-row{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-2);
}
.stage-card__title-icon{
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bp-primary, #2d5f8a);
}
.stage-card__title-icon svg{
  width: 18px;
  height: 18px;
  display: block;
}
.stage-card__title-text{
  font-size: 15px;
  font-weight: 700;
  color: var(--bp-text, #1a2533);
  line-height: 1.25;
  min-width: 0;
}
.stage-card__desc {
  font-size: 13px;
  color: var(--bp-text-muted, #64748b);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}
.stage-card__divider{
  height: 0;
  border-top: 1px solid var(--bp-border, #e2e8f0);
  margin: 0 0 var(--space-3);
}
.stage-card__choices{
  display: block;
}
.stage-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--bp-border, #e2e8f0);
  font-size: 13px;
}
.stage-choice:last-child { border-bottom: none; }
.stage-choice__info { min-width: 0; width: 100%; }
.stage-choice__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.stage-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.stage-dot--best { background: #1f4d3a; }
.stage-dot--ok   { background: #d4a012; }
.stage-dot--no   { background: #c0392b; }
.stage-choice__label {
  font-weight: 600;
  color: var(--bp-text, #1a2533);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.stage-choice__icon{
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #2d5f8a;
}
.stage-choice__icon svg,
.stage-choice__icon img{
  width: 16px;
  height: 16px;
  display: block;
}
.stage-choice__label-text{
  min-width: 0;
}
.stage-choice__note  { color: var(--bp-text-muted, #64748b); margin-top: 2px; }

.stage-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
}
/* Как .s5 / .s3 / .s1 в таблице оценок */
.stage-pill--best {
  background: #1f4d3a;
  color: #ecf5f0;
  border-color: color-mix(in srgb, #ecf5f0 22%, #1f4d3a);
}
.stage-pill--ok {
  background: #f2d06b;
  color: #2d2818;
  border-color: color-mix(in srgb, #2d2818 12%, #f2d06b);
}
.stage-pill--no {
  background: #c0392b;
  color: #fdfbf6;
  border-color: color-mix(in srgb, #fdfbf6 18%, #c0392b);
}

/* ── Charts section ──────────────────────────────────────── */
.charts-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.comp-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--bp-border, #e2e8f0);
  background: var(--bp-surface, #fff);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
  user-select: none;
}
.comp-pill:is(button) {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--bp-border, #e2e8f0);
  background: var(--bp-surface, #fff);
  color: inherit;
}
.comp-pill:hover {
  border-color: var(--bp-primary, #2d5f8a);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,.10);
}
.comp-pill:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,.10);
}
.comp-pill.active {
  border-color: var(--bp-primary, #2d5f8a);
  background: color-mix(in srgb, var(--bp-primary, #2d5f8a) 8%, transparent);
}
.comp-pill:focus-visible {
  outline: none;
  box-shadow: var(--bp-focus-ring, 0 0 0 3px rgba(104, 133, 161, 0.35));
}
.pill-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.charts-grid-outer { overflow-x: auto; }
.charts-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(236px, 1fr));
  gap: var(--space-grid-gap);
  min-width: 1200px;
}

/* Stack: pie card + TCO bar strip (no card) per approach */
.approach-charts-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.approach-card {
  background: var(--bp-surface, #fff);
  border: 1px solid var(--bp-border, #e2e8f0);
  border-radius: 12px;
  padding: var(--space-card-pad);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.approach-card--pie .doughnut-wrap {
  /* Taller canvas: larger ring; labels sit in outer margin */
  min-height: 268px;
  height: 268px;
  padding: 2px 0 4px;
  box-sizing: border-box;
  overflow: visible;
}
.approach-card--pie .doughnut-wrap canvas {
  display: block;
  max-width: 100%;
}

.approach-cost-strip {
  min-width: 0;
}

.approach-cost-strip__title{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bp-text-muted, #64748b);
  margin: 0 0 8px;
}

.approach-card.featured {
  border-color: var(--bp-primary, #2d5f8a);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bp-primary, #2d5f8a) 20%, transparent);
}
.approach-card__title { font-size: 13px; font-weight: 700; color: var(--bp-text, #1a2533); }
.approach-card__sub   {
  font-size: 11px;
  color: var(--bp-text-muted, #64748b);
  margin-top: 2px;
  line-height: 1.35;
  /* Reserve space so header divider aligns across cards */
  min-height: calc(3 * 1.35em);
}
.approach-card__head{
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.approach-card__icon{
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: #2d5f8a;
}
.approach-card__icon svg,
.approach-card__icon img{
  width: 20px;
  height: 20px;
  display: block;
}
.approach-card__head-text{ min-width: 0; }
.approach-card__divider {
  height: 0;
  border-top: 1px solid var(--bp-border, #e2e8f0);
}
.doughnut-wrap { position: relative; width: 100%; }
.bar-wrap {
  position: relative;
  height: 230px;
}
.bar-wrap.bar-wrap--dual-cost {
  height: 100px;
  min-height: 100px;
}

/* ── Comparison table ────────────────────────────────────── */
.table-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bp-primary, #2d5f8a);
  background: color-mix(in srgb, var(--bp-primary, #2d5f8a) 8%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--bp-primary, #2d5f8a) 30%, transparent);
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: var(--space-4);
}
.table-toggle-btn:hover { background: color-mix(in srgb, var(--bp-primary, #2d5f8a) 15%, transparent); }

/* overflow:hidden breaks position:sticky inside; keep it only while collapsed (max-height:0). */
.table-section-wrap {
  transition: max-height .4s ease;
}
.table-section-wrap[data-open="0"] {
  overflow: hidden;
}
.table-section-wrap[data-open="1"] {
  overflow: visible;
}

/* Horizontal scroll only — keeps vertical sticky rows tied to the page scrollport (not this box). */
.comp-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}
.comp-table {
  /* Overwritten in app.js from measured thead height (fallback until then). */
  --comp-thead-sticky-height: 56px;
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 780px;
}
.comp-table th {
  position: sticky;
  top: 52px;
  background: var(--bp-surface, #fff);
  padding: 12px 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--bp-text-muted, #64748b);
  border-bottom: 2px solid var(--bp-border, #e2e8f0);
  white-space: normal;
  z-index: 10;
}
.comp-table th:first-child { text-align: left; }
.comp-table th.featured-col { color: var(--bp-primary, #2d5f8a); }
.comp-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--bp-border, #e2e8f0);
  vertical-align: middle;
  text-align: center;
}
.comp-table td:first-child { text-align: left; }
.comp-table tr:last-child td { border-bottom: none; }
.comp-table tr:hover td { background: var(--bp-bg, #f8f9fb); }

.group-header td {
  background: var(--bp-bg, #f8f9fb);
  font-weight: 700;
  font-size: 13px;
  color: var(--bp-text, #1a2533);
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  border-top: 2px solid var(--bp-border, #e2e8f0);
}
.group-header td {
  position: sticky;
  top: calc(52px + var(--comp-thead-sticky-height));
  z-index: 9;
}
.group-header td:first-child { text-align: left; }
.group-header td:not(:first-child) { text-align: center; white-space: nowrap; }
.group-header .avg-pill { margin-left: 0; }
.group-header td:hover { background: color-mix(in srgb, var(--bp-primary, #2d5f8a) 6%, transparent); }
.group-toggle-icon { margin-right: 8px; display: inline-block; transition: transform .2s; }
.group-toggle-icon.open { transform: rotate(90deg); }

.avg-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 6px;
}

.accordion-btn-row td {
  padding: 6px 14px;
  background: var(--bp-bg, #f8f9fb);
}
.accordion-btn {
  font-size: 12px;
  color: var(--bp-primary, #2d5f8a);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}
.accordion-btn:hover { text-decoration: underline; }

.crit-label { font-size: 13px; color: var(--bp-text, #1a2533); }
.crit-label small { display: block; font-size: 11px; color: var(--bp-text-muted, #64748b); margin-top: 1px; }

/* ── FAQ (legacy, section removed) ───────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.faq-item {
  background: var(--bp-surface, #fff);
  border: 1px solid var(--bp-border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: var(--space-4) var(--space-card-pad);
  font-size: 14px;
  font-weight: 600;
  color: var(--bp-text, #1a2533);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-q:hover { background: var(--bp-bg, #f8f9fb); }
.faq-icon { font-size: 18px; color: var(--bp-primary, #2d5f8a); flex-shrink: 0; transition: transform .2s; }
.faq-icon.open { transform: rotate(45deg); }
.faq-a {
  display: none;
  padding: 0 20px 16px;
  font-size: 13px;
  color: var(--bp-text-muted, #64748b);
  line-height: 1.6;
}
.faq-a.open { display: block; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--bp-border, #e2e8f0);
  padding: var(--space-5) 0;
  text-align: center;
  font-size: 13px;
  color: var(--bp-text-muted, #64748b);
}
.site-footer a {
  color: var(--bp-primary, #2d5f8a);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .site-nav a,
  .site-nav a::after,
  .comp-pill,
  .group-toggle-icon {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
  .site-nav a:hover::after,
  .site-nav a:focus-visible::after {
    opacity: 1;
  }
}

/* ── Large screens: scale up safely (no impact on laptop) ───────────
   Goal: when the page is shown on a big external display, the UI
   shouldn't feel "tiny" while keeping the same layout system. */
@media (min-width: 1440px) {
  :root {
    --space-section-y: 54px;
    --space-section-header-gap: 34px;
    --space-grid-gap: 16px;
    --space-card-pad: 22px;

    --type-card-title-size: 16px;
    --type-card-body-size: 14px;
    --type-card-muted-size: 13px;
  }

  body { font-size: 16px; }

  .page-wrap { max-width: 1560px; }
  .site-nav__inner { max-width: 1560px; }
}

@media (min-width: 1920px) {
  :root {
    --space-section-y: 60px;
    --space-section-header-gap: 38px;
    --space-grid-gap: 18px;
    --space-card-pad: 24px;

    --type-card-title-size: 17px;
    --type-card-body-size: 15px;
    --type-card-muted-size: 14px;
  }

  body { font-size: 17px; }

  .page-wrap { max-width: 1680px; }
  .site-nav__inner { max-width: 1680px; }
}
