/*
 * rheos.css — Rheos dark/red theme
 * Extends and overrides Perseus conventions (UIkit base + perseus class patterns).
 * Variables: mirror perseus naming but redirect to Rheos palette.
 */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ────────────────────────────────────────────────── */
:root {
  /* Canvas */
  --bg-base:       #0a0a0f;
  --bg-surface:    #0f0f17;
  --bg-card:       #13131e;
  --bg-card-hover: #181826;
  --bg-input:      #0d0d18;
  --bg-sidebar:    #0c0c16;

  /* Red accent (Rheos brand) */
  --red:           #ff0000;
  --red-light:     #ff3333;
  --red-dark:      #cc0000;
  --red-glow:      rgba(255, 0, 0, 0.3);
  --red-subtle:    rgba(255, 0, 0, 0.12);

  /* Text */
  --text-primary:   #f0f0f5;
  --text-secondary: #9898b0;
  --text-muted:     #5a5a72;
  --text-mono:      #e0e0f0;

  /* Borders */
  --border:        rgba(255, 255, 255, 0.07);
  --border-red:    rgba(255, 0, 0, 0.35);
  --border-active: var(--red);

  /* Status */
  --green:         #2ecc71;
  --green-subtle:  rgba(46, 204, 113, 0.15);
  --yellow:        #f39c12;
  --yellow-subtle: rgba(243, 156, 18, 0.15);
  --red-loss:      #ff4444;
  --red-loss-subtle: rgba(255, 68, 68, 0.15);

  /* Layout */
  --sidebar-w:     240px;
  --topbar-h:      58px;
  --radius-card:   16px;
  --radius-sm:     10px;
  --radius-pill:   999px;

  /* Typography (mirror Perseus tokens) */
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:     'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* Shadows */
  --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-red:    0 0 24px rgba(255, 0, 0, 0.2);
  --shadow-modal:  0 24px 80px rgba(0, 0, 0, 0.7);

  /* Transitions */
  --ease:          cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--red-light); text-decoration: none; }
a:hover { color: var(--red); }

/* ── Typography (Perseus class names, Rheos values) ───────────────────────── */
.t-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-light);
}

.t-headline {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.t-headline-grad {
  background: linear-gradient(135deg, #ffffff 30%, #ff8a7a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.t-subhead {
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.55;
  color: var(--text-secondary);
}

.t-mono {
  font-family: var(--font-mono);
  color: var(--text-mono);
}

.display-title {
  font-size: clamp(24px, 3.5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

/* ── Containers (Perseus conventions) ─────────────────────────────────────── */
.container {
  max-width: 980px;
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 40px);
  width: 100%;
}

.container-lg {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 40px);
  width: 100%;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  border: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn svg { width: 14px; height: 14px; flex: 0 0 14px; }

.btn-primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 12px var(--red-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--red-light) 0%, var(--red) 100%);
  color: #fff;
  box-shadow: 0 4px 20px var(--red-glow);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}

.btn-danger {
  background: rgba(255,68,68,0.15);
  color: var(--red-light);
  border: 1px solid rgba(255,68,68,0.3);
}
.btn-danger:hover {
  background: rgba(255,68,68,0.25);
  color: var(--red-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 15px; }

/* ── Cards (Perseus bento-card adapted) ───────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.card-glow {
  border-color: var(--border-red);
  box-shadow: var(--shadow-red);
}

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

.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ── Surface (Perseus .surface adapted for dark theme) ────────────────────── */
.surface {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── App Shell Layout ──────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s var(--ease);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px var(--red-glow);
}

.sidebar-logo-mark svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.sidebar-logo-text span {
  color: var(--red-light);
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 450;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: var(--red-subtle);
  color: #fff;
  font-weight: 500;
}
.nav-item.active svg { opacity: 1; stroke: var(--red-light); }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  line-height: 16px;
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Main content area ─────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.topbar-spacer { flex: 1; }

.page-body {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Stats row (dashboard, portfolio) ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
}

.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.positive { color: var(--green) !important; }
.negative { color: var(--red-loss) !important; }
.neutral  { color: var(--text-secondary) !important; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td {
  background: rgba(255,255,255,0.025);
  color: var(--text-primary);
}

/* ── Status badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-buy   { background: var(--green-subtle);    color: var(--green);    }
.badge-sell  { background: var(--red-loss-subtle); color: var(--red-loss); }
.badge-hold  { background: var(--yellow-subtle);   color: var(--yellow);   }
.badge-open  { background: rgba(100,149,237,0.15); color: #6495ed;         }
.badge-closed{ background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-paper { background: var(--yellow-subtle);   color: var(--yellow);   }
.badge-live  { background: var(--green-subtle);    color: var(--green);    }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-dot-pulse {
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ── Bot status indicator ──────────────────────────────────────────────────── */
.bot-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}

.bot-status-running { background: var(--green-subtle);    border-color: rgba(46,204,113,0.3); color: var(--green);    }
.bot-status-stopped { background: var(--red-loss-subtle); border-color: rgba(255,68,68,0.3);  color: var(--red-loss); }
.bot-status-paper   { background: var(--yellow-subtle);   border-color: rgba(243,156,18,0.3); color: var(--yellow);   }

.bot-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.bot-status-running .bot-status-dot { animation: pulse-dot 1.5s ease-in-out infinite; }

/* ── Confidence meter ──────────────────────────────────────────────────────── */
.confidence-meter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.confidence-bar-track {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red-dark), var(--red), var(--red-light));
  transition: width 0.8s var(--ease-bounce);
  width: 0%;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-subtle);
}

