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

:root {
  --bg:         #050a08;
  --card:       rgba(255,255,255,0.032);
  --card2:      rgba(255,255,255,0.055);
  --card3:      rgba(255,255,255,0.09);
  --stroke:     rgba(255,255,255,0.065);
  --stroke2:    rgba(52,232,138,0.22);
  --text:       #f4faf6;
  --text2:      rgba(232,244,238,0.55);
  --text3:      rgba(232,244,238,0.3);
  --green:      #2ce080;
  --green-hi:   #34e88a;
  --green-lo:   #17c96b;
  --green-grad: linear-gradient(135deg, #34e88a 0%, #17c96b 100%);
  --green-dim:  rgba(44,224,128,0.11);
  --red:        #ff5c5c;
  --red-dim:    rgba(255,92,92,0.12);
  --blue:       #4da3ff;
  --purple:     #b07aff;
  --radius:     20px;
  --nav-h:      86px;
  --ease-out:   cubic-bezier(.22,.68,.31,1);
  --ease-sheet: cubic-bezier(.32,.72,.24,1);
  --card-shadow: 0 1px 0 rgba(255,255,255,0.045) inset, 0 10px 30px -18px rgba(0,0,0,0.8);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient glow — layered, alive */
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 42% at 50% -12%, rgba(44,224,128,0.16), transparent 62%),
    radial-gradient(ellipse 55% 30% at 90% 108%, rgba(44,224,128,0.07), transparent 60%),
    radial-gradient(ellipse 40% 22% at 8% 55%, rgba(77,163,255,0.04), transparent 65%);
}

#app { position: relative; z-index: 1; height: 100vh; overflow: hidden; padding-bottom: var(--nav-h); }

