/* ============================================================
   ALPHA TRADING ACADEMY — Design System
   Dark green-tinted terminal aesthetic. Light mode included.
   ============================================================ */

:root {
  /* Type */
  --font-display: 'Sora', system-ui, sans-serif;
  --font-ui: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Accent (shared across themes) */
  --green: #22c55e;
  --green-soft: #16a34a;
  --green-glow: rgba(34, 197, 94, 0.18);
  --red: #ef4444;
  --red-soft: #dc2626;
  --amber: #f0b90b;
  --blue: #3b82f6;
  --purple: #a855f7;
  --cyan: #06b6d4;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- DARK (default) ---------- */
/* Tell the browser we already fully theme both modes ourselves — without this,
   some browsers' own "auto dark mode for websites" heuristic can re-process
   an already-dark, custom-palette page on top of our styles and wash out
   text to near-invisible in spots (reported on the AI Coach panel). */
:root, [data-theme="dark"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

:root, [data-theme="dark"] {
  --bg: #07090a;
  --bg-2: #0b0e0d;
  --surface: #0f1311;
  --surface-2: #141917;
  --surface-3: #1a201d;
  --elevated: #111614;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8efe9;
  --text-2: #9aa6a0;
  --text-3: #67726c;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 30px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.55);
  --grid-line: rgba(255,255,255,0.04);
  --glass: rgba(15, 19, 17, 0.72);
}

/* ---------- LIGHT ---------- */
[data-theme="light"] {
  --bg: #f3f5f3;
  --bg-2: #eef1ef;
  --surface: #ffffff;
  --surface-2: #f7f9f7;
  --surface-3: #eef2ef;
  --elevated: #ffffff;
  --border: rgba(10, 20, 15, 0.09);
  --border-strong: rgba(10, 20, 15, 0.16);
  --text: #0e1512;
  --text-2: #5a655f;
  --text-3: #8a948e;
  --shadow: 0 1px 2px rgba(20,40,30,0.06), 0 10px 30px rgba(20,40,30,0.08);
  --shadow-lg: 0 24px 60px rgba(20,40,30,0.14);
  --grid-line: rgba(10,30,20,0.05);
  --glass: rgba(255, 255, 255, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

#root { height: 100vh; }

::selection { background: var(--green-glow); color: var(--text); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--green-glow), transparent 60%),
    var(--bg);
}
.app.collapsed { grid-template-columns: 76px 1fr; }

/* off-canvas nav scrim — hidden on desktop, shown only in the phone drawer */
.nav-scrim { display: none; }

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 0; }

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 18px;
  cursor: pointer;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--green), var(--green-soft));
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: #04140b;
  box-shadow: 0 4px 16px var(--green-glow);
  overflow: hidden;
}
.brand-mark img { width: 78%; height: 78%; object-fit: contain; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.1; white-space: nowrap; }
.brand-name span { display: block; font-size: 9.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0.22em; text-transform: uppercase; margin-top: 3px; }

.nav-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 12px 6px;
}
.collapsed .nav-group-label, .collapsed .brand-name, .collapsed .nav-item .nav-text, .collapsed .nav-item .nav-badge { display: none; }
/* sidebar-reward isn't a .nav-item, so it wasn't covered by the rule above —
   its label + points number overflowed the 76px collapsed rail. */
.collapsed .sidebar-reward { justify-content: center; padding: 9px; gap: 0; }
.collapsed .sidebar-reward .nav-text, .collapsed .sidebar-reward > span:last-child { display: none; }
/* profile row: hiding .nav-text (rule above) still left the logout button
   floating next to the avatar in the 76px rail — hide it too and center. */
.collapsed .sidebar-profile { justify-content: center; padding: 9px; gap: 0; }
.collapsed .sidebar-profile .sidebar-logout-btn { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-md);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  background: transparent; font-family: inherit; text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  position: relative; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--green);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: var(--green-glow); color: var(--green); padding: 2px 7px; border-radius: 99px;
}
.nav-badge.dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; background: var(--green); }

/* Main area */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }

