/* ==========================================================================
   CashFlow Mini App — визуальная система
   Тёмная тема: слоистые поверхности, мягкий свет, аккуратная типографика.
   ========================================================================== */

:root {
  /* Фон и поверхности: холодная база с лёгким синим подтоном */
  --bg: #07080d;
  --bg-raise: #0d0f17;
  --surface: #12151f;
  --surface-2: #181c28;
  --surface-3: #1f2431;

  /* Текст */
  --ink: #f3f5fb;
  --ink-2: #bdc4d6;
  --muted: #737d94;

  /* Границы */
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.11);
  --line-3: rgba(255, 255, 255, 0.18);

  /* Акценты */
  --primary: #6b7cff;
  --primary-2: #9a6bff;
  --accent: #38bdf8;
  --grad: linear-gradient(135deg, #5b7cfa 0%, #7c5cff 55%, #9a6bff 100%);
  --grad-soft: linear-gradient(135deg, rgba(91, 124, 250, 0.16), rgba(154, 107, 255, 0.11));
  --mint: #2fd8a2;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;

  /* Свет сверху: имитация освещения для «стеклянных» плоскостей */
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 62%);
  --hairline: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  /* Тени */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-2: 0 10px 28px -14px rgba(0, 0, 0, 0.75);
  --sh-3: 0 22px 48px -20px rgba(0, 0, 0, 0.85);
  --sh-primary: 0 10px 26px -10px rgba(108, 99, 255, 0.6);

  --ring: rgba(154, 130, 255, 0.75);

  --radius-xl: 26px;
  --radius: 20px;
  --radius-s: 14px;
  --radius-xs: 11px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --dock-h: 66px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.46, 0.64, 1);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-feature-settings: "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* Живой фон: медленно дрейфующее северное сияние */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(46% 34% at 82% 4%, rgba(154, 107, 255, 0.2), transparent 66%),
    radial-gradient(40% 30% at 4% 26%, rgba(91, 124, 250, 0.14), transparent 62%),
    radial-gradient(44% 32% at 62% 96%, rgba(47, 216, 162, 0.08), transparent 64%);
  animation: aurora 28s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* Зерно: убирает бандинг на градиентах и добавляет «плёночность» */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.028;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}

@keyframes aurora {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-3%, 2%, 0) scale(1.12); }
}

.hidden { display: none !important; }

/* ================= Каркас ================= */

.app,
.screen {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  padding: calc(12px + var(--safe-top)) 15px calc(var(--dock-h) + 30px + var(--safe-bottom));
}
.screen {
  padding-bottom: calc(28px + var(--safe-bottom));
  display: grid;
  gap: 12px;
  align-content: start;
}

/* ================= Шапка ================= */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 2px 2px 0;
}
.brand {
  font-family: "Unbounded", "Inter", sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  background: linear-gradient(104deg, #ffffff 6%, #b9c6ff 42%, #c9b4ff 72%, #9a6bff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(124, 92, 255, 0.28));
}
.brand-sub {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: 3px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--sheen), var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--hairline), var(--sh-1);
  color: var(--ink-2);
  cursor: pointer;
  transition: transform 0.45s var(--ease-out), color 0.2s ease, border-color 0.2s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active {
  transform: rotate(-160deg) scale(0.9);
  color: var(--ink);
  border-color: var(--line-3);
}

/* ================= Заголовки экранов ================= */

.view { display: grid; gap: 13px; }

.page-head { padding: 2px 2px 4px; }
.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #a5b1ff;
  margin-bottom: 7px;
}
.page-kicker::before {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(124, 92, 255, 0.7);
}
.page-title {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.033em;
  line-height: 1.16;
  text-wrap: balance;
}
.page-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-wrap: pretty;
}
.page-sub code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ================= Карточки ================= */

.panel,
.task {
  position: relative;
  background: var(--sheen), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--hairline), var(--sh-2);
}
.panel { padding: 17px 16px; }
.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 13px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #8b93a8;
}
.panel h2::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 8px rgba(124, 92, 255, 0.8);
  flex-shrink: 0;
}
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; text-wrap: pretty; }

