/* BondHound — спокойный, лёгкий интерфейс для Telegram Mini App.
   Принципы: одна акцентная краска, цвет — только для смысла (доход, риск, статус),
   текст не ниже 4.5:1 в обеих темах, ритм отступов кратен 4. */

:root {
  color-scheme: light;
  --bg: #f2f3f6;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --text: #14171c;
  --text-2: #4d5461;
  --muted: #666d7a;
  --line: #e7e9ee;
  --accent: #2470cc;
  --accent-text: #1f66bf;
  --accent-ink: #1b5aa6;
  --accent-soft: #eaf1fb;
  --on-accent: #ffffff;
  /* Значок или цифра поверх яркой заливки (галочки выплат и бенчмарков) */
  --on-fill: #ffffff;
  /* Активный сегмент переключателя и дорожка выключенного тумблера */
  --seg-on: #ffffff;
  --seg-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 0 0 0.5px rgba(16, 24, 40, 0.04);
  --switch-off: #d6dae1;
  --badge-bad: #c23b3b;
  --sheet-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  /* Невыбранные месяцы на графике выплат приглушаются */
  --bar-dim: 0.45;
  --good: #17793a;
  --good-soft: #e6f4eb;
  --bad: #c23b3b;
  --bad-soft: #fcecec;
  --warn: #935700;
  --warn-soft: #fcf2e1;
  --neutral-soft: #eef0f3;
  --press: rgba(20, 24, 31, 0.045);
  --focus: rgba(36, 112, 204, 0.45);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 0 0 0.5px rgba(16, 24, 40, 0.04);
  --shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.12), 0 0 0 0.5px rgba(16, 24, 40, 0.06);
  --backdrop: rgba(14, 17, 22, 0.4);

  /* Порядковая шкала рейтинга: один оттенок, от тёмного к светлому */
  --rs-aaa: #104281;
  --rs-aa: #1c5cab;
  --rs-a: #2a78d6;
  --rs-bbb: #5598e7;
  --rs-bb: #86b6ef;

  /* Выплаты: купоны и номинал — две ступени одного оттенка */
  --pay-coupon: #2a78d6;
  --pay-principal: #86b6ef;
  /* Прошедшие выплаты: получена — зелёный, ждём от брокера — жёлтый */
  --pay-received: #2e9d55;
  --pay-nrd: #1f8f86;
  --pay-pending: #e0a43a;

  /* Линии графика роста: портфель и до трёх бенчмарков — первые слоты проверенной палитры */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-base: #8a91a0;

  /* Форма и ритм */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --gap-card: 12px;
  --tabbar-h: 60px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));

  /* Движение: короткий отклик на нажатие, чуть дольше — на смену состояния */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 120ms;
  --t: 200ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1014;
    --surface: #191c22;
    --surface-2: #21252c;
    --text: #eef0f3;
    --text-2: #b0b7c2;
    --muted: #8a92a0;
    --line: #2a2f37;
    --accent: #2a73cf;
    --accent-text: #5a9df0;
    --accent-ink: #9cc4f5;
    --accent-soft: #1a2a3e;
    --good: #5cc283;
    --good-soft: #16301f;
    --bad: #ec7272;
    --bad-soft: #3a1d1d;
    --warn: #e3a943;
    --warn-soft: #352914;
    --neutral-soft: #262a32;
    --on-fill: #0e1014;
    --seg-on: #3a404b;
    --seg-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --switch-off: #3b414c;
    --badge-bad: #d63b3b;
    --sheet-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    --bar-dim: 0.55;
    --press: rgba(255, 255, 255, 0.05);
    --focus: rgba(90, 157, 240, 0.55);
    /* Тёмная тема: тени не видны — карточке форму даёт едва заметный светлый край */
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px #2a2f37;
    --backdrop: rgba(0, 0, 0, 0.6);
    --rs-aaa: #b8d5f8;
    --rs-aa: #86b7f0;
    --rs-a: #5a9be9;
    --rs-bbb: #3a80dc;
    --rs-bb: #2a6bc0;
    --pay-coupon: #3987e5;
    --pay-principal: #9ec5f4;
    --pay-received: #5cc283;
    --pay-nrd: #3fbdb2;
    --pay-pending: #e0a43a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-base: #747c8a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1014;
  --surface: #191c22;
  --surface-2: #21252c;
  --text: #eef0f3;
  --text-2: #b0b7c2;
  --muted: #8a92a0;
  --line: #2a2f37;
  --accent: #2a73cf;
  --accent-text: #5a9df0;
  --accent-ink: #9cc4f5;
  --accent-soft: #1a2a3e;
  --good: #5cc283;
  --good-soft: #16301f;
  --bad: #ec7272;
  --bad-soft: #3a1d1d;
  --warn: #e3a943;
  --warn-soft: #352914;
  --neutral-soft: #262a32;
  --on-fill: #0e1014;
  --seg-on: #3a404b;
  --seg-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --switch-off: #3b414c;
  --badge-bad: #d63b3b;
  --sheet-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --bar-dim: 0.55;
  --press: rgba(255, 255, 255, 0.05);
  --focus: rgba(90, 157, 240, 0.55);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px #2a2f37;
  --backdrop: rgba(0, 0, 0, 0.6);
  --rs-aaa: #b8d5f8;
  --rs-aa: #86b7f0;
  --rs-a: #5a9be9;
  --rs-bbb: #3a80dc;
  --rs-bb: #2a6bc0;
  --pay-coupon: #3987e5;
  --pay-principal: #9ec5f4;
  --pay-received: #5cc283;
  --pay-nrd: #3fbdb2;
  --pay-pending: #e0a43a;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-base: #747c8a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  /* Без висячих слов в конце абзаца; заголовки — balance (ниже) */
  text-wrap: pretty;
}