/* Topbar */
.topbar {
  height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  position: relative; z-index: 20;
}
.topbar h1 { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.topbar .crumb { color: var(--text-3); font-size: 13px; font-weight: 500; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  transition: all 0.15s var(--ease); position: relative;
}
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .ping { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }

/* Ticker */
.ticker {
  display: flex; align-items: center; gap: 22px; overflow: hidden;
  flex: 1; mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.ticker-track { display: flex; gap: 26px; animation: ticker 38s linear infinite; white-space: nowrap; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
.tick { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12px; }
.tick b { font-weight: 600; color: var(--text); letter-spacing: 0.02em; }
.tick .px { color: var(--text-2); }
.tick .chg { font-weight: 600; }
.up { color: var(--green); }
.down { color: var(--red); }

/* Content scroll region */
.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 26px; scroll-behavior: smooth; }
.content-inner { max-width: 1500px; margin: 0 auto; animation: fadeUp 0.4s var(--ease-out); }
/* translate-only: never leaves content invisible if the animation is paused/throttled */
@keyframes fadeUp { from { transform: translateY(12px); } to { transform: none; } }
.rule-card { animation: ruleCardIn 0.45s var(--ease-out) both; }
@keyframes ruleCardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  position: relative;
}
.card.pad { padding: 20px; }
.card.hover { transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.card.hover:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.card-sub { font-size: 12px; color: var(--text-3); }

.grid { display: grid; gap: 16px; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mono { font-family: var(--font-mono); }

.section-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); font-size: 13.5px; margin-top: 5px; max-width: 560px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: all 0.15s var(--ease); white-space: nowrap;
}
.btn:hover { background: var(--surface-3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--green), var(--green-soft)); color: #04140b; border-color: transparent; box-shadow: 0 4px 18px var(--green-glow); }
.btn.primary:hover { box-shadow: 0 6px 24px var(--green-glow); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn.danger { background: rgba(239,68,68,0.12); color: var(--red); border-color: rgba(239,68,68,0.3); }

/* Badges / chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge.green { background: var(--green-glow); color: var(--green); border-color: transparent; }
.badge.red { background: rgba(239,68,68,0.12); color: var(--red); border-color: transparent; }
.badge.amber { background: rgba(240,185,11,0.12); color: var(--amber); border-color: transparent; }
.badge.blue { background: rgba(59,130,246,0.12); color: var(--blue); border-color: transparent; }
.badge.purple { background: rgba(168,85,247,0.14); color: var(--purple); border-color: transparent; }
.badge .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Stat block */
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--font-mono); font-size: 27px; font-weight: 600; letter-spacing: -0.02em; margin-top: 7px; line-height: 1; }
.stat-delta { font-family: var(--font-mono); font-size: 12px; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }

/* Avatars */
.avatar {
  border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; color: #fff;
  background: var(--surface-3); position: relative; overflow: hidden;
}
.avatar.ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--green); }
.avatar-on { position: absolute; bottom: -1px; right: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2.5px solid var(--surface); }

/* Progress */
.progress { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green-soft), var(--green)); transition: width 1s var(--ease-out); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.12s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { font-family: var(--font-mono); font-weight: 500; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 8px; border: none; background: transparent; color: var(--text-2); cursor: pointer; transition: all 0.15s var(--ease); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); }

/* Inputs */
.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 14px; color: var(--text);
  font-family: var(--font-ui); font-size: 13.5px; transition: border-color 0.15s var(--ease);
}
.input:focus { outline: none; border-color: var(--green); }
.input::placeholder { color: var(--text-3); }
/* hide the native number-input spinner — it renders inconsistently (and ugly)
   across browsers against this dark theme; a plain field reads cleaner */
.input[type="number"] { -moz-appearance: textfield; }
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.search {
  display: flex; align-items: center; gap: 9px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 13px; height: 38px; min-width: 240px;
}
.search svg { width: 16px; height: 16px; color: var(--text-3); }
.search input { background: none; border: none; outline: none; color: var(--text); font-family: var(--font-ui); font-size: 13px; width: 100%; }

