/* Облигационный портфель — тёмный дашборд с анимацией. Без внешних зависимостей. */

:root {
  --bg: #0b1020;
  --bg-soft: #121a33;
  --card: rgba(23, 32, 58, 0.82);
  --card-border: rgba(120, 150, 220, 0.14);
  --text: #e8edf9;
  --muted: #8ea0c4;
  --accent: #4f8cff;
  --accent-2: #00c2a8;
  --pos: #2fd48a;
  --neg: #ff6b6b;
  --warn: #ffb020;
  --radius: 18px;
  --shadow: 0 18px 45px rgba(3, 8, 22, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(79, 140, 255, 0.20), transparent 60%),
    radial-gradient(760px 460px at 88% 0%, rgba(0, 194, 168, 0.16), transparent 62%),
    radial-gradient(700px 600px at 50% 110%, rgba(167, 139, 250, 0.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: bg-drift 24s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, -18px, 0) scale(1.04); }
}

main {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 26px 60px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ------------------------------------------------------------------ шапка */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 26px;
  background: rgba(11, 16, 32, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(0, 194, 168, 0.65);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 194, 168, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(0, 194, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 194, 168, 0); }
}

.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-link:hover { color: var(--text); background: rgba(120, 160, 255, 0.10); transform: translateY(-1px); }
.nav-link.active { color: #fff; background: linear-gradient(135deg, rgba(79,140,255,.28), rgba(0,194,168,.20)); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.sync-stamp { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sync-stamp.warn { color: var(--warn); }

.btn {
  border: 0;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #06122a;
  background: linear-gradient(135deg, #6ea2ff, #00c2a8);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  box-shadow: 0 8px 20px rgba(79, 140, 255, 0.28);
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(79, 140, 255, 0.36); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--card-border);
  box-shadow: none;
}
.btn.ghost:hover { color: var(--text); background: rgba(120, 160, 255, 0.08); }
.btn.wide { width: 100%; padding: 12px; }

/* ------------------------------------------------------------------ карточки */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise .55s cubic-bezier(.2, .7, .3, 1) both;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-2 > .card { display: flex; flex-direction: column; }
.grid-2 > .card > .bars,
.grid-2 > .card > .donut-wrap { margin-top: auto; margin-bottom: auto; }
.grid-2 > .card:nth-child(2) { animation-delay: .08s; }

@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-head h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.card-note { color: var(--muted); font-size: 12.5px; }
.card-link { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 550; }
.card-link:hover { text-decoration: underline; }

.banner {
  border-left: 3px solid var(--warn);
  font-size: 13.5px;
  color: var(--muted);
  padding: 14px 18px;
}
.banner b { color: var(--text); }
.banner-ok { border-left-color: var(--pos); color: var(--text); }
.banner-err { border-left-color: var(--neg); color: var(--text); }

.card form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card form input {
  flex: 1 1 240px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(9, 14, 28, .7);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.card form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.18); }

