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

:root {
  --bg: #060610;
  --bg-nav: #09091a;
  --bg-card: rgba(255,255,255,0.033);
  --bg-card-hover: rgba(255,255,255,0.058);
  --bg-input: rgba(255,255,255,0.048);
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.14);
  --text: #dde0ee;
  --text-muted: #55557a;
  --text-dim: #8080a8;
  --bitcoin: #f7931a;
  --stocks: #3b82f6;
  --gold: #eab308;
  --silver: #94a3b8;
  --real-estate: #22c55e;
  --private-equity: #a855f7;
  --income-funds: #14b8a6;
  --cash: #64748b;
  --positive: #22c55e;
  --negative: #ef4444;
  --sidebar-w: 232px;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 20px;
  flex-shrink: 0;
  overflow-y: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  padding: 0 6px;
}

.logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 14px; color: #fff;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.logo-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--text);
}
.logo-name em { color: var(--text-muted); font-style: normal; font-weight: 500; }

.nav-section {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 8px 7px;
}

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all var(--ease);
  border: 1px solid transparent;
  user-select: none;
  text-decoration: none;
  margin-bottom: 1px;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-link.active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}

.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.legend-title {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px; padding: 0 4px;
}

.legend-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; font-size: 12px;
  color: var(--text-dim); cursor: pointer;
  border-radius: 6px; transition: all var(--ease);
}
.legend-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ===== MAIN ===== */
.main {
  flex: 1; overflow-y: auto;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.016) 1px, transparent 1px);
  background-size: 52px 52px;
}

.page {
  display: none; padding: 32px 40px;
  min-height: 100%;
  animation: pgIn 0.22s ease;
  position: relative;
}
.page.active { display: block; }

@keyframes pgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 28px;
}
.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 26px; font-weight: 800;
  color: var(--text); letter-spacing: -0.025em;
}
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color var(--ease), background var(--ease);
}
.card:hover { border-color: var(--border-bright); background: var(--bg-card-hover); }

/* ===== STAT GRID ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 20px;
  transition: all var(--ease);
}
.stat-card:hover { border-color: var(--border-bright); background: var(--bg-card-hover); }

.stat-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 9px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px; font-weight: 600;
  color: var(--text); letter-spacing: -0.02em;
  line-height: 1;
}

/* ===== PRICES LOADING OVERLAY ===== */
#ov-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(10, 10, 22, 0.35);
  border-radius: var(--radius);
}
.ov-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ov-spin 0.75s linear infinite;
}
@keyframes ov-spin { to { transform: rotate(360deg); } }

.stat-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; margin-top: 7px;
  display: flex; align-items: center; gap: 4px;
}
.stat-sub.pos { color: var(--positive); }
.stat-sub.neg { color: var(--negative); }
.stat-sub.muted { color: var(--text-muted); font-family: 'DM Sans', sans-serif; font-size: 11px; }

/* ===== CHART ROW ===== */
.chart-row {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px; margin-bottom: 22px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  transition: all var(--ease);
}
.chart-card:hover { border-color: var(--border-bright); }

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 18px;
}

/* DONUT */
.donut-wrap { position: relative; width: 164px; height: 164px; margin: 0 auto 18px; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.donut-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 600; color: var(--text);
}
.donut-lbl { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.alloc-list { display: flex; flex-direction: column; gap: 8px; }
.alloc-row { display: flex; align-items: center; gap: 8px; }
.alloc-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.alloc-name { font-size: 12px; color: var(--text-dim); flex: 1; }
.alloc-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; color: var(--text);
}
.alloc-amt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-muted);
  min-width: 72px; text-align: right;
}

/* ASSET PERF CARDS */
.asset-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; align-content: start;
}

.asset-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all var(--ease);
  position: relative; overflow: hidden;
}
.asset-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px; border-radius: 10px 10px 0 0;
}
.asset-card:hover { border-color: var(--border-bright); transform: translateY(-1px); }

