/* [credit_cost_rating] — рейтинг по стоимости, дизайн «сценарии-колонки».
   Палитра и рамки — как у остального сайта: серая рамка карточек журнала
   (#E4E4E7), фирменный зелёный из tokens.css, рамка 2px с нижней 4px —
   «приподнятая» плитка, как .wf-hero__tile:hover. */

.wf-cr3 {
  --cr-green: #00C677;
  --cr-green-dark: var(--wf-green, #0b5d46);
  --cr-dark: #0d362b;
  --cr-ink: #09090B;
  --cr-muted: #71717A;
  --cr-line: #E4E4E7;
  --cr-card: #fff;
  --cr-tint: #EDF8E6;
  --cr-red: #c0453a;
  --cr-amber: #c98a2b;

  box-sizing: border-box;
  width: 100%;
  color: var(--cr-ink);
  font-size: 16px;
  line-height: 1.4;
}

.wf-cr3 *,
.wf-cr3 *::before,
.wf-cr3 *::after { box-sizing: border-box; }

.wf-cr3--empty { color: var(--cr-muted); font-size: 14px; }

/* ---------- панель управления ---------- */

.wf-cr3__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.wf-cr3__chips,
.wf-cr3__sorts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.wf-cr3__label {
  width: 100%;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cr-muted);
  margin-bottom: 2px;
}
.wf-cr3__sorts { justify-content: flex-end; }
.wf-cr3__sorts .wf-cr3__label { text-align: right; }

.wf-cr3__chip,
.wf-cr3__sort {
  appearance: none;
  cursor: pointer;
  border: 2px solid var(--cr-line);
  border-bottom-width: 4px;
  background: var(--cr-card);
  color: var(--cr-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 10px 16px;
  border-radius: 12px;
  transition: background .15s, border-color .15s, color .15s;
}
.wf-cr3__chip:hover,
.wf-cr3__sort:hover { border-color: var(--cr-dark); }

.wf-cr3__chip.is-active {
  background: var(--cr-green-dark);
  border-color: var(--cr-dark);
  color: #fff;
  font-weight: 600;
}
.wf-cr3__sort.is-active {
  background: var(--cr-tint);
  border-color: var(--cr-green);
  color: var(--cr-green-dark);
  font-weight: 600;
}

/* ---------- таблица ---------- */

.wf-cr3__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 2px solid var(--cr-line);
  border-bottom-width: 4px;
  border-radius: 18px;
  background: var(--cr-card);
}

.wf-cr3__table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
}

.wf-cr3-th {
  text-align: right;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cr-muted);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--cr-line);
  white-space: nowrap;
}
.wf-cr3-th--brand { text-align: left; }
.wf-cr3-th[data-col] { opacity: .55; }
.wf-cr3-th.is-sorted { opacity: 1; color: var(--cr-green-dark); }
.wf-cr3-th.is-sorted::after { content: ' ↓'; font-size: 13px; }
.wf-cr3-th sup { color: var(--cr-red); }

.wf-cr3-row { transition: background .12s; }
.wf-cr3-row:hover { background: #FAFAFA; }
/* Низ таблицы — нижняя рамка обёртки, своя линия у последней строки лишняя. */
.wf-cr3-row:last-child td { border-bottom: 0; }

.wf-cr3-row td {
  padding: 16px;
  border-bottom: 1px solid var(--cr-line);
  vertical-align: middle;
  text-align: right;
  white-space: nowrap;
}

/* бренд */
.wf-cr3-brand {
  text-align: left !important;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.wf-cr3-rank { width: 18px; font-weight: 700; color: var(--cr-muted); text-align: center; flex: 0 0 auto; }
.wf-cr3-row:nth-child(1) .wf-cr3-rank { color: #d4a017; }
.wf-cr3-row:nth-child(2) .wf-cr3-rank { color: #9aa7a0; }
.wf-cr3-row:nth-child(3) .wf-cr3-rank { color: #b07a3c; }

.wf-cr3-logo {
  width: 40px; height: 40px; flex: 0 0 auto;
  object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--cr-line);
}
.wf-cr3-logo--ph {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--cr-green-dark); background: var(--cr-tint);
  text-transform: uppercase; border-color: transparent;
}
.wf-cr3-brand__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wf-cr3-brand__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.wf-cr3-brand__meta { font-size: 12px; color: var(--cr-muted); }
.wf-cr3-brand__link { color: inherit; text-decoration: none; }
.wf-cr3-brand__link:hover,
.wf-cr3-brand__link:focus-visible { color: var(--cr-green-dark); text-decoration: underline; text-underline-offset: 3px; }

/* ячейка сценария: неактивные — приглушены, активная — яркая (клик реально меняет картину) */
/* Приглушаем текст, а не ячейку: opacity на td бледнит и линию между строками. */
.wf-cr3-cell { transition: background .15s; }
.wf-cr3-cell > span { opacity: .4; transition: opacity .15s; }
.wf-cr3-cell.is-sorted > span { opacity: 1; }
.wf-cr3-cell__sum { display: block; font-weight: 700; font-size: 15px; }
.wf-cr3-cell__sub { display: block; font-size: 12px; color: var(--cr-muted); margin-top: 2px; }

.wf-cr3-cell.is-sorted {
  background: var(--cr-tint);
  box-shadow: inset 3px 0 0 var(--cr-green);
}
.wf-cr3-cell.is-sorted .wf-cr3-cell__sum { color: var(--cr-green-dark); font-size: 18px; }

.wf-cr3-cell--na .wf-cr3-cell__sum { color: var(--cr-muted); font-weight: 600; }

/* переплата/тіло */
.wf-cr3-mult { min-width: 130px; }
.wf-cr3-mult__val { font-weight: 800; font-size: 18px; }
.wf-cr3-mult__cap { font-size: 11px; color: var(--cr-muted); margin-left: 4px; }
.wf-cr3-mult__bar {
  display: block; height: 6px; margin-top: 8px; border-radius: 4px;
  background: var(--cr-line); overflow: hidden;
}
.wf-cr3-mult__bar > span { display: block; height: 100%; border-radius: 4px; }
.wf-cr3-mult.is-low  .wf-cr3-mult__val { color: var(--cr-green-dark); }
.wf-cr3-mult.is-low  .wf-cr3-mult__bar > span { background: var(--cr-green); }
.wf-cr3-mult.is-mid  .wf-cr3-mult__val { color: var(--cr-amber); }
.wf-cr3-mult.is-mid  .wf-cr3-mult__bar > span { background: var(--cr-amber); }
.wf-cr3-mult.is-high .wf-cr3-mult__val { color: var(--cr-red); }
.wf-cr3-mult.is-high .wf-cr3-mult__bar > span { background: var(--cr-red); }

.wf-cr3__note {
  margin: 14px 2px 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--cr-muted);
}
.wf-cr3__note sup { color: var(--cr-red); }

/* ---------- мобилка: таблица скроллится, подсказка ---------- */
@media (max-width: 640px) {
  .wf-cr3__controls { gap: 12px; }
  .wf-cr3__sorts { justify-content: flex-start; }
  .wf-cr3__sorts .wf-cr3__label { text-align: left; }
  .wf-cr3-row td { padding: 12px; }
}