/* Пустое состояние */
.panel.empty {
  padding: 28px 20px;
  text-align: center;
  border-style: dashed;
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.012);
  box-shadow: none;
}

/* Форматированный текст от бота */
.rich { word-break: break-word; overflow-wrap: anywhere; line-height: 1.62; }
.rich b, .rich strong { color: var(--ink); font-weight: 700; }
.rich a {
  color: #a9b8ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(169, 184, 255, 0.32);
}
.rich code,
.rich pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.rich pre { display: block; padding: 11px 13px; overflow-x: auto; }
.page-sub.rich, .page-sub { word-break: break-word; overflow-wrap: anywhere; }

/* Раскрывающийся блок */
.details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.details summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.24s var(--ease-out);
  flex-shrink: 0;
}
.details[open] summary::before { transform: rotate(45deg); }
.details summary::-webkit-details-marker { display: none; }

/* ================= Баланс (герой) ================= */

.wallet-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 21px 20px 19px;
  border: 1px solid transparent;
  background:
    linear-gradient(150deg, #1a1f33 0%, #151a2a 48%, #10131f 100%) padding-box,
    linear-gradient(140deg, rgba(154, 107, 255, 0.6), rgba(91, 124, 250, 0.2) 46%, rgba(47, 216, 162, 0.32)) border-box;
  box-shadow: var(--sh-3), 0 0 0 1px rgba(124, 92, 255, 0.04);
}
/* Медленно вращающийся цветной свет под содержимым */
.wallet-card::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: -70%;
  left: -30%;
  width: 160%;
  height: 240%;
  background: conic-gradient(
    from 0deg,
    rgba(154, 107, 255, 0.5),
    rgba(56, 189, 248, 0.16),
    rgba(47, 216, 162, 0.22),
    rgba(154, 107, 255, 0.5)
  );
  filter: blur(46px);
  opacity: 0.5;
  animation: orbit 26s linear infinite;
}
/* Зеркальный блик по верхней кромке */
.wallet-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(120% 80% at 12% -20%, rgba(255, 255, 255, 0.11), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%);
}
.wallet-card > * { position: relative; z-index: 1; }

@keyframes orbit { to { transform: rotate(360deg); } }

.wallet-card .wc-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.6);
}
.wallet-card .wc-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(47, 216, 162, 0.16), 0 0 12px rgba(47, 216, 162, 0.8);
  animation: pulse-dot 2.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  50% { box-shadow: 0 0 0 5px rgba(47, 216, 162, 0.08), 0 0 14px rgba(47, 216, 162, 0.5); }
}
.wallet-card .wc-value {
  margin-top: 9px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.038em;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
  word-break: break-word;
  color: #fff;
  text-shadow: 0 2px 24px rgba(151, 128, 255, 0.35);
}
.wallet-card .wc-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.wc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--hairline);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.wc-chip b { color: #fff; font-weight: 700; }

/* ================= Метрики ================= */

.stat {
  position: relative;
  overflow: hidden;
  background: var(--sheen), var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 13px 14px;
  box-shadow: var(--hairline);
}
/* Цветной акцент слева — своя тональность для каждой метрики */
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14%;
  bottom: 14%;
  width: 2.5px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  opacity: 0.85;
}
.grid2 .stat:nth-child(2)::before { background: var(--accent); }
.grid2 .stat:nth-child(3)::before { background: var(--mint); }
.grid2 .stat:nth-child(4)::before { background: var(--warn); }
.stat .label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.stat .value {
  font-weight: 800;
  margin-top: 5px;
  font-size: 17px;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.balances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 14px; }

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