/* ------------------------------------------------------------------ KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .kpis { grid-template-columns: 1fr; } }

.kpi {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
  transition: transform .2s ease, border-color .2s ease;
}
.kpi:nth-child(2) { animation-delay: .06s; }
.kpi:nth-child(3) { animation-delay: .12s; }
.kpi:nth-child(4) { animation-delay: .18s; }
.kpi:hover { transform: translateY(-3px); border-color: rgba(120, 160, 255, 0.32); }

.kpi::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,140,255,.22), transparent 70%);
}
.kpi.pos::after { background: radial-gradient(circle, rgba(47,212,138,.22), transparent 70%); }
.kpi.neg::after { background: radial-gradient(circle, rgba(255,107,107,.22), transparent 70%); }

.kpi-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .7px; }
.kpi-value { font-size: 27px; font-weight: 680; margin: 6px 0 3px; letter-spacing: -.4px; }
.kpi.pos .kpi-value { color: var(--pos); }
.kpi.neg .kpi-value { color: var(--neg); }
.kpi-sub { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ графики */
.donut-wrap { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.donut { width: 200px; height: 200px; flex: none; }

.donut circle {
  stroke-dasharray: var(--len) var(--gap);
  animation: donut-grow 1.05s cubic-bezier(.3, .8, .3, 1) both;
  transition: stroke-width .18s ease, opacity .18s ease;
  cursor: default;
}
.donut circle:hover { stroke-width: 32; }
.donut:hover circle { opacity: .5; }
.donut:hover circle:hover { opacity: 1; }

@keyframes donut-grow {
  from { stroke-dasharray: 0 var(--circ); }
  to   { stroke-dasharray: var(--len) var(--gap); }
}

.donut-total { fill: var(--text); font-size: 21px; font-weight: 680; text-anchor: middle; }
.donut-label { fill: var(--muted); font-size: 11px; text-anchor: middle; letter-spacing: .5px; }

.legend { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 7px; }
.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
  padding: 5px 8px;
  border-radius: 9px;
  transition: background .16s ease;
  animation: fade-in .5s ease both;
}
.legend-row:hover { background: rgba(120, 160, 255, 0.08); }
.swatch { width: 12px; height: 12px; border-radius: 4px; }
.legend-name { color: var(--text); }
.legend-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-share { font-weight: 620; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.legend-share.warn { color: var(--warn); }

@keyframes fade-in { from { opacity: 0; transform: translateX(-6px); } }

.bars { width: 100%; height: auto; overflow: visible; }
.bars rect {
  transform-origin: bottom;
  animation: bar-grow .75s cubic-bezier(.25,.8,.3,1) both;
  transition: filter .18s ease;
}
.bars .bar:hover rect { filter: brightness(1.25); }
.bar-label { fill: var(--muted); font-size: 10.5px; text-anchor: middle; }
.bar-value {
  fill: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  text-anchor: middle;
  opacity: 0;
  animation: fade-in-up .5s ease forwards;
  animation-delay: .55s;
}
@keyframes fade-in-up { from { opacity: 0; transform: translateY(5px); } to { opacity: .85; transform: none; } }

@keyframes bar-grow { from { transform: scaleY(0); opacity: .2; } }

/* ------------------------------------------------------------------ таблицы */
.table-wrap { overflow-x: auto; border-radius: 12px; }
.table-wrap.tall { max-height: 560px; overflow-y: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  background: rgba(16, 24, 46, 0.96);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  border-bottom: 1px solid var(--card-border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(120, 150, 220, 0.07);
  font-variant-numeric: tabular-nums;
}
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: rgba(120, 160, 255, 0.07); }
table.compact td, table.compact th { padding: 8px 10px; font-size: 13.5px; }

.right { text-align: right; }
.strong { font-weight: 620; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.total-row td { background: rgba(79, 140, 255, 0.10); font-weight: 620; }
.month-sep td {
  background: rgba(120, 150, 220, 0.09);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  font-weight: 620;
}
tr.closed td { opacity: .5; }
.empty { color: var(--muted); text-align: center; padding: 26px; font-size: 14px; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-coupon    { background: rgba(47, 212, 138, .16); color: var(--pos); }
.tag-principal { background: rgba(255, 176, 32, .16); color: var(--warn); }
.tag-buy       { background: rgba(120, 160, 255, .16); color: #9dc0ff; }

/* ------------------------------------------------------------------ таймлайн */
.timeline { display: flex; gap: 0; align-items: stretch; overflow-x: auto; padding: 6px 2px 14px; }
.tl-item {
  position: relative;
  flex: 1 0 132px;
  padding: 14px 12px 12px;
  border-left: 1px solid rgba(120, 150, 220, 0.14);
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.tl-item:first-child { border-left: 0; }
.tl-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-2); margin-bottom: 9px;
  box-shadow: 0 0 0 4px rgba(0, 194, 168, .14);
}
.tl-item.principal .tl-dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 176, 32, .14); }
.tl-date { font-size: 12px; color: var(--muted); }
.tl-name { font-size: 13px; margin: 3px 0; line-height: 1.25; }
.tl-sum { font-weight: 650; font-size: 15px; }

/* ------------------------------------------------------------------ вход */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  position: relative;
  z-index: 1;
  width: min(380px, 92vw);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 32px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.login-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 650; }
.login-sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 20px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(9, 14, 28, .7);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, .18); }
.login-error {
  color: var(--neg);
  font-size: 13px;
  margin-bottom: 12px;
  animation: shake .4s ease;
}
@keyframes shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ------------------------------------------------------------------ тост */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: rgba(18, 26, 51, .97);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 13px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================================================================= HUD-слой
   Приборная панель: сканирующие блики, вращающиеся кольца, угловые скобки.
   Всё оформление — CSS поверх существующей разметки, данных не касается. */

/* Медленно ползущая координатная сетка на фоне */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  background-image:
    linear-gradient(rgba(120, 160, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, .045) 1px, transparent 1px);
  background-size: 54px 54px;
  pointer-events: none;
  z-index: 0;
  animation: grid-crawl 38s linear infinite;
}

@keyframes grid-crawl {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(54px, 54px, 0); }
}

/* Угловые скобки на карточках — «прицел» вокруг блока */
.card { position: relative; }

.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(120, 160, 255, .38);
  opacity: .55;
  pointer-events: none;
  transition: opacity .25s ease, width .25s ease, height .25s ease;
}

.card::before {
  top: -1px; left: -1px;
  border-right: 0; border-bottom: 0;
  border-top-left-radius: var(--radius);
}

.card::after {
  bottom: -1px; right: -1px;
  border-left: 0; border-top: 0;
  border-bottom-right-radius: var(--radius);
}

