:root {
  --bg: #06080d;
  --panel: #0c1018;
  --card: rgba(12, 18, 28, 0.9);
  --border: rgba(201, 145, 124, 0.2);
  --gold: #c9917c;
  --teal: #2dd4bf;
  --text: #f4f2ec;
  --muted: rgba(244, 242, 236, 0.58);
  --success: #4ade80;
  --danger: #f87171;
  --header-bg: #0a0e16;
  --header-text: #f4f2ec;
  --sidebar-w: 240px;
  --font: "Stack Sans Notch", system-ui, sans-serif;
}
[data-theme="light"] {
  --bg: #eef1f7;
  --panel: #ffffff;
  --card: rgba(255, 255, 255, 0.92);
  --border: rgba(10, 14, 22, 0.12);
  --text: #0a0e16;
  --muted: rgba(10, 14, 22, 0.62);
  --header-bg: #0a0e16;
  --header-text: #f4f2ec;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text); font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--gold), #a67c6d); color: #06080d; border: none; }
.btn-glass { background: rgba(12,18,28,0.7); }
.btn-ghost { color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.75rem; }

.portal-login { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.portal-login-card {
  width: min(100%, 400px); padding: 2rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; text-align: center;
}
.portal-logo { height: 44px; margin: 0 auto 1rem; }
.portal-logo-sm { height: 28px; }
.portal-login-card h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.portal-login-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.portal-login-card label { display: block; text-align: left; font-size: 0.78rem; color: var(--muted); margin: 0.5rem 0 0.3rem; }
.portal-login-card input,
.portal-field input,
.portal-field select {
  width: 100%; padding: 0.65rem 0.75rem; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--text); font-family: inherit; font-size: 0.85rem;
}
[data-theme="light"] .portal-login-card input,
[data-theme="light"] .portal-field input,
[data-theme="light"] .portal-field select { background: #fff; }
.portal-login-card form { display: flex; flex-direction: column; gap: 0.5rem; }
.login-remember {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.15rem 0 0.35rem;
  cursor: pointer;
}
.login-remember input { width: auto; margin: 0; accent-color: var(--gold); }
.settings-hint { font-size: 0.72rem; color: var(--muted); }
.portal-demo-hint { font-size: 0.72rem; color: var(--teal); margin-top: 0.75rem; }
.portal-security-note { font-size: 0.68rem; color: var(--teal); margin-top: 0.5rem; opacity: 0.85; }

.login-creds-box {
  margin-top: 1rem; padding: 0.85rem 1rem; border-radius: 12px;
  border: 1px solid rgba(45,212,191,0.25); background: rgba(45,212,191,0.06);
  text-align: left;
}
.login-creds-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--teal); font-weight: 700; margin-bottom: 0.55rem;
}
.login-creds-row { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; font-size: 0.72rem; }
.login-creds-lbl { color: var(--muted); }
.login-creds-val { color: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 0.68rem; }
.portal-creds-box .btn-block { margin-top: 0.5rem; }

.tb-portal-toast-stack {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 100060;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: min(340px, calc(100vw - 2rem));
  pointer-events: none;
}
.tb-portal-toast {
  pointer-events: auto; padding: 0.7rem 0.9rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3); font-size: 0.82rem;
  transform: translateY(12px); opacity: 0; transition: all 0.25s ease;
}
.tb-portal-toast.show { transform: translateY(0); opacity: 1; }
.tb-portal-toast.ok { border-color: rgba(74,222,128,0.4); }
.tb-portal-toast.error { border-color: rgba(248,113,113,0.4); }
.tb-portal-toast.warn { border-color: rgba(201,145,124,0.4); }
.tb-portal-toast.info { border-color: rgba(45,212,191,0.35); }
.status-msg { font-size: 0.8rem; min-height: 1.2em; margin-top: 0.5rem; color: var(--muted); }
.status-msg.error { color: var(--danger); }

/* App shell */
.portal-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.portal-shell { display: flex; flex-direction: column; min-width: 0; }

.portal-sidebar {
  background: var(--header-bg);
  color: var(--header-text);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}