/* Фокус с клавиатуры виден всегда, касание пальцем — без рамки. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }
.card:focus-visible, .row:focus-visible { outline-offset: -2px; }

body.no-scroll { overflow: hidden; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

input, select { font: inherit; color: inherit; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; text-wrap: balance; }

.ic { flex: none; display: block; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* ---------- Каркас ---------- */

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  min-height: 100vh;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin: 6px 0 14px;
}

.page-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.group-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 28px 4px 10px;
}

.group-title .muted { font-size: 13px; letter-spacing: 0; font-weight: 400; }

.iev-sub { font-size: 14px; font-weight: 600; color: var(--text); margin: 14px 4px 6px; }
.iev-sub .muted { color: var(--muted); font-weight: 400; }

.footnote {
  font-size: 12.5px;
  color: var(--muted);
  margin: 12px 4px 0;
}

.footnote a { color: var(--accent-text); text-decoration: none; }

/* ---------- Кнопки ---------- */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  transition: background var(--t-fast), transform var(--t-fast) var(--ease);
}

.icon-btn.filled { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 28%, transparent); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.ghost:active { background: var(--neutral-soft); }
/* Маленькая кнопка-иконка: видимый круг 32px, зона касания — 44px. */
.icon-btn.sm { width: 32px; height: 32px; position: relative; }
.icon-btn.sm::after { content: ""; position: absolute; inset: -6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease), background var(--t);
}

.btn:active { transform: scale(0.98); opacity: 0.85; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.secondary { background: var(--accent-soft); color: var(--accent-ink); }
.btn.outline { box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); }
.btn.link { color: var(--accent-text); min-height: 40px; padding: 0 8px; font-weight: 500; }
.btn.link.sm { min-height: 32px; font-size: 14px; }
.btn.danger-link { color: var(--bad); font-weight: 500; }
.btn.block { width: 100%; margin-top: 12px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent-text);
  margin: 8px 0 4px -6px;
  padding: 6px;
}

/* ---------- Бейджи, чипы, сегменты ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--neutral-soft);
  color: var(--text-2);
  white-space: nowrap;
  vertical-align: 1px;
}

.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.rating { font-weight: 600; letter-spacing: 0.02em; }
.badge.r-aaa, .badge.r-aa { background: var(--accent-soft); color: var(--accent-ink); }
.badge.r-a { background: var(--neutral-soft); color: var(--text-2); }
.badge.r-bbb { background: var(--warn-soft); color: var(--warn); }
.badge.r-bb { background: var(--bad-soft); color: var(--bad); }
/* Агентство — тем же цветом, но тише и без разрядки; глаз — рейтинг под наблюдением. */
.badge.rating .r-agency { font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.badge.rating .r-agency::before { content: '· '; }
.badge.rating.r-watch { box-shadow: inset 0 0 0 1px var(--warn); }
.badge.rating.r-watch .ic { margin-left: 4px; color: var(--warn); flex: none; }
.badge.watch-tag { gap: 4px; }
.badge.watch-tag .ic { flex: none; }
/* Рейтинг агентства на странице эмитента: рейтинг и «под наблюдением», под ними действие с датой и прогноз. */
.agency-row { align-items: flex-start; }
.agency-row > span:first-child { white-space: nowrap; }
.agency-row > span:last-child { display: grid; gap: 2px; justify-items: end; }
.watch-mark { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 12.5px; color: var(--warn); vertical-align: -2px; }

.segmented {
  display: flex;
  padding: 3px;
  margin: 20px 0 12px;
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
}

.segmented button {
  flex: 1;
  min-height: 34px;
  border-radius: 9px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--t), color var(--t), box-shadow var(--t);
}

.segmented button.on {
  background: var(--seg-on);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--seg-shadow);
}

