/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a3e;
  --bg-card-hover: #222255;
  --bg-modal: #16163a;
  --text-primary: #f0f0ff;
  --text-secondary: #8888bb;
  --text-muted: #555588;
  --accent: #6C5CE7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --green: #00B894;
  --green-glow: rgba(0, 184, 148, 0.25);
  --red: #E17055;
  --red-glow: rgba(225, 112, 85, 0.25);
  --blue: #0984E3;
  --yellow: #FDCB6E;
  --border: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 70px;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #020408;
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ===== STARFIELD ===== */
#starfield {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  display: block;
}

/* ===== SCREENS ===== */
.screen { display: none; height: 100%; position: relative; z-index: 1; }
.screen.active { display: flex; flex-direction: column; }


/* ===== LOGIN ===== */
.login-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 40px 20px;
  background: linear-gradient(145deg, #0a0a1a 0%, #12122a 50%, #1a1040 100%);
}
.login-icon { font-size: 64px; margin-bottom: 12px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

.login-container h1 {
  font-size: 28px; font-weight: 700; margin-bottom: 6px;
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 30px; }

.pin-dots { display: flex; gap: 14px; margin-bottom: 30px; }
.pin-dots .dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--accent); transition: all 0.2s ease;
}
.pin-dots .dot.filled { background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 72px); gap: 12px;
}
.pin-btn {
  width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary); font-size: 24px; font-weight: 500;
  cursor: pointer; transition: all 0.15s ease;
  display: flex; align-items: center; justify-content: center;
}
.pin-btn:active { background: var(--accent); transform: scale(0.93); }
.pin-del { font-size: 20px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 16px; min-height: 20px; }

/* ===== APP HEADER ===== */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 8px; flex-shrink: 0;
}
.app-header h2 { font-size: 22px; font-weight: 700; }
.header-btn {
  width: 40px; height: 40px; border-radius: 12px; border: none;
  background: var(--bg-card); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ===== VIEWS ===== */
#views-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0 16px 100px; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative; overscroll-behavior-y: contain;
  width: 100%;
}
.view { display: none; flex-direction: column; gap: 16px; padding-bottom: 20px; width: 100%; min-width: 0; box-sizing: border-box; align-self: stretch; }
.view.active { display: flex; }

/* ===== FUND CARD ===== */
.fund-card {
  background: linear-gradient(135deg, #1a3a2e 0%, #0d2a20 100%);
  border: 1px solid rgba(0, 184, 148, 0.2);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden;
}
.fund-card::after {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,184,148,0.15) 0%, transparent 70%);
}
.fund-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fund-icon { font-size: 20px; }
.fund-title { font-size: 14px; color: var(--green); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.fund-amount { font-size: 36px; font-weight: 800; margin-bottom: 16px; }
.fund-progress-container { position: relative; z-index: 1; }
.fund-progress-bar {
  height: 10px; border-radius: 5px;
  background: rgba(255,255,255,0.08); overflow: hidden;
}
.fund-progress-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--green), #55efc4);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--green-glow);
}
.fund-progress-labels {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; color: var(--text-secondary);
}

/* Fund card with split */
.fund-card-split {
  padding-bottom: 0;
}
.fund-card-split .fund-amount {
  margin-bottom: 12px;
}
.fund-card-split .split-card-halves {
  margin: 0 -20px;
  border-top: 1px solid rgba(0, 184, 148, 0.15);
}
.fund-card-split .split-card-badge {
  margin-left: auto;
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.section-header h3 { font-size: 16px; font-weight: 600; }
.btn-add-small {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--accent); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; font-weight: 500; }

/* ===== WALLETS GRID ===== */
.wallets-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.wallet-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  cursor: pointer; transition: all 0.2s ease; position: relative; overflow: hidden;
}
.wallet-card:active { transform: scale(0.97); }
.wallet-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.wallet-card .wallet-icon { font-size: 28px; margin-bottom: 8px; }
.wallet-card .wallet-name { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.wallet-card .wallet-balance { font-size: 20px; font-weight: 700; }
.wallet-card .wallet-split {
  font-size: 10px; color: var(--accent); margin-top: 6px;
  background: var(--accent-glow); padding: 2px 8px; border-radius: 4px; display: inline-block;
}

/* ===== STATS ROW ===== */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  border-radius: var(--radius-sm); padding: 16px;
  border: 1px solid var(--border);
}
.stat-income { background: linear-gradient(135deg, rgba(0,184,148,0.1), rgba(0,184,148,0.02)); }
.stat-expense { background: linear-gradient(135deg, rgba(225,112,85,0.1), rgba(225,112,85,0.02)); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-income .stat-value { color: var(--green); }
.stat-expense .stat-value { color: var(--red); }

/* ===== TRANSACTIONS LIST ===== */
.transactions-list { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: background 0.15s;
}
.tx-item:active { background: var(--bg-card-hover); }
.tx-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  flex-shrink: 0;
}
.tx-icon.income { background: var(--green-glow); }
.tx-icon.expense { background: var(--red-glow); }
.tx-icon.transfer { background: var(--accent-glow); }
.tx-info { 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(--text-secondary); margin-top: 2px; }
.tx-amount { font-size: 16px; font-weight: 700; text-align: right; flex-shrink: 0; }
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--red); }
.tx-amount.transfer { color: var(--accent); }
.tx-delete {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: rgba(225,112,85,0.15); color: var(--red); font-size: 14px;
  cursor: pointer; flex-shrink: 0; display: none; align-items: center; justify-content: center;
}
.tx-item:hover .tx-delete { display: flex; }
.tx-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 8px; width: 100%; }
.filter-select {
  flex: 1; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 13px; font-family: inherit;
  -webkit-appearance: none;
}