/* Misc utils */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.dim { color: var(--text-2); }
.dim3 { color: var(--text-3); }
.tnum { font-variant-numeric: tabular-nums; }
.scroll-y { overflow-y: auto; }
.tile-glow::before { content:''; position:absolute; inset:0; border-radius: inherit; background: radial-gradient(400px 120px at 50% -20%, var(--green-glow), transparent 70%); opacity:.5; pointer-events:none; }

/* Count-up entrance — translate-only so paused/throttled tabs never hide content */
.rise { animation: rise 0.5s var(--ease-out) both; }
@keyframes rise { from { transform: translateY(8px); } }

/* skeleton shimmer for media placeholders */
.media-ph {
  background:
    repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface-3) 10px, var(--surface-3) 20px);
  border: 1px solid var(--border); border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--text-3);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
}

/* podium */
.podium-bar { border-radius: 12px 12px 0 0; background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--border); border-bottom: none; position: relative; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-wrap {
  height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px; position: relative; overflow: hidden;
}
.auth-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(900px 500px at 78% -8%, var(--green-glow), transparent 58%),
    radial-gradient(700px 420px at 12% 108%, rgba(59,130,246,0.10), transparent 60%),
    var(--bg);
}
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 412px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 30px 28px; box-shadow: var(--shadow-lg);
  animation: rise 0.5s var(--ease-out) both;
}
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
select.input { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2367726c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.auth-err { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--red); background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); border-radius: var(--r-md); padding: 9px 12px; }
.auth-demo { margin-top: 18px; padding: 13px 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md); }
.auth-foot { position: relative; z-index: 1; font-size: 11px; }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: currentColor; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none !important; }

/* MT5 connect */
.mt5-note { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; line-height: 1.55; color: var(--text-2); background: var(--green-glow); border: 1px solid transparent; border-radius: var(--r-md); padding: 11px 13px; }
.connect-empty { text-align: center; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; }

/* connected pill in sidebar / topbar */
.mt5-pill { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--green-glow); color: var(--green); }
.mt5-pill.off { background: var(--surface-3); color: var(--text-3); }
.mt5-pill.danger { background: rgba(239,68,68,0.12); color: var(--red); }

/* reward points chip in topbar */
.reward-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 11px; border-radius: 99px; border: 1px solid color-mix(in oklab, var(--amber) 35%, var(--border)); background: color-mix(in oklab, var(--amber) 12%, transparent); color: var(--amber); cursor: pointer; font-weight: 600; transition: all 0.15s var(--ease); flex-shrink: 0; }
.reward-chip:hover { background: color-mix(in oklab, var(--amber) 20%, transparent); transform: translateY(-1px); }
.reward-chip .mono { font-size: 12.5px; }
.reward-chip .reward-plus { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 99px; background: var(--amber); color: #1a1200; }

/* reward points bar in the sidebar profile area */
.sidebar-reward { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 11px; border-radius: var(--r-md); border: 1px solid color-mix(in oklab, var(--amber) 28%, var(--border)); background: color-mix(in oklab, var(--amber) 9%, transparent); color: var(--text); cursor: pointer; transition: all 0.15s var(--ease); }
.sidebar-reward:hover { background: color-mix(in oklab, var(--amber) 16%, transparent); }
.sidebar-reward .reward-plus { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 99px; background: var(--amber); color: #1a1200; flex-shrink: 0; }

/* loading skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* admin edit modal */
.admin-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fadeIn 0.18s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }

/* selectable chips (emotions, tags) */
.chip { font-size: 12.5px; font-weight: 500; padding: 7px 13px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: all 0.14s var(--ease); }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--green-glow); border-color: var(--green); color: var(--green); }

/* trader code pill */
.code-pill { font-family: var(--font-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; padding: 6px 12px; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text); cursor: pointer; }

/* toggle switch */
.toggle { width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background 0.18s var(--ease); flex-shrink: 0; padding: 0; }
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 99px; background: #fff; transition: transform 0.18s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle.on .toggle-knob { transform: translateX(18px); }

/* range slider */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; background: var(--surface-3); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 99px; background: var(--green); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 99px; background: var(--green); cursor: pointer; border: 3px solid var(--surface); }