/* ─── Pages ──────────────────────────────────────────────────────────── */
.page { display: none; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 28px; }
.page.active { display: block; animation: pageIn .32s var(--ease-out); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ─── App header ─────────────────────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 14px;
}
.app-title { text-align: center; flex: 1; }
.app-name { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.app-sub { font-size: 11px; color: var(--text3); margin-top: 1px; letter-spacing: .3px; }
.header-actions { display: flex; gap: 8px; }

.icon-btn {
  background: none; border: none; color: var(--text2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s var(--ease-out), background .15s, opacity .15s;
}
.icon-btn.ghost {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--stroke);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(.92); opacity: .75; }
.avatar-btn { font-size: 14px; font-weight: 700; color: var(--text); }
.help-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 18px;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.help-chip svg { width: 14px; height: 14px; }
.help-chip:active { transform: scale(.94); }

/* ─── Hero balance card ──────────────────────────────────────────────── */
.hero-card {
  position: relative; margin: 4px 16px 16px; padding: 20px 20px 0;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(44,224,128,0.10), rgba(255,255,255,0.028) 48%),
    var(--card);
  border: 1px solid var(--stroke2);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 24px 70px -28px rgba(44,224,128,0.35),
    0 10px 30px -18px rgba(0,0,0,0.8);
  overflow: hidden;
}
.hero-card::after {  /* slow light sheen */
  content: ''; position: absolute; top: -60%; left: -70%; width: 55%; height: 220%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: rotate(18deg);
  animation: sheen 6.5s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 55% { left: -70%; }
  85%, 100% { left: 140%; }
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.balance-label { font-size: 13px; color: var(--text2); }
.month-chip {
  font-size: 12px; color: var(--text2); padding: 5px 12px;
  background: var(--card2); border: 1px solid var(--stroke); border-radius: 20px;
}
.balance-amount {
  font-size: 46px; font-weight: 800; letter-spacing: -1.6px; line-height: 1.05;
  margin-top: 10px;
  font-feature-settings: "tnum";
  background: linear-gradient(180deg, #ffffff 30%, rgba(255,255,255,0.72));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.balance-sub { font-size: 13px; color: var(--green); margin-top: 5px; font-weight: 500; font-feature-settings: "tnum"; }
.hero-spark { display: block; width: calc(100% + 40px); margin: 8px -20px 0; height: 70px; }
.spark-line {
  stroke: url(#sparkStroke), var(--green); stroke-width: 2; stroke-linecap: round;
  filter: drop-shadow(0 0 7px rgba(44,224,128,0.55));
}

/* ─── Quick actions ──────────────────────────────────────────────────── */
.quick-actions { display: flex; gap: 12px; padding: 0 16px 20px; }
.action-card {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 18px; border: 1px solid var(--stroke);
  background: var(--card); color: var(--text); cursor: pointer; text-align: left;
  box-shadow: var(--card-shadow);
  transition: transform .16s var(--ease-out), background .16s;
}
.action-card:active { transform: scale(.965); background: var(--card2); }
.action-ico {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--card2); border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center; color: var(--text2);
}
.action-ico svg { width: 19px; height: 19px; }
.action-ico.green-glow {
  background: var(--green-grad); border: none; color: #06331c;
  box-shadow: 0 4px 22px -4px rgba(44,224,128,0.65), 0 1px 0 rgba(255,255,255,0.35) inset;
}
.action-name { font-size: 15px; font-weight: 600; }
.action-hint { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ─── Sections / panels ──────────────────────────────────────────────── */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 20px 10px;
}
.section-title { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.section-link {
  font-size: 12px; color: var(--text2); cursor: pointer;
  padding: 5px 12px; background: var(--card2); border-radius: 16px; border: 1px solid var(--stroke);
  transition: transform .15s var(--ease-out);
}
.section-link:active { transform: scale(.94); }

.panel {
  margin: 0 16px 16px; padding: 6px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}

/* ─── Tx list ────────────────────────────────────────────────────────── */
.tx-list { min-height: 60px; }
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--stroke);
  transition: opacity .15s;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:active { opacity: .6; }
.tx-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(160deg, var(--card3), var(--card));
  border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
}
.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.tx-amount { font-size: 14px; font-weight: 700; flex-shrink: 0; font-feature-settings: "tnum"; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--text); }
.tx-amount.trade { color: var(--green); opacity: .8; }
.tx-amount.transfer { color: var(--text3); font-weight: 500; }

.empty {
  text-align: center; color: var(--text3); font-size: 13px; padding: 36px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty::before {
  content: ''; width: 56px; height: 56px; border-radius: 50%;
  background: var(--card2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(230,242,236,0.35)' stroke-width='1.6'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E") center/24px no-repeat;
  border: 1px solid var(--stroke);
}
.loading { text-align: center; color: var(--text3); font-size: 13px; padding: 24px; }

/* Дружелюбные пустые состояния */
.nice-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; padding: 28px 16px;
}
.nice-empty-ico {
  width: 52px; height: 52px; border-radius: 50%; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  box-shadow: 0 0 30px -8px rgba(44,224,128,0.4);
  margin-bottom: 4px;
}
.nice-empty-title { font-size: 14px; font-weight: 700; }
.nice-empty-text { font-size: 12px; color: var(--text3); max-width: 250px; line-height: 1.45; }

/* Skeleton shimmer */
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.skel {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--card2) 25%, var(--card3) 50%, var(--card2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-ico { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skel-line { height: 12px; flex: 1; }
.skel-line.short { flex: 0 0 60px; }

.stats-footer {
  text-align: center; color: var(--text3); font-size: 12px;
  padding: 4px 16px 16px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  font-feature-settings: "tnum";
}
.dot { color: var(--text3); }
.tx-list-full { padding-bottom: 20px; }

/* ─── Filters ────────────────────────────────────────────────────────── */
.filter-row { display: flex; gap: 8px; padding: 0 16px 14px; }
.filter-row select {
  flex: 1; background: var(--card2); border: 1px solid var(--stroke); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; appearance: none; outline: none;
}

/* ─── Analytics ──────────────────────────────────────────────────────── */
.period-tabs { display: flex; gap: 8px; padding: 0 16px 16px; overflow-x: auto; }
.period-btn {
  padding: 8px 20px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--card2); border: 1px solid var(--stroke); color: var(--text2);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: transform .15s var(--ease-out), background .2s, color .2s;
}
.period-btn:active { transform: scale(.94); }
.period-btn.active {
  background: var(--green-grad); border-color: transparent; color: #06331c;
  box-shadow: 0 4px 20px -4px rgba(44,224,128,0.55), 0 1px 0 rgba(255,255,255,0.3) inset;
}

.summary-cards { display: flex; gap: 10px; padding: 0 16px; margin-bottom: 10px; }
.sum-card {
  flex: 1; border-radius: 18px; padding: 16px; min-width: 0;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}
.sum-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sum-label { font-size: 12px; color: var(--text2); }
.sum-badge {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.sum-badge svg { width: 13px; height: 13px; }
.sum-badge.up { background: var(--green-dim); color: var(--green); box-shadow: 0 0 14px -2px rgba(44,224,128,0.4); }
.sum-badge.down { background: var(--red-dim); color: var(--red); }
.sum-value { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; font-feature-settings: "tnum"; }
.sum-value.green { color: var(--green); }
.sum-value.red { color: var(--red); }

.net-card {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 16px 16px; padding: 14px 16px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}
.net-card .sum-value { font-size: 20px; }

.chart-wrap { height: 220px; padding: 16px; }
.chart-empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; text-align: center;
}
.chart-empty-ico {
  width: 52px; height: 52px; border-radius: 50%; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  box-shadow: 0 0 30px -8px rgba(44,224,128,0.4);
  margin-bottom: 4px;
}
.chart-empty-title { font-size: 14px; font-weight: 700; }
.chart-empty-text { font-size: 12px; color: var(--text3); max-width: 240px; line-height: 1.45; }

/* ─── Categories ─────────────────────────────────────────────────────── */
.category-list { min-height: 40px; }
.category-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--stroke);
}
.category-item:last-child { border-bottom: none; }
.cat-emoji { font-size: 18px; width: 26px; flex-shrink: 0; }
.cat-name { font-size: 13px; flex: 1; }
.cat-bar-wrap { width: 70px; height: 4px; background: var(--card2); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.cat-bar {
  height: 100%; background: var(--green-grad); border-radius: 2px;
  box-shadow: 0 0 8px rgba(44,224,128,0.5);
  animation: barGrow .5s var(--ease-out);
  transform-origin: left;
}
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.cat-amount { font-size: 13px; font-weight: 600; min-width: 68px; text-align: right; flex-shrink: 0; font-feature-settings: "tnum"; }
.cat-amount.positive { color: var(--green); }
.cat-amount.negative { color: var(--red); }
.cat-bar.negative { background: linear-gradient(135deg, #ff6b6b, #f43f3f); box-shadow: 0 0 8px rgba(255,92,92,0.45); }

/* ─── Accounts ───────────────────────────────────────────────────────── */
.accounts-list { padding: 0 16px 20px; }
.account-item {
  display: flex; align-items: center;
  padding: 13px 14px; margin-bottom: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}
.acct-icon { font-size: 20px; margin-right: 12px; flex-shrink: 0; }
.acct-logo {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  margin-right: 12px; object-fit: contain;
  background: var(--card2); border: 1px solid var(--stroke); padding: 4px;
}
.pf-item .acct-icon, .pf-item .acct-logo { margin-right: 10px; }
.pf-wallet-row .acct-icon { margin-right: 10px; }
.acct-body { flex: 1; }
.acct-name { font-size: 14px; font-weight: 600; }
.acct-type { font-size: 11px; color: var(--text3); margin-top: 2px; }
.acct-balance { font-size: 15px; font-weight: 700; font-feature-settings: "tnum"; }

/* ─── Positions ──────────────────────────────────────────────────────── */
.positions-list { padding: 0 16px 8px; }
.position-item {
  border-radius: 18px; padding: 14px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}
.position-item.long { border-left: 3px solid var(--green); }
.position-item.short { border-left: 3px solid var(--red); }
.pos-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.pos-symbol { font-size: 15px; font-weight: 700; }
.pos-exchange { font-size: 11px; color: var(--text3); margin-top: 2px; }
.pos-pnl { font-size: 17px; font-weight: 800; font-feature-settings: "tnum"; }
.pos-pnl.positive { color: var(--green); }
.pos-pnl.negative { color: var(--red); }
.pos-details { display: flex; gap: 14px; flex-wrap: wrap; }
.pos-details > div { font-size: 11px; color: var(--text3); }
.pos-details > div span { color: var(--text); font-weight: 600; margin-left: 3px; font-feature-settings: "tnum"; }

/* ─── Wallets ────────────────────────────────────────────────────────── */
.wallets-list { padding: 0 16px 20px; }
.wallet-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; margin-bottom: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
}
.wallet-info { flex: 1; min-width: 0; }
.w-label { font-size: 14px; font-weight: 600; }
.w-chain { font-size: 11px; color: var(--green); margin-top: 2px; }
.w-addr { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: 'SF Mono', ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-del { color: var(--red); font-size: 20px; padding: 4px 8px; cursor: pointer; flex-shrink: 0; transition: transform .15s; }
.wallet-del:active { transform: scale(.85); }

/* ─── Portfolio ──────────────────────────────────────────────────────── */
.pf-hero { padding-bottom: 20px; }
.pf-distribution { padding: 0 16px 6px; }
.pf-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px;
  margin-bottom: 12px;
  box-shadow: 0 0 20px -6px rgba(44,224,128,0.25);
}
.pf-seg { height: 100%; border-radius: 3px; transition: width .6s var(--ease-out); }
.pf-legend { margin-bottom: 10px; }
.pf-legend-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.pf-legend-name { flex: 1; color: var(--text2); }
.pf-legend-pct { color: var(--text3); min-width: 38px; text-align: right; font-feature-settings: "tnum"; }
.pf-legend-usd { font-weight: 600; min-width: 80px; text-align: right; font-feature-settings: "tnum"; }
.pf-group { margin: 0 16px 14px; }
.pf-group-header { display: flex; justify-content: space-between; padding: 4px 4px 8px; }
.pf-group-title { font-size: 15px; font-weight: 700; }
.pf-group-total { font-size: 14px; color: var(--text2); font-weight: 600; font-feature-settings: "tnum"; }
.pf-item {
  display: flex; flex-direction: column;
  padding: 13px 14px; margin-bottom: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
  transition: transform .15s var(--ease-out);
}
.pf-item:active { transform: scale(.985); }
.pf-item:not(.pf-wallet) { flex-direction: row; align-items: center; justify-content: space-between; }
.pf-wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pf-item-info { flex: 1; min-width: 0; }
.pf-item-name { font-size: 14px; font-weight: 600; }
.pf-item-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.pf-item-usd { font-size: 15px; font-weight: 700; flex-shrink: 0; font-feature-settings: "tnum"; }
.pf-chain {
  display: inline-block; font-size: 10px; font-weight: 600; color: var(--green);
  background: var(--green-dim); border: 1px solid var(--stroke2);
  padding: 2px 8px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}
.pf-addr { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: 'SF Mono', ui-monospace, monospace; }
.pf-assets { display: none; margin-top: 10px; border-top: 1px solid var(--stroke); padding-top: 4px; }
.pf-wallet.expanded .pf-assets { display: block; animation: pageIn .25s var(--ease-out); }
.asset-row { display: flex; align-items: center; padding: 8px 0; font-size: 13px; }
.asset-symbol { font-weight: 600; flex: 1; }
.asset-amount { color: var(--text3); margin-right: 14px; font-feature-settings: "tnum"; }
.asset-usd { font-weight: 600; min-width: 70px; text-align: right; font-feature-settings: "tnum"; }
.pf-assets-empty { color: var(--text3); font-size: 12px; padding: 8px 0; }
.pf-errors { margin: 4px 16px 12px; font-size: 11px; color: var(--text3); text-align: center; }

/* ─── Settings ───────────────────────────────────────────────────────── */
.settings-section { padding: 4px 16px 0; }
.settings-group-title {
  font-size: 12px; color: var(--text2); text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 10px; padding-left: 4px;
}
.cred-service {
  border-radius: 18px; margin-bottom: 10px; overflow: hidden;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}
.cred-service-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--stroke);
}
.cred-service-name { font-size: 15px; font-weight: 700; }
.cred-dot { width: 8px; height: 8px; border-radius: 50%; }
.cred-dot.ok { background: var(--green); box-shadow: 0 0 10px rgba(44,224,128,0.9); }
.cred-dot.missing { background: rgba(255,92,92,.5); }
.cred-dot.error { background: var(--red); box-shadow: 0 0 10px rgba(255,92,92,.9); }
.cred-service.broken { border-color: rgba(255,92,92,.35); }
.cred-warn {
  font-size: 12.5px; line-height: 1.45; color: var(--red);
  background: var(--red-dim); border-bottom: 1px solid var(--stroke);
  padding: 10px 16px;
}
.cred-field { display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--stroke); gap: 10px; }
.cred-field:last-child { border-bottom: none; }
.cred-field-name { flex: 1; font-size: 13px; color: var(--text2); }
.cred-field-status { font-size: 11px; }
.cred-field-status.set { color: var(--green); }
.cred-field-status.unset { color: var(--text3); }
.cred-set-btn {
  padding: 6px 14px; border-radius: 10px;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.cred-set-btn:active { transform: scale(.92); }
.cred-del-btn {
  padding: 6px 9px; border-radius: 10px;
  background: var(--red-dim); border: 1px solid rgba(255,92,92,.3);
  color: var(--red); font-size: 12px; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.cred-del-btn:active { transform: scale(.9); }
.cred-add-btn {
  display: block; width: 100%; padding: 10px; margin-bottom: 10px;
  border-radius: 14px; border: 1px dashed var(--stroke);
  background: transparent; color: var(--text2);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.cred-add-btn:active { transform: scale(.97); }

.import-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; margin-bottom: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--card-shadow);
}
.import-name { font-size: 14px; font-weight: 600; }
.import-hint { font-size: 11px; color: var(--text3); margin-top: 2px; }
.upload-btn {
  padding: 8px 16px; border-radius: 12px;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  color: var(--green); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.upload-btn:active { transform: scale(.94); }

.version-note { text-align: center; color: var(--text3); font-size: 11px; padding: 12px 0 4px; }

/* ─── Bottom nav ─────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(5,10,8,0.78);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border-top: 1px solid var(--stroke);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav::before {  /* hairline glow on top edge */
  content: ''; position: absolute; top: -1px; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(44,224,128,0.25), transparent);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; color: var(--text3); cursor: pointer; padding-top: 6px;
  transition: color .2s;
}
.nav-ico {
  width: 40px; height: 30px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s var(--ease-out);
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item span { font-size: 10px; font-weight: 500; }
.nav-item:active .nav-ico { transform: scale(.88); }
.nav-item.active { color: var(--green); }
.nav-item.active .nav-ico {
  background: var(--green-dim);
  box-shadow: 0 0 20px -2px rgba(44,224,128,0.5), 0 1px 0 rgba(255,255,255,0.06) inset;
}

/* ─── Sheets ─────────────────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 200; }
.sheet.hidden { display: none; }
.sheet-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.66);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-box {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, rgba(44,224,128,0.045), transparent 120px), #0a130e;
  border-top: 1px solid var(--stroke2);
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 -24px 90px -20px rgba(44,224,128,0.18);
  animation: sheetUp .4s var(--ease-sheet);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 36px; height: 4px; background: var(--card3); border-radius: 2px; margin: 0 auto 18px; }
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 20px; letter-spacing: -0.3px; }

.type-switcher {
  display: flex; background: var(--card); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 3px; margin-bottom: 20px;
}
.type-btn {
  flex: 1; padding: 9px; border: none; border-radius: 11px; font-size: 14px;
  background: none; color: var(--text2); cursor: pointer; font-weight: 600;
  transition: background .2s, color .2s, transform .15s var(--ease-out);
}
.type-btn:active { transform: scale(.96); }
.type-btn.active { background: var(--green-grad); color: #06331c; box-shadow: 0 3px 14px -3px rgba(44,224,128,0.5); }
.type-btn[data-type="expense"].active {
  background: linear-gradient(135deg, #ff6b6b, #f43f3f); color: #fff;
  box-shadow: 0 3px 14px -3px rgba(255,92,92,0.5);
}

.amount-input-wrap {
  display: flex; align-items: center; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  padding: 12px 16px; margin-bottom: 12px;
  transition: border-color .2s;
}
.amount-input-wrap:focus-within { border-color: var(--stroke2); }
.currency-prefix { font-size: 26px; font-weight: 300; color: var(--text3); margin-right: 6px; }
.amount-input-wrap input {
  flex: 1; background: none; border: none; color: var(--text);
  font-size: 26px; font-weight: 700; outline: none; width: 100%;
  font-feature-settings: "tnum";
}

.text-input, .select-input {
  display: block; width: 100%; color: var(--text);
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 14px 16px; font-size: 15px;
  margin-bottom: 12px; outline: none; appearance: none;
  transition: border-color .2s;
}
.text-input::placeholder { color: var(--text3); }
.text-input:focus, .select-input:focus { border-color: var(--stroke2); }

.category-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.cat-chip {
  padding: 8px 14px; border-radius: 20px; font-size: 13px; cursor: pointer;
  background: var(--card); border: 1px solid var(--stroke); color: var(--text2);
  transition: all .18s var(--ease-out);
}
.cat-chip:active { transform: scale(.93); }
.cat-chip.active {
  background: var(--green-dim); border-color: var(--green); color: var(--green);
  box-shadow: 0 0 14px -3px rgba(44,224,128,0.4);
}

.sheet-actions { display: flex; gap: 10px; padding-top: 4px; }
.btn-cancel {
  flex: 1; padding: 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  color: var(--text2); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.btn-cancel:active { transform: scale(.96); }
.btn-save {
  flex: 2; padding: 14px; border-radius: 16px; border: none;
  background: var(--green-grad); color: #06331c; font-size: 15px; font-weight: 800; cursor: pointer;
  box-shadow: 0 10px 34px -8px rgba(44,224,128,0.65), 0 1px 0 rgba(255,255,255,0.35) inset;
  transition: transform .15s var(--ease-out), box-shadow .2s;
}
.btn-save:active { transform: scale(.96); box-shadow: 0 6px 20px -8px rgba(44,224,128,0.5); }

.modal-hint { font-size: 12px; color: var(--text3); margin-bottom: 16px; text-align: center; }

/* ─── Tx detail sheet ────────────────────────────────────────────────── */
.txd-amount { font-size: 36px; font-weight: 800; letter-spacing: -1.2px; text-align: center; margin-top: 4px; font-feature-settings: "tnum"; }
.txd-type { font-size: 13px; color: var(--text3); text-align: center; margin: 4px 0 18px; }
.txd-rows {
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 2px 16px; margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}
.txd-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--stroke);
}
.txd-row:last-child { border-bottom: none; }
.txd-label { font-size: 13px; color: var(--text2); flex-shrink: 0; }
.txd-value { font-size: 14px; font-weight: 500; text-align: right; font-feature-settings: "tnum"; }
.txd-desc { font-size: 14px; color: var(--text2); padding: 0 4px 10px; word-break: break-word; }
.txd-desc:empty { display: none; }
.txd-id { font-size: 11px; color: var(--text3); text-align: center; padding-bottom: 14px; }
.txd-actions { display: flex; gap: 10px; }
.btn-edit {
  flex: 1; padding: 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.btn-edit:active { transform: scale(.96); }
.btn-delete {
  flex: 1; padding: 14px; border-radius: 16px;
  background: var(--red-dim); border: 1px solid rgba(255,92,92,.3);
  color: var(--red); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease-out);
}
.btn-delete:active { transform: scale(.96); }

