/* ═══════════════════════════════════════════════════════════════════
   TraderAI — Global Stylesheet
   Terminal-style dark financial platform
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Design tokens ─────────────────────────────────────────────── */
:root {
  --bg-base:       #060b18;
  --bg-card:       #0c1428;
  --bg-card-hover: #111e38;
  --bg-input:      #0a1020;

  --border:        #1a2840;
  --border-bright: #1e3a5f;

  --primary:    #0ea5e9;   /* sky blue  */
  --primary-dim:#0369a1;
  --accent:     #06b6d4;   /* cyan      */

  --green:      #22c55e;
  --green-dim:  #16a34a;
  --red:        #ef4444;
  --red-dim:    #b91c1c;
  --yellow:     #f59e0b;

  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow: 0 4px 24px rgba(0,0,0,.6);
  --glow-blue: 0 0 20px rgba(14,165,233,.25);
  --glow-green: 0 0 20px rgba(34,197,94,.2);
}

/* ─── Light theme overrides ─────────────────────────────────────── */
html.light {
  --bg-base:       #f0f4f8;
  --bg-card:       #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input:      #ffffff;

  --border:        #e2e8f0;
  --border-bright: #cbd5e1;

  --text:       #0f172a;
  --text-muted: #64748b;
  --text-dim:   #475569;

  --shadow: 0 4px 24px rgba(0,0,0,.10);
}

html.light body {
  background: var(--bg-base);
  color: var(--text);
}

html.light .nav {
  background: rgba(240,244,248,.95);
  border-bottom-color: var(--border);
}

html.light .card,
html.light .auth-card,
html.light .modal {
  background: var(--bg-card);
  border-color: var(--border);
}

html.light .input {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
}

html.light #sidebar {
  background: #f8fafc;
  border-right-color: var(--border);
}

html.light .sb-link { color: var(--text-dim); }
html.light .sb-link:hover { background: rgba(14,165,233,.08); color: var(--text); }
html.light .ticker-bar { background: var(--bg-card); border-bottom-color: var(--border); }
html.light .hamburger-btn { border-color: var(--border); }
html.light .ham-line { background: var(--text-dim); }

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

img, svg { display: block; }

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* ─── Typography ────────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: .9rem;  font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }

.mono { font-family: var(--font-mono); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-primary{ color: var(--primary); }

/* ─── Layout helpers ────────────────────────────────────────────── */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.flex       { display: flex; }
.flex-center{ display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* ─── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color .2s, box-shadow .2s;
}
.card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ─── Button ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); box-shadow: var(--glow-blue); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: rgba(14,165,233,.12); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text); }
.btn-green  { background: var(--green);  color: #fff; }
.btn-green:hover  { background: var(--green-dim); }
.btn-red    { background: var(--red);    color: #fff; }
.btn-red:hover    { background: var(--red-dim); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* ─── Badge ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
}
.badge-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-red    { background: rgba(239,68,68,.15);   color: var(--red); }
.badge-blue   { background: rgba(14,165,233,.15);  color: var(--primary); }
.badge-yellow { background: rgba(245,158,11,.15);  color: var(--yellow); }

/* ─── Form elements ─────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s;
}
.input:focus  { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,.1); }
.input::placeholder { color: var(--text-muted); }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-group { margin-bottom: 16px; }

/* ─── Hamburger button ──────────────────────────────────────────── */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 12px;
  transition: border-color .2s, background .2s;
}
.hamburger-btn:hover {
  border-color: var(--primary);
  background: rgba(14,165,233,.08);
}
.ham-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: transform .25s, opacity .25s, background .2s;
}
.hamburger-btn:hover .ham-line { background: var(--primary); }
.hamburger-btn.active .ham-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.active .ham-line:nth-child(2) { opacity: 0; }
.hamburger-btn.active .ham-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Fixed variant (login page — no nav) */
.hamburger-fixed {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 500;
  background: var(--bg-card) !important;
  border-color: var(--border-bright) !important;
}

/* ─── Sidebar backdrop ──────────────────────────────────────────── */
#sb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 599;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
#sb-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* ─── Sidebar panel ─────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100dvh;
  background: #080f20;
  border-right: 1px solid var(--border-bright);
  z-index: 600;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 40px rgba(0,0,0,.7);
}
#sidebar.open {
  transform: translateX(0);
}

/* Close button */
.sb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, color .2s;
}
.sb-close:hover { border-color: var(--red); color: var(--red); }