/* ===== FAB ===== */
.fab {
  position: fixed; bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px); right: 20px;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  color: white; font-size: 28px; font-weight: 300;
  cursor: pointer; z-index: 50;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.9); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  display: flex; justify-content: space-around; align-items: center;
  height: var(--nav-height); padding-bottom: var(--safe-bottom);
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  flex-shrink: 0; z-index: 40;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 8px 16px; transition: color 0.2s;
  font-family: inherit;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 11px; font-weight: 500; }

/* ===== MODAL ===== */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 100;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.modal.active { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.modal-content {
  width: 100%; max-width: 500px; max-height: 90vh;
  background: var(--bg-modal); border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 40px; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--bg-card); color: var(--text-secondary); font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ===== TX TYPE TABS ===== */
.tx-type-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.tx-type-tab {
  flex: 1; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); font-size: 13px;
  font-weight: 600; cursor: pointer; text-align: center; transition: all 0.2s;
  font-family: inherit;
}
.tx-type-tab.active {
  background: var(--accent); color: white; border-color: var(--accent);
}
.tx-type-tab[data-type="income"].active { background: var(--green); border-color: var(--green); }
.tx-type-tab[data-type="transfer"].active { background: var(--blue); border-color: var(--blue); }

/* ===== FORM ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.input-field {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 15px; font-family: inherit;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.input-field:focus { outline: none; border-color: var(--accent); }
.input-amount { font-size: 32px; font-weight: 700; text-align: center; padding: 16px; }

.btn-primary {
  width: 100%; padding: 14px; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(135deg, var(--accent), #a29bfe);
  color: white; font-size: 16px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: opacity 0.2s;
}
.btn-primary:active { opacity: 0.8; }
.btn-secondary {
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary); font-size: 14px;
  cursor: pointer; font-family: inherit; margin-top: 8px;
}
.btn-submit { margin-top: 8px; }

/* ===== ICON/COLOR PICKER ===== */
.icon-picker, .color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px; border: 2px solid transparent;
  background: var(--bg-card); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-card-hover); }
.icon-btn.active { border-color: var(--accent); background: var(--accent-glow); }

/* "Ещё иконки" button */
.icon-more-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 8px 12px; margin-top: 8px;
  border-radius: 8px; border: 1px dashed rgba(108, 92, 231, 0.3);
  background: transparent; color: var(--accent);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all 0.2s ease;
}
.icon-more-btn:hover {
  background: rgba(108, 92, 231, 0.08);
  border-color: var(--accent);
}
.icon-more-arrow {
  font-size: 10px; transition: transform 0.3s ease;
  display: inline-block;
}
.icon-more-arrow.rotated {
  transform: rotate(180deg);
}

/* Expanded icon picker */
.icon-picker-expanded {
  display: none; flex-direction: column; gap: 12px;
  margin-top: 10px; padding: 12px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 280px; overflow-y: auto;
  animation: expandDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.icon-picker-expanded.open {
  display: flex;
}
@keyframes expandDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 280px; }
}

/* Scrollbar for expanded picker */
.icon-picker-expanded::-webkit-scrollbar {
  width: 4px;
}
.icon-picker-expanded::-webkit-scrollbar-track {
  background: transparent;
}
.icon-picker-expanded::-webkit-scrollbar-thumb {
  background: rgba(108, 92, 231, 0.3);
  border-radius: 2px;
}

/* Icon categories */
.icon-category-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px; padding-left: 2px;
}
.icon-category-icons {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.icon-category-icons .icon-btn {
  width: 40px; height: 40px; font-size: 20px; border-radius: 8px;
}

.color-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; transition: all 0.15s;
}
.color-btn.active { border-color: white; transform: scale(1.15); }