/* ─── More menu ──────────────────────────────────────────────────────── */
.more-menu { display: flex; flex-direction: column; padding-bottom: 4px; }
.more-item {
  display: flex; align-items: center; gap: 14px; padding: 15px 4px;
  background: none; border: none; border-bottom: 1px solid var(--stroke);
  color: var(--text); cursor: pointer; text-align: left; width: 100%;
  transition: opacity .15s;
}
.more-item:active { opacity: .6; }
.more-item:last-child { border-bottom: none; }
.more-ico {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
  background: var(--card2); border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center; color: var(--green);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset;
}
.more-ico svg { width: 19px; height: 19px; }
.more-txt { flex: 1; }
.more-name { font-size: 15px; font-weight: 600; }
.more-hint { font-size: 12px; color: var(--text3); margin-top: 2px; }
.more-arrow { width: 16px; height: 16px; color: var(--text3); flex-shrink: 0; }

/* ─── Portfolio empty-state instruction ──────────────────────────────── */
.pf-onb {
  margin: 8px 16px; padding: 26px 20px; border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(44,224,128,0.07), rgba(255,255,255,0.02) 55%),
    var(--card);
  border: 1px solid var(--stroke2);
  box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.pf-onb-ico {
  width: 72px; height: 72px; border-radius: 50%; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  box-shadow: 0 0 40px -8px rgba(44,224,128,0.5);
  margin-bottom: 16px;
}
.pf-onb-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 10px; }
.pf-onb-text { font-size: 14px; line-height: 1.5; color: var(--text2); margin-bottom: 14px; }
.pf-onb-note {
  font-size: 12.5px; line-height: 1.5; color: var(--green);
  background: var(--green-dim); border: 1px solid var(--stroke2);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 18px; text-align: left;
}
.pf-onb-btn { width: 100%; flex: none; }