/* User profile block */
.sb-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
}
.sb-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .3s;
}
.sb-profile-info { overflow: hidden; }
.sb-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.sb-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Divider */
.sb-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 20px;
  flex-shrink: 0;
}

/* Nav links */
.sb-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 2px;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sb-link:hover {
  background: rgba(14,165,233,.08);
  color: var(--text);
}
.sb-link.active {
  background: rgba(14,165,233,.12);
  color: var(--primary);
}
.sb-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.sb-btn-link { color: var(--text-dim); }
.sb-btn-link:hover { color: var(--red); background: rgba(239,68,68,.08); }

/* Footer */
.sb-footer {
  margin-top: auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Top Nav ───────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6,11,24,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}
.nav-logo span { color: var(--primary); }
.nav-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all .15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-card);
}
.nav-links a.active { color: var(--primary); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ─── Ticker tape ───────────────────────────────────────────────── */
.ticker-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 0;
}
.ticker-track {
  display: inline-flex;
  gap: 40px;
  animation: tickerScroll 40s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.ticker-symbol { color: var(--text-dim); font-weight: 600; }
.ticker-price  { color: var(--text); }
.ticker-change { font-size: 11px; }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ─── Market clocks ─────────────────────────────────────────────── */
.clocks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.clock-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: all .2s;
}
.clock-card:hover { border-color: var(--border-bright); }
.clock-city { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 8px; }
.clock-time { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--text); letter-spacing: .05em; }
.clock-status { margin-top: 8px; }
.status-open   { background: rgba(34,197,94,.15); color: var(--green); }
.status-closed { background: rgba(100,116,139,.15); color: var(--text-muted); }
.status-pre    { background: rgba(245,158,11,.15);  color: var(--yellow); }

/* ─── Section headings ──────────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.section-title h2 { font-size: 1.2rem; }
.section-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* ─── Asset card (top assets) ───────────────────────────────────── */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
}
.asset-card:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-blue);
  transform: translateY(-2px);
}
.asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.asset-info { display: flex; align-items: center; gap: 10px; }
.asset-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.asset-symbol { font-weight: 700; font-size: 15px; }
.asset-name   { font-size: 12px; color: var(--text-muted); }
.asset-price  { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; }
.asset-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.sparkline-container { height: 48px; }

