/* ── Telegram theme tokens ─────────────────────────────────────── */
:root {
  --bg:          var(--tg-theme-bg-color,           #ffffff);
  --bg2:         var(--tg-theme-secondary-bg-color,  #f2f2f7);
  --text:        var(--tg-theme-text-color,          #000000);
  --hint:        var(--tg-theme-hint-color,          #8e8e93);
  --link:        var(--tg-theme-link-color,          #007aff);
  --btn:         var(--tg-theme-button-color,        #007aff);
  --btn-text:    var(--tg-theme-button-text-color,   #ffffff);
  --sep:         rgba(0,0,0,.08);
  --green:       #34c759;
  --red:         #ff3b30;
  --yellow:      #ff9500;
  --r:           14px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Fullscreen Main Mini App: отступ под «Закрыть» (#182) */
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
  --tg-safe-area-inset-left: 0px;
  --tg-safe-area-inset-right: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --tg-content-safe-area-inset-left: 0px;
  --tg-content-safe-area-inset-right: 0px;
  --safe-top: calc(
    var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)
  );
  --safe-bottom: calc(
    var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)
  );
}

/* ── Тёмная тема (#260) ─────────────────────────────────────────
   Активируется через data-color-scheme="dark" на <html>.
   В Telegram — Telegram сам инжектирует --tg-theme-* переменные.
   В браузере — используем iOS-стандартные тёмные значения как fallback. */
[data-color-scheme="dark"] {
  --bg:       var(--tg-theme-bg-color,                #1c1c1e);
  --bg2:      var(--tg-theme-secondary-bg-color,       #2c2c2e);
  --text:     var(--tg-theme-text-color,               #ffffff);
  --hint:     var(--tg-theme-hint-color,               #8d8d92);
  --link:     var(--tg-theme-link-color,               #0a84ff);
  --btn:      var(--tg-theme-button-color,             #0a84ff);
  --btn-text: var(--tg-theme-button-text-color,        #ffffff);
  --sep:      rgba(255,255,255,.10);
  --green:    #30d158;
  --red:      #ff453a;
  --yellow:   #ffd60a;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg2);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: calc(
    var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px)
  );
  padding-right: calc(
    var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px)
  );
}

.staging-banner {
  position: sticky;
  top: var(--safe-top);
  z-index: 9999;
  padding: 6px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  background: #ff9800;
  color: #1a1a1a;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }

/* ── App shell ─────────────────────────────────────────────────── */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; }

/* ── Tab bar: крупные pills + язык (#169); скролл с контентом (#217) ── */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border-bottom: none;
  padding: 16px 12px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-pills {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-pills::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 9px 15px;
  min-height: 36px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab.active {
  background: var(--btn);
  color: var(--btn-text);
  font-weight: 700;
}
.lang-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 10px 6px 8px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-btn-flag {
  font-size: 15px;
  line-height: 1;
}
.lang-btn-code {
  line-height: 1;
}
.lang-btn-chevron {
  font-size: 10px;
  line-height: 1;
  opacity: 0.65;
  margin-left: 1px;
}
.lang-btn:active { opacity: 0.75; }
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 12px;
  max-height: 60vh;
  overflow-y: auto;
}
.lang-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
.lang-item:active,
.lang-item.active { background: var(--bg2); }
.lang-item-flag { font-size: 18px; line-height: 1; flex-shrink: 0; }
.lang-item-code {
  width: 40px;
  font-size: 13px;
  font-weight: 700;
  color: var(--hint);
  letter-spacing: .04em;
}
.lang-item.active .lang-item-code { color: var(--btn); }
.lang-item-name { flex: 1; font-weight: 500; }
.lang-item-check {
  color: var(--btn);
  font-weight: 700;
}

/* ── Screens ───────────────────────────────────────────────────── */
.screen { display: none; padding: 12px 16px 32px; }
.screen.active { display: block; }

/* ── Converter card ────────────────────────────────────────────── */
.converter-card {
  background: var(--bg);
  border-radius: var(--r);
  padding: 4px 0 0;
  margin-bottom: 8px;
  overflow: hidden;
}

.conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}
.conv-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.conv-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--hint);
}
.conv-flag { font-size: 20px; }

.conv-amount-row { padding: 4px 16px 12px; }
.conv-input {
  width: 100%;
  border: none;
  outline: none;
  background: none;
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  caret-color: var(--btn);
}
.conv-input::placeholder { color: var(--hint); }

.conv-divider { padding: 0 16px; }
.conv-hr { border: none; border-top: 1px solid var(--sep); }

/* Выбор страны — отдельная кнопка над карточкой */
.conv-country-row { margin-bottom: 8px; }

.corridor-picker-top {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  background: var(--bg);
  border: none;
  border-radius: var(--r);
  padding: 13px 16px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}
.corridor-picker-top #cp-flag { font-size: 22px; line-height: 1; }
.corridor-picker-top #cp-name { flex: 1; font-size: 16px; font-weight: 600; }
.corridor-picker-top .cp-arrow { font-size: 18px; color: var(--hint); }

/* Фильтр валют — pill-табы в стиле папок Telegram */
.recv-currency-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: flex-end;
  max-width: min(72vw, 320px);
}
.recv-currency-tabs::-webkit-scrollbar { display: none; }
.rct-btn {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  background: var(--bg2);
  color: var(--text);
  border: none;
  transition: background .15s, color .15s, opacity .15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.2;
}
.rct-btn.rct-active {
  background: var(--btn);
  color: var(--btn-text);
  font-weight: 600;
}
.rct-btn[disabled]:not(.rct-active) {
  opacity: 0.45;
  cursor: default;
  background: var(--bg2);
  color: var(--hint);
}
.rct-btn.rct-active[disabled] { cursor: default; }
.rct-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: color-mix(in srgb, var(--text) 16%, transparent);
  color: inherit;
}
.rct-dot { font-size: 8px; opacity: .6; }


.pay-currency-select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--btn);
  color: var(--btn-text, #fff);
  border: none;
  border-radius: 10px;
  padding: 6px 28px 6px 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .3px;
  cursor: pointer;
  min-width: 96px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23fff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

/* Фильтр способов доставки — pill-табы как папки Telegram */
.delivery-filter {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Горизонталь = отступ .screen, без второго слоя (#191) */
  padding: 4px 0 10px;
  margin: 0;
}
.delivery-filter[hidden] { display: none !important; }
.delivery-filter::-webkit-scrollbar { display: none; }
.df-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.df-pill.df-active {
  background: var(--btn);
  color: var(--btn-text);
  font-weight: 600;
}
.df-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: rgba(128, 128, 128, 0.22);
  color: inherit;
}
.df-pill.df-active .df-badge {
  background: rgba(255, 255, 255, 0.28);
}

/* Баннер устаревших данных */
.stale-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 16px 8px;
  padding: 8px 12px;
  background: rgba(255,149,0,.12);
  border-radius: 10px;
  font-size: 13px; color: var(--yellow);
}
.stale-spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* Presets */
.presets {
  display: flex;
  gap: 4px;
  padding: 4px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.presets::-webkit-scrollbar { display: none; }
.preset {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1.5px solid var(--sep);
  border-radius: 20px;
  background: none;
  color: var(--hint);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
}
.preset.active, .preset:active {
  background: var(--btn);
  border-color: var(--btn);
  color: var(--btn-text);
}

/* ── CBR row ───────────────────────────────────────────────────── */
.cbr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  background: var(--bg);
  border-radius: var(--r);
  padding: 8px 14px;
  margin-bottom: 8px;
}
.cbr-text {
  font-size: 12px;
  font-weight: 400;
  color: var(--hint);
  flex: 1 1 auto;
}
.list-updated {
  font-size: 12px;
  color: var(--hint);
  opacity: .7;
  white-space: nowrap;
}

/* Кнопка «Поделиться списком курсов» (#1451): полноширинная, между плашкой
   ЦБ и фильтром доставки (на «Оплате» — над фильтром). Видимостью управляет
   app.js: скрыта, пока по коридору нет ни одной котировки (R04). */
.share-list-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  margin-bottom: 8px;
  border: none;
  /* #1807: полностью закруглённая (pill) — по просьбе владельца. Радиус
     заведомо больше половины высоты, форма не зависит от --r. */
  border-radius: 999px;
  /* #1690: фиксированный пурпурный, не привязанный к теме Telegram
     (--tg-theme-button-color) — кнопка обязана выделяться на фоне обычных
     синих/зелёных акцентов бота, а не сливаться с ними. */
  background: #7c3aed;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.share-list-btn:active { opacity: .7; }

/* ── Provider list ─────────────────────────────────────────────── */
/* ── Избранное: группы по стране назначения (#1595) ───────────── */
.favorites-country-group { margin-bottom: 16px; }
.favorites-country-group:last-child { margin-bottom: 0; }
.favorites-country-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 4px 8px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}
.favorites-country-heading span { font-size: 20px; line-height: 1; }
.favorites-country-items { overflow: hidden; border-radius: var(--r); }

.provider-list { display: flex; flex-direction: column; gap: 1px; }

/* Loading */
.list-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--hint);
  font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--bg2);
  border-top-color: var(--btn);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Provider row */
.prow {
  background: var(--bg);
  padding: 14px 86px 12px 16px;
  cursor: pointer;
  position: relative;
  transition: background .1s;
}
.prow-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.prow-share {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.prow-share:active { opacity: 0.55; }
.prow-fav {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.prow-fav svg { fill: none; stroke: currentColor; }
.prow-fav.active { color: #ff3b30; }
.prow-fav.active svg { fill: currentColor; stroke: #ff3b30; }
.prow-fav:active { opacity: 0.6; }
.prow:active { background: var(--bg2); }
.prow:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0; left: 16px; right: 0;
  background: var(--sep);
}
.prow:first-child { border-radius: var(--r) var(--r) 0 0; }
.prow:last-child  { border-radius: 0 0 var(--r) var(--r); }
.prow:only-child  { border-radius: var(--r); }

/* Best badge */
.best-badge {
  display: inline-block;
  background: #e8f9ee;
  color: #1a7a36;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Row layout */
.prow-right { }
.prow-amount { font-size: 24px; font-weight: 700; white-space: nowrap; }

/* Sub-row: rate + margin chips */
.prow-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.prow-rate  { font-size: 12px; color: var(--hint); }
.prow-fee {
  display: inline-block;
  font-size: 11px;
  color: var(--red);
  background: rgba(255,59,48,.08);
  border-radius: 4px;
  padding: 1px 6px;
}
.rate-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--hint);
  background: var(--bg2);
  border-radius: 4px;
  padding: 1px 6px;
}
/* #724: провайдер не примет введённую сумму. Карточка гасится, но остаётся
   в списке и остаётся кликабельной: решение владельца — помечать, а не
   скрывать, потому что пропавшая строка читается как поломка приложения.

   Гасятся ИМЕННО элементы, а не контейнер `.prow` (замечание Codex).
   `opacity` на родителе создаёт слой композиции: всё содержимое рисуется
   с этой прозрачностью, и `opacity: 1` у ребёнка яркость уже не вернёт.
   Подпись с лимитом — единственное объяснение потухшей строки, и она
   обязана оставаться читаемой, поэтому в список ниже не входит. */
.prow-out-of-limits .prow-right,
.prow-out-of-limits .prow-left,
.prow-out-of-limits .rate-badge,
.prow-out-of-limits .margin-chip,
.prow-out-of-limits .prow-fee { opacity: .45; }
.prow-limit {
  display: inline-block;
  font-size: 11px;
  color: var(--hint);
  background: var(--bg2);
  border: 1px solid var(--hint);
  border-radius: 4px;
  padding: 0 6px;
}

/* Provider identity — logo + name, sits at bottom of card */
.prow-left {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.prow-logo {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: var(--bg2);
  flex-shrink: 0;
}
.prow-logo-svg { background: none !important; padding: 0; border-radius: 0; }
.prow-logo-svg svg { display: block; border-radius: 10px; }
/* CMS-логотип из URL (#248): вписывается в контейнер логотипа */
.prow-logo-img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; display: block; }
.prow-name-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}
.prow-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prow-corridor { font-size: 12px; color: var(--hint); white-space: nowrap; letter-spacing: -.1px; flex-shrink: 0; }
.prow-delivery { font-size: 12px; color: var(--hint); margin-top: 1px; }

/* Margin chip */
.margin-chip {
  font-size: 11px;
  color: var(--yellow);
  background: rgba(255,149,0,.08);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}
.margin-chip.ok   { color: var(--green);  background: rgba(52,199,89,.08); }
.margin-chip.warn { color: var(--yellow); background: rgba(255,149,0,.10); }
.margin-chip.bad  { color: var(--red);    background: rgba(255,59,48,.08); }


/* ── Payment rates screen ─────────────────────────────────────── */
.screen-title { font-size: 20px; font-weight: 700; padding: 4px 0; }

/* ── Overlays / bottom sheets ──────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.bottom-sheet {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px 0 calc(32px + var(--safe-bottom));
  animation: slideUp .25s cubic-bezier(.32,.72,0,1);
}
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.bs-handle {
  width: 36px; height: 4px;
  background: var(--sep);
  border-radius: 2px;
  margin: 6px auto 12px;
}
.bs-title { font-size: 17px; font-weight: 700; padding: 0 16px 12px; }

/* Country list */
.country-list { display: flex; flex-direction: column; }
.country-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--sep);
  transition: background .1s;
}
.country-item:last-child { border-bottom: none; }
.country-item:active { background: var(--bg2); }
.country-item.active { background: rgba(0,122,255,.05); }
.ci-flag { font-size: 24px; }
.ci-name { flex: 1; font-size: 16px; font-weight: 500; color: var(--text); }
.ci-codes { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ci-curr { font-size: 11px; font-weight: 600; color: var(--btn-text); background: var(--btn); border-radius: 4px; padding: 2px 5px; opacity: 0.75; }
.ci-curr-soon { color: var(--hint); background: var(--bg2); }
.ci-check { color: var(--btn); font-size: 18px; font-weight: 700; }

/* Detail sheet */
.detail-header { padding: 0 16px 16px; }
.dh-name { font-size: 20px; font-weight: 700; }
.provider-type-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; margin-top: 5px; letter-spacing: .2px; }
.provider-type-bank    { background: rgba(0,122,255,.12); color: #007aff; }
.provider-type-service { background: rgba(255,149,0,.12); color: #ff9500; }
.dh-delivery { font-size: 13px; color: var(--hint); margin-top: 3px; }
/* CMS-поля провайдера (#248) — Markdown-рендер (#259) */
.dh-desc { font-size: 13px; color: var(--fg); margin-top: 8px; line-height: 1.5; text-align: left; }
.dh-desc > *:first-child { margin-top: 0; }
.dh-desc > *:last-child { margin-bottom: 0; }
.dh-desc p { margin: 0 0 8px; }
.dh-desc h1, .dh-desc h2, .dh-desc h3 { font-weight: 700; margin: 12px 0 4px; font-size: 14px; }
.dh-desc h1 { font-size: 15px; }
.dh-desc ul, .dh-desc ol { margin: 4px 0 8px; padding-left: 18px; }
.dh-desc li { margin-bottom: 3px; }
.dh-desc strong { font-weight: 700; }
.dh-desc em { font-style: italic; }
.dh-desc code { font-family: monospace; background: var(--sep); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.dh-desc pre { background: var(--sep); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0; }
.dh-desc pre code { background: none; padding: 0; }
.dh-desc blockquote { border-left: 3px solid var(--hint); margin: 6px 0; padding: 2px 10px; color: var(--hint); }
.dh-desc a { color: var(--accent, #2481cc); text-decoration: underline; }
.dh-desc hr { border: none; border-top: 1px solid var(--sep); margin: 10px 0; }
.dh-limits { font-size: 13px; color: var(--hint); margin-top: 6px; }

/* Компактное подтверждение добавления в избранное (#1594). */
.favorite-toast {
  position: fixed;
  z-index: 120;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--tg-content-safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 20px;
  box-sizing: border-box;
  /* --card не является токеном Telegram-темы: из-за него background
     становился невалидным и плашка была прозрачной (#1634). */
  border-radius: 999px;
  background: #5f6368;
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .20);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  opacity: 0;
  transform: translateY(calc(100% + 24px));
  pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
}
.favorite-toast-heart { font-size: 25px; line-height: 1; }
.favorite-toast.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .favorite-toast { transition: none; }
}

/* Алерты варианта (#838): сумма вне лимитов, комиссия ощутима, курс мог устареть */
.detail-alerts { padding: 0 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.detail-alert {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.4;
  background: rgba(255,149,0,.12); color: var(--yellow);
}

.detail-rows { padding: 0 16px; }
.dr { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--sep); font-size: 15px; }
.dr:last-of-type { border-bottom: none; }
.dr-label { color: var(--hint); }
.dr-val { font-weight: 600; }
.dr-val.warn { color: var(--yellow); }
.dr-val.good { color: var(--green); }

.detail-note { font-size: 12px; color: var(--hint); text-align: center; margin-top: 8px; }

.detail-link-inline { color: var(--link, #3390ec); text-decoration: none; }
.detail-link-inline:active { opacity: .7; }

/* #275/#287: кнопки сторов / веб — только при наличии ссылки из CMS */
.detail-links { display: flex; flex-direction: column; gap: 10px; padding: 8px 16px 16px; }
.detail-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.detail-link-web {
  background: transparent;
  color: var(--text);
  border: 1.5px solid color-mix(in srgb, var(--text) 28%, transparent);
}

/* ── Payment rates screen: стили унаследованы от .prow-* ──── */

/* ── Light / dark (tg.colorScheme) ─────────────────────────────── */
html[data-color-scheme="dark"] {
  --sep: rgba(255, 255, 255, .12);
}

/* ── App shell: нижняя навигация разделов и реакция оболочки ──────
   Нижняя навигация «Финансы / Работа / …» — общая хромировка приложения,
   а не стиль раздела: разделы в неё не лезут, оболочка сама решает, что
   показать. Стили самих разделов — frontend/styles/<раздел>.css
   (AGENTS.md §3.1, сторож tests/test_css_scope.js). #450 #473 #474 */

.jbn[hidden] { display: none !important; }
.jbn {
  display: flex;
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  z-index: 200;
  align-items: center;
  height: 56px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 28px;
  /* Плашка следует живой теме Telegram (--bg2), а не фиксированному серому —
     иначе на устройстве с акцентной тёмной темой навигация выглядит чужеродно
     нейтрально-серой на фоне синего/акцентного остального интерфейса (#530). */
  background: color-mix(in srgb, var(--bg2) 75%, transparent);
  box-shadow: 0 8px 18px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
}
/* Отступ капсулы 2px при padding плашки 5px (#561). Вкладки живут внутри
   этого padding, поэтому шаг между ними остаётся (100% - 10px) / count, а
   капсула выходит за вкладку на 3px с каждой стороны — отсюда +6px к ширине
   и сдвиг «своя ширина минус эти 6px». Ширина и сдвиг связаны жёстко: если
   поправить одно без другого, промах накапливается и к последней вкладке
   капсула уезжает.

   Активное состояние — залитая капсула цветом кнопок Telegram (#563), а не
   подсветка и не фиксированный тёмный. Прежняя светлая капсула требовала
   синего текста поверх и держала контраст около 2.7:1 при норме WCAG AA
   4.5:1 (посчитано в #551); фиксированный тёмный контраст решал, но выпадал
   из цветовой схемы приложения. Пара --btn / --btn-text приходит из темы уже
   контрастной, поэтому читаемость обеспечивает Telegram, а не наши расчёты. */
.jbn-indicator {
  position: absolute;
  z-index: 0;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 10px) / var(--jbn-tab-count, 2) + 6px);
  border-radius: 24px;
  background: var(--btn);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  transform: translateX(calc(var(--jbn-active-index, 0) * (100% - 6px)));
  transition: transform 240ms cubic-bezier(.22, .8, .36, 1);
}
@media (prefers-color-scheme: dark) {
  /* Ранний фолбэк до того, как Telegram JS проставит data-color-scheme
     (см. #530): --bg2 в этот момент ещё не переключён на тёмный, поэтому
     здесь зафиксированы те же числа, что в фолбэке --bg2 тёмной темы. */
  .jbn { background: rgba(44,44,46,.75); border-color: rgba(255,255,255,.12); box-shadow: 0 8px 18px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.08); }
}
.jbn-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  height: 46px;
  padding: 4px;
  border: none;
  background: none;
  color: color-mix(in srgb, var(--text) 72%, transparent);
  font-family: var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: color .15s;
}
.jbn-tab[hidden] { display: none; }
/* Иконки нарисованы на currentColor, поэтому одного color достаточно (#561).
   --btn-text — парный к --btn цвет из темы Telegram: контраст обеспечивает
   сама тема, а не наши расчёты, и отдельного правила для тёмной схемы у
   капсулы больше не нужно — --btn меняется вместе с темой (#563). */
.jbn-tab.jbn-active { color: var(--btn-text); }
/* Размеры и вес — те, что раньше были только у активной вкладки (#561):
   иконка 23px × 1.06 ≈ 24px, подпись 10px × 1.06 ≈ 10.5px, вес 600. Это
   честные значения вместо transform: scale — текст не размывается, как при
   масштабировании, и высота строки остаётся предсказуемой. */
.jbn-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.jbn-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Текст и иконка выглядят одинаково в обоих состояниях (#561) — оформление
   выбранной вкладки стало общим для всех, а не наоборот. Отдельных правил для
   .jbn-active по размеру и весу нет: при переключении раздела ничего не
   «прыгает», активную обозначает сама тёмная капсула.
   Цвет — единственное оставшееся отличие, и оно вынужденное: на тёмной
   капсуле подпись цвета неактивной вкладки была бы нечитаемой. */
body.bottom-nav-mode #app { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
body.bottom-nav-mode:not(.nav-section-finance) .tab-bar { display: none; }
.product-placeholder { display:none; min-height:240px; align-items:center; justify-content:center; text-align:center; }
.product-placeholder h1 { margin:0; font-size:22px; color:var(--text); }
.product-placeholder.active { display:flex; }
@media (prefers-reduced-motion: reduce) {
  /* Иконка и подпись больше не анимируются (#561) — двигается только капсула. */
  .jbn-indicator { transition: none; }
}

/* Boot по кэшу флага раздела (#472): навигация и место под неё появляются
   до ответа /health, иначе контент дёргается. Снимается в init. */
html.jobs-boot #jobs-bottom-nav { display: flex !important; }
html.jobs-boot #app { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }

/* Boot по кэшу настроек CMS (#479): выключенная вкладка не должна мигать
   до ответа /api/app-settings. Классы вешает инлайн-скрипт в index.html,
   снимаются после applySectionVisibility() в app.js. */
html.boot-hide-calc .tab[data-tab="calc"] { display: none !important; }
html.boot-hide-exchange .tab[data-tab="exchange"] { display: none !important; }
html.boot-hide-payment .tab[data-tab="payment"] { display: none !important; }

/* Правовая сноска о независимости сервиса от поставщиков (#1696).
   Постоянный футер внизу #app: виден под активным списком курсов. */
.disclaimer-note {
  margin: 18px 12px calc(12px + var(--safe-bottom));
  padding-top: 12px;
  border-top: 1px solid var(--sep);
  font-size: 11px;
  line-height: 1.5;
  color: var(--hint);
}
.disclaimer-note-line { margin: 0; }
.disclaimer-note-full { margin: 8px 0 0; }
.disclaimer-note-toggle {
  display: inline;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--link);
  cursor: pointer;
}
.disclaimer-note-toggle:hover { text-decoration: underline; }
/* Ссылки на Политику конфиденциальности / Условия использования (#1699) */
.disclaimer-note-links { margin: 8px 0 0; }
.disclaimer-note-link { color: var(--link); text-decoration: none; }
.disclaimer-note-link:hover { text-decoration: underline; }
.disclaimer-note-dot { margin: 0 6px; color: var(--hint); }

/* #1780: мягкая скрываемая плашка «на домашний экран». Внизу экрана, не
   перекрывает контент модально, закрывается крестиком. */
.hs-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--tg-theme-secondary-bg-color, #1c1c1d);
  color: var(--tg-theme-text-color, #ffffff);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
  font-size: 14px;
  animation: hs-slide-up .25s ease;
}
.hs-banner[hidden] { display: none; }
.hs-banner-text { flex: 1; line-height: 1.3; }
.hs-banner-add {
  flex: none; border: none; border-radius: 9px;
  padding: 8px 14px; font-family: inherit; font-size: 14px; font-weight: 600;
  background: #7c3aed; color: #ffffff; cursor: pointer;
}
.hs-banner-add:active { opacity: .7; }
.hs-banner-close {
  flex: none; border: none; background: transparent;
  color: var(--tg-theme-hint-color, #98989e); font-size: 18px; line-height: 1;
  padding: 4px; cursor: pointer;
}
@keyframes hs-slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hs-banner { animation: none; } }

/* #1811: подсказка «прислать, когда курс вырастет» — в потоке под результатом,
   НЕ фиксированная (в отличие от плашки #1780), чтобы не спорить с ней и не
   перекрывать навигацию. Мягкий пурпурный акцент — тот же, что у кнопки шэра. */
.push-prompt {
  position: relative;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(124, 58, 237, .35);
  border-radius: var(--r);
  background: rgba(124, 58, 237, .08);
}
.push-prompt[hidden] { display: none; }
.push-prompt-close {
  position: absolute; top: 6px; right: 8px;
  border: none; background: transparent; cursor: pointer;
  color: var(--hint); font-size: 18px; line-height: 1; padding: 4px;
}
.push-prompt-body { display: flex; gap: 10px; padding-right: 18px; }
.push-prompt-icon { flex: none; color: #7c3aed; margin-top: 1px; }
.push-prompt-title { font-size: 14px; font-weight: 600; }
.push-prompt-sub { font-size: 12px; color: var(--hint); margin-top: 2px; line-height: 1.35; }
.push-prompt-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.push-prompt-yes {
  border: none; border-radius: 999px;
  padding: 8px 18px; font-family: inherit; font-size: 13px; font-weight: 600;
  background: #7c3aed; color: #ffffff; cursor: pointer;
}
.push-prompt-yes:active { opacity: .7; }
.push-prompt-no {
  border: none; background: transparent; cursor: pointer;
  color: var(--hint); font-family: inherit; font-size: 13px; padding: 8px 6px;
}