.portal-sidebar-brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 0.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 1rem;
  font-size: 0.82rem; font-weight: 600; color: var(--header-text);
}
.portal-nav { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.portal-nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  width: 100%; padding: 0.7rem 0.85rem; border: none; border-radius: 10px;
  background: transparent; color: rgba(244,242,236,0.65);
  font-family: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; text-align: left;
}
.portal-nav-item:hover { background: rgba(255,255,255,0.06); color: var(--header-text); }
.portal-nav-item.active {
  background: rgba(201,145,124,0.18);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(201,145,124,0.25);
}
.portal-nav-icon { opacity: 0.85; font-size: 0.9rem; }
.portal-sidebar-foot { margin-top: auto; padding-top: 1rem; }
.portal-sidebar-foot .btn { color: rgba(244,242,236,0.55); border-color: rgba(255,255,255,0.1); }

.portal-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: var(--header-bg);
  color: var(--header-text);
  position: sticky; top: 0; z-index: 40;
}
.portal-user-name { display: block; font-size: 1rem; color: var(--header-text); }
.portal-user-tier {
  display: inline-block; font-size: 0.7rem; color: var(--teal);
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.15rem;
}
.portal-header .btn-glass {
  background: rgba(255,255,255,0.08);
  color: var(--header-text);
  border-color: rgba(255,255,255,0.12);
}
.portal-header .btn-ghost { color: rgba(244,242,236,0.7); }
.portal-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.notif-count {
  background: var(--danger); color: #fff; font-size: 0.65rem; padding: 0.1rem 0.35rem;
  border-radius: 999px; margin-left: 0.2rem;
}

.portal-notif-panel {
  position: fixed;
  top: 4.25rem;
  right: 1.25rem;
  width: min(360px, calc(100vw - 2rem));
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 18, 28, 0.98);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  z-index: 100050;
  overflow: hidden;
}
[data-theme="light"] .portal-notif-panel { background: rgba(255, 255, 255, 0.98); }
.portal-notif-panel.hidden { display: none !important; }
.portal-notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
}
.portal-notif-head strong { font-size: 0.85rem; color: var(--gold); }
.portal-notif-close {
  border: none; background: transparent; color: var(--muted); font-size: 1.25rem;
  line-height: 1; cursor: pointer; padding: 0.1rem 0.35rem;
}
.portal-notif-body { max-height: min(420px, 70vh); overflow-y: auto; padding: 0.5rem 1rem 0.75rem; }
.portal-notif-item { font-size: 0.82rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); line-height: 1.45; }
.portal-notif-item:last-child { border-bottom: none; }
.portal-notif-item.unread { color: var(--teal); }
.portal-notif-item small { display: block; color: var(--muted); font-size: 0.68rem; margin-top: 0.2rem; }

.portal-main { flex: 1; max-width: 1540px; width: 100%; margin: 0 auto; padding: 1.5rem; }
.portal-page-head { margin-bottom: 1.25rem; }
.portal-page-head h1 { font-size: 1.45rem; color: var(--gold); margin-bottom: 0.25rem; }
.portal-page-head p { color: var(--muted); font-size: 0.88rem; }