.chips { display: flex; gap: 8px; margin: 12px 0; }
.chips.wrap { flex-wrap: wrap; margin: 0; }
.chips.scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
  margin: 7px -16px;
  /* Вертикальный запас — чтобы расширенная зона касания чипов не обрезалась прокруткой. */
  padding: 5px 16px;
}
.chips.scroll-x::-webkit-scrollbar { display: none; }
/* Ленты, которые листаются вбок, мягко гаснут у краёв вместо резкого среза —
   и видно, что за краем есть ещё. Зона затухания — в пределах боковых полей. */
.chips.scroll-x, .bars-scroll {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
  color: var(--text-2);
  white-space: nowrap;
  transition: background var(--t), color var(--t), box-shadow var(--t), transform var(--t-fast) var(--ease);
}

.chip:active { transform: scale(0.96); }

.chip.on {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px transparent;
  color: var(--accent-ink);
  font-weight: 500;
}

.mini-seg { display: flex; gap: 4px; padding: 2px; border-radius: 9px; background: var(--neutral-soft); }
.mini-seg button { padding: 4px 12px; border-radius: 7px; font-size: 14px; color: var(--text-2); transition: background var(--t), color var(--t); }
.mini-seg button.on { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: var(--seg-shadow); }

/* ---------- Списки ---------- */

.list { overflow: hidden; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  position: relative;
  min-height: 56px;
  transition: background var(--t-fast);
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  border-top: 1px solid var(--line);
}

button.row:active, .row.clickable:active, .toggle-row:active { background: var(--press); }
.row.clickable { cursor: pointer; }

.row-main { flex: 1; min-width: 0; display: block; }

.row-title {
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

/* Бейджи и текст в подписи строки: если не помещаются в одну линию, текст целиком
   переносится под бейджи, а не рвётся посередине. */
.row-sub:has(> .badge) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 5px;
}

.row-side { text-align: right; flex: none; }
.row-side .row-sub { white-space: nowrap; }
.row-pct { font-variant-numeric: tabular-nums; }
/* Узкий экран: процент под рублями, чтобы не отнимать ширину у названия выпуска. */
@media (max-width: 359px) {
  .row-pct { display: block; }
  .row-pct .sep { display: none; }
  /* Четыре вкладки не помещаются поровну — ширина по тексту, с зазором между словами */
  .segmented button { flex: 1 1 auto; padding: 0 6px; font-size: 13.5px; }
  .growth .gc-periods { gap: 4px; }
  .gc-periods .chip.sm { padding: 0 9px; }
}
.row-value { font-weight: 600; white-space: nowrap; }

.row.danger .row-title { color: var(--bad); }

.list.plain .row { padding-left: 0; padding-right: 0; }
.list.plain .row + .row::before { left: 0; }

.empty-inline {
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.empty-inline .btn { display: flex; margin: 6px auto 0; }

.tile-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--neutral-soft);
  color: var(--text-2);
}

.tile-icon.lg { width: 56px; height: 56px; border-radius: 16px; }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-neutral { background: var(--neutral-soft); color: var(--text-2); }

.date-pill {
  flex: none;
  width: 44px;
  padding: 4px 0;
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
  line-height: 1.15;
}

.date-pill b { display: block; font-size: 16px; }
.date-pill span { font-size: 11.5px; color: var(--muted); }

/* ---------- Портфель ---------- */

.hero { padding: 18px 18px 16px; }

.hero-top { display: flex; justify-content: space-between; align-items: center; margin: -4px -6px 0 0; }

.hero-value {
  font-size: 38px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 4px 0 6px;
}

.hero-value .cur { margin-left: 0.18em; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.hero-sub { font-size: 14px; transition: opacity var(--t-fast); }
.hero-sub:active { opacity: 0.6; }
.hero-sub .good, .hero-sub .bad { font-weight: 500; }
.hero-parts { font-size: 12px; margin-top: 2px; }
.hero-foot { font-size: 12px; margin-top: 8px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stat b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin-top: 2px; white-space: nowrap; }
.stat .muted { font-size: 12.5px; }

.next-pay {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: var(--gap-card);
  padding: 14px 16px;
  transition: transform var(--t-fast) var(--ease);
}

.next-pay:active, .issuer-card:active { transform: scale(0.985); }

.next-pay .row-title { margin-top: 1px; }
.np-amount { display: block; font-weight: 600; white-space: nowrap; }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  margin-top: var(--gap-card);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}

/* Карточка «Требует внимания» на экране портфеля */
.attn { margin-top: var(--gap-card); }
.attn-row { align-items: flex-start; padding-top: 14px; padding-bottom: 14px; }
.attn-row .tile-icon { width: 32px; height: 32px; border-radius: 9px; margin-top: 1px; }
.attn-row + .attn-row::before { left: 60px; }
.attn-title { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; }
.attn-row.attn-bad .attn-title { color: var(--bad); }
.attn-text { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.4; color: var(--text-2); }
.attn-go { color: var(--muted); align-self: center; opacity: 0.7; }