/* VIP */
.badge.vip { background: linear-gradient(145deg,#fde68a,#f59e0b); color: #3a2a02; border: none; }
.vip-btn { background: linear-gradient(145deg,#fbbf24,#f59e0b); color: #3a2a02; border: none; font-weight: 600; }
.vip-btn:hover { filter: brightness(1.06); }
.vip-banner { background: linear-gradient(120deg, rgba(245,158,11,0.12), transparent 70%); border-color: rgba(245,158,11,0.3); }
.vip-plan { position: relative; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 16px; cursor: pointer; transition: all 0.15s var(--ease); }
.vip-plan:hover { border-color: var(--border-strong); }
.vip-plan.on { border-color: var(--amber); background: linear-gradient(140deg, rgba(245,158,11,0.1), var(--surface-2)); }

/* rank chip */
.rank-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 99px; background: var(--green-glow); color: var(--green); }

/* notifications */
.notif-dot { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.notif-pop { position: absolute; top: calc(100% + 10px); right: 0; width: 320px; max-width: 88vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 80; overflow: hidden; animation: rise 0.18s var(--ease-out) both; }
.notif-row { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-row:last-child { border-bottom: none; }

/* dashboard hero stats */
.hero-stat { min-height: 132px; }
.hero-stat > div:last-child svg { width: 100% !important; height: 100% !important; }
.quick-action { color: var(--text); background: var(--surface); }

/* success message (mirror of auth-err) */
.auth-ok { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--green); background: var(--green-glow); border: 1px solid rgba(34,197,94,0.28); border-radius: var(--r-md); padding: 9px 12px; }

@media (max-width: 820px) {
  .replay-grid { grid-template-columns: 1fr !important; }
  .rep-summary { grid-template-columns: repeat(2,1fr) !important; }
}

/* ============ AI 2.0 ============ */
.ai2-hero { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: var(--r-lg); background: linear-gradient(120deg, rgba(168,85,247,0.14), transparent 70%); border: 1px solid color-mix(in oklab, var(--purple) 26%, var(--border)); margin-bottom: 18px; }
.ai2-hero-ic { width: 48px; height: 48px; border-radius: 13px; background: var(--purple); color: #fff; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 8px 24px rgba(168,85,247,0.35); }
.ai2-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 5px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.ai2-tab { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all 0.14s var(--ease); }
.ai2-tab:hover { background: var(--surface-3); color: var(--text); }
.ai2-tab.on { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 6px 18px rgba(168,85,247,0.32); }
.ai2-verdict { border-radius: var(--r-lg); padding: 24px; border: 1px solid color-mix(in oklab, var(--vc) 28%, var(--border)); background: linear-gradient(135deg, color-mix(in oklab, var(--vc) 10%, transparent), var(--surface) 65%); }
.ai2-pattern { border-left: 3px solid var(--pc); }
@media (max-width: 820px) {
  .ai2-plan-grid { grid-template-columns: 1fr 1fr !important; }
  .ai2-dna-row { grid-template-columns: 1fr !important; gap: 18px !important; }
}
@media (max-width: 560px) { .ai2-plan-grid { grid-template-columns: 1fr !important; } }

/* mobile bottom tab bar — hidden on desktop */
.mobile-nav { display: none; }
.podium-rank { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.nav-scrim { display: none; }

/* small tablet: icon rail */
@media (max-width: 1100px) and (min-width: 901px) {
  .app, .app.collapsed { grid-template-columns: 76px 1fr; }
  .sidebar .nav-text, .sidebar .nav-group-label, .brand-name, .nav-badge { display: none; }
}

/* phone: off-canvas drawer */
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 270px; z-index: 60;
    transform: translateX(-100%); transition: transform 0.26s var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: none; }
  .sidebar .nav-text, .sidebar .nav-group-label, .brand-name, .nav-badge { display: revert; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none; transition: opacity 0.26s; }
  .app.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

  .topbar { padding: 0 12px; gap: 10px; height: 56px; }
  .topbar h1 { font-size: 16px; }
  .topbar .icon-btn { width: 40px; height: 40px; flex-shrink: 0; }
  .ticker { display: none; }
  .content { padding: 20px 14px calc(76px + env(safe-area-inset-bottom, 0px)); }

  /* leaderboard podium: keep 3-up & compact, show rank number */
  .podium-row { flex-wrap: nowrap !important; gap: 7px !important; align-items: flex-end !important; }
  .podium-card { flex: 1 1 0 !important; min-width: 0; padding: 14px 6px 12px !important; align-self: flex-end !important; }
  .podium-card.first { padding: 16px 6px 12px !important; }
  .podium-card .avatar { width: 46px !important; height: 46px !important; font-size: 17px !important; }
  .podium-card.first .avatar { width: 58px !important; height: 58px !important; font-size: 21px !important; }
  .podium-flag { font-size: 8px !important; padding: 2px 7px !important; white-space: nowrap; }
  .podium-name { font-size: 11.5px !important; margin-top: 8px !important; }
  .podium-card.first .podium-name { font-size: 12.5px !important; }
  .podium-pct { font-size: 15px !important; margin: 3px 0 !important; }
  .podium-card.first .podium-pct { font-size: 18px !important; }
  .podium-sub { font-size: 9px !important; line-height: 1.3; }
  .podium-rank { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 11px; color: var(--text-3); margin-bottom: 6px; }
  .podium-card.first .podium-rank { color: var(--green); }

  /* bottom tab bar */
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: color-mix(in oklab, var(--bg-2) 96%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
  }
  .mnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; cursor: pointer; padding: 5px 2px; border-radius: 12px;
    color: var(--text-3); font-family: var(--font-ui); font-size: 10px; font-weight: 600;
    transition: color 0.15s var(--ease); -webkit-tap-highlight-color: transparent; min-height: 48px;
  }
  .mnav-item.active { color: var(--green); }
  .mnav-item:active { background: var(--surface-2); }
  .page-head { margin-bottom: 16px; gap: 12px; }
  .section-title { font-size: 19px; }
  .card.pad { padding: 15px; }
  .stat-value { font-size: 21px; }

  /* collapse fixed multi-column grids */
  .grid[style*="repeat(5"], .grid[style*="repeat(4"], .grid[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
  .grid[style*="1.6fr 1fr"], .grid[style*="1.4fr 1fr"], .grid[style*="1.5fr 1fr"], .grid[style*="1fr 1.3fr"], .grid[style*="1.3fr 1fr"], .grid[style*="1.6fr 1fr"] { grid-template-columns: 1fr !important; }

  /* tables scroll horizontally instead of breaking the layout */
  .card:has(.tbl) { overflow-x: auto; }
  .tbl { font-size: 12px; min-width: 480px; }
  .tbl th, .tbl td { padding: 9px 10px; }

  .seg { overflow-x: auto; max-width: 100%; }
  .seg button { white-space: nowrap; }
}

/* section-specific grids */
.signals-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }

/* ---- Trading Lounge (full-height chat, collapsible channels) ---- */
.lounge-page { height: 100%; display: flex; flex-direction: column; gap: 12px; }
.lounge-bar { position: relative; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.lounge-chan-btn { flex: 1; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.lounge-chan-btn:hover { border-color: var(--border-strong); }
.lounge-chan-menu { position: absolute; top: 50px; left: 0; width: 280px; max-width: 90vw; max-height: 60vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 40; padding: 6px; }
.lounge-scrim { position: fixed; inset: 0; z-index: 30; }
.lounge-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.lounge-msgs { flex: 1; overflow-y: auto; padding: 10px 14px; min-height: 0; }
.lounge-compose { padding: 12px 14px; border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .signals-grid { grid-template-columns: 1fr; }
  .signals-aside { display: none; }
  .journal-grid, .analytics-2col, .econ-grid { grid-template-columns: 1fr !important; }
  .analytics-3col { grid-template-columns: 1fr !important; }
  .dash-hero { grid-template-columns: 1fr 1fr !important; }
}

/* very small phones */
@media (max-width: 600px) {
  .dash-hero { grid-template-columns: 1fr 1fr !important; }
  .ai2-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .ai2-tab { flex-shrink: 0; }
  .stat-value, .stat-value.tnum { font-size: 20px !important; }
  .hero-stat .stat-value { font-size: 24px !important; }
  .topbar h1 { display: none; }
  .mt5-pill { font-size: 10px; padding: 4px 8px; }
  .reward-chip .reward-plus { display: none; }
  /* tables scroll horizontally instead of clipping */
  .tbl-wrap, .card > .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 540px; }
  .comp-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
  .comp-stats .stat-value, .comp-stats .stat-label { font-size: 11px; }
  .comp-stats .card { padding: 12px 8px; }
  .grid[style*="repeat(5"], .grid[style*="repeat(4"], .grid[style*="repeat(2"] { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 380px) {
  .grid[style*="repeat(5"], .grid[style*="repeat(4"] { grid-template-columns: 1fr 1fr !important; }
}

/* ============================================================
   ENHANCEMENTS v2 — calendar, lounge media, reactions, battles,
   danger zone, push, deeper mobile
   ============================================================ */

/* password field with reveal toggle */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { flex: 1; padding-right: 40px; }
.input-eye { position: absolute; right: 6px; width: 30px; height: 30px; display: grid; place-items: center; border: none; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 8px; transition: color 0.12s, background 0.12s; }
.input-eye:hover { color: var(--text); background: var(--surface-2); }

.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green-glow); animation: pulse-ring 1.8s ease-out infinite; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* area / line chart — always visible (no opacity tricks; reliable in every context) */
.line-draw, .area-draw { opacity: 1; }

/* ---- Journal P&L calendar ---- */
.journal-grid { display: grid; gap: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
/* weekly view: taller cells with day-of-week + number stacked */
.cal-week .cal-day { aspect-ratio: auto; min-height: 96px; }
/* monthly view */
.cal-month { gap: 7px; }
.cal-month .cal-day { aspect-ratio: auto; min-height: 78px; padding: 8px 9px; border-radius: 10px; }
.cal-month .cal-day .cal-num { font-size: 12px; }
.cal-month .cal-day .cal-pnl { font-size: 13px; }
.cal-month .cal-day .cal-trades { top: 6px; right: 7px; font-size: 9px; min-width: 15px; height: 15px; }
.cal-day .cal-dow-in { font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.cal-day.today { outline: 2px solid var(--green); outline-offset: 1px; }
.cal-day.today .cal-dow-in { color: var(--green); }
.cal-day.future { border-style: dashed; opacity: 0.5; cursor: default; }
.cal-day.future:hover { transform: none; box-shadow: none; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding-bottom: 4px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1; min-height: 56px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); padding: 7px 8px;
  display: flex; flex-direction: column; align-items: flex-start;
  font-family: var(--font-ui); color: var(--text);
  transition: transform 0.16s var(--ease-out), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease), outline-color 0.16s var(--ease);
  outline: 2px solid transparent; outline-offset: 1px;
}
.cal-day .cal-num { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--text-3); line-height: 1; }
.cal-day .cal-pnl { font-family: var(--font-mono); font-size: 13px; font-weight: 700; margin: auto 0 0; line-height: 1.1; letter-spacing: -0.01em; }
.cal-day .cal-trades { position: absolute; top: 6px; right: 7px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 99px; min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center; }
.cal-day.has { cursor: pointer; }
.cal-day.has:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 24px rgba(0,0,0,0.32); border-color: var(--border-strong); z-index: 3; }
.cal-day.has:hover .cal-num { color: var(--text); }
.cal-day.active { outline-color: var(--green); transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 22px var(--green-glow); z-index: 2; }
.cal-day:not(.has) .cal-num { color: var(--text-3); opacity: 0.6; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--text-3); }
.cal-legend .sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 5px; }