.card:hover::before,
.card:hover::after { opacity: 1; width: 26px; height: 26px; }

/* Блик, пробегающий по KPI-карточкам волной */
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent,
              rgba(140, 180, 255, .13) 45%, rgba(140, 180, 255, .18) 55%, transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  animation: sweep 7s ease-in-out infinite;
}

.kpi:nth-child(2)::before { animation-delay: .5s; }
.kpi:nth-child(3)::before { animation-delay: 1s; }
.kpi:nth-child(4)::before { animation-delay: 1.5s; }

@keyframes sweep {
  0%, 62%  { left: -60%; }
  92%, 100% { left: 115%; }
}

/* Цифра KPI слегка «дышит» подсветкой, пока данные свежие */
.kpi-value { position: relative; }

.kpi-value[data-value] {
  animation: value-glow 5.5s ease-in-out infinite;
}

@keyframes value-glow {
  0%, 100% { text-shadow: 0 0 0 rgba(120, 170, 255, 0); }
  50%      { text-shadow: 0 0 18px rgba(120, 170, 255, .30); }
}

/* Кольца вокруг диаграммы концентрации: два контура, разная скорость */
.donut-wrap { position: relative; }

.donut { position: relative; z-index: 1; }

.donut-wrap::before,
.donut-wrap::after {
  content: "";
  position: absolute;
  left: 100px;
  top: 50%;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.donut-wrap::before {
  width: 196px; height: 196px;
  border: 1px dashed rgba(120, 160, 255, .55);
  animation: ring-spin 26s linear infinite;
}

.donut-wrap::after {
  width: 220px; height: 220px;
  border: 1px solid rgba(0, 194, 168, .22);
  border-top-color: rgba(0, 194, 168, .85);
  border-right-color: rgba(0, 194, 168, .45);
  box-shadow: 0 0 22px rgba(0, 194, 168, .10);
  animation: ring-spin 14s linear infinite reverse;
}

/* Радарный луч, обегающий диаграмму */
.donut-radar {
  position: absolute;
  left: 100px;
  top: 50%;
  width: 186px;
  height: 186px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg,
              rgba(0, 194, 168, .22), rgba(0, 194, 168, .06) 22deg, transparent 46deg);
  pointer-events: none;
  animation: ring-spin 7.5s linear infinite;
  z-index: 0;
}

/* Метка-риска на внешнем кольце: видно, что «прибор» живой */
.donut-tick {
  position: absolute;
  left: 100px;
  top: 50%;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: ring-spin 14s linear infinite reverse;
}

.donut-tick i {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}

@media (max-width: 700px) {
  .donut-radar, .donut-tick { display: none; }
}

@keyframes ring-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 700px) {
  .donut-wrap::before, .donut-wrap::after { display: none; }
}

/* Строка таблицы подсвечивается бегущей полосой при наведении */
tbody tr { position: relative; }

tbody tr:hover {
  background: linear-gradient(90deg, rgba(79, 140, 255, .12), rgba(79, 140, 255, .02));
}

/* Индикатор живых данных рядом со временем обновления */
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .4px;
  text-transform: uppercase;
}

.live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: live-blink 1.8s ease-in-out infinite;
}

@keyframes live-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .25; transform: scale(.7); }
}

/* Кнопка синхронизации во время работы: вращающееся кольцо вместо текста */
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }

.btn.loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 15px; height: 15px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, .28);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ring-spin-simple .7s linear infinite;
}

@keyframes ring-spin-simple {
  to { transform: rotate(360deg); }
}

/* Полоса сканирования поверх страницы во время синхронизации */
.scanline {
  position: fixed;
  left: 0; right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), rgba(0, 194, 168, .9), transparent);
  box-shadow: 0 0 18px rgba(79, 140, 255, .65);
  opacity: 0;
  z-index: 60;
  pointer-events: none;
}

.scanline.on {
  opacity: 1;
  animation: scan 1.6s cubic-bezier(.5, 0, .5, 1) infinite;
}

@keyframes scan {
  0%   { transform: translateY(0); opacity: .15; }
  50%  { opacity: 1; }
  100% { transform: translateY(100vh); opacity: .15; }
}

/* Уравнение капитала под карточками */
.balance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: rgba(15, 22, 43, .5);
  backdrop-filter: blur(8px);
  animation: rise .55s cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: .22s;
}