.notice .ic { color: var(--accent-text); margin-top: 1px; }
.notice.tone-bad { background: var(--bad-soft); color: var(--text); }
.notice.tone-bad .ic { color: var(--bad); }
.notice.tone-warn { background: var(--warn-soft); color: var(--text); }
.notice.tone-warn .ic { color: var(--warn); }

.block { padding: 16px; margin-bottom: var(--gap-card); }
.block-title { font-size: 15px; margin-bottom: 14px; }

.stack {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
}

.stack i { display: block; min-width: 3px; }

.legend { margin-top: 12px; }

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
}

.legend-label { flex: 1; }
.legend-row .muted { font-size: 13px; }
.legend-row b { width: 52px; text-align: right; font-weight: 600; }

.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

.rs-aaa { background: var(--rs-aaa); }
.rs-aa { background: var(--rs-aa); }
.rs-a { background: var(--rs-a); }
.rs-bbb { background: var(--rs-bbb); }
.rs-bb { background: var(--rs-bb); }
.rs-nr { background: var(--muted); }
.kv-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); text-decoration: none; }

.hbar + .hbar { margin-top: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.hbar-top b { font-weight: 600; }
.hbar-track { height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.chart-value { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }

.legend.inline { display: flex; gap: 12px; margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); }
.legend.inline span { display: inline-flex; align-items: center; gap: 5px; }

/* Лента столбиков: прошлые месяцы + 12 будущих; не помещается — листается вбок */
.bars-scroll {
  position: relative;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 0 16px;
  scrollbar-width: none;
}

.bars-scroll::-webkit-scrollbar { display: none; }

.bars {
  display: grid;
  grid-template-columns: repeat(var(--cols, 12), minmax(24px, 1fr));
  gap: 4px;
  height: 132px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border-radius: 8px;
  padding-top: 4px;
}

.bar-stack {
  flex: 1;
  width: 100%;
  max-width: 22px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.bar-stack i { display: block; width: 100%; min-height: 2px; }
.bar-stack i:last-child { border-radius: 4px 4px 0 0; }

.b-coupon { background: var(--pay-coupon); }
.b-principal { background: var(--pay-principal); }
.b-received { background: var(--pay-received); }
.b-pending { background: var(--pay-pending); }
.b-nrd { background: var(--pay-nrd); }

.bar-col.now .bar-label { text-decoration: underline; text-underline-offset: 3px; }
.chart-card .legend.inline { flex-wrap: wrap; margin-top: 12px; }

.pay-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 16px;
  margin-top: 10px;
}

.pay-total .label { display: inline-flex; align-items: center; gap: 5px; }
.pay-total b { display: block; font-size: 16px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.pay-total .muted { font-size: 12px; }

.pay-row { padding-right: 12px; }

/* Подсветка выплаты, к которой привёл переход из шапки портфеля */
@keyframes pay-flash { from { background: var(--accent-soft); } to { background: transparent; } }
.row.flash { animation: pay-flash 1.6s ease-out 0.35s backwards; }
.pay-open { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; }
.pay-open:active { opacity: 0.7; }
.pay-st.good { color: var(--good); }
.pay-st.warn { color: var(--warn); }
.pay-st.accent { color: var(--pay-nrd); }
.pay-st.bad { color: var(--bad); }

.pay-check {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--pay-pending);
  color: transparent;
  transition: background-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--ease);
}

.pay-check .ic {
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 140ms ease-out, transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pay-check.on .ic { opacity: 1; transform: none; }

.pay-check.late { box-shadow: inset 0 0 0 1.5px var(--bad); }
.pay-check.nrd { box-shadow: inset 0 0 0 1.5px var(--pay-nrd); }
.pay-check.on { background: var(--pay-received); box-shadow: none; color: var(--on-fill); }
.pay-check:active { transform: scale(0.92); }

.group-title .btn { text-transform: none; letter-spacing: 0; font-weight: 500; }

.bar-col:not(.on) .bar-stack i { opacity: var(--bar-dim); }
.bar-label { font-size: 11px; color: var(--muted); }
.bar-col.on .bar-label { color: var(--text); font-weight: 600; }

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 0;
  font-size: 14px;
  color: var(--text-2);
}

.summary-line b { color: var(--text); font-weight: 600; }

