@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2dd4a0;
  --primary-dim: rgba(45, 212, 160, 0.15);
  --accent: #facc15;
  --bg: #0a0f1c;
  --bg-2: #060912;
  --sidebar: #060a14;
  --card: rgba(15, 23, 42, 0.7);
  --card-solid: #131c30;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --border: rgba(45, 212, 160, 0.25);
  --border-soft: rgba(255, 255, 255, 0.06);
  --green: #2dd4a0;
  --red: #f87171;
  --yellow: #facc15;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
  --radius: 12px;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 212, 160, 0.06), transparent),
    radial-gradient(ellipse 60% 60% at 100% 80%, rgba(96, 165, 250, 0.04), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
}

button { font-family: inherit; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ───── TICKER STRIP ───── */
.ticker-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: rgba(10, 15, 28, 0.95);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
  z-index: 200;
  backdrop-filter: blur(12px);
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2.5rem;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
  padding-left: 100%;
}

@keyframes ticker {
  to { transform: translateX(-100%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-family: var(--mono);
  font-weight: 600;
}

.ticker-item .sym { color: var(--text-dim); }
.ticker-item .price { color: var(--text); }
.ticker-item .chg { font-size: 0.8rem; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; }
.ticker-item .chg.up { background: rgba(45, 212, 160, 0.12); color: var(--green); }
.ticker-item .chg.down { background: rgba(248, 113, 113, 0.12); color: var(--red); }

/* ───── SIDEBAR ───── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 0;
  padding-top: calc(36px + 1.2rem);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-top { padding: 0 1.4rem 1.2rem; border-bottom: 1px solid var(--border-soft); }

.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-mark { font-size: 1.6rem; }

.brand-text span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sb-nav { flex: 1; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.25rem; }

.sb-link {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}

.sb-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.sb-link.active { background: var(--primary-dim); color: var(--primary); }

.sb-icon { font-size: 1.15rem; flex-shrink: 0; }

.sb-count {
  background: var(--primary);
  color: #0a0f1c;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  margin-left: auto;
}

.sb-bottom { padding: 1rem 1.4rem 0; border-top: 1px solid var(--border-soft); margin-top: 1rem; }

.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 0.8rem;
  transition: all 0.2s;
}

.back-link:hover { background: var(--primary-dim); transform: translateX(-3px); }

.live-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 160, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(45, 212, 160, 0); }
}

/* ───── MAIN ───── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 36px;
}

.topbar {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 36px;
  z-index: 50;
}

.mobile-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.page-title { margin: 0; font-size: 1.3rem; flex: 1; }

.topbar-right { display: flex; gap: 0.7rem; align-items: center; }

.currency-toggle {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 3px;
  display: flex;
  gap: 2px;
}

.cur-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.cur-btn.active { background: var(--primary); color: #0a0f1c; }

.btc-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
}

.btc-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.btc-price {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
}

/* ───── PAGE ───── */
.page { padding: 2rem; animation: fadeIn 0.3s ease; }
.page[hidden] { display: none !important; }

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

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-title { margin: 0 0 0.2rem; font-size: 1.5rem; }
.section-sub { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

/* ───── BUTTONS ───── */
.btn-primary, .btn-ghost {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #22b387);
  color: #0a0f1c;
  padding: 0.65rem 1.4rem;
  box-shadow: 0 4px 15px rgba(45, 212, 160, 0.25);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(45, 212, 160, 0.4); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
  padding: 0.5rem 1.1rem;
}

.btn-ghost:hover { background: var(--primary-dim); }

/* ───── MARKET STATS ───── */
.market-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ms-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.ms-card:hover { transform: translateY(-2px); border-color: var(--border); }

.ms-label { color: var(--text-dim); font-size: 0.78rem; margin-bottom: 0.4rem; font-weight: 500; }
.ms-value { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 0.5rem; }
.ms-change { font-size: 0.85rem; font-weight: 600; }
.ms-change.positive { color: var(--green); }
.ms-change.negative { color: var(--red); }

.ms-bar {
  margin-top: 0.5rem;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.ms-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.5s;
}

.fear-greed {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.08), rgba(250, 204, 21, 0.05));
}

.fg-value {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.fg-label {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ───── DASHBOARD GRID ───── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel h3 { margin: 0; font-size: 1.05rem; }
.panel-sub { color: var(--text-dim); font-size: 0.82rem; margin: 0 0 1rem; }

.time-range {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.tr-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
  font-family: var(--mono);
}

.tr-btn.active { background: var(--primary); color: #0a0f1c; }

.chart-wrap { position: relative; height: 320px; }

/* ───── MOVERS LIST ───── */
.movers-list { display: flex; flex-direction: column; gap: 0.5rem; }

.mover-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.mover-item:hover { background: rgba(0, 0, 0, 0.4); }

.mover-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #0a0f1c;
}

.mover-name { font-weight: 600; }
.mover-sym { color: var(--text-dim); font-size: 0.78rem; font-family: var(--mono); }
.mover-price { font-family: var(--mono); font-weight: 600; }
.mover-chg { font-family: var(--mono); font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.85rem; }
.mover-chg.up { background: rgba(45, 212, 160, 0.12); color: var(--green); }
.mover-chg.down { background: rgba(248, 113, 113, 0.12); color: var(--red); }

/* ───── COINS TABLE ───── */
.coin-list-controls {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.coin-list-controls input {
  flex: 1;
  min-width: 240px;
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  padding: 0.6rem 1.1rem;
  font-family: inherit;
  font-size: 0.92rem;
}

.coin-list-controls input:focus { outline: none; border-color: var(--primary); }

.coin-list-controls select {
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}

.coins-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.coins-table thead { background: rgba(0, 0, 0, 0.3); }
.coins-table th {
  text-align: left;
  padding: 0.9rem 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}

.coins-table th.num { text-align: right; }

.coins-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
}

.coins-table tr:last-child td { border-bottom: none; }
.coins-table tr { cursor: pointer; transition: background 0.15s; }
.coins-table tr:hover td { background: rgba(45, 212, 160, 0.03); }

.coin-cell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.coin-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0a0f1c;
  flex-shrink: 0;
}

.coin-name { font-weight: 600; }
.coin-sym { color: var(--text-dim); font-size: 0.78rem; font-family: var(--mono); text-transform: uppercase; }

.num-cell {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.num-cell strong { font-weight: 700; }

.chg-up { color: var(--green); }
.chg-down { color: var(--red); }

.spark-wrap { width: 110px; height: 36px; }
.spark-wrap canvas { max-width: 100%; max-height: 100%; }

.fav-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.fav-btn:hover { color: var(--accent); }
.fav-btn.active { color: var(--accent); }

/* ───── COIN DETAIL ───── */
.cd-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.cd-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

.cd-head .coin-icon { width: 56px; height: 56px; font-size: 1.4rem; }

.cd-meta { flex: 1; min-width: 0; }
.cd-name { font-size: 1.4rem; font-weight: 700; }
.cd-sym { color: var(--text-dim); font-family: var(--mono); font-size: 0.85rem; text-transform: uppercase; }

.cd-actions { display: flex; gap: 0.5rem; }

.cd-price-row { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

.cd-price {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.cd-chg {
  font-family: var(--mono);
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
  font-size: 1rem;
}

.cd-chg.up { background: rgba(45, 212, 160, 0.15); color: var(--green); }
.cd-chg.down { background: rgba(248, 113, 113, 0.15); color: var(--red); }

.cd-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.cd-stat {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 0.8rem;
}

.cd-stat .lbl { color: var(--text-dim); font-size: 0.75rem; margin-bottom: 0.3rem; }
.cd-stat .val { font-family: var(--mono); font-weight: 700; }

/* ───── PORTFOLIO ───── */
.portfolio-hero {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.1), rgba(96, 165, 250, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: center;
  backdrop-filter: blur(10px);
}

@media (max-width: 900px) { .portfolio-hero { grid-template-columns: 1fr; } }

.port-label { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.4rem; }

.port-amount {
  font-family: var(--mono);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.port-pnl { font-family: var(--mono); }
.port-pnl .pnl-amt { font-size: 1.2rem; font-weight: 700; }
.port-pnl .pnl-pct { font-size: 1rem; margin-left: 0.5rem; }
.port-pnl .pnl-label { color: var(--text-dim); font-size: 0.85rem; margin-left: 0.5rem; font-family: 'Poppins'; }
.port-pnl.positive .pnl-amt, .port-pnl.positive .pnl-pct { color: var(--green); }
.port-pnl.negative .pnl-amt, .port-pnl.negative .pnl-pct { color: var(--red); }

.port-chart-wrap { position: relative; height: 180px; }

/* ───── ALERTS ───── */
.alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.alert-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  backdrop-filter: blur(10px);
}

.alert-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; }
.alert-head .coin-icon { width: 40px; height: 40px; font-size: 1rem; }

.alert-coin-name { font-weight: 700; font-size: 1rem; }
.alert-current { color: var(--text-dim); font-size: 0.78rem; font-family: var(--mono); }

.alert-condition {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 0.8rem;
}

.alert-dir { font-size: 0.78rem; color: var(--text-dim); }
.alert-target {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.alert-target.up { color: var(--green); }
.alert-target.down { color: var(--red); }

.alert-progress {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.alert-actions { display: flex; gap: 0.5rem; }

.action-sm {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s;
}

.action-sm:hover { background: var(--primary-dim); color: var(--primary); }
.action-sm.danger:hover { background: rgba(248,113,113,0.1); color: var(--red); border-color: rgba(248,113,113,0.3); }

/* Triggered alert styling */
.alert-card.triggered { border-color: var(--accent); animation: glow 2s infinite; }

@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(250, 204, 21, 0); }
}

/* ───── SENTIMENT ───── */
.sentiment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .sentiment-grid { grid-template-columns: 1fr; } }

.fg-gauge-wrap { text-align: center; }
.fg-gauge { max-width: 320px; margin: 0 auto; position: relative; }
.fg-gauge svg { width: 100%; height: auto; }
.fg-needle { transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1); transform-origin: 100px 100px; }

.fg-readout { margin-top: -2.5rem; text-align: center; }
.fg-num { font-family: var(--mono); font-size: 2.5rem; font-weight: 800; line-height: 1; }
.fg-text { font-size: 1rem; font-weight: 600; margin-top: 0.3rem; }

.fg-labels-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* News feed */
.news-feed { display: flex; flex-direction: column; gap: 0.8rem; }

.news-item {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  border-left: 3px solid var(--primary);
}

.news-item.bullish { border-left-color: var(--green); }
.news-item.bearish { border-left-color: var(--red); }
.news-item.neutral { border-left-color: var(--blue); }

.news-icon { font-size: 1.5rem; flex-shrink: 0; }
.news-content { flex: 1; min-width: 0; }
.news-title { font-weight: 600; margin-bottom: 0.3rem; font-size: 0.95rem; }
.news-source { color: var(--text-dim); font-size: 0.78rem; }
.news-time { color: var(--text-faint); font-size: 0.72rem; margin-left: 0.5rem; }
.news-sentiment-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

.news-sentiment-tag.bullish { background: rgba(45, 212, 160, 0.15); color: var(--green); }
.news-sentiment-tag.bearish { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.news-sentiment-tag.neutral { background: rgba(96, 165, 250, 0.15); color: var(--blue); }

/* ───── EMPTY STATE ───── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.empty-emoji { font-size: 3rem; margin-bottom: 0.8rem; opacity: 0.6; }

/* ───── MODAL ───── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal[hidden] { display: none; }

.modal-content {
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  animation: slideUp 0.3s ease;
  max-height: 92vh;
  overflow-y: auto;
}

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

.modal-content h2 { margin: 0 0 1.2rem; color: var(--primary); }

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.form-row { margin-bottom: 1.1rem; }
.form-row.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

.form-row label {
  display: block;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-row input, .form-row select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
}

.form-row input:focus, .form-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.trigger-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.trigger-option input { display: none; }

.trigger-card {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.trigger-card.up { color: var(--green); }
.trigger-card.down { color: var(--red); }
.trigger-option input:checked + .trigger-card { border-color: currentColor; background: rgba(45, 212, 160, 0.1); }
.trigger-option input[value="below"]:checked + .trigger-card { background: rgba(248, 113, 113, 0.1); }

.notify-options { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.notify-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.notify-opt input { margin: 0; }

.form-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 1.3rem;
}

/* ───── TOAST ───── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-solid);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 0.9rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  animation: toastIn 0.3s ease;
  font-weight: 500;
}

.toast[hidden] { display: none; }

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

/* Price flash animation */
.price-flash-up { animation: flashUp 0.6s; }
.price-flash-down { animation: flashDown 0.6s; }

@keyframes flashUp {
  0% { background-color: rgba(45, 212, 160, 0.3); }
  100% { background-color: transparent; }
}

@keyframes flashDown {
  0% { background-color: rgba(248, 113, 113, 0.3); }
  100% { background-color: transparent; }
}

/* ───── RESPONSIVE ───── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    z-index: 200;
    transition: left 0.3s;
    padding-top: calc(36px + 1.2rem);
  }
  .sidebar.mobile-open { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,0.4); }
  .mobile-menu { display: block; }
}

@media (max-width: 600px) {
  .page { padding: 1.2rem; }
  .topbar { padding: 0.8rem 1.2rem; }
  .btc-mini { display: none; }
  .form-row.split { grid-template-columns: 1fr; }
  .toast { left: 1rem; right: 1rem; }
}