input::placeholder { color: var(--text-muted); }

select option { background: var(--bg-card); color: var(--text-primary); }

.form-error {
  font-size: 12px;
  color: var(--red-light);
  margin-top: 2px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Range slider ──────────────────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  padding: 0;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  cursor: pointer;
  box-shadow: 0 0 8px var(--red-glow);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── Chat UI ───────────────────────────────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 56px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.msg {
  display: flex;
  gap: 12px;
  max-width: 78%;
  animation: msg-in 0.3s var(--ease) both;
}

.msg-user  { margin-left: auto; flex-direction: row-reverse; }
.msg-assistant { margin-right: auto; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.msg-avatar-ai {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  box-shadow: 0 2px 8px var(--red-glow);
  color: #fff;
  font-size: 11px;
}

.msg-avatar-user { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.msg-user .msg-bubble {
  background: var(--red-subtle);
  border: 1px solid var(--border-red);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

.msg-assistant .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}
.msg-assistant .msg-time { text-align: left; }

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 16px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.chat-input-wrap {
  flex: 1;
  position: relative;
}

.chat-textarea {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Signal feed ───────────────────────────────────────────────────────────── */
.signal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.signal-row:last-child { border-bottom: none; }

.signal-symbol {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 70px;
}

.signal-meta {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

.signal-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Gauge (confidence circle) ─────────────────────────────────────────────── */
.gauge-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.gauge-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.gauge-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }

.gauge-fill {
  fill: none;
  stroke: url(#gaugeGrad);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-bounce);
}

.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.gauge-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Auth page ─────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 1000px 600px at 10% -10%, rgba(255,0,0,0.18), transparent 60%),
    radial-gradient(ellipse 800px 500px at 90% 110%, rgba(142,26,14,0.12), transparent 60%),
    var(--bg-base);
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow-modal);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-mark {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--red-glow);
  margin-bottom: 12px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 7px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  color: var(--text-muted);
  border: none;
  background: transparent;
}

.auth-tab.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ── Chart container ───────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  width: 100% !important;
}

/* ── Ticker strip ──────────────────────────────────────────────────────────── */
.ticker-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ticker-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
  cursor: pointer;
}

.ticker-chip:hover { border-color: var(--border-red); }
.ticker-chip.active { border-color: var(--red); box-shadow: var(--shadow-red); }

.ticker-symbol {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ticker-price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.ticker-change {
  font-size: 11px;
  font-weight: 600;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ── Reveal animations (Perseus convention) ────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  transform: scale(0.95);
  transition: transform 0.25s var(--ease-bounce);
}

.modal-overlay.open .modal { transform: scale(1); }

/* ── Notification toast ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  max-width: 340px;
  animation: toast-in 0.3s var(--ease-bounce) both;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red-loss); }
.toast-info    { border-left: 3px solid #6495ed; }

/* ── Keyframes ─────────────────────────────────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1; }
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
}

@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
}