.empty { padding: 32px 20px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty .tile-icon { margin-bottom: 14px; }
.empty h2 { font-size: 19px; }
.empty p { color: var(--text-2); margin: 6px 0 18px; max-width: 300px; }
.empty .btn.primary { width: 100%; max-width: 280px; }

/* ---------- Карточка облигации ---------- */

.detail-head { margin: 8px 0 16px; }
.detail-head h1 { font-size: 24px; }
.detail-sub { color: var(--text-2); margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
  padding: 16px;
}

.stats-grid .stat b { font-size: 18px; }
.stats-grid .stat .muted { display: block; margin-top: 1px; }

.position-card { padding: 14px 16px 16px; margin-top: 10px; }
.pc-top { display: flex; justify-content: space-between; align-items: center; margin: -6px -8px 4px 0; }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pc-grid b { display: block; font-weight: 600; margin-top: 1px; }
.position-card > .row-sub { margin-top: 10px; }

.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

.kv { padding: 4px 16px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; font-size: 14.5px; }
.kv-row + .kv-row { border-top: 1px solid var(--line); }
.kv-row span:last-child { text-align: right; }

.row.static { cursor: default; }

.status-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
}

.status-banner > .ic { margin-top: 1px; }
.status-banner.tone-bad > .ic { color: var(--bad); }
.status-banner.tone-warn > .ic { color: var(--warn); }
.sb-title { font-weight: 600; margin-bottom: 2px; }
.sb-text { color: var(--text); }

/* Отчётность */

.report { padding: 14px 16px 16px; }
.report-verdict { margin-top: 8px; }

.report-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin: 14px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.rm b { display: block; font-weight: 600; margin-top: 1px; white-space: nowrap; }
.rm-change { font-size: 12.5px; color: var(--muted); }
.rm-change.good { color: var(--good); }
.rm-change.bad { color: var(--bad); }
.report-summary { margin: 0; font-size: 14px; color: var(--text-2); }
.report-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--accent-text); text-decoration: none; }
details.report { margin-top: 10px; }
details.report summary { list-style: none; cursor: pointer; }
details.report summary::-webkit-details-marker { display: none; }
details.report:not([open]) .report-head .row-sub::after { content: " · подробнее"; color: var(--accent-text); }

/* ---------- Скринер ---------- */

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.sheet .search-field { background: var(--surface-2); }

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
}

.search-field input::placeholder { color: var(--muted); }
.search-field input::-webkit-search-cancel-button { display: none; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }

.sort-select { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

.sort-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-text);
  font-weight: 500;
  padding: 6px 2px;
  outline: 0;
}

.toolbar + .chips { margin-top: 10px; }
.toolbar + .chips.scroll-x { margin-top: 5px; }
.results-meta { font-size: 13px; margin: 4px 4px 8px; }

.dot-held {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 3px;
  margin-left: 2px;
}

/* ---------- События ---------- */

.row.event { align-items: flex-start; }
.row.event .row-title { white-space: normal; }
.ev-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent-text);
  text-decoration: none;
}
.ev-yours + .ev-link { margin-left: 10px; }
.row.event .tile-icon { margin-top: 2px; }
.ev-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ev-top .row-title { flex: 1; }
.ev-date { flex: none; font-size: 12.5px; color: var(--muted); }
.ev-subject { font-size: 13.5px; color: var(--text-2); margin-top: 1px; }
.ev-text { font-size: 14px; line-height: 1.45; margin-top: 4px; color: var(--text-2); }
.ev-yours {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--good-soft);
  color: var(--good);
  font-weight: 500;
}

.row.event.fresh .row-title::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}

/* ---------- Профиль ---------- */

.profile-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }

.avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 18px;
  object-fit: cover;
}

.profile-card .row-title { font-size: 17px; }

/* Тема: подпись сверху, переключатель на всю ширину — три варианта не влезают в строку. */
.theme-row { flex-direction: column; align-items: stretch; gap: 10px; }
.theme-row .segmented { margin: 0; }
.row-go { flex: none; color: var(--muted); }

.notice.static { cursor: default; }

.about {
  margin: 28px 4px 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  display: grid;
  gap: 4px;
}
.about-logo { justify-self: center; margin-bottom: 6px; border-radius: 13px; box-shadow: 0 2px 8px rgb(15 47 87 / .18); }
.about-brand b { color: var(--text); font-weight: 650; letter-spacing: .01em; }
.about-tagline { margin-bottom: 6px; font-style: italic; }

/* ---------- Переключатель ---------- */

.toggle-row { cursor: pointer; }

.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: var(--switch-off);
  transition: background 0.2s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Нижняя шторка ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 50; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.25s;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 0 16px calc(var(--safe-bottom) + 16px);
  box-shadow: var(--sheet-shadow);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }

.sheet-grip { position: relative; width: 36px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 35%, transparent); margin: 8px auto 4px; cursor: grab; touch-action: none; }
/* «Ручку» мышью легко поймать: зона захвата шире полоски */
.sheet-grip::after { content: ""; position: absolute; inset: -8px -48px; }
.sheet.dragging, .sheet-backdrop.dragging { transition: none; }
.sheet.dragging .sheet-grip { cursor: grabbing; }
/* Закрытие короче открытия и с ускорением — шторка «уходит», а не плывёт */
.sheet-wrap.closing .sheet { transition: transform 200ms cubic-bezier(0.4, 0, 1, 1); }
.sheet-wrap.closing .sheet-backdrop { transition: opacity 200ms; }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.sheet-head h2 { flex: 1; font-size: 19px; }
.sheet-head .icon-btn:first-child { margin-left: -10px; }
.sheet-head .icon-btn:last-child { margin-right: -10px; }