/* ─── Скрины в инструкции ────────────────────────────────────────────── */
.pf-shots {
  display: flex; gap: 10px; width: 100%; margin-bottom: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory;
}
.pf-shots img {
  width: 82%; flex-shrink: 0; scroll-snap-align: center;
  border-radius: 16px; border: 1px solid var(--stroke);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,0.8);
}

/* ─── Portfolio demo preview (внутри инструкции) ─────────────────────── */
.pf-demo {
  width: 100%; padding: 12px; margin-bottom: 14px;
  border-radius: 16px; background: rgba(0,0,0,0.35);
  border: 1px solid var(--stroke); text-align: left;
}
.pf-demo-hero {
  padding: 10px 12px; border-radius: 12px; margin-bottom: 4px;
  background: linear-gradient(160deg, rgba(44,224,128,0.09), rgba(255,255,255,0.02) 55%);
  border: 1px solid var(--stroke2);
}
.pf-demo-label { font-size: 11px; color: var(--text2); }
.pf-demo-total {
  font-size: 24px; font-weight: 800; letter-spacing: -0.8px; margin-top: 2px;
  font-feature-settings: "tnum";
  background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,0.72));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pf-demo-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 4px; border-bottom: 1px solid var(--stroke);
  font-size: 12.5px;
}
.pf-demo-row:last-child { border-bottom: none; }
.pf-demo-row img {
  width: 24px; height: 24px; border-radius: 7px; object-fit: contain;
  background: var(--card2); border: 1px solid var(--stroke); padding: 3px;
}
.pf-demo-row span { flex: 1; font-weight: 600; }
.pf-demo-row b { font-feature-settings: "tnum"; }