/* ===== SETTINGS ===== */
.settings-list { display: flex; flex-direction: column; gap: 20px; width: 100%; min-width: 0; }
.settings-group {
  background: var(--bg-card); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--border); width: 100%; box-sizing: border-box; min-width: 0;
}
.settings-group h3 { font-size: 15px; margin-bottom: 12px; }
.setting-item { display: flex; flex-direction: column; gap: 8px; }
.upload-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 14px; cursor: pointer; text-align: center;
}
.import-result { font-size: 13px; color: var(--green); min-height: 18px; }
.import-result.error { color: var(--red); }

/* ===== PULL TO REFRESH ===== */
.ptr-indicator {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  height: 0; overflow: hidden; transition: height 0.2s ease;
  z-index: 30; pointer-events: none;
}
.ptr-indicator.pulling, .ptr-indicator.refreshing {
  height: 50px;
}
.ptr-spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.6;
}
.ptr-indicator.pulling .ptr-spinner {
  opacity: 1;
}
.ptr-indicator.refreshing .ptr-spinner {
  animation: spin 0.7s linear infinite;
  opacity: 1;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SPLIT WALLET CARD ===== */
.wallet-card-split {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; position: relative;
  overflow: hidden; grid-column: span 2; transition: all 0.2s ease;
}
.wallet-card-split:active { transform: scale(0.98); }
.wallet-card-split .split-card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 8px; position: relative; z-index: 1;
}
.wallet-card-split .split-card-icon { font-size: 22px; }
.wallet-card-split .split-card-name {
  font-size: 14px; color: var(--text-secondary); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.wallet-card-split .split-card-badge {
  margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: var(--accent-glow); color: var(--accent); font-weight: 600;
}
.wallet-card-split .split-card-total {
  padding: 0 16px 10px; font-size: 24px; font-weight: 800;
  color: var(--text-primary); position: relative; z-index: 1;
}
.split-card-halves {
  display: flex; position: relative;
  border-top: 1px solid var(--border);
}
.split-card-half {
  flex: 1; padding: 14px 16px; cursor: pointer;
  transition: background 0.2s ease; position: relative;
}
.split-card-half:hover { background: rgba(255,255,255,0.03); }
.split-card-half:active { background: rgba(255,255,255,0.06); }
.split-card-half--personal {
  border-right: 1px solid var(--border);
}
.split-card-half--personal::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #00b894, #55efc4);
  border-radius: 0 0 0 var(--radius);
}
.split-card-half--business::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), #a29bfe);
  border-radius: 0 0 var(--radius) 0;
}
.split-half-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-secondary); margin-bottom: 6px;
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px;
}
.split-half-icon { font-size: 14px; }
.split-half-pct {
  font-size: 10px; padding: 1px 5px; border-radius: 3px;
  background: rgba(255,255,255,0.06); color: var(--text-muted);
}
.split-half-amount {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.split-half-amount--personal { color: var(--green); }
.split-half-amount--business { color: var(--accent); }

/* Top accent bar for split card */
.wallet-card-split::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--green), var(--accent));
  z-index: 2;
}

/* ===== SPLIT RATIO INPUT (Wallet Form) ===== */
.split-ratio-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
.split-ratio-side { flex: 1; text-align: center; }
.split-ratio-label {
  font-size: 11px; color: var(--text-secondary); margin-bottom: 6px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; display: block;
}
.split-ratio-value-wrap {
  display: flex; align-items: center; justify-content: center; gap: 2px;
}
.split-ratio-value {
  width: 54px; padding: 6px 4px; text-align: center; border-radius: 6px;
  background: var(--bg-primary); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 20px; font-weight: 700;
  font-family: inherit; -webkit-appearance: none; -moz-appearance: textfield;
}
.split-ratio-value:focus { outline: none; border-color: var(--accent); }
.split-ratio-value::-webkit-inner-spin-button,
.split-ratio-value::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.split-pct { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.split-ratio-divider {
  font-size: 24px; color: var(--text-muted); font-weight: 300;
}

/* Range slider */
.split-slider {
  width: 100%; margin-top: 12px; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; outline: none;
  background: linear-gradient(90deg, var(--green) 0%, var(--accent) 100%);
  opacity: 0.8; transition: opacity 0.2s;
}
.split-slider:hover { opacity: 1; }
.split-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: white; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 2px solid var(--accent);
}
.split-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: white; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 2px solid var(--accent);
}