/* Animated page banners (all portal views) */
.portal-banner {
  position: relative;
  border-radius: 16px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(12,18,28,0.92) 0%, rgba(6,8,13,0.96) 50%, rgba(45,212,191,0.1) 100%);
}
[data-theme="light"] .portal-banner {
  background: linear-gradient(135deg,
    rgba(255, 252, 248, 1) 0%,
    rgba(230, 245, 242, 0.95) 45%,
    rgba(252, 238, 230, 0.9) 100%);
  border-color: rgba(184, 125, 106, 0.35);
  box-shadow: 0 4px 24px rgba(13, 148, 136, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
[data-theme="light"] .portal-banner-bg {
  background:
    radial-gradient(ellipse 75% 85% at 12% 25%, rgba(201, 145, 124, 0.42), transparent 58%),
    radial-gradient(ellipse 55% 65% at 88% 72%, rgba(13, 148, 136, 0.32), transparent 52%);
  opacity: 1;
}
[data-theme="light"] .portal-banner-particles {
  opacity: 0.9;
  background-image:
    radial-gradient(circle, rgba(13, 148, 136, 0.55) 2px, transparent 2px),
    radial-gradient(circle, rgba(184, 125, 106, 0.35) 1px, transparent 1px);
  background-size: 26px 26px, 18px 18px;
}
[data-theme="light"] .portal-banner-sub {
  color: rgba(10, 14, 22, 0.72);
  font-weight: 500;
}
.portal-banner-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 80% at 15% 20%, rgba(201,145,124,0.22), transparent 55%),
    radial-gradient(ellipse 50% 60% at 85% 75%, rgba(45,212,191,0.15), transparent 50%);
  animation: portal-bg-pulse 6s ease-in-out infinite alternate;
}
.portal-banner-particles {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.55;
  background-image: radial-gradient(circle, rgba(45,212,191,0.5) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  animation: portal-particles-float 12s linear infinite;
}
@keyframes portal-bg-pulse {
  0% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.03) translateX(1%); }
}
[data-theme="light"] .portal-banner-bg,
[data-theme="light"] .profile-hero-bg {
  animation: portal-bg-pulse-light 5s ease-in-out infinite alternate;
}
@keyframes portal-bg-pulse-light {
  0% { opacity: 0.65; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.06) translateX(2%); }
}
@keyframes portal-particles-float {
  0% { background-position: 0 0; }
  100% { background-position: 48px 48px; }
}
.portal-banner-content { position: relative; z-index: 1; }
.portal-banner-title {
  font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.35rem;
  color: var(--gold);
  background: linear-gradient(90deg, #c9917c, #2dd4bf, #c9917c, #2dd4bf);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: portal-title-shine 3s linear infinite;
}
[data-theme="light"] .portal-banner-title {
  background: linear-gradient(90deg, #8b5a4a, #0a7a72, #c9917c, #0d9488, #8b5a4a);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8));
}
@keyframes portal-title-shine {
  0% { background-position: 0% center; }
  100% { background-position: 300% center; }
}
.portal-banner-sub { font-size: 0.9rem; color: var(--muted); }

.portal-stats { margin-bottom: 1.5rem; }

/* Dashboard hero (client portal) */
.dash-hero {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem 1.5rem;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(12,18,28,0.95) 0%, rgba(6,8,13,0.98) 60%, rgba(45,212,191,0.06) 100%);
}
[data-theme="light"] .dash-hero {
  background: linear-gradient(135deg,
    rgba(255, 252, 248, 1) 0%,
    rgba(230, 245, 242, 0.95) 55%,
    rgba(252, 238, 230, 0.88) 100%);
  border-color: rgba(184, 125, 106, 0.3);
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.12);
}
.dash-hero-glow {
  position: absolute; top: -40%; right: -10%; width: 50%; height: 140%;
  background: radial-gradient(ellipse, rgba(201,145,124,0.15), transparent 70%);
  pointer-events: none;
}
[data-theme="light"] .dash-hero-glow {
  background: radial-gradient(ellipse, rgba(201, 145, 124, 0.32), transparent 65%);
}
[data-theme="light"] .dash-hero-eyebrow { color: #0a7a72; font-weight: 600; }
.dash-hero-inner {
  position: relative;
  display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: stretch; justify-content: space-between;
}
.dash-hero-eyebrow {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--teal); margin-bottom: 0.65rem;
}
.dash-rate-row { display: flex; gap: 2rem; flex-wrap: wrap; }
.dash-rate .dash-rate-val { display: block; font-size: 2.4rem; font-weight: 700; line-height: 1; }
.dash-rate.win .dash-rate-val { color: var(--success); }
.dash-rate.loss .dash-rate-val { color: var(--danger); }
.dash-rate-lbl { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; display: block; }
.dash-hero-sub { font-size: 0.82rem; color: var(--muted); margin-top: 0.75rem; }
.dash-mini-grid { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: stretch; }
.dash-mini-card {
  flex: 1; min-width: 110px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
  text-align: center;
}
[data-theme="light"] .dash-mini-card { background: rgba(255,255,255,0.75); }
.dash-mini-val { display: block; font-size: 1.5rem; font-weight: 700; color: var(--gold); }
.dash-mini-val.teal { color: var(--teal); }
.dash-mini-lbl { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.dash-mini-sub { display: block; font-size: 0.65rem; color: var(--teal); margin-top: 0.2rem; }

/* Animated signal chart */
.signal-chart {
  position: relative;
  height: 58px;
  margin: -1rem -1rem 0.85rem;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}
.signal-chart.chart-long {
  background: linear-gradient(135deg, rgba(74,222,128,0.12) 0%, rgba(45,212,191,0.06) 45%, rgba(6,8,13,0.2) 100%);
}
.signal-chart.chart-short {
  background: linear-gradient(135deg, rgba(248,113,113,0.12) 0%, rgba(201,145,124,0.06) 45%, rgba(6,8,13,0.2) 100%);
}
[data-theme="light"] .signal-chart.chart-long {
  background: linear-gradient(135deg, rgba(74,222,128,0.14) 0%, rgba(13,148,136,0.06) 50%, rgba(238,241,247,0.9) 100%);
}
[data-theme="light"] .signal-chart.chart-short {
  background: linear-gradient(135deg, rgba(248,113,113,0.12) 0%, rgba(184,125,106,0.06) 50%, rgba(238,241,247,0.9) 100%);
}
.signal-chart-shimmer {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.07) 50%, transparent 70%);
  animation: chart-shimmer 4s ease-in-out infinite;
}
.signal-chart svg { width: 100%; height: 100%; display: block; }
.signal-chart-glow {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: chart-draw 2.2s ease-out forwards, chart-glow-pulse 3s ease-in-out infinite 2.2s;
}
.signal-chart-line { animation: chart-line-fade 2.2s ease-out forwards; }
.signal-chart-head { animation: chart-head-pulse 1.4s ease-in-out infinite; }
@keyframes chart-draw { to { stroke-dashoffset: 0; } }
@keyframes chart-shimmer { 0%, 100% { transform: translateX(-120%); } 50% { transform: translateX(120%); } }
@keyframes chart-glow-pulse { 0%, 100% { opacity: 0.88; } 50% { opacity: 1; filter: drop-shadow(0 0 6px currentColor); } }
@keyframes chart-line-fade { from { opacity: 0; } to { opacity: 0.45; } }
@keyframes chart-head-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