/* ─── Onboarding ─────────────────────────────────────────────────────── */
.onb {
  position: fixed; inset: 0; z-index: 400;
  background:
    radial-gradient(ellipse 90% 45% at 50% -10%, rgba(44,224,128,0.14), transparent 60%),
    var(--bg);
  display: flex; flex-direction: column;
  animation: fadeIn .3s ease;
}
.onb.hidden { display: none; }
.onb-skip {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 16px); right: 18px;
  background: none; border: none; color: var(--text3); font-size: 14px; cursor: pointer; z-index: 2;
  padding: 6px 10px;
}
.onb-track {
  flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.onb-slide {
  min-width: 100%; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 36px;
}
.onb-ico {
  width: 96px; height: 96px; border-radius: 50%; font-size: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  box-shadow: 0 0 60px -10px rgba(44,224,128,0.5), 0 1px 0 rgba(255,255,255,0.08) inset;
  margin-bottom: 28px;
}
.onb-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 14px; }
.onb-text { font-size: 15px; line-height: 1.55; color: var(--text2); max-width: 320px; }
.onb-text-badge {
  font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .8px;
  background: var(--green-dim); border: 1px solid var(--stroke2);
  padding: 4px 12px; border-radius: 12px; margin-bottom: 12px;
}
.onb-dots { display: flex; gap: 8px; justify-content: center; padding: 8px 0 20px; }
.onb-dot {
  width: 7px; height: 7px; border-radius: 4px; background: var(--card3);
  transition: all .25s var(--ease-out);
}
.onb-dot.active { width: 22px; background: var(--green); box-shadow: 0 0 10px rgba(44,224,128,0.6); }
.onb-next {
  margin: 0 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  flex: none;
}