.row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 9px; }

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 17px;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--grad);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.012em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--sh-primary), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.16s var(--ease-out), box-shadow 0.2s ease, opacity 0.16s ease, filter 0.16s ease;
}
/* Мягкий блик в верхней части заливки */
.btn::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent);
  pointer-events: none;
}
.btn:active {
  transform: scale(0.97);
  box-shadow: 0 4px 12px -6px rgba(108, 99, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  filter: saturate(1.15);
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn.secondary {
  background: var(--sheen), var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--ink);
  box-shadow: var(--hairline), var(--sh-1);
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  box-shadow: none;
}
.btn.ghost::after, .btn.secondary::after { display: none; }
.btn.ghost:active { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.btn.warn {
  background: linear-gradient(135deg, #f8b429, #ef7d1a);
  box-shadow: 0 10px 24px -12px rgba(245, 158, 11, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.danger {
  background: linear-gradient(135deg, #f4574f, #d92d20);
  box-shadow: 0 10px 24px -12px rgba(239, 68, 68, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn.block { width: 100%; }
.btn.sm {
  min-height: 37px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: var(--radius-xs);
}
/* Неактивная кнопка теряет акцентную заливку, чтобы не читалась как основная */
.btn:disabled {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: default;
  box-shadow: none;
  transform: none;
}
.btn:disabled::after { display: none; }

/* ================= Задания ================= */

.task {
  padding: 15px 16px;
  display: grid;
  gap: 10px;
  transition: border-color 0.2s ease, transform 0.2s var(--ease-out);
}
.task .t-top { display: flex; justify-content: space-between; gap: 11px; align-items: flex-start; }
.task .title {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.task .meta { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  background: rgba(47, 216, 162, 0.13);
  color: var(--mint);
  border: 1px solid rgba(47, 216, 162, 0.28);
  box-shadow: 0 0 18px -8px rgba(47, 216, 162, 0.6);
}
.badge.neutral {
  background: var(--surface-3);
  color: var(--ink-2);
  border-color: var(--line-2);
  box-shadow: none;
}

/* ================= Навигация по разделам ================= */

.hub-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 14px 15px;
  background: var(--sheen), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: var(--hairline), var(--sh-1);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.012em;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.16s var(--ease-out);
}
.hub-item:active {
  border-color: rgba(154, 107, 255, 0.45);
  background-color: var(--surface-2);
  transform: scale(0.99);
}
.hub-item:disabled { opacity: 0.4; cursor: default; }
.hub-item .hi-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--grad-soft);
  border: 1px solid rgba(154, 107, 255, 0.22);
  box-shadow: var(--hairline);
  color: #aeb9ff;
}
.hub-item .hi-icon svg { width: 19px; height: 19px; }
/* Разная тональность иконок задаёт визуальный ритм списка */
.stack .hub-item:nth-child(2) .hi-icon {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(56, 189, 248, 0.07));
  border-color: rgba(56, 189, 248, 0.24);
  color: #7dd3fc;
}
.stack .hub-item:nth-child(3) .hi-icon {
  background: linear-gradient(135deg, rgba(47, 216, 162, 0.16), rgba(47, 216, 162, 0.07));
  border-color: rgba(47, 216, 162, 0.24);
  color: #6ee7b7;
}
.stack .hub-item:nth-child(4) .hi-icon {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(251, 191, 36, 0.07));
  border-color: rgba(251, 191, 36, 0.24);
  color: #fcd34d;
}
.stack .hub-item:nth-child(5) .hi-icon {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.16), rgba(244, 114, 182, 0.07));
  border-color: rgba(244, 114, 182, 0.24);
  color: #f9a8d4;
}
.hub-item .hi-arrow {
  margin-left: auto;
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.2s var(--ease-out), color 0.2s ease;
}
.hub-item .hi-arrow svg { width: 16px; height: 16px; }
.hub-item:active .hi-arrow { transform: translateX(3px); color: var(--ink-2); }

/* ================= Поля ввода ================= */

.field { display: grid; gap: 7px; }
.field > span {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  padding: 0 15px;
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
input::placeholder, textarea::placeholder { color: rgba(115, 125, 148, 0.65); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(154, 107, 255, 0.65);
  background-color: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 3.5px rgba(124, 92, 255, 0.16);
}
textarea { min-height: 96px; padding: 13px 15px; resize: vertical; line-height: 1.5; }

/* ================= Списки ================= */

.list { display: grid; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.list-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.list-item:first-child { padding-top: 2px; }
.list-item strong {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.list-item .muted { font-size: 12px; margin-top: 3px; }

/* ================= Док ================= */

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(11px + var(--safe-bottom));
  width: min(520px, calc(100% - 18px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  padding: 7px;
  border-radius: 22px;
  background: rgba(13, 15, 23, 0.72);
  border: 1px solid var(--line-2);
  box-shadow: var(--hairline), 0 20px 46px -12px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(26px) saturate(1.6);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  z-index: 20;
}
.nav-item {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: var(--radius-s);
  padding: 9px 2px 8px;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: color 0.22s ease, background 0.22s ease, transform 0.2s var(--ease-spring);
}
.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.28s var(--ease-spring);
}
.nav-item:active { transform: scale(0.93); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(165deg, rgba(124, 92, 255, 0.26), rgba(91, 124, 250, 0.13));
  box-shadow: var(--hairline);
}
.nav-item.active svg {
  transform: translateY(-1px) scale(1.06);
  filter: drop-shadow(0 3px 10px rgba(154, 107, 255, 0.85));
}
/* Светящаяся риска на кромке дока над активным разделом */
.nav-item.active::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.95);
}

/* ================= Шит (модальное окно) ================= */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 8, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.22s ease;
}
.sheet {
  width: min(560px, 100%);
  background: var(--sheen), var(--bg-raise);
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  padding: 10px 19px calc(20px + var(--safe-bottom));
  box-shadow: 0 -24px 60px -18px rgba(0, 0, 0, 0.9), var(--hairline);
  animation: sheet-up 0.34s var(--ease-out);
}
.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-3);
  margin: 5px auto 16px;
}
.sheet h3 {
  margin: 0 0 5px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.sheet .sheet-sub { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sheet-fields { display: grid; gap: 13px; margin: 15px 0 17px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 9px; }

@keyframes sheet-up {
  from { transform: translateY(16%); opacity: 0.35; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet-overlay.closing { animation: fade-out 0.18s ease forwards; }
.sheet-overlay.closing .sheet { animation: sheet-down 0.2s ease forwards; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-down { to { transform: translateY(24%); opacity: 0; } }

/* ================= Тост ================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 26px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(20, 24, 34, 0.9);
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 12px 17px;
  border-radius: var(--radius-s);
  max-width: min(420px, calc(100% - 26px));
  z-index: 60;
  box-shadow: var(--hairline), 0 18px 40px -14px rgba(0, 0, 0, 0.85);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.45;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: toast-in 0.26s var(--ease-spring);
}
.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--mint);
}
.toast.error { border-color: rgba(248, 113, 113, 0.38); }
.toast.error::before { background: var(--bad); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ================= Скелетоны ================= */

.skel {
  border-radius: var(--radius);
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0.055) 50%, rgba(255, 255, 255, 0) 68%),
    var(--surface);
  background-size: 220% 100%, auto;
  animation: shimmer 1.5s infinite linear;
  border: 1px solid var(--line);
}
.skel-hero { height: 158px; border-radius: var(--radius-xl); }
.skel-card { height: 100px; }
.skel-row { height: 56px; border-radius: var(--radius-s); }
@keyframes shimmer { to { background-position: -220% 0, 0 0; } }

/* ================= Появление и доступность ================= */

.view > * { animation: rise 0.34s var(--ease-out) both; }
.view > *:nth-child(2) { animation-delay: 0.05s; }
.view > *:nth-child(3) { animation-delay: 0.1s; }
.view > *:nth-child(4) { animation-delay: 0.15s; }
.view > *:nth-child(5) { animation-delay: 0.2s; }
.view > *:nth-child(n + 6) { animation-delay: 0.24s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 8px;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: rgba(124, 92, 255, 0.35); color: #fff; }

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

@media (max-width: 400px) {
  .balances { grid-template-columns: 1fr; }
  .wallet-card { padding: 18px 17px; }
  .wallet-card .wc-value { font-size: 27px; }
  .page-title { font-size: 20px; }
  .nav-item { font-size: 9.5px; }
  .nav-item svg { width: 20px; height: 20px; }
}