.portal-setup-chart { height: 48px; margin-bottom: 0.5rem; border-radius: 8px; overflow: hidden; }
.portal-setup-chart svg { width: 100%; height: 100%; display: block; }

.portal-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem;
  background: var(--card);
}
.portal-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.portal-panel-head h2 { font-size: 1rem; color: var(--gold); }

.portal-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.portal-field label {
  display: block; font-size: 0.72rem; color: var(--muted);
  margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.portal-field-search { grid-column: span 1; }
.portal-filter-count {
  font-size: 0.8rem; color: var(--muted); align-self: center;
  padding: 0.5rem 0;
}

.portal-setup-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem;
}
.portal-setup-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 1rem;
  background: var(--card);
  user-select: none;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.portal-setup-card:hover {
  border-color: rgba(45,212,191,0.35);
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
}
.portal-setup-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.65rem; }
.portal-setup-pair { font-size: 1.05rem; font-weight: 700; }
.portal-setup-dir { font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 4px; }
.portal-setup-dir.long { background: rgba(74,222,128,0.15); color: var(--success); }
.portal-setup-dir.short { background: rgba(248,113,113,0.15); color: var(--danger); }
.status-badge { font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 4px; letter-spacing: 0.04em; }
.status-badge.status-active { background: rgba(45,212,191,0.15); color: var(--teal); }
.status-badge.status-target_hit { background: rgba(74,222,128,0.15); color: var(--success); }
.status-badge.status-stopped { background: rgba(248,113,113,0.15); color: var(--danger); }
.status-badge.status-expired { background: rgba(244,242,236,0.08); color: var(--muted); }
[data-theme="light"] .status-badge.status-expired { background: rgba(10,14,22,0.06); }
.portal-setup-row { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 0.25rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
[data-theme="light"] .portal-setup-row { border-bottom-color: rgba(10,14,22,0.06); }
.portal-setup-chart { height: 48px; margin-bottom: 0.5rem; border-radius: 8px; overflow: hidden; }
.portal-setup-chart svg { width: 100%; height: 100%; display: block; }

.portal-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.portal-video-card {
  padding: 1rem; border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  background: var(--card); transition: border-color 0.2s;
}
.portal-video-card:hover { border-color: var(--teal); }
.portal-video-module { font-size: 0.68rem; color: var(--teal); text-transform: uppercase; display: block; margin-bottom: 0.35rem; }
.portal-player-wrap { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.portal-player-wrap video { width: 100%; max-height: 420px; border-radius: 8px; }

/* Profile */
.profile-layout { display: flex; flex-direction: column; gap: 1.25rem; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.profile-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem;
  background: var(--card);
}
.profile-card h2 {
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 1rem;
}
.profile-hero {
  background: linear-gradient(135deg, rgba(12,18,28,0.95), rgba(45,212,191,0.08));
  padding: 0;
  overflow: hidden;
  position: relative;
}
[data-theme="light"] .profile-hero {
  background: linear-gradient(135deg,
    rgba(255, 252, 248, 1) 0%,
    rgba(230, 245, 242, 0.95) 50%,
    rgba(252, 238, 230, 0.9) 100%);
  border-color: rgba(184, 125, 106, 0.3);
  box-shadow: 0 4px 24px rgba(13, 148, 136, 0.1);
}
[data-theme="light"] .profile-hero-bg {
  background:
    radial-gradient(ellipse 75% 85% at 12% 25%, rgba(201, 145, 124, 0.45), transparent 58%),
    radial-gradient(ellipse 55% 65% at 88% 72%, rgba(13, 148, 136, 0.35), transparent 52%);
}
[data-theme="light"] .profile-hero-particles {
  opacity: 0.9;
  background-image:
    radial-gradient(circle, rgba(13, 148, 136, 0.55) 2px, transparent 2px),
    radial-gradient(circle, rgba(184, 125, 106, 0.35) 1px, transparent 1px);
  background-size: 26px 26px, 18px 18px;
}
[data-theme="light"] .profile-welcome-sub { color: rgba(10, 14, 22, 0.7); }
.profile-hero-animated {
  position: relative;
  padding: 2rem 1.5rem 1.5rem;
  overflow: hidden;
}
.profile-hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 80% at 15% 20%, rgba(201,145,124,0.25), transparent 55%),
    radial-gradient(ellipse 50% 60% at 85% 75%, rgba(45,212,191,0.18), transparent 50%);
  animation: portal-bg-pulse 6s ease-in-out infinite alternate;
}
.profile-hero-particles {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background-image: radial-gradient(circle, rgba(45,212,191,0.5) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  animation: portal-particles-float 12s linear infinite;
}
.profile-welcome-title {
  font-size: 1.85rem; font-weight: 700; line-height: 1.2;
  color: var(--gold);
  background: linear-gradient(90deg, #c9917c, #2dd4bf, #c9917c, #2dd4bf);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: portal-title-shine 3s linear infinite;
}
[data-theme="light"] .profile-welcome-title {
  background: linear-gradient(90deg, #8b5a4a, #0a7a72, #c9917c, #0d9488, #8b5a4a);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8));
}
.profile-welcome-sub { font-size: 0.9rem; color: var(--muted); margin-top: 0.4rem; }
.profile-card-wide { grid-column: 1 / -1; }
.profile-card-hint { font-size: 0.78rem; color: var(--muted); margin: -0.5rem 0 0.75rem; }
.quick-notes-field {
  width: 100%; padding: 0.85rem; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.2); color: var(--text); font-family: inherit; font-size: 0.88rem;
  resize: vertical; min-height: 140px; line-height: 1.5;
}
[data-theme="light"] .quick-notes-field { background: #fff; }

/* LMS progress & modules */
.lms-progress-hero {
  border: 1px solid var(--border); border-radius: 14px; padding: 1.15rem 1.25rem;
  margin-bottom: 1rem; background: var(--card);
}
.lms-progress-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.lms-progress-head h3 { font-size: 0.95rem; color: var(--gold); }
.lms-progress-stats { font-size: 0.82rem; color: var(--muted); }
.lms-progress-track {
  height: 12px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
}
[data-theme="light"] .lms-progress-track { background: rgba(10,14,22,0.06); }
.lms-progress-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(45,212,191,0.4);
}
.lms-module-tabs {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem;
}
.lms-module-tab {
  padding: 0.5rem 0.9rem; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.lms-module-tab:hover { border-color: var(--teal); color: var(--text); }
.lms-module-tab.active {
  background: rgba(45,212,191,0.15); border-color: var(--teal); color: var(--teal);
}
.lms-module-tab .tab-count { opacity: 0.7; font-size: 0.72rem; margin-left: 0.25rem; }
.lms-modules-wrap { display: flex; flex-direction: column; gap: 1.5rem; }
.lms-module-section {
  border: 1px solid var(--border); border-radius: 14px; padding: 1.15rem;
  background: var(--card);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
[data-theme="light"] .lms-module-section {
  background: #fff;
  box-shadow: 0 4px 16px rgba(10,14,22,0.06);
}
.lms-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.portal-video-card {
  padding: 1.15rem; border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  background: rgba(0,0,0,0.15); transition: border-color 0.2s, transform 0.15s;
  min-height: 120px;
}
[data-theme="light"] .portal-video-card { background: rgba(255,255,255,0.9); }
.portal-video-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.portal-video-card strong { display: block; font-size: 1rem; margin: 0.25rem 0; color: var(--text); }
.lms-module-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 0.85rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--border);
}
.lms-module-head h3 { font-size: 1rem; color: var(--gold); }
.lms-module-progress { font-size: 0.75rem; color: var(--teal); }
.lms-module-mini-bar {
  height: 4px; border-radius: 999px; background: rgba(255,255,255,0.08); margin-top: 0.35rem; overflow: hidden;
}
.lms-module-mini-bar span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.lms-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.portal-video-card { position: relative; }
.portal-video-card.completed { border-color: rgba(74,222,128,0.35); }
.portal-video-progress {
  height: 4px; border-radius: 999px; background: rgba(255,255,255,0.08);
  margin-top: 0.65rem; overflow: hidden;
}
.portal-video-progress span {
  display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: 999px; transition: width 0.3s;
}
.portal-video-pct { font-size: 0.68rem; color: var(--muted); margin-top: 0.25rem; }
.portal-video-done { font-size: 0.65rem; color: var(--success); font-weight: 700; text-transform: uppercase; }
.portal-video-play {
  display: inline-block; margin-top: 0.5rem; font-size: 0.75rem; font-weight: 600;
  color: var(--teal);
}
.profile-hero-inner {
  display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; justify-content: space-between;
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  display: grid; place-items: center;
  font-size: 1.4rem; font-weight: 700; color: #06080d;
}
.profile-hero-name { font-size: 1.25rem; font-weight: 700; }
.profile-hero-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.profile-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.profile-badge {
  font-size: 0.68rem; font-weight: 700; padding: 0.2rem 0.5rem;
  border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em;
}
.profile-badge.tier { background: rgba(201,145,124,0.18); color: var(--gold); }
.profile-badge.active { background: rgba(74,222,128,0.15); color: var(--success); }
.profile-badge.paused { background: rgba(248,113,113,0.15); color: var(--danger); }
.profile-form { display: flex; flex-direction: column; gap: 0.65rem; }
.profile-form textarea {
  width: 100%; padding: 0.65rem 0.75rem; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--text); font-family: inherit; font-size: 0.85rem;
  resize: vertical; min-height: 100px;
}
[data-theme="light"] .profile-form textarea { background: #fff; }
.profile-tools { display: flex; flex-direction: column; gap: 0.5rem; }
.profile-tool-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(0,0,0,0.15); color: var(--text); font-family: inherit;
  font-size: 0.84rem; cursor: pointer; text-align: left;
}
[data-theme="light"] .profile-tool-btn { background: rgba(255,255,255,0.6); }
.profile-tool-btn:hover { border-color: var(--teal); }
.profile-tool-btn span { color: var(--muted); font-size: 0.72rem; }

/* Profile tabs & trading focus */
.profile-section-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.profile-section-tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.22s ease;
  text-align: left;
}
.profile-section-tab:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255,255,255,0.03);
}
[data-theme="light"] .profile-section-tab:hover { background: rgba(10,14,22,0.04); }
.profile-section-tab.active {
  background: linear-gradient(135deg, rgba(201,145,124,0.22), rgba(45,212,191,0.14));
  border-color: rgba(45,212,191,0.4);
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.profile-tab-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.profile-section-tab.active .profile-tab-icon {
  background: rgba(45,212,191,0.15);
  border-color: rgba(45,212,191,0.35);
}
.profile-tab-text { display: flex; flex-direction: column; gap: 0.1rem; }
.profile-tab-text strong { font-size: 0.88rem; font-weight: 700; }
.profile-tab-text small { font-size: 0.68rem; color: var(--muted); font-weight: 500; }
.profile-section-tab.active .profile-tab-text small { color: rgba(244,242,236,0.65); }
[data-theme="light"] .profile-section-tab.active .profile-tab-text small { color: rgba(10,14,22,0.55); }
.profile-tab-panel { display: flex; flex-direction: column; gap: 1.15rem; }
.profile-trading-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.15rem;
  align-items: stretch;
}
.profile-markets-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.profile-market-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}
.profile-market-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35rem; padding: 0.85rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 78px;
}
[data-theme="light"] .profile-market-tile {
  background: rgba(10,14,22,0.04);
  color: rgba(10,14,22,0.7);
  border-color: rgba(10,14,22,0.12);
}
.profile-market-tile:hover {
  border-color: var(--teal);
  color: var(--text);
  transform: translateY(-1px);
}
.profile-market-tile.active {
  background: linear-gradient(160deg, rgba(45,212,191,0.2), rgba(201,145,124,0.12));
  border-color: var(--teal);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(45,212,191,0.15);
}
[data-theme="light"] .profile-market-tile.active {
  background: linear-gradient(160deg, rgba(13,148,136,0.12), rgba(184,125,106,0.1));
  color: #0a0e16;
}
.pmt-icon {
  font-size: 1.25rem; font-weight: 700; line-height: 1;
  color: var(--gold);
}
.profile-market-tile.active .pmt-icon { color: var(--teal); }
.pmt-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.profile-card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; margin-bottom: 1.15rem;
}
.profile-card-head h2 { margin-bottom: 0; font-size: 1.05rem; }
.profile-card-head .profile-card-hint { margin: 0.3rem 0 0; max-width: 36ch; }
.profile-card-tag {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.3rem 0.55rem; border-radius: 999px;
  background: rgba(45,212,191,0.12); color: var(--teal); border: 1px solid rgba(45,212,191,0.25);
}
.profile-markets-form { display: flex; flex-direction: column; gap: 1.15rem; }
.profile-field-group { display: flex; flex-direction: column; gap: 0.55rem; }
.profile-field-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.profile-chip-row, .profile-segment-row {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.profile-chip, .profile-segment {
  padding: 0.52rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  color: var(--muted);
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.18s ease;
}
[data-theme="light"] .profile-chip,
[data-theme="light"] .profile-segment {
  background: rgba(10,14,22,0.05);
  color: rgba(10,14,22,0.72);
  border-color: rgba(10,14,22,0.14);
}
.profile-chip:hover, .profile-segment:hover { border-color: var(--teal); color: var(--text); }
.profile-chip.active {
  background: rgba(45,212,191,0.18); border-color: var(--teal); color: var(--teal);
}
[data-theme="light"] .profile-chip.active { color: #0d7a72; background: rgba(13,148,136,0.12); }
.profile-segment.active {
  background: rgba(201,145,124,0.22); border-color: var(--gold); color: var(--gold);
}
[data-theme="light"] .profile-segment.active { color: #8b5a4a; background: rgba(184,125,106,0.15); }
.profile-markets-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  padding-top: 0.65rem; margin-top: 0.15rem;
  border-top: 1px solid var(--border);
}
.profile-journal-overview {
  display: flex; flex-direction: column; gap: 1rem;
  background: linear-gradient(165deg, rgba(12,18,28,0.98), rgba(45,212,191,0.08));
  min-height: 100%;
}
[data-theme="light"] .profile-journal-overview {
  background: linear-gradient(165deg, #fff, rgba(230,245,242,0.9));
}
.profile-journal-stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem;
}
.profile-journal-stat {
  padding: 0.85rem 0.9rem; border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
  text-align: center;
}
[data-theme="light"] .profile-journal-stat {
  background: rgba(255,255,255,0.85);
  border-color: rgba(10,14,22,0.1);
}
.profile-journal-stat-val {
  display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.1;
}
.profile-journal-stat-val.taken { color: var(--success); }
.profile-journal-stat-val.watching { color: var(--teal); }
.profile-journal-stat-val.skipped { color: var(--muted); }
.profile-journal-stat-val.unlogged { color: var(--gold); }
.profile-journal-stat-lbl {
  display: block; font-size: 0.65rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem;
}
.profile-journal-insight {
  font-size: 0.8rem; color: var(--muted); line-height: 1.5;
  padding: 0.85rem; border-radius: 10px;
  border: 1px dashed rgba(45,212,191,0.28);
  background: rgba(45,212,191,0.06);
  margin-top: auto;
}
.profile-journal-card {
  padding: 1.25rem;
}
.profile-journal-head-row { margin-bottom: 0.85rem; }
.profile-journal-head-row h2 { font-size: 1.05rem; color: var(--gold); margin-bottom: 0.25rem; }
.profile-journal-toolbar {
  padding: 0.65rem 0.75rem; margin-bottom: 1rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.12);
  border: 1px solid var(--border);
}
[data-theme="light"] .profile-journal-toolbar { background: rgba(10,14,22,0.03); }
.profile-journal-filters {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.profile-journal-filter {
  padding: 0.42rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
  color: var(--muted);
  font-family: inherit; font-size: 0.74rem; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
[data-theme="light"] .profile-journal-filter {
  background: #fff;
  color: rgba(10,14,22,0.65);
  border-color: rgba(10,14,22,0.12);
}
.profile-journal-filter:hover { border-color: var(--teal); color: var(--text); }
.profile-journal-filter.active {
  background: rgba(201,145,124,0.2);
  border-color: var(--gold);
  color: var(--gold);
}
[data-theme="light"] .profile-journal-filter.active {
  color: #8b5a4a;
  background: rgba(184,125,106,0.15);
}
.profile-journal-list {
  display: flex; flex-direction: column; gap: 0.75rem;
}
.profile-journal-item {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; background: rgba(0,0,0,0.12);
  transition: border-color 0.2s;
}
[data-theme="light"] .profile-journal-item { background: rgba(255,255,255,0.65); }
.profile-journal-item.match-pref { border-color: rgba(45,212,191,0.35); }
.profile-journal-item.has-entry { border-left: 3px solid var(--teal); }
.profile-journal-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.profile-journal-pair { font-size: 1rem; font-weight: 700; }
.profile-journal-dir {
  font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.45rem;
  border-radius: 4px; text-transform: uppercase;
}
.profile-journal-dir.long { background: rgba(74,222,128,0.15); color: var(--success); }
.profile-journal-dir.short { background: rgba(248,113,113,0.15); color: var(--danger); }
.profile-journal-match {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  padding: 0.18rem 0.4rem; border-radius: 4px;
  background: rgba(45,212,191,0.12); color: var(--teal);
}
.profile-journal-meta {
  display: flex; flex-wrap: wrap; gap: 0.65rem 1rem;
  font-size: 0.75rem; color: var(--muted); margin-bottom: 0.75rem;
}
.profile-journal-meta strong { color: var(--text); font-weight: 600; }
.profile-journal-actions {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem;
}
.profile-journal-action {
  padding: 0.42rem 0.75rem; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-family: inherit; font-size: 0.74rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.profile-journal-action:hover { border-color: var(--teal); color: var(--text); }
.profile-journal-action.active-taken {
  background: rgba(74,222,128,0.15); border-color: var(--success); color: var(--success);
}
.profile-journal-action.active-watching {
  background: rgba(45,212,191,0.15); border-color: var(--teal); color: var(--teal);
}
.profile-journal-action.active-skipped {
  background: rgba(255,255,255,0.06); border-color: var(--border); color: var(--muted);
}
.profile-journal-notes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem;
}
.profile-journal-notes textarea {
  width: 100%; min-height: 68px; padding: 0.55rem 0.65rem;
  border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.2); color: var(--text);
  font-family: inherit; font-size: 0.78rem; resize: vertical;
}
[data-theme="light"] .profile-journal-notes textarea { background: #fff; }
.profile-journal-notes label {
  display: block; font-size: 0.68rem; color: var(--muted);
  margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.profile-journal-empty {
  text-align: center; padding: 2rem 1rem; color: var(--muted); font-size: 0.85rem;
}

@media (max-width: 900px) {
  .portal-app { grid-template-columns: 1fr; }
  .portal-sidebar {
    position: relative; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 0.75rem 1rem; gap: 0.5rem;
  }
  .portal-sidebar-brand { border: none; margin: 0; padding: 0; }
  .portal-nav { flex-direction: row; flex-wrap: wrap; flex: unset; }
  .portal-nav-item { width: auto; padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .portal-sidebar-foot { display: none; }
  .profile-trading-grid { grid-template-columns: 1fr; }
  .profile-markets-split { grid-template-columns: 1fr; }
  .profile-market-tiles { grid-template-columns: repeat(2, 1fr); }
  .profile-section-nav { grid-template-columns: 1fr; }
  .profile-journal-notes { grid-template-columns: 1fr; }
}