[data-ac="bitcoin"]::before { background: var(--bitcoin); }
[data-ac="stocks"]::before { background: var(--stocks); }
[data-ac="gold_silver"]::before { background: var(--gold); }
[data-ac="real_estate"]::before { background: var(--real-estate); }
[data-ac="private_equity"]::before { background: var(--private-equity); }
[data-ac="income_funds"]::before { background: var(--income-funds); }
[data-ac="cash"]::before { background: var(--cash); }

.ac-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.ac-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim);
}
.ac-dot { width: 6px; height: 6px; border-radius: 50%; }
.ac-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 6px; border-radius: 4px;
}
.ac-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 600;
  color: var(--text); letter-spacing: -0.02em;
  margin-bottom: 3px;
}
.ac-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.ac-gain { font-family: 'JetBrains Mono', monospace; }

/* ===== TIMELINE ===== */
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  margin-bottom: 20px;
  transition: all var(--ease);
}
.timeline-card:hover { border-color: var(--border-bright); }

/* ===== TRANSACTIONS ===== */
.tx-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px;
  transition: all var(--ease);
}
.tx-card:hover { border-color: var(--border-bright); }

.tx-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 18px;
}

.tx-list { display: flex; flex-direction: column; }

.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: all var(--ease);
}
.tx-item:last-child { border-bottom: none; }

.tx-icon {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tx-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 500; color: var(--text); text-align: right;
}

/* ===== ADD ENTRY PAGE ===== */
.type-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }

.type-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all var(--ease);
  font-family: 'DM Sans', sans-serif;
}
.type-btn:hover { border-color: var(--border-bright); color: var(--text); }
.type-btn .tdot { width: 6px; height: 6px; border-radius: 50%; }

/* ===== FORM ===== */
.entry-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 30px;
  max-width: 660px;
}

.fsection {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 16px;
}

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 16px; margin-bottom: 16px; }
.fgrid.full { grid-template-columns: 1fr; }

.ffield { display: flex; flex-direction: column; gap: 6px; }
.ffield.s2 { grid-column: span 2; }

.flabel {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}

.finput, .fselect {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: var(--text); font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: all var(--ease);
  width: 100%;
}
.finput:focus, .fselect:focus {
  border-color: var(--border-bright);
  background: rgba(255,255,255,0.065);
}
.finput::placeholder { color: var(--text-muted); }
.fselect option { background: #1a1a2e; }

/* Planning page */
.plan-alloc-row {
  display: grid;
  grid-template-columns: 155px 1fr 64px 105px 105px 130px;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
input[type=range].plan-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-bright);
  cursor: pointer;
  outline: none;
}
input[type=range].plan-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border-bright);
}
input[type=range].plan-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border-bright);
}
.plan-pct-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 5px 8px;
  width: 100%;
  text-align: right;
  outline: none;
}
.plan-pct-input:focus { border-color: var(--border-bright); }

.cost-pill {
  grid-column: span 2;
  background: rgba(255,255,255,0.025);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  display: flex; align-items: center; justify-content: space-between;
}
.cost-pill-label { font-size: 11.5px; color: var(--text-muted); }
.cost-pill-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px; font-weight: 600; color: var(--text);
}

.fdivider { height: 1px; background: var(--border); margin: 18px 0 16px; grid-column: span 2; }

.form-actions { display: flex; gap: 9px; align-items: center; margin-top: 22px; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff; border: none;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all var(--ease);
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 4px 14px rgba(59,130,246,0.25);
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-card); color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all var(--ease);
}
.btn-secondary:hover { border-color: var(--border-bright); color: var(--text); }

/* ===== HOLDINGS ===== */
.hfilters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }

.filter-btn {
  padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--ease);
  font-family: 'DM Sans', sans-serif;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-bright); }

.htable-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.htable { width: 100%; border-collapse: collapse; }

.htable th {
  padding: 11px 15px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); text-align: left;
  background: rgba(255,255,255,0.018);
  border-bottom: 1px solid var(--border);
}
.htable th:last-child { text-align: right; }

.htable td {
  padding: 12px 15px;
  font-size: 13px; color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.035);
  vertical-align: middle;
}
.htable tr:last-child td { border-bottom: none; }
.htable tbody tr:hover td { background: rgba(255,255,255,0.018); }
.htable td:last-child { text-align: right; }