.sheet .list.plain { margin-top: 6px; }

.mini-bond { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 14px; }

.field { display: block; margin-top: 12px; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .range input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  outline: 0;
}
.field input:focus, .range input:focus { border-color: var(--accent); }

.sum-line { margin-top: 14px; font-size: 14px; color: var(--text-2); }
.sum-line b { color: var(--text); }

.f-group { margin-top: 18px; }
.f-group:first-of-type { margin-top: 4px; }
.f-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.range { display: flex; align-items: center; gap: 10px; }
.f-toggles { margin-top: 14px; }

.sheet-actions.single { grid-template-columns: 1fr; }
.btn.danger-soft { background: var(--bad-soft); color: var(--bad); }

.sheet-actions {
  position: sticky;
  bottom: calc(-1 * (var(--safe-bottom) + 16px));
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin: 16px -16px 0;
  padding: 12px 16px calc(var(--safe-bottom) + 16px);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* ---------- Таб-бар ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 0.5px solid var(--line);
}

.tab {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--t);
}

.tab.on { color: var(--accent-text); font-weight: 600; }
/* Активная вкладка — мягкая «таблетка» под иконкой */
.tab-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 28px;
  border-radius: 14px;
  transition: background var(--t), transform var(--t-fast) var(--ease);
}
.tab.on .tab-icon { background: var(--accent-soft); }
.tab:active .tab-icon { transform: scale(0.92); }

.tab-badge {
  position: absolute;
  top: -3px;
  left: 29px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge-bad);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Тост ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Telegram Desktop и браузер: подсветка под курсором, на тач-экранах её нет. */
@media (hover: hover) {
  button.row:hover, .row.clickable:hover, .toggle-row:hover { background: var(--press); }
  .chip:not(.on):hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 45%, transparent); }
  .icon-btn.ghost:hover { background: var(--neutral-soft); }
  .card.next-pay:hover, .card.issuer-card:hover { box-shadow: var(--shadow-pop); }
}

/* Переход вглубь (выпуск, эмитент): блоки появляются по очереди — снизу на 6 px и из прозрачности */
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }
.screen.enter > * { animation: screen-in 260ms var(--ease) backwards; }
.screen.enter > :nth-child(2) { animation-delay: 40ms; }
.screen.enter > :nth-child(3) { animation-delay: 80ms; }
.screen.enter > :nth-child(n+4) { animation-delay: 120ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
  .screen.enter > * { animation: none !important; }
}

/* ---------- Подтверждение ---------- */

.ask { display: grid; gap: 18px; padding-top: 8px; }
.ask h2 { font-size: 18px; text-wrap: balance; }
.ask-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.danger { background: var(--bad); color: var(--on-accent); }

/* ---------- Налоговая задолженность ---------- */

.td-clean { display: flex; align-items: center; gap: 12px; }
.td-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 2px; }
.td-value { display: block; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.td-top .badge { flex: none; }
.td-parts { padding: 0; margin-top: 10px; border-top: 1px solid var(--line); }
.td-history { margin-top: 12px; display: grid; gap: 6px; font-size: 14px; }
.td-step { display: flex; justify-content: space-between; gap: 12px; }
.td-step > span:first-child { color: var(--text-2); }

/* ---------- Эмитент ---------- */

.issuer-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  color: var(--accent-text);
  font-size: 15px;
}

.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.badge.title-badge { height: 24px; font-size: 13px; font-weight: 600; }
.about-text { margin: 12px 0 0; color: var(--text); max-width: 60ch; }

.follow-btn { margin: 0 0 4px; }

.holding { padding: 14px 16px; margin-bottom: 10px; }
.holding-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 2px; }
.holding-row b { font-size: 20px; font-weight: 650; }
.holding-warn { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 13.5px; color: var(--warn); }
.holding-warn .ic { margin-top: 1px; }

.risk + .risk { margin-top: 10px; }
.risk summary { list-style: none; cursor: pointer; }
.risk summary::-webkit-details-marker { display: none; }
.risk-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.risk-chevron { color: var(--muted); transition: transform 0.2s; }
.risk[open] .risk-chevron { transform: rotate(90deg); }
.risk-body { padding: 0 16px 16px 64px; }
.risk-body .td-parts { margin-top: 10px; }
.risk-body .kv-row { flex-direction: column; gap: 1px; padding: 9px 0; }
.risk-body .kv-row span:last-child { text-align: left; }