/* ─── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 14px); left: 50%;
  transform: translateX(-50%) translateY(20px) scale(.95);
  background: rgba(15,36,24,0.9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--stroke2);
  color: var(--text); padding: 11px 22px; border-radius: 22px;
  font-size: 13px; font-weight: 500; opacity: 0;
  transition: all .32s var(--ease-out);
  pointer-events: none; white-space: nowrap; z-index: 300;
  box-shadow: 0 8px 30px -8px rgba(44,224,128,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

@keyframes spin { to { transform: rotate(360deg); } }
.syncing svg { animation: spin 1s linear infinite; transform-origin: 50% 50%; }
.syncing { color: var(--green); border-color: var(--stroke2); }

::-webkit-scrollbar { display: none; }

/* ─── Admin ─── */
.adm-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.adm-user { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.adm-user:last-child { border-bottom: none; }
.adm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.adm-dot.on { background: var(--green); box-shadow: 0 0 6px rgba(46,224,128,0.5); }
.adm-user-main { flex: 1; min-width: 0; }
.adm-user-name { font-size: 13px; font-weight: 600; }
.adm-user-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.adm-user-date { font-size: 11px; color: var(--text-dim); flex-shrink: 0; font-feature-settings: "tnum"; }
.adm-err { color: var(--red); white-space: normal; }