/* tradingview entry/exit tags */
.tv-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 5px 11px; }
.tv-tag b { color: var(--text); }

/* ---- Lounge media + reactions ---- */
.chat-msg { display: flex; gap: 12px; padding: 9px 6px; border-radius: 12px; transition: background 0.14s var(--ease); position: relative; }
.chat-msg:hover { background: var(--surface-2); }
.chat-media { margin-top: 7px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); max-width: 340px; display: block; }
.chat-media img, .chat-media video { display: block; width: 100%; max-height: 280px; object-fit: cover; background: var(--surface-3); }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.react-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; height: 26px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: all 0.13s var(--ease); }
.react-pill:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.react-pill.mine { background: var(--green-glow); border-color: var(--green); color: var(--green); }
.react-add { width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center; opacity: 0; transition: opacity 0.14s; }
.chat-msg:hover .react-add { opacity: 1; }
.react-bar { display: flex; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 99px; box-shadow: var(--shadow-lg); }
.react-bar button { font-size: 17px; width: 32px; height: 32px; border-radius: 99px; border: none; background: transparent; cursor: pointer; transition: transform 0.12s, background 0.12s; }
.react-bar button:hover { transform: scale(1.25); background: var(--surface-2); }
.chat-attach-row { display: flex; align-items: center; gap: 8px; }
.lounge-attach-btn { color: var(--text-3); transition: color 0.14s, background 0.14s, transform 0.14s; }
.lounge-attach-btn:hover { color: var(--green); transform: scale(1.06); }
.lounge-send-btn {
  width: 36px; height: 36px; border-radius: 99px; border: none; flex-shrink: 0;
  display: grid; place-items: center; margin-right: 4px; cursor: pointer;
  background: var(--surface-3); color: var(--text-3);
  transition: background 0.16s, color 0.16s, transform 0.12s;
}
.lounge-send-btn.active { background: var(--green); color: #08130d; box-shadow: 0 4px 14px var(--green-glow); }
.lounge-send-btn.active:hover { transform: scale(1.08); }
.lounge-send-btn svg { transform: translateX(-1px); }
.media-preview { position: relative; margin-bottom: 10px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); max-width: 220px; }
.media-preview img, .media-preview video { display: block; width: 100%; max-height: 160px; object-fit: cover; }
.media-preview .x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 99px; background: rgba(0,0,0,0.6); color: #fff; border: none; cursor: pointer; display: grid; place-items: center; }