/* Presets */
.split-presets { display: flex; gap: 8px; margin-top: 10px; }
.split-preset-btn {
  flex: 1; padding: 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.split-preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.split-preset-btn.active {
  background: var(--accent-glow); border-color: var(--accent); color: var(--accent);
}

/* ===== SPLIT PART SELECTOR (Transaction Form) ===== */
.split-part-tabs { display: flex; gap: 8px; }
.split-part-tab {
  flex: 1; padding: 12px 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer; text-align: center;
  transition: all 0.2s ease; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.split-part-tab:hover { border-color: rgba(255,255,255,0.12); }
.split-part-tab.active[data-part="personal"] {
  border-color: var(--green); background: var(--green-glow); color: var(--green);
}
.split-part-tab.active[data-part="business"] {
  border-color: var(--accent); background: var(--accent-glow); color: var(--accent);
}
.split-part-icon { font-size: 20px; }
.split-part-name { font-size: 12px; font-weight: 600; }
.split-part-balance { font-size: 13px; font-weight: 700; margin-top: 2px; }

/* ===== TRANSACTION SPLIT BADGE ===== */
.tx-split-badge {
  font-size: 9px; padding: 1px 6px; border-radius: 3px;
  font-weight: 600; margin-left: 4px; display: inline-block;
}
.tx-split-badge--personal {
  background: var(--green-glow); color: var(--green);
}
.tx-split-badge--business {
  background: var(--accent-glow); color: var(--accent);
}

/* ===== PERIOD SELECTOR ===== */
.period-selector {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 4px;
}
.period-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.period-tab {
  flex: 1;
  padding: 7px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}
.period-tab:hover {
  border-color: rgba(255,255,255,0.12);
  color: var(--text-primary);
}
.period-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.period-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.period-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.period-nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}
.period-nav-btn:active {
  transform: scale(0.93);
}
.period-nav-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 140px;
  text-align: center;
}
.period-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.input-field-sm {
  padding: 8px 10px;
  font-size: 13px;
}
.period-range-sep {
  color: var(--text-muted);
  font-size: 16px;
}
.period-apply-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.period-apply-btn:hover {
  background: var(--accent);
  color: white;
}

/* ===== COMPARE PERIODS BUTTON ===== */
.btn-compare {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(108, 92, 231, 0.3);
  background: linear-gradient(135deg, rgba(108,92,231,0.12) 0%, rgba(162,155,254,0.06) 100%);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.btn-compare::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(108,92,231,0.1), transparent);
  transition: left 0.5s ease;
}
.btn-compare:hover::before {
  left: 100%;
}
.btn-compare:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(108,92,231,0.2) 0%, rgba(162,155,254,0.1) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(108,92,231,0.2);
}
.btn-compare:active {
  transform: scale(0.98);
}
.btn-compare-icon {
  font-size: 20px;
}

/* ===== COMPARISON MODAL ===== */
.modal-content-compare {
  max-height: 92vh;
}
.compare-setup {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.compare-period-block {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.compare-period-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.compare-period-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 8px;
}
.compare-period-tabs .period-tab {
  font-size: 11px;
  padding: 5px 3px;
}
.compare-period-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.compare-period-nav .period-nav-btn {
  width: 28px;
  height: 28px;
  font-size: 16px;
}
.compare-period-nav .period-nav-label {
  font-size: 13px;
  min-width: 90px;
}
.compare-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  padding: 0 4px;
  align-self: center;
}
.compare-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.compare-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.compare-summary-card .cmp-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.compare-summary-card .cmp-values {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: baseline;
}
.compare-summary-card .cmp-val-a {
  font-size: 16px;
  font-weight: 700;
}
.compare-summary-card .cmp-val-b {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.compare-summary-card .cmp-arrow {
  font-size: 14px;
}
.compare-summary-card .cmp-change {
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}
.cmp-change.positive {
  color: var(--green);
  background: var(--green-glow);
}
.cmp-change.negative {
  color: var(--red);
  background: var(--red-glow);
}
.cmp-change.neutral {
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
}
.compare-chart-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.compare-chart-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}
.compare-chart-section canvas {
  width: 100% !important;
  border-radius: 8px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

/* ===== ANIMATIONS ===== */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.loading { animation: pulse 1.5s infinite; }

/* ===== DESKTOP ===== */
@media (min-width: 600px) {
  #views-container {
    max-width: 1100px; margin: 0 auto; scrollbar-gutter: stable;
  }
  .modal { align-items: center; }
  .modal-content {
    border-radius: var(--radius); margin-bottom: 0;
    max-width: 860px; max-height: 88vh;
  }
  .wallets-grid { grid-template-columns: repeat(4, 1fr); }
  .wallet-card-split { grid-column: span 2; }
  /* Settings — Импорт/Экспорт рядом, остальное на всю ширину */
  .settings-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .settings-group {
    width: 100%;
  }
  .settings-group:nth-child(3),
  .settings-group:nth-child(4),
  .settings-group:nth-child(5) {
    grid-column: span 2;
  }
}