/* ─── News ───────────────────────────────────────────────────────── */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.news-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.news-source {
  display: flex;
  align-items: center;
  gap: 8px;
}
.news-source-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(14,165,233,.1);
  padding: 2px 8px;
  border-radius: 4px;
}
.news-time { font-size: 11px; color: var(--text-muted); }
.news-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.news-summary { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ─── Hero banner ───────────────────────────────────────────────── */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse, rgba(14,165,233,.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14,165,233,.1);
  border: 1px solid rgba(14,165,233,.3);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.hero h1 { font-size: 3rem; line-height: 1.15; margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p { font-size: 1.1rem; color: var(--text-dim); max-width: 540px; margin: 0 auto 32px; }
.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ─── Dashboard grid ────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-grid .span-2 { grid-column: span 2; }
.dashboard-grid .span-3 { grid-column: span 3; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700; }
.stat-change { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 6px; }

/* ─── Table ──────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(26,40,64,.6);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Tabs ──────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
}
.tab {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: transparent;
}
.tab:hover    { color: var(--text); }
.tab.active   { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow); }

/* ─── Filter chips ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  transition: all .15s;
}
.chip:hover  { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Search bar ────────────────────────────────────────────────── */
.search-wrapper {
  position: relative;
  max-width: 320px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.search-input { padding-left: 36px; }

/* ─── Donut chart ───────────────────────────────────────────────── */
.donut-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
}
canvas#donut-chart {
  filter: drop-shadow(0 0 12px rgba(245,158,11,0.18));
  flex-shrink: 0;
}
.donut-legend  { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.legend-item   { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.legend-item:last-child { border-bottom: none; }
.legend-dot    { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.legend-label  { color: var(--text-dim); flex: 1; text-transform: capitalize; }
.legend-pct    { font-family: var(--font-mono); font-weight: 700; }
.legend-value  { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* ─── Broker autocomplete ───────────────────────────────────────── */
.broker-field    { position: relative; }
.broker-chips    { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.broker-chip     { padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border);
                   background: transparent; color: var(--text-muted); cursor: pointer;
                   font-size: 12px; transition: all .15s; }
.broker-chip:hover, .broker-chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.broker-dropdown { position: absolute; background: var(--bg-card); border: 1px solid var(--border);
                   border-radius: 8px; max-height: 180px; overflow-y: auto; z-index: 200;
                   width: 100%; box-shadow: 0 8px 24px rgba(0,0,0,.4); display: none; top: 100%; left: 0; }
.broker-option   { padding: 10px 14px; cursor: pointer; font-size: 13px; }
.broker-option:hover { background: rgba(255,255,255,.06); }

/* ─── AI Analysis panel ─────────────────────────────────────────── */
.ai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ai-header {
  background: linear-gradient(135deg, rgba(14,165,233,.15), rgba(6,182,212,.08));
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 3px 8px;
  border-radius: 4px;
}
.ai-body { padding: 20px; }
.ai-section { margin-bottom: 16px; }
.ai-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.ai-text { font-size: 13px; color: var(--text-dim); line-height: 1.7; }

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .1em;
}
.verdict-buy  { background: rgba(34,197,94,.15);  color: var(--green);   border: 1px solid rgba(34,197,94,.3); }
.verdict-hold { background: rgba(245,158,11,.15); color: var(--yellow);  border: 1px solid rgba(245,158,11,.3); }
.verdict-sell { background: rgba(239,68,68,.15);  color: var(--red);     border: 1px solid rgba(239,68,68,.3); }

/* ─── Chat ──────────────────────────────────────────────────────── */
.chat-messages {
  height: 320px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
}
.chat-msg.user {
  background: rgba(14,165,233,.15);
  border: 1px solid rgba(14,165,233,.25);
  align-self: flex-end;
  color: var(--text);
}
.chat-msg.ai {
  background: var(--bg-input);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text-dim);
}
.chat-msg.ai .msg-label { font-size: 10px; font-weight: 700; color: var(--primary); margin-bottom: 4px; letter-spacing: .06em; }
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ─── Login page ─────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(14,165,233,.08) 0%, transparent 60%);
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.auth-tab.active { background: var(--bg-card); color: var(--primary); }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.divider::before,
.divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── Translation prevention ────────────────────────────────────── */
.notranslate { translate: no; }

/* ─── Login page buttons ─────────────────────────────────────────── */
#login-form button[type="submit"],
#signup-form button[type="submit"] {
  margin-bottom: 16px;
}

button[onclick="signInWithGoogle()"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
button[onclick="signInWithGoogle()"]:hover {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.2);
}
a[href*="demo=1"] { margin-top: 8px; }

/* ─── Market page ────────────────────────────────────────────────── */
.market-row-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.sparkline-td { width: 100px; }

/* ─── Chart period buttons ───────────────────────────────────────── */
.period-btns { display: flex; gap: 4px; }
.period-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all .15s;
}
.period-btn:hover  { border-color: var(--primary); color: var(--primary); }
.period-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Portfolio add form ─────────────────────────────────────────── */
.add-position-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
}

/* ─── Loading skeleton ───────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position:  1000px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-sm);
}

/* ─── Toast notification ─────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  min-width: 280px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--primary); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  transform: translateY(16px);
  transition: transform .2s;
  overflow: visible;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text); }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .clocks-grid        { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid     { grid-template-columns: 1fr 1fr; }
  .dashboard-grid .span-3 { grid-column: span 2; }
  .form-grid-4        { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2rem; }
  .clocks-grid    { grid-template-columns: 1fr; }
  .assets-grid    { grid-template-columns: 1fr; }
  .news-grid      { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .span-2, .dashboard-grid .span-3 { grid-column: 1; }
  .nav-links      { display: none; }
  .form-grid-4    { grid-template-columns: 1fr; }
  .container      { padding: 0 16px; }
}

/* ─── Utility ────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.py-32 { padding-top: 32px; padding-bottom: 32px; }
.py-48 { padding-top: 48px; padding-bottom: 48px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ─── Page section spacing ───────────────────────────────────────── */
.page-section { padding: 40px 0; }
.page-section + .page-section { border-top: 1px solid var(--border); }

/* ─── Watchlist panel ────────────────────────────────────────────── */
.wl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.wl-row:last-child { border-bottom: none; }
.wl-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
}
.wl-symbol { font-weight: 700; font-size: 14px; color: var(--text); }
.wl-name   { font-size: 11px; color: var(--text-muted); }
.wl-price  { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; }
.wl-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .2s;
}
.wl-remove:hover { color: var(--red); }