/* moderation banner */
.mod-banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.28); color: var(--red); font-size: 12.5px; font-weight: 500; }

/* ---- Battles ---- */
.metric-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.instr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.instr-chip { font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-align: center; padding: 9px 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: all 0.13s var(--ease); }
.instr-chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.deposit-box { background: linear-gradient(135deg, rgba(168,85,247,0.12), transparent 70%); border: 1px solid rgba(168,85,247,0.3); border-radius: var(--r-lg); padding: 16px; }

/* ---- Danger zone ---- */
.danger-zone { border-color: rgba(239,68,68,0.3); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.danger-row:last-child { border-bottom: none; }

/* ---- deeper mobile ---- */
@media (max-width: 900px) {
  .grid[style*="1fr 1fr 1fr"], .grid[style*="1.5fr 1fr"], .grid[style*="1.4fr 1fr"] { grid-template-columns: 1fr !important; }
  .analytics-3col { grid-template-columns: 1fr !important; }
  .grid[style*="repeat(6"] { grid-template-columns: repeat(3, 1fr) !important; }
  .danger-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .cal-day { min-height: 46px; border-radius: 9px; padding: 5px 6px; }
  .cal-day .cal-pnl { font-size: 11px; }
  .cal-day .cal-trades { display: none; }
  /* 7 columns is tight on a phone — shrink gaps/cells further than desktop so
     numbers don't collide, and let the weekly view's taller cells collapse too */
  .cal-grid { gap: 4px; }
  .cal-week .cal-day { min-height: 64px; padding: 4px 5px; }
  .cal-month .cal-day { min-height: 50px; padding: 4px 5px; }
  .cal-month .cal-day .cal-num { font-size: 10px; }
  .cal-month .cal-day .cal-pnl { font-size: 10px; }
  .cal-day .cal-dow-in { font-size: 8px; }
  .chat-media { max-width: 100%; }
  .grid[style*="repeat(6"], .grid[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
  .instr-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-toggle { width: 100%; }
}

@media (max-width: 760px){ .radar-row{ grid-template-columns:1fr !important; gap:18px !important; } }