.htable tfoot td {
  padding: 13px 15px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.09);
  border-bottom: none;
}

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.pos { color: var(--positive) !important; }
.neg { color: var(--negative) !important; }

.act-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 9px; border-radius: 5px;
  font-size: 11px; cursor: pointer;
  transition: all var(--ease);
  font-family: 'DM Sans', sans-serif;
}
.act-btn:hover { border-color: var(--border-bright); color: var(--text); }
.act-btn.del:hover { border-color: var(--negative); color: var(--negative); }

/* ===== LIVE PRICES ===== */
.live-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 18px;
  margin-bottom: 14px;
  gap: 14px; flex-wrap: wrap;
}
.live-tickers { display: flex; gap: 18px; align-items: center; flex: 1; flex-wrap: wrap; min-width: 0; }
.live-ticker { display: flex; align-items: center; gap: 6px; }
.live-ticker-name {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
}
.live-ticker-price { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--text); }
.live-chg { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; padding: 1px 5px; border-radius: 4px; }
.live-chg.pos { color: var(--positive); background: rgba(34,197,94,0.1); }
.live-chg.neg { color: var(--negative); background: rgba(239,68,68,0.1); }
.live-chg.ld  { color: var(--text-muted); background: rgba(255,255,255,0.05); }
.live-sep { width: 1px; height: 16px; background: var(--border); flex-shrink: 0; }

.live-controls { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.live-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }

.pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.pdot.live    { background: var(--positive); animation: pdot-pulse 2s ease-in-out infinite; }
.pdot.loading { background: #eab308;         animation: pdot-pulse 0.7s ease-in-out infinite; }
.pdot.stale   { background: #eab308; }
.pdot.error   { background: var(--negative); }
@keyframes pdot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.8); }
}
.spin { display: inline-block; animation: do-spin 0.75s linear infinite; }
@keyframes do-spin { to { transform: rotate(360deg); } }

.live-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--positive); background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.18);
  padding: 1px 5px; border-radius: 3px;
  vertical-align: middle; margin-left: 5px;
}
.auto-wrap {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-dim); cursor: pointer;
}
.auto-wrap input[type="checkbox"] { cursor: pointer; accent-color: #3b82f6; width: 13px; height: 13px; }
.lp-cell { display: flex; flex-direction: column; gap: 2px; }
.lp-price { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.lp-chg   { font-family: 'JetBrains Mono', monospace; font-size: 10px; }

/* ===== EMPTY STATE ===== */
.empty {
  text-align: center; padding: 56px 28px;
  color: var(--text-muted);
}
.empty-icon { font-size: 36px; margin-bottom: 14px; opacity: 0.35; }
.empty h3 {
  font-family: 'Syne', sans-serif;
  font-size: 17px; font-weight: 700;
  color: var(--text-dim); margin-bottom: 7px;
}
.empty p { font-size: 13px; max-width: 280px; margin: 0 auto 18px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: #161626;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px 17px;
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--text);
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  transform: translateY(18px); opacity: 0;
  transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 1000; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: #0f0f22;
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  padding: 28px 30px;
  width: 480px; max-width: 95vw;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay.show .modal { transform: scale(1); }

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 700;
  color: var(--text); margin-bottom: 20px;
}

.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 22px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .chart-row { grid-template-columns: 1fr; }
  .asset-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .asset-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .page { padding: 24px 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .ffield.s2 { grid-column: span 1; }
  .cost-pill { grid-column: span 1; }
  .fdivider { grid-column: span 1; }
}

/* ===== ORDER TOGGLE (buy/sell in stock form) ===== */
.order-toggle { display: flex; gap: 0; margin-bottom: 4px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.ot-btn { flex: 1; padding: 9px 14px; background: transparent; border: none; color: var(--text-dim); font-size: 13px; font-weight: 500; cursor: pointer; transition: background var(--ease), color var(--ease); }
.ot-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.ot-btn.active-buy  { background: rgba(59,130,246,0.15); color: #3b82f6; }
.ot-btn.active-sell { background: rgba(239,68,68,0.13); color: var(--negative); }
.badge-sell { background: rgba(239,68,68,0.13); color: var(--negative); }