.balance-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.balance-item b { font-size: 17px; font-weight: 620; }
.balance-item .muted { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
.balance-item.strong b { color: var(--accent); font-size: 19px; }
.balance-item.pos b { color: var(--accent-2); }
.balance-item.neg b { color: var(--danger, #ff6b6b); }

.balance .op {
  font-size: 19px;
  color: var(--muted);
  opacity: .65;
  animation: op-pulse 3.4s ease-in-out infinite;
}

.balance .op:nth-of-type(2) { animation-delay: .4s; }
.balance .op:nth-of-type(3) { animation-delay: .8s; }

@keyframes op-pulse {
  0%, 100% { opacity: .35; transform: scale(1); }
  50%      { opacity: .9; transform: scale(1.14); }
}

@media (max-width: 640px) {
  .balance { gap: 10px; padding: 12px; }
  .balance-item b { font-size: 15px; }
}

/* Бегущая строка ближайших выплат под шапкой */
.ticker {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(15, 22, 43, .55);
  backdrop-filter: blur(8px);
  padding: 9px 0;
  font-size: 13px;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-track {
  display: inline-flex;
  gap: 34px;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-run 46s linear infinite;
}

.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker-item { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.ticker-item b { color: var(--text); font-weight: 600; }
.ticker-item .amount { color: var(--accent-2); font-weight: 650; }
.ticker-item::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

@keyframes ticker-run {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Обратный отсчёт до ближайшей выплаты */
.countdown {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.countdown-value {
  font-variant-numeric: tabular-nums;
  font-size: 25px;
  font-weight: 660;
  letter-spacing: .5px;
  color: var(--accent-2);
  text-shadow: 0 0 22px rgba(0, 194, 168, .35);
}

.countdown-value span { opacity: .45; margin: 0 2px; animation: colon-blink 1s steps(2) infinite; }

@keyframes colon-blink { 50% { opacity: .12; } }

/* Полоски долей в легенде концентрации */
.legend-bar {
  grid-column: 1 / -1;
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
  margin-top: 5px;
}

.legend-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  transform-origin: left center;
  animation: bar-fill 1.1s cubic-bezier(.25, .8, .3, 1) both;
}

@keyframes bar-fill { from { transform: scaleX(0); } }

/* Каскадное появление строк таблиц */
tbody tr {
  animation: row-in .45s cubic-bezier(.2, .7, .3, 1) both;
}

tbody tr:nth-child(1) { animation-delay: .02s; }
tbody tr:nth-child(2) { animation-delay: .06s; }
tbody tr:nth-child(3) { animation-delay: .10s; }
tbody tr:nth-child(4) { animation-delay: .14s; }
tbody tr:nth-child(5) { animation-delay: .18s; }
tbody tr:nth-child(6) { animation-delay: .22s; }
tbody tr:nth-child(7) { animation-delay: .26s; }
tbody tr:nth-child(8) { animation-delay: .30s; }
tbody tr:nth-child(n+9) { animation-delay: .34s; }

@keyframes row-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* Наклон KPI-карточки вслед за курсором */
.kpi {
  transform-style: preserve-3d;
  transition: transform .25s cubic-bezier(.2,.7,.3,1), border-color .2s ease;
}

.kpi.tilt { transition: transform .08s linear, border-color .2s ease; }

/* Вспышка на обновлённых значениях */
.flash { animation: flash-in 1.1s ease both; }

@keyframes flash-in {
  0%   { background: rgba(79, 140, 255, .28); }
  100% { background: transparent; }
}

/* Бегущая по контуру подсветка у последней KPI-карточки (результат) */
.kpi:last-child {
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    conic-gradient(from var(--edge, 0deg),
      rgba(0, 194, 168, .55), rgba(79, 140, 255, .18) 90deg,
      transparent 180deg, rgba(0, 194, 168, .30) 340deg) border-box;
  border: 1px solid transparent;
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both, edge-run 9s linear infinite;
}

@property --edge {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

@keyframes edge-run {
  to { --edge: 360deg; }
}

/* Мягкое дыхание значения прироста */
.kpi:last-child .kpi-value {
  animation: value-glow 5.5s ease-in-out infinite, breathe 4.2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.018); }
}

/* Тонкие телеметрические штрихи по краю карточек */
.card-head { position: relative; }

.card-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -9px;
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  opacity: .5;
  animation: tick-slide 4.5s ease-in-out infinite;
}

@keyframes tick-slide {
  0%, 100% { width: 34px; opacity: .35; }
  50%      { width: 78px; opacity: .75; }
}

/* Медленно плывущие точки на фоне — глубина сцены */
.dust {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.dust i {
  position: absolute;
  bottom: -12px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(140, 180, 255, .55);
  box-shadow: 0 0 8px rgba(140, 180, 255, .5);
  animation: dust-rise linear infinite;
}

@keyframes dust-rise {
  from { transform: translateY(0) translateX(0); opacity: 0; }
  12%  { opacity: .75; }
  88%  { opacity: .5; }
  to   { transform: translateY(-104vh) translateX(26px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  body::after, .kpi::before, .donut-wrap::before, .donut-wrap::after,
  .dust, .ticker-track { display: none; }
}