.scale { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin-top: 14px; }
.scale span {
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--neutral-soft);
}
.scale span:first-child { border-radius: 6px 0 0 6px; }
.scale span:last-child { border-radius: 0 6px 6px 0; }
.scale span.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.scale span.on.bad { background: var(--bad); }
.scale-hint { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11.5px; color: var(--muted); }

.hbar-link { display: block; width: 100%; padding: 2px 0; }
.hbar-link .hbar-top span:first-child { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hbar-side { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); }
.hbar-side b { color: var(--text); }

.more-btn { margin-top: 4px; }

.issuer-card { display: flex; width: 100%; padding: 14px 16px; text-align: left; }
.issuer-card:active { background: var(--surface-2); }
.issuer-about {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-2);
}
.issuer-card .tags { margin-top: 10px; }
.issuer-more { display: inline-flex; align-items: center; gap: 2px; margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--accent-text); }


/* ---------- Доход и сделки ---------- */

.hero-link { display: inline-flex; align-items: center; gap: 4px; }
.hero-link .ic { color: var(--muted); }
.stats.stats-4 { grid-template-columns: 1fr 1fr; row-gap: 14px; }
.stats-4 .stat .muted { display: block; font-size: 12px; margin-top: 1px; }

.income-tabs { margin: 0 0 10px; }
.income { padding: 6px 16px; }
.inc-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; }
.inc-line > span { display: flex; flex-direction: column; min-width: 0; }
.inc-line > span .muted { font-size: 12.5px; margin-top: 1px; }
.inc-line b { font-weight: 600; white-space: nowrap; }
.inc-line + .inc-line, .inc-group, .inc-group + .inc-line { border-top: 1px solid var(--line); }
.inc-line.total { font-weight: 600; }
.inc-line.total b { font-size: 17px; }
.inc-group { padding-bottom: 8px; }
.inc-sub { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); padding: 2px 0 2px 12px; }
.inc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 0; }
.inc-stats .stat { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.inc-stats .stat .muted { display: block; font-size: 12px; margin-top: 2px; }

.actions-row.three { grid-template-columns: 1fr 1fr 1fr; }
.actions-row.three .btn { padding-left: 8px; padding-right: 8px; font-size: 14px; }

.trade-side { margin: 0 0 14px; }
.field-head { display: flex !important; justify-content: space-between; gap: 8px; }
.field-head em { font-style: normal; color: var(--muted); text-align: right; }
.field-row { display: flex !important; gap: 8px; margin: 0 !important; color: var(--text) !important; font-size: 15px !important; }
.field-row input { flex: 1; }
.btn.sm { min-height: 46px; padding: 0 16px; font-size: 14px; }
.link-btn { color: var(--accent-text); font-size: 13px; }

.trade-sum { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.ts-line { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; color: var(--text-2); }
.ts-line span:last-child { color: var(--text); white-space: nowrap; }
.ts-total { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text); }
.ts-total b { font-weight: 600; }
.ts-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.ts-sale { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.ts-title { font-weight: 600; margin-bottom: 4px; }
.ts-warn { display: flex; gap: 6px; align-items: flex-start; margin-top: 10px; color: var(--bad); }
.ts-line .good { color: var(--good) !important; }
.ts-line .bad { color: var(--bad) !important; }

.fee-input { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.fee-input input { width: 72px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); outline: 0; text-align: right; }
.fee-input input:focus { border-color: var(--accent); }

/* ---------- График роста ---------- */

.growth { padding-bottom: 16px; margin-top: var(--gap-card); }
.gc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.gc-head .block-title { margin: 0; white-space: nowrap; }
.gc-head .mini-seg button { padding: 4px 9px; font-size: 13.5px; }
.gc-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 10px; font-size: 14px; }
.gc-value b { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.gc-empty { display: flex; align-items: center; gap: 8px; min-height: 120px; justify-content: center; color: var(--text-2); font-size: 14px; text-align: center; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.gchart { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.gc-plot { position: relative; height: 170px; margin-right: 44px; }
.gc-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gc-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.gc-zero { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.gc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.gc-line.dashed { stroke-dasharray: 4 4; stroke-width: 1.5; }
.gc-area { fill: var(--series-1); opacity: 0.08; }
.gc-ytick { position: absolute; left: 100%; transform: translate(6px, -50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.gc-xticks { display: flex; justify-content: space-between; margin: 6px 44px 0 0; font-size: 11px; color: var(--muted); }
.gc-cross { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; }
.gc-cross i { position: absolute; top: 0; bottom: 0; left: -0.5px; width: 1px; background: var(--text-2); opacity: 0.5; }
.gc-dot { position: absolute; left: -5px; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.gc-tip { position: absolute; top: 4px; min-width: 150px; padding: 8px 10px; border-radius: 10px; background: var(--surface); box-shadow: 0 4px 16px rgba(20, 24, 31, 0.14), inset 0 0 0 1px var(--line); font-size: 12.5px; pointer-events: none; z-index: 2; }
.gc-tip.below { top: auto; bottom: 4px; }
.gc-tip-date { color: var(--muted); margin-bottom: 4px; }
.gc-tip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.gc-tip-row span { flex: 1; color: var(--text-2); }
.gc-tip-row b { font-weight: 600; white-space: nowrap; }

.gc-periods { margin: 14px 0 0; gap: 6px; flex-wrap: wrap; }
.chip.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.chip.add { color: var(--accent-text); }
.gc-legend { flex-wrap: wrap; align-items: center; margin-top: 12px; row-gap: 8px; }
.sw { display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor; flex: none; }
.sw.dashed { border-top-style: dashed; }
.s-1 { color: var(--series-1); stroke: var(--series-1); }
.s-2 { color: var(--series-2); stroke: var(--series-2); }
.s-3 { color: var(--series-3); stroke: var(--series-3); }
.s-4 { color: var(--series-4); stroke: var(--series-4); }
.s-base { color: var(--series-base); stroke: var(--series-base); }
.gc-dot.s-1 { background: var(--series-1); }
.gc-dot.s-2 { background: var(--series-2); }
.gc-dot.s-3 { background: var(--series-3); }
.gc-dot.s-4 { background: var(--series-4); }
.gc-dot.s-base { background: var(--series-base); }
.gc-compare { margin-top: 12px; border-top: 1px solid var(--line); }
.gc-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 14px; }
.gc-row + .gc-row { border-top: 1px solid var(--line); }
.gc-row .legend-label { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.gc-row b { font-weight: 600; white-space: nowrap; }
.gc-note { margin: 10px 0 0; }

/* ---------- Бенчмарки ---------- */

.sheet-note { font-size: 13px; color: var(--text-2); margin: 0 0 4px; }
.bench-row { padding-right: 0; }
.bench-pick { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; }
.bench-check { flex: none; width: 24px; height: 24px; border-radius: 7px; box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; transition: background-color var(--t-fast), box-shadow var(--t-fast); }
.bench-check.on { color: var(--on-fill); box-shadow: none; }
.bench-check.on.s-2 { background: var(--series-2); }
.bench-check.on.s-3 { background: var(--series-3); }
.bench-check.on.s-4 { background: var(--series-4); }
.bench-parts-title { margin-top: 18px; }
.bench-part { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.bench-part select { flex: 1 1 100%; height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.bench-num { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.bench-num input { width: 70px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); outline: 0; text-align: right; }
.bench-num input:focus, .bench-part select:focus { border-color: var(--accent); outline: 0; }

.row-sub.good, .row-value.good { color: var(--good); }
.row-sub.bad, .row-value.bad { color: var(--bad); }

.ts-main { color: var(--text); }
.ts-main b { font-weight: 600; }
.ts-main + .ts-line { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text); }
.inc-note { font-size: 13px; color: var(--text-2); padding: 0 0 10px; }
.gc-legend b { font-weight: 600; color: var(--text); }
.gc-value { margin-bottom: 4px; }
.gc-legend { margin: 0 0 12px; }

.inc-label { display: flex; flex-direction: column; min-width: 0; }
.inc-label .muted { font-size: 12.5px; margin-top: 1px; }
.earned { margin-top: 4px; }

/* ---------- Зоны касания ----------
   Мелкие ссылки и переключатели выглядят как раньше, но принимают касание в зоне ~44 px
   (рекомендация Apple и Telegram): невидимое расширение через ::after, без сдвига вёрстки. */
.hero-link, .issuer-link, .ev-link, .report-link, .kv-link, .issuer-more, .link-btn,
.pay-check, .segmented button, .chip, .mini-seg button, .btn.link.sm, .back-link {
  position: relative;
}
/* У выпадающего списка псевдоэлемента нет — расширяем его самого, гасим отрицательным отступом. */
.sort-select select { padding-top: 12px; padding-bottom: 12px; margin: -6px 0; }
.hero-link::after, .issuer-link::after, .ev-link::after, .report-link::after, .kv-link::after,
.issuer-more::after, .link-btn::after, .pay-check::after, .segmented button::after, .chip::after,
.mini-seg button::after, .btn.link.sm::after, .back-link::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--hit-y, 12px)) calc(-1 * var(--hit-x, 0px));
}
.issuer-link { --hit-y: 11px; }
.link-btn { --hit-y: 13px; }
.pay-check { --hit-y: 6px; --hit-x: 6px; }
.segmented button, .chip, .back-link { --hit-y: 5px; }
.chip.sm { --hit-y: 7px; }
.mini-seg button { --hit-y: 8px; }
.btn.link.sm { --hit-y: 6px; }
