/* ═══════════════════════════════════════════════════════
   TrendExpert  –  Dark Trading UI (TradingView-inspired neon)
   ═══════════════════════════════════════════════════════ */

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

:root {
  /* Core surfaces — midnight blue-black */
  --bg:          #131722;
  --bg2:         #1a1f2e;
  --surface:     #1e222d;
  --card:        #1e222d;
  --border:      #2a2e39;
  /* Electric cyan + magenta highlights (chart-terminal vibe) */
  --primary:     #22d3ee;
  --primary-h:   #06b6d4;
  --accent:      #e879f9;
  --accent-h:    #d946ef;
  --success:     #089981;
  --danger:      #f23645;
  --warning:     #f5a623;
  --text:        #d1d4dc;
  --text-muted:  #787b86;
  --text-dim:    #5d606b;
  --radius:      8px;
  --shadow:      0 4px 24px rgba(0,0,0,.45);
  --space-1:     6px;
  --space-2:     12px;
  --space-3:     20px;
  --motion-fast: .22s;
  --motion-slow: .45s;
  --content-max: 1400px;
  --glow-cyan:   0 0 24px rgba(34, 211, 238, 0.22);
  --glow-magenta: 0 0 20px rgba(232, 121, 249, 0.18);
  --glow-panel:  0 0 0 1px rgba(42, 46, 57, 0.9), 0 12px 40px rgba(0,0,0,.35);
  /* TradingView “Publish” / focus blue */
  --tv-blue:     #2962ff;
  --tv-blue-mid: #1e53e5;
  --tv-glow:     0 0 28px rgba(41, 98, 255, 0.45);
  --tv-ring:     rgba(41, 98, 255, 0.55);
  --gold-accent: #f7931a;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { font-size:14.5px; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    linear-gradient(rgba(42,46,57,.38) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42,46,57,.30) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  background-attachment: fixed;
  animation: bg-grid-drift 28s ease-in-out infinite;
}
body::before,
body::after {
  content: "";
  position: fixed;
  width: 44rem;
  height: 44rem;
  border-radius: 50%;
  filter: blur(78px);
  opacity: .28;
  pointer-events: none;
  z-index: -1;
  animation: glow-drift 18s ease-in-out infinite;
}
body::before {
  top: -14rem;
  left: -12rem;
  background: radial-gradient(circle at center, rgba(34,211,238,.85) 0%, rgba(34,211,238,0) 68%);
}
body::after {
  right: -14rem;
  bottom: -16rem;
  background: radial-gradient(circle at center, rgba(232,121,249,.75) 0%, rgba(217,70,239,0) 70%);
  animation-delay: -9s;
}

/* ═══ Scrollbar ══════════════════════════════════════════ */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius:3px; }

/* ═══ Loading Screen ═════════════════════════════════════ */
#loading-screen {
  position: fixed; inset:0; z-index:9999;
  display: flex; align-items:center; justify-content:center;
  background:
    radial-gradient(circle at 18% 22%, rgba(14,165,233,.20) 0%, rgba(14,165,233,0) 34%),
    radial-gradient(circle at 85% 80%, rgba(59,130,246,.18) 0%, rgba(59,130,246,0) 36%),
    linear-gradient(145deg, #06090f 0%, #0c1220 45%, #141b2c 100%);
  transition: opacity .6s ease, visibility .6s ease;
}
#loading-screen.fade-out { opacity:0; visibility:hidden; }

.loader-content { text-align:center; min-width: 340px; }
.loader-reactors {
  position: absolute;
  left: 24px;
  bottom: 20px;
  width: 132px;
  height: 96px;
  pointer-events: none;
  opacity: .86;
  filter: drop-shadow(0 0 14px rgba(56,189,248,.30));
}
.reactor {
  position: absolute;
  display: block;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(224,242,254,.98) 0 7%, rgba(56,189,248,.86) 8% 15%, rgba(8,145,178,.34) 16% 29%, rgba(15,23,42,.10) 30% 48%, rgba(56,189,248,0) 49% 100%),
    repeating-conic-gradient(
      from 6deg,
      rgba(147,197,253,.68) 0deg 12deg,
      rgba(8,47,73,.38) 12deg 22deg,
      rgba(56,189,248,.78) 22deg 26deg,
      rgba(8,47,73,.42) 26deg 36deg
    );
  border: 1px solid rgba(125,211,252,.55);
  box-shadow: inset 0 0 16px rgba(56,189,248,.28), inset 0 0 30px rgba(14,165,233,.18), 0 0 14px rgba(56,189,248,.30);
  animation: loader-reactor-core 2.7s ease-in-out infinite;
}
.reactor::before,
.reactor::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.reactor::before {
  inset: 12%;
  border: 1px solid rgba(186,230,253,.86);
  background:
    radial-gradient(circle at center, rgba(56,189,248,.0) 52%, rgba(125,211,252,.33) 53% 58%, rgba(56,189,248,.0) 59% 100%),
    repeating-conic-gradient(
      from 0deg,
      rgba(224,242,254,.75) 0deg 10deg,
      rgba(56,189,248,.22) 10deg 22deg
    );
  box-shadow: inset 0 0 9px rgba(125,211,252,.45), 0 0 10px rgba(56,189,248,.35);
  animation: loader-reactor-spin-rev 6.6s linear infinite;
}
.reactor::after {
  inset: 34%;
  border: 1px solid rgba(186,230,253,.58);
  background:
    radial-gradient(circle at center, rgba(240,249,255,.96) 0 16%, rgba(56,189,248,.62) 17% 42%, rgba(34,211,238,.16) 43% 100%),
    conic-gradient(from 0deg, rgba(56,189,248,.0), rgba(186,230,253,.58), rgba(56,189,248,.0) 70%);
  box-shadow: 0 0 11px rgba(125,211,252,.72);
  animation: loader-reactor-flicker 1.8s ease-in-out infinite;
}
.reactor-lg {
  width: 62px;
  height: 62px;
  left: 0;
  top: 24px;
  animation: loader-reactor-spin 7.2s linear infinite, loader-reactor-flicker 2.2s ease-in-out infinite;
}
.reactor-md {
  width: 42px;
  height: 42px;
  left: 48px;
  top: 2px;
  animation: loader-reactor-spin-rev 5.4s linear infinite, loader-reactor-flicker 2.4s ease-in-out infinite;
}
.reactor-sm {
  width: 30px;
  height: 30px;
  left: 86px;
  top: 40px;
  animation: loader-reactor-spin 4.2s linear infinite, loader-reactor-flicker 2.0s ease-in-out infinite;
}
.reactor-glow {
  position: absolute;
  left: 18px;
  bottom: -6px;
  width: 96px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(14,165,233,.35), rgba(14,165,233,0) 72%);
  animation: loader-reactor-glow 2.8s ease-in-out infinite;
}
.reactor-label {
  position: absolute;
  left: 8px;
  bottom: -26px;
  font-size: .64rem;
  letter-spacing: .06rem;
  text-transform: uppercase;
  color: rgba(125,211,252,.82);
  text-shadow: 0 0 12px rgba(56,189,248,.32);
  white-space: nowrap;
  animation: reactor-label-pulse 2.6s ease-in-out infinite;
}
.loader-hud {
  width: 236px;
  height: 236px;
  margin: 0 auto 10px;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  animation: loader-float 5.8s ease-in-out infinite;
}
.loader-hud::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(56,189,248,.0) 40%, rgba(56,189,248,.12) 58%, rgba(56,189,248,.0) 72%),
    conic-gradient(from 0deg, rgba(56,189,248,.0), rgba(56,189,248,.30), rgba(59,130,246,.12), rgba(56,189,248,.0));
  filter: blur(.8px);
  animation: loader-rot 8.5s linear infinite;
}
.loader-hud::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  border: 1px solid rgba(125,211,252,.28);
  clip-path: polygon(0 0, 18% 0, 30% 100%, 0 100%);
  opacity: .7;
  animation: loader-sweep 2.8s ease-in-out infinite;
}
.hud-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, .42);
  box-shadow: 0 0 20px rgba(14,165,233,.20), inset 0 0 16px rgba(14,165,233,.14);
}
.ring-a { width: 214px; height: 214px; animation: loader-rot 9s linear infinite; }
.ring-b { width: 166px; height: 166px; border-style: dashed; animation: loader-rot-rev 7s linear infinite; }
.ring-c { width: 118px; height: 118px; border-color: rgba(125,211,252,.55); animation: loader-pulse 2.5s ease-in-out infinite; }
.hud-orbit {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
}
.hud-orbit span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #67e8f9;
  box-shadow: 0 0 12px rgba(103,232,249,.85);
  animation: loader-blip 1.6s ease-in-out infinite;
}
.orbit-a { animation: loader-rot 5.5s linear infinite; }
.orbit-b { animation: loader-rot-rev 7.5s linear infinite; }
.orbit-c { animation: loader-rot 10.5s linear infinite; }
.orbit-a span { top: 2px; left: calc(50% - 4.5px); }
.orbit-b span { top: 18%; left: 79%; background:#60a5fa; }
.orbit-c span { top: 80%; left: 26%; background:#38bdf8; }
.hud-core {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(186,230,253,.30), rgba(2,6,23,.72));
  border: 1px solid rgba(125,211,252,.45);
  box-shadow: 0 0 24px rgba(56,189,248,.30), 0 0 44px rgba(37,99,235,.22);
  display: grid;
  place-items: center;
  z-index: 2;
}
.loader-logo {
  width:56px; height:56px; border-radius:15px;
  object-fit:contain;
  animation: pulse-glow 2.2s ease-in-out infinite;
}
.hud-scanline {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(34,211,238,0) 0%, rgba(34,211,238,.16) 50%, rgba(34,211,238,0) 100%);
  mix-blend-mode: screen;
  animation: scanline 2.8s linear infinite;
  transform-origin: center center;
}
.loader-title {
  font-size:2.1rem; font-weight:800; letter-spacing: .22rem;
  background: linear-gradient(135deg, #67e8f9, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.loader-sub { color:#93c5fd; margin:4px 0 12px; font-size:.82rem; text-transform: uppercase; letter-spacing: .08rem; }
.loader-meta {
  margin: 8px auto 8px;
  width: min(420px, 86vw);
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: .78rem;
}
.loader-progress {
  width: min(420px, 86vw);
  height: 8px;
  margin: 0 auto 10px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(125,211,252,.35);
  background: rgba(15,23,42,.6);
}
#loader-progress-bar {
  position: relative;
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(6,182,212,.92), rgba(59,130,246,.95));
  box-shadow: 0 0 12px rgba(56,189,248,.45);
  transition: width .28s ease;
}
#loader-progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -24px;
  width: 32px;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,.0), rgba(255,255,255,.65), rgba(255,255,255,.0));
  filter: blur(1px);
}
.loader-status { color:var(--text-dim); margin-top:8px; font-size:.9rem; }
.engine-health-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.engine-health-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid rgba(34,211,238,.38);
  background: rgba(19,23,34,.72);
  color: #a5f3fc;
  font-size: .76rem;
  letter-spacing: .02rem;
  font-weight: 500;
  box-shadow: 0 0 12px rgba(34,211,238,.12);
}
.engine-health-chip.ok {
  border-color: rgba(8,153,129,.65);
  color: #a7f3d0;
  box-shadow: 0 0 14px rgba(8,153,129,.2);
}
.engine-health-chip.warn {
  border-color: rgba(245,166,35,.55);
  color: #fde68a;
  box-shadow: 0 0 12px rgba(245,166,35,.15);
}
.engine-health-chip.danger {
  border-color: rgba(242,54,69,.6);
  color: #fecdd3;
  box-shadow: 0 0 14px rgba(242,54,69,.18);
}

/* Shift-hold: spotlight emergency controls (A5) */
body.te-panic-path .command-deck .deck-actions-primary .btn:not(.te-panic-action) {
  opacity: 0.45;
  filter: saturate(0.72);
  transition: opacity 0.15s ease, filter 0.15s ease;
}
body.te-panic-path .command-deck .deck-pill {
  opacity: 0.5;
  transition: opacity 0.15s ease;
}
body.te-panic-path .te-panic-action {
  outline: 2px solid rgba(248, 113, 113, 0.95);
  outline-offset: 3px;
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.35), 0 0 42px rgba(239, 68, 68, 0.12);
  z-index: 3;
  position: relative;
}
body.te-panic-path .guardrail-actions .te-panic-action {
  outline-color: rgba(251, 191, 36, 0.92);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.3);
}

/* Dashboard load skeletons (A6) */
.te-skel-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 44px;
  justify-content: center;
}
.te-skel-wide {
  grid-column: 1 / -1;
}
.te-skeleton-line {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(51, 65, 85, 0.35), rgba(71, 85, 105, 0.52), rgba(51, 65, 85, 0.35));
  background-size: 220% 100%;
  animation: teSkelShimmer 1.15s ease-in-out infinite;
}
.te-skeleton-line-xs { width: 28%; height: 8px; }
.te-skeleton-line-sm { width: 42%; height: 8px; }
.te-skeleton-line-md { width: 55%; height: 9px; }
.te-skeleton-line-lg { width: 78%; height: 12px; }
.te-skeleton-row .te-skeleton-line { margin: 0 auto; }
@media (prefers-reduced-motion: reduce) {
  .te-skeleton-line {
    animation: none;
    background: rgba(51, 65, 85, 0.42);
  }
}
@keyframes teSkelShimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.loader-telemetry {
  width: min(420px, 86vw);
  margin: 6px auto 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: .74rem;
  color: #93c5fd;
}
.loader-telemetry span {
  border: 1px solid rgba(56,189,248,.22);
  border-radius: 8px;
  padding: 4px 6px;
  background: rgba(2,6,23,.5);
}
.loader-telemetry strong {
  color: #cffafe;
  margin-left: 4px;
}
.loader-lines {
  width: min(420px, 86vw);
  margin: 8px auto 10px;
  text-align: left;
  display: grid;
  gap: 4px;
}
.boot-line {
  font-size: .73rem;
  color: #64748b;
  letter-spacing: .03rem;
  transition: color .25s ease, text-shadow .25s ease;
}
.boot-line.active {
  color: #67e8f9;
  text-shadow: 0 0 10px rgba(103,232,249,.35);
}

.spinner {
  width:40px; height:40px; margin:0 auto;
  border:3px solid var(--border);
  border-top-color:var(--primary);
  border-radius:50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform:rotate(360deg); } }
@keyframes loader-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}
@keyframes loader-reactor-spin { to { transform: rotate(360deg); } }
@keyframes loader-reactor-spin-rev { to { transform: rotate(-360deg); } }
@keyframes loader-reactor-core {
  0%, 100% { filter: brightness(.95) saturate(1); }
  50% { filter: brightness(1.14) saturate(1.2); }
}
@keyframes loader-reactor-glow {
  0%, 100% { opacity: .5; transform: scale(1); }
  50% { opacity: .9; transform: scale(1.08); }
}
@keyframes loader-reactor-flicker {
  0%, 100% { opacity: .92; }
  20% { opacity: .82; }
  48% { opacity: 1; }
  70% { opacity: .86; }
}
@keyframes reactor-label-pulse {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}
@keyframes pulse-glow {
  0%,100% { filter: drop-shadow(0 0 8px rgba(59,130,246,.3)); }
  50%     { filter: drop-shadow(0 0 20px rgba(59,130,246,.6)); }
}
@keyframes loader-rot { to { transform: rotate(360deg); } }
@keyframes loader-rot-rev { to { transform: rotate(-360deg); } }
@keyframes loader-pulse { 0%,100% { transform: scale(.97); } 50% { transform: scale(1.03); } }
@keyframes loader-blip { 0%,100% { opacity: .9; transform: scale(1); } 50% { opacity: .45; transform: scale(.72); } }
@keyframes loader-sweep {
  0% { transform: rotate(0deg); opacity: .25; }
  55% { opacity: .85; }
  100% { transform: rotate(360deg); opacity: .25; }
}
@keyframes scanline {
  0% { transform: translate(-50%, -50%) rotate(0deg); opacity: .35; }
  50% { opacity: .8; }
  100% { transform: translate(-50%, -50%) rotate(360deg); opacity: .35; }
}
@keyframes glow-drift {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(12px,-18px,0) scale(1.05); }
}
@keyframes bg-grid-drift {
  0%, 100% { background-position: 0 0, 0 0; }
  50% { background-position: 24px 18px, -18px 22px; }
}

/* ═══ Ambient market background (blurred chart illusion) ═══ */
.te-market-bg {
  --te-scan-opacity: 0.42;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* overflow visible so fixed ::after scanline is not clipped (see .te-market-bg-scene) */
  overflow: visible;
}
.te-market-bg-scene {
  position: absolute;
  inset: -12%;
  width: 124%;
  height: 124%;
  overflow: hidden;
  filter: blur(32px) saturate(1.2);
  opacity: 0.38;
  will-change: transform;
  animation: te-market-drift 48s ease-in-out infinite;
}
.te-market-bg .te-market-chart {
  width: 100%;
  height: 100%;
  display: block;
}
.te-market-candles rect {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: te-candle-pulse 3.2s ease-in-out infinite;
}
.te-market-candles rect:nth-child(3n) { animation-delay: -0.4s; }
.te-market-candles rect:nth-child(3n+1) { animation-delay: -1.1s; }
.te-market-candles rect:nth-child(5n) { animation-delay: -2s; }
@keyframes te-candle-pulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 0.78; transform: scaleY(1.06); }
}
.te-market-spark {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: te-spark-flow 18s ease-in-out infinite;
}
@keyframes te-spark-flow {
  0% { stroke-dashoffset: 2000; opacity: 0.5; }
  45% { stroke-dashoffset: 0; opacity: 0.95; }
  100% { stroke-dashoffset: -2000; opacity: 0.5; }
}
.te-market-grid line {
  animation: te-grid-fade 22s ease-in-out infinite;
}
@keyframes te-grid-fade {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.45; }
}
@keyframes te-market-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(-1.5%, 0.8%, 0) scale(1.03); }
  66% { transform: translate3d(1.2%, -0.6%, 0) scale(1.02); }
}
/* Legacy ::after strip kept subtle; primary sweep is .te-app-scanner (above market bg, under UI). */
.te-market-bg::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  height: 4px;
  top: -4px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(41, 98, 255, 0.12) 18%,
    rgba(34, 211, 238, 0.45) 50%,
    rgba(232, 121, 249, 0.15) 82%,
    transparent 100%
  );
  box-shadow: 0 0 28px rgba(41, 98, 255, 0.28), 0 0 48px rgba(34, 211, 238, 0.18);
  opacity: calc(var(--te-scan-opacity) * 0.55);
  animation: te-scanline-v 14s cubic-bezier(0.38, 0.02, 0.22, 1) infinite;
}
@keyframes te-scanline-v {
  0% { transform: translate3d(0, -8vh, 0); }
  100% { transform: translate3d(0, 108vh, 0); }
}

/*
 * Scanner overlay: MUST paint above #app (z-index) so it is visible on solid cards.
 * pointer-events: none — clicks pass through to the UI below.
 */
.te-app-scanner {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: normal;
  opacity: 1;
  transform: translateZ(0);
}
.te-app-scanner__beam {
  position: absolute;
  left: -10%;
  width: 120%;
  height: clamp(140px, 26vh, 280px);
  top: -24%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(34, 211, 238, 0.08) 32%,
    rgba(41, 98, 255, 0.16) 48%,
    rgba(232, 121, 249, 0.12) 54%,
    rgba(34, 211, 238, 0.08) 68%,
    rgba(0, 0, 0, 0) 100%
  );
  filter: blur(8px) saturate(1.2);
  opacity: 0.55;
  animation: te-app-scanner-sweep 14.5s cubic-bezier(0.33, 0.02, 0.18, 1) infinite;
  will-change: transform;
}
.te-app-scanner__beam::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(34, 211, 238, 0.95),
    rgba(59, 130, 246, 0.75),
    rgba(232, 121, 249, 0.55),
    transparent
  );
  opacity: 0.85;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.65), 0 0 40px rgba(41, 98, 255, 0.35);
}
.te-app-scanner__beam--echo {
  opacity: 0.35;
  height: clamp(160px, 30vh, 320px);
  filter: blur(18px) saturate(1.1);
  animation-duration: 22s;
  animation-delay: -7s;
}
.te-app-scanner__beam--echo::after {
  opacity: 0.4;
  height: 1px;
}
@keyframes te-app-scanner-sweep {
  0% { transform: translate3d(0, -22vh, 0); }
  100% { transform: translate3d(0, 122vh, 0); }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .card::before { animation: none !important; opacity: 0; }
  .dashboard-hero-grid > .card,
  .dashboard-hero-grid > .profit-engine { animation: none !important; }
  .btn-primary::after,
  .btn-nexus::after { animation: none !important; display: none; }
  .nav-item.active { animation: none; }
  .te-market-bg::after { display: none; }
  .te-app-scanner__beam { animation: none !important; }
  .te-app-scanner { opacity: 0.35; }
  .te-market-bg-scene {
    animation: none;
    opacity: 0.2;
    filter: blur(40px) saturate(1);
  }
  .te-market-spark { animation: none !important; stroke-dashoffset: 0 !important; opacity: 0.35 !important; }
  .te-market-candles rect { animation: none !important; }
}

/* ═══ App Layout ═════════════════════════════════════════ */
.hidden { display:none !important; }

#app {
  display:grid;
  grid-template-columns: 220px 1fr;
  min-height:100vh;
  position: relative;
  z-index: 40;
}

#mobile-menu-toggle {
  display:none;
  position:fixed;
  left:10px;
  top:10px;
  z-index:1300;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(56,189,248,.35);
  background:rgba(8,15,28,.92);
  color:#dbeafe;
  box-shadow:0 8px 20px rgba(2,6,23,.48);
}
#mobile-sidebar-backdrop {
  display:none;
}

/* ═══ Sidebar ════════════════════════════════════════════ */
#sidebar {
  background: linear-gradient(180deg, rgba(7,12,24,.96) 0%, rgba(8,16,28,.95) 52%, rgba(6,10,22,.98) 100%);
  border-right: 1px solid rgba(56,189,248,.24);
  display:flex; flex-direction:column;
  padding:16px 0;
  position:sticky; top:0; height:100vh;
  z-index: 2;
  backdrop-filter: blur(16px);
  box-shadow: inset -1px 0 0 rgba(148,163,184,.08), 20px 0 45px rgba(2,6,23,.45);
}

#sidebar::before {
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(200px 220px at 30px 40px, rgba(34,211,238,.16), transparent 65%),
    radial-gradient(220px 200px at 100% 10%, rgba(59,130,246,.14), transparent 70%);
  pointer-events:none;
}

.sidebar-logo {
  display:flex; align-items:center; gap:10px;
  padding:0 18px 20px;
  border-bottom:1px solid rgba(148,163,184,.22);
  margin-bottom:12px;
  position:relative;
}
.sidebar-logo img {
  width:38px; height:38px; border-radius:10px; object-fit:contain;
  border:1px solid rgba(56,189,248,.35);
  box-shadow: 0 0 0 2px rgba(14,165,233,.10), 0 0 16px rgba(14,165,233,.30);
}
.sidebar-logo span {
  font-size:1.2rem; font-weight:700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-stack { display:flex; flex-direction:column; gap:4px; }
.sidebar-tagline {
  color:#7dd3fc;
  font-size:.62rem;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.sidebar-cp-hint {
  padding: 0 14px 10px;
  margin-top: -4px;
}
.sidebar-cp-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  background: linear-gradient(92deg, rgba(14, 165, 233, 0.08), rgba(15, 23, 42, 0.35));
  color: var(--text-dim, #94a3b8);
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.sidebar-cp-btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--text, #e2e8f0);
  background: linear-gradient(92deg, rgba(14, 165, 233, 0.14), rgba(59, 130, 246, 0.08));
}
.sidebar-cp-btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.45);
  outline-offset: 2px;
}
.sidebar-cp-btn i {
  color: rgba(34, 211, 238, 0.85);
  font-size: 0.75rem;
}
.sidebar-cp-label {
  flex: 1;
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.sidebar-cp-keys {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.sidebar-cp-plus {
  font-size: 0.65rem;
  opacity: 0.65;
  user-select: none;
}
.te-cp-kbd-compact {
  font-size: 0.62rem;
  padding: 2px 5px;
}

.nav-list { list-style:none; flex:1; overflow-y:auto; }
.nav-section {
  font-size:.65rem; color:var(--text-dim);
  text-transform:uppercase; letter-spacing:1.2px; font-weight:700;
  padding:14px 20px 4px; user-select:none;
}
.nav-item {
  display:flex; align-items:center; gap:10px;
  padding:11px 14px;
  color: var(--text-muted);
  cursor:pointer;
  transition: all .22s ease, box-shadow .3s ease;
  border:1px solid transparent;
  font-size:.9rem;
  border-radius:12px;
  margin:3px 8px;
  background:linear-gradient(92deg, rgba(15,23,42,.48), rgba(15,23,42,.18));
}
.nav-item:hover {
  color:var(--text);
  border-color:rgba(96,165,250,.36);
  background:linear-gradient(90deg, rgba(14,165,233,.2), rgba(59,130,246,.08), rgba(15,23,42,.16));
  transform: translateX(2px);
  box-shadow: inset 0 0 20px rgba(56,189,248,.09), 0 0 14px rgba(14,165,233,.12);
}
.nav-item.active {
  color:#e8f4ff;
  background:linear-gradient(90deg, rgba(41,98,255,.22), rgba(34,211,238,.18), rgba(15,23,42,.22));
  border-color:rgba(41,98,255,.45);
  border-left:3px solid var(--tv-blue);
  font-weight:600;
  box-shadow:
    inset 0 0 22px rgba(41,98,255,.12),
    inset 4px 0 0 rgba(34,211,238,.15),
    0 0 22px rgba(41,98,255,.28);
  animation: nav-active-pulse 3.2s ease-in-out infinite;
}
.nav-item.active::after {
  content:"";
  position:absolute;
  right:10px;
  width:26px;
  height:2px;
  border-radius:99px;
  background:linear-gradient(90deg, rgba(56,189,248,.0), rgba(56,189,248,.95));
  box-shadow:0 0 10px rgba(56,189,248,.55);
  animation: nav-trail 1.6s ease-in-out infinite;
}
.nav-item i {
  width:18px;
  text-align:center;
  transition: transform .22s ease, color .22s ease, filter .22s ease;
}
.nav-item.bot-running i {
  color: #6ee7b7;
  animation: nav-running-icon 1.35s ease-in-out infinite;
}
@keyframes nav-trail {
  0%,100% { transform: translateX(0); opacity:.45; }
  50% { transform: translateX(4px); opacity:1; }
}
@keyframes nav-running-icon {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(16,185,129,.0)); }
  50% { transform: scale(1.14); filter: drop-shadow(0 0 6px rgba(16,185,129,.55)); }
}

/* ── Sidebar Filter Toggle ─────────────────────────────── */
.sidebar-filter {
  display:flex; align-items:center; gap:4px;
  padding:6px 14px 10px; position:relative;
}
.filter-pill {
  flex:1; padding:6px 0; border:none; border-radius:8px;
  font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.6px;
  cursor:pointer; transition:all .25s ease;
  display:flex; align-items:center; justify-content:center; gap:5px;
  background:transparent; color:var(--text-dim);
}
.filter-pill:hover { color:#c7d2fe; }
.filter-pill.active {
  background:linear-gradient(120deg, rgba(59,130,246,.2), rgba(14,165,233,.2));
  color:#e0f2fe;
  box-shadow:0 0 14px rgba(56,189,248,.22);
}
.filter-hidden-count {
  position:absolute; right:14px; top:2px;
  font-size:.65rem; font-weight:700; color:var(--text-dim);
  background:var(--surface); border:1px solid var(--border);
  border-radius:10px; padding:1px 6px;
  display:none;
}
.filter-hidden-count.visible { display:inline-block; }

/* ── Nav item running indicator ───────────────────────── */
.nav-item { position:relative; }
.nav-item .running-dot {
  width:6px; height:6px; border-radius:50%;
  background:var(--success);
  box-shadow:0 0 6px rgba(16,185,129,.6);
  margin-left:auto; flex-shrink:0;
  animation:pulse-dot 2s ease-in-out infinite;
  display:none;
}
.nav-item.bot-running .running-dot { display:block; }

@keyframes pulse-dot {
  0%,100% { opacity:1; box-shadow:0 0 4px rgba(16,185,129,.4); }
  50% { opacity:.6; box-shadow:0 0 10px rgba(16,185,129,.8); }
}
@keyframes nav-active-pulse {
  0%, 100% { box-shadow: inset 0 0 22px rgba(41,98,255,.12), inset 4px 0 0 rgba(34,211,238,.12), 0 0 20px rgba(41,98,255,.22); }
  50% { box-shadow: inset 0 0 28px rgba(41,98,255,.18), inset 4px 0 0 rgba(34,211,238,.22), 0 0 28px rgba(41,98,255,.38); }
}

/* ── Nav item hide/show animations ────────────────────── */
.nav-item,
.nav-section { overflow:hidden; transition:max-height .3s ease, opacity .25s ease, padding .3s ease, margin .3s ease; max-height:50px; }
.nav-item.sidebar-hidden,
.nav-section.sidebar-hidden {
  max-height:0; opacity:0; padding-top:0; padding-bottom:0; margin:0;
  pointer-events:none;
}

/* ═══ Main Content ═══════════════════════════════════════ */
#content { padding:24px 28px; overflow-y:auto; position: relative; z-index: 2; }
#content.te-shell {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

.page { display:none; animation: fadeIn .32s ease; }
.page.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px) scale(.995)} to{opacity:1;transform:translateY(0) scale(1)} }

/* ═══ Page Header ════════════════════════════════════════ */
.page-header {
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:20px;
  padding-bottom:14px;
  border-bottom:1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.2), transparent 70%);
  border-radius: 12px 12px 0 0;
}
.page-header h2 { font-size:1.5rem; font-weight:700; display:flex; align-items:center; gap:10px; }
.page-header h2 i { color:var(--primary); }

/* Command deck */
.command-deck {
  display:flex; justify-content:space-between; align-items:flex-start; gap:12px;
  padding:10px 12px; margin:0 0 14px;
  background:linear-gradient(125deg, rgba(41,98,255,.14), rgba(59,130,246,.12), rgba(139,92,246,.1));
  border:1px solid rgba(41,98,255,.32);
  border-radius:12px;
  box-shadow:
    0 0 0 1px rgba(34,211,238,.08),
    0 16px 32px rgba(0,0,0,.28),
    0 0 40px rgba(41,98,255,.12);
  position:sticky; top:8px; z-index:20;
  backdrop-filter: blur(14px) saturate(1.1);
  overflow: visible;
}
.command-deck::before {
  content:"";
  position:absolute; inset:-40% -20%;
  background:conic-gradient(from 0deg, rgba(59,130,246,.0), rgba(59,130,246,.25), rgba(139,92,246,.20), rgba(16,185,129,.15), rgba(59,130,246,.0));
  filter: blur(24px);
  animation: deck-sweep 9s linear infinite;
  pointer-events:none;
}
.command-deck::after {
  content:"";
  position:absolute;
  left:-20%;
  top:0;
  width:42%;
  height:100%;
  background:linear-gradient(90deg, rgba(56,189,248,0), rgba(56,189,248,.16), rgba(56,189,248,0));
  transform: skewX(-18deg);
  animation: deck-data-scan 6.5s linear infinite;
  pointer-events:none;
}
.command-deck > * { position:relative; z-index:1; }
.deck-sig {
  display:flex; align-items:center; gap:6px;
  color:#dbeafe; font-weight:700; letter-spacing:.3px;
  padding:7px 11px; border-radius:10px;
  background:rgba(15,23,42,.52);
  border:1px solid rgba(96,165,250,.33);
  box-shadow:0 0 16px rgba(59,130,246,.18);
}
.deck-sig i { color:#60a5fa; }
.deck-sig span { font-size:.8rem; }
.deck-cp-mini {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 7px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text-dim, #94a3b8);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.deck-cp-mini:hover {
  border-color: rgba(34, 211, 238, 0.5);
  color: #e2e8f0;
  background: rgba(14, 165, 233, 0.12);
}
.deck-cp-mini:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.45);
  outline-offset: 2px;
}
.deck-cp-k {
  font-family: ui-monospace, monospace;
  font-size: 0.58rem;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.75);
  color: #cbd5e1;
}

.te-hub-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: linear-gradient(115deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.45));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
}
.te-hub-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.85);
  flex-shrink: 0;
}
.te-hub-scroll {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.te-hub-link {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.4);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.te-hub-link:hover {
  border-color: rgba(56, 189, 248, 0.4);
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.12);
}
.te-hub-link.active {
  border-color: rgba(34, 211, 238, 0.55);
  color: #f0f9ff;
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.22), rgba(34, 211, 238, 0.12));
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.15);
}
.te-hub-link:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.45);
  outline-offset: 2px;
}

.page-related {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(96, 165, 250, 0.22);
  background: rgba(15, 23, 42, 0.28);
}
.page-related--dashboard {
  margin-top: 4px;
  margin-bottom: 14px;
}
.page-related-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.75);
  margin-right: 4px;
}
.page-related-btn {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.4);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.page-related-btn:hover {
  border-color: rgba(56, 189, 248, 0.42);
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.1);
}
.page-related-btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.4);
  outline-offset: 2px;
}
.page-related--bot-desk {
  margin-top: 2px;
  margin-bottom: 12px;
}

/* Risk schedule (weekend / session calendar) — global banner under command deck */
.te-risk-schedule-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(245, 166, 35, 0.55);
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.14), rgba(242, 54, 69, 0.10));
  color: #fde68a;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 0 24px rgba(245, 166, 35, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: te-risk-banner-pulse 1.8s ease-in-out infinite;
}
.te-risk-schedule-banner i {
  color: #fbbf24;
  font-size: 1.05rem;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.45));
}
.te-risk-schedule-banner--hidden {
  display: none !important;
}
.te-risk-schedule-label {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(254, 243, 199, 0.95);
}
.te-risk-schedule-reason {
  flex: 1 1 220px;
  min-width: 0;
  color: #fff7ed;
  font-weight: 500;
  line-height: 1.35;
}
@keyframes te-risk-banner-pulse {
  0%, 100% {
    border-color: rgba(245, 166, 35, 0.45);
    box-shadow: 0 0 18px rgba(245, 166, 35, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  50% {
    border-color: rgba(251, 191, 36, 0.85);
    box-shadow: 0 0 28px rgba(245, 166, 35, 0.35), 0 0 40px rgba(242, 54, 69, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}
@media (prefers-reduced-motion: reduce) {
  .te-risk-schedule-banner {
    animation: none;
  }
}

@keyframes deck-data-scan {
  0% { transform: translateX(-130%) skewX(-18deg); opacity:0; }
  12% { opacity:.65; }
  100% { transform: translateX(420%) skewX(-18deg); opacity:0; }
}
.deck-pill { position:relative; }
.deck-pill::after {
  content:"";
  position:absolute; inset:0;
  border-radius:inherit;
  background:linear-gradient(115deg, rgba(255,255,255,.05), rgba(255,255,255,0));
  pointer-events:none;
}
.deck-left, .deck-right { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.deck-right {
  justify-content:flex-end;
  display:grid;
  grid-template-columns: 1fr;
  gap:6px;
  min-width: 520px;
}
.command-deck .btn {
  padding: 7px 12px;
  font-size: .78rem;
  border-radius: 9px;
}
.deck-actions-primary,
.deck-status-row,
.deck-actions-danger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.20);
  background: rgba(3,7,18,.36);
}
.deck-status-row {
  justify-content: space-between;
}
.deck-mini-tag {
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #bae6fd;
  border: 1px solid rgba(56,189,248,.34);
  background: rgba(8,30,49,.42);
  border-radius: 999px;
  padding: 4px 9px;
}
.deck-actions-danger .btn-danger {
  color: #fecaca;
  border-color: rgba(239,68,68,.55);
  background: rgba(127,29,29,.40);
}
.deck-actions-danger .btn-danger:hover {
  background: rgba(127,29,29,.56);
}
.deck-actions-danger #top-action-debug {
  margin-left: 0;
}
.nexus-top-banner {
  display:flex;
  align-items:center;
  gap:8px;
  width:auto;
  justify-content:flex-start;
}
.nexus-top-banner strong {
  color:#67e8f9;
  font-size:.8rem;
  letter-spacing:.06em;
}
.nexus-top-banner span {
  color:#cbd5e1;
  font-size:.78rem;
  border:1px solid rgba(56,189,248,.28);
  border-radius:999px;
  background:rgba(3,7,18,.56);
  padding:5px 10px;
  position:relative;
  overflow:hidden;
}
.nexus-top-banner span::after {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.16), rgba(255,255,255,0));
  transform: translateX(-120%);
  animation: banner-shimmer 4.8s ease-in-out infinite;
}
@keyframes banner-shimmer {
  0%, 60%, 100% { transform: translateX(-120%); }
  80% { transform: translateX(130%); }
}
.deck-pill {
  min-width:120px;
  padding:7px 10px;
  border-radius:10px;
  background:rgba(9,12,18,.5);
  border:1px solid rgba(148,163,184,.2);
}
.deck-pill span {
  display:block;
  color:var(--text-dim);
  font-size:.7rem;
  text-transform:uppercase;
  letter-spacing:.5px;
}
.deck-pill strong { font-size:.92rem; color:var(--text); }
.nexus-armed-pill {
  margin-left: 0;
  min-width: 165px;
  justify-content: center;
  border-color: rgba(148,163,184,.35);
}
.nexus-armed-pill.armed {
  color: #67e8f9;
  border-color: rgba(34,211,238,.55);
  background: rgba(6,182,212,.16);
  box-shadow: 0 0 16px rgba(6,182,212,.26), inset 0 0 10px rgba(34,211,238,.08);
  animation: nexus-armed-pulse 1.9s ease-in-out infinite;
}
.nexus-armed-pill .armed-since {
  margin-left: 6px;
  font-size: .7rem;
  color: #bae6fd;
  opacity: .92;
}
.nexus-alert-pill {
  border-color: rgba(148,163,184,.35);
  color: #cbd5e1;
}
.nexus-alert-wrap {
  position: relative;
  display: inline-flex;
  z-index: 60;
}
.nexus-alert-tooltip {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  max-width: min(86vw, 360px);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(56,189,248,.28);
  background: rgba(2,8,23,.95);
  box-shadow: 0 18px 40px rgba(2,6,23,.48);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 120;
}
.nexus-alert-wrap:hover .nexus-alert-tooltip,
.nexus-alert-wrap:focus-within .nexus-alert-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.nexus-alert-tooltip-title {
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #bae6fd;
  margin-bottom: 8px;
}
.nexus-alert-tooltip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.nexus-alert-tooltip-item {
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(15,23,42,.5);
}
.nexus-alert-tooltip-item strong {
  display: block;
  color: #e2e8f0;
  font-size: .74rem;
}
.nexus-alert-tooltip-item span {
  display: block;
  color: #94a3b8;
  font-size: .72rem;
  margin-top: 2px;
}
.nexus-alert-tooltip-empty {
  color: #94a3b8;
  font-size: .74rem;
}
.nexus-alert-pill.hot {
  color: #fecaca;
  border-color: rgba(239,68,68,.58);
  background: rgba(127,29,29,.28);
  box-shadow: 0 0 16px rgba(239,68,68,.25);
  animation: nexus-alert-pulse 1.2s ease-in-out infinite, nexus-alert-shake .36s ease-in-out infinite;
}
@keyframes nexus-alert-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(239,68,68,.18); }
  50% { box-shadow: 0 0 20px rgba(239,68,68,.38); }
}
@keyframes nexus-alert-shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}
@keyframes nexus-armed-pulse {
  0%, 100% {
    box-shadow: 0 0 14px rgba(6,182,212,.22), inset 0 0 10px rgba(34,211,238,.06);
  }
  50% {
    box-shadow: 0 0 24px rgba(6,182,212,.44), inset 0 0 14px rgba(34,211,238,.14);
  }
}

.comment-legend {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, .25);
  background: rgba(8, 22, 35, .42);
}
.comment-legend-title {
  color: #bae6fd;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.comment-legend-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.legend-pill {
  font-size: .78rem;
  color: var(--text-soft);
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, .45);
}
.comment-legend-example {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text-dim);
}
/* Legend column = content width only; N.E.X.U.S autostart gets all remaining width (no huge empty band). */
.comment-legend-split {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr);
  gap: 16px 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .comment-legend-split {
    grid-template-columns: 1fr;
  }
}
.comment-legend-left {
  min-width: 0;
  max-width: min(100%, 440px);
}
.comment-legend-nexus {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(6, 182, 212, 0.28);
  background: rgba(6, 24, 38, 0.55);
}
.nexus-autostart-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.86rem;
  color: #a5f3fc;
  margin-bottom: 6px;
}
.nexus-autostart-hint {
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0 0 10px;
}
.nexus-autostart-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.nexus-autostart-filter-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  font-size: 0.82rem;
}
.nexus-autostart-filter-input::placeholder {
  color: var(--text-dim);
}
.nexus-autostart-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nexus-autostart-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 480px);
  overflow-y: auto;
  padding: 4px 6px 4px 2px;
}
.nexus-autostart-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: start;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.8rem;
}
.nexus-autostart-row--hidden {
  display: none !important;
}
.nexus-autostart-row--blocked {
  opacity: 0.88;
  border-color: rgba(148, 163, 184, 0.22);
}
.nexus-autostart-row-check {
  padding-top: 2px;
}
.nexus-autostart-row-check input {
  margin: 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
  cursor: pointer;
}
.nexus-autostart-row-check input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.nexus-autostart-row-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nexus-autostart-row-title {
  color: var(--text-soft, #cbd5e1);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.nexus-autostart-row-key {
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  word-break: break-all;
}
.nexus-autostart-row-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.nexus-autostart-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-dim);
}
.nexus-autostart-badge--warn {
  border-color: rgba(245, 166, 35, 0.45);
  color: #fcd34d;
  background: rgba(245, 166, 35, 0.08);
}
.nexus-autostart-badge--lock {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.08);
}
.nexus-autostart-unlock-btn {
  align-self: flex-start;
  margin-top: 2px;
}
.nexus-autostart-empty {
  margin: 0;
  font-size: 0.8rem;
}
.nexus-autostart-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.strategy-switcher-below-legend {
  margin: 0 0 14px;
}
.strategy-switcher-card .guardrail-head h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.strategy-switcher-blurb {
  font-size: 0.86rem;
  margin: 0 0 10px;
  line-height: 1.45;
}
.strategy-switcher-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.strategy-switcher-label {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.strategy-switcher-select {
  min-width: min(240px, 100%);
  flex: 1 1 200px;
  max-width: 360px;
}
.symbol-tag {
  display:inline-block;
  background:var(--card); border:1px solid var(--border);
  padding:2px 10px; border-radius:20px;
  font-size:.8rem; color:var(--text-muted);
  margin-left:8px;
}

.header-balance { text-align:right; }
.balance-label { display:block; font-size:.8rem; color:var(--text-dim); }
.balance-value { font-size:1.4rem; font-weight:700; color:var(--success); }

/* ═══ Controls Bar ═══════════════════════════════════════ */
.controls-bar {
  display:flex; align-items:center; gap:10px;
  margin-bottom:20px; flex-wrap:wrap;
}

.btn {
  padding:9px 18px; border:none; border-radius:var(--radius);
  font-size:.9rem; font-weight:600; cursor:pointer;
  display:inline-flex; align-items:center; gap:6px;
  transition: all .2s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.btn:active { transform:scale(.97); }
.btn-start { background:linear-gradient(135deg, #10b981 0%, #059669 100%); color:#fff; }
.btn-start:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(16,185,129,.25); }
.btn-stop-active { background:linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color:#fff; }
.btn-stop-active:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(239,68,68,.25); }
.btn-danger { background:rgba(239,68,68,.15); color:var(--danger); border:1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background:rgba(239,68,68,.25); }
.btn-primary {
  background: linear-gradient(135deg, var(--tv-blue) 0%, var(--tv-blue-mid) 48%, #1d4ed8 100%);
  color: #fff;
  border: 1px solid rgba(147, 197, 253, .35);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: btn-tv-shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--tv-glow), 0 12px 28px rgba(41, 98, 255, .35);
}
.btn-nexus {
  background: linear-gradient(135deg, #22d3ee 0%, var(--tv-blue) 42%, #0ea5e9 100%);
  color: #f0f9ff;
  border: 1px solid rgba(125, 211, 252, .5);
  text-shadow: 0 0 10px rgba(34, 211, 238, .55);
  position: relative;
  overflow: hidden;
}
.btn-nexus::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(95deg, transparent, rgba(255,255,255,.12), transparent);
  transform: translateX(-100%);
  animation: btn-tv-shimmer 4s ease-in-out infinite;
  pointer-events: none;
}
.btn-nexus:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(41, 98, 255, .4), 0 12px 28px rgba(14, 165, 233, .35);
}
@keyframes btn-tv-shimmer {
  0%, 40% { transform: translateX(-120%); opacity: 0; }
  55% { opacity: 1; }
  70%, 100% { transform: translateX(120%); opacity: 0; }
}
.btn-nexus-muted {
  background: rgba(12, 34, 56, .74);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, .35);
}
.btn-nexus-muted:hover {
  background: rgba(17, 45, 72, .85);
  color: #bfdbfe;
}

.full-w { width:100%; justify-content:center; margin-top:8px; }

.status-pill {
  margin-left:auto;
  padding:6px 14px; border-radius:20px;
  font-size:.85rem; font-weight:600;
  background:rgba(100,116,139,.15); color:var(--text-dim);
  display:flex; align-items:center; gap:6px;
  border:1px solid rgba(148,163,184,.25);
  box-shadow: 0 0 14px rgba(100,116,139,.12), inset 0 0 8px rgba(255,255,255,.03);
}
.status-pill i { font-size:8px; }
.status-pill.running {
  background:rgba(16,185,129,.14);
  color:var(--success);
  border-color: rgba(16,185,129,.35);
  box-shadow: 0 0 18px rgba(16,185,129,.22), inset 0 0 10px rgba(16,185,129,.08);
}
.status-pill.running i {
  animation: status-dot-pulse 1.05s ease-in-out infinite;
}
.status-pill.excluded {
  background:rgba(244,114,182,.12);
  color:#ffb7db;
  border-color:rgba(244,114,182,.45);
  box-shadow: 0 0 16px rgba(244,114,182,.20), inset 0 0 8px rgba(244,114,182,.08);
}
.status-pill.excluded i { color:#f472b6; }
.status-pill.risk-schedule {
  background: rgba(245, 166, 35, 0.14);
  color: #fde68a;
  border-color: rgba(245, 166, 35, 0.55);
  box-shadow: 0 0 20px rgba(245, 166, 35, 0.28), inset 0 0 10px rgba(245, 166, 35, 0.08);
  animation: status-dot-pulse 1.2s ease-in-out infinite;
}
.status-pill.risk-schedule i { color: #fbbf24; }
.status-pill.blocked-trade {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.5);
}
.status-pill.blocked-trade i { color: #f87171; }
.root-tf-active-line {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.95;
}
@keyframes status-dot-pulse {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.45); opacity: 1; }
}
.tf-summary {
  margin-left: 0;
  min-width: 110px;
  justify-content: center;
}

body.nexus-mode .command-deck {
  border-color: rgba(34, 211, 238, .52);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .16), 0 18px 34px rgba(2, 132, 199, .33);
  background: linear-gradient(115deg, rgba(8, 47, 73, .55), rgba(12, 74, 110, .40), rgba(30, 58, 138, .35));
}
body.nexus-mode .command-deck::before {
  background: conic-gradient(from 0deg, rgba(34,211,238,.0), rgba(34,211,238,.30), rgba(59,130,246,.22), rgba(14,165,233,.24), rgba(34,211,238,.0));
}
body.nexus-mode .deck-sig {
  border-color: rgba(34, 211, 238, .48);
  box-shadow: 0 0 20px rgba(6, 182, 212, .30);
  color: #cffafe;
}
body.nexus-mode .deck-pill {
  border-color: rgba(56, 189, 248, .35);
  background: rgba(2, 6, 23, .55);
}
body.nexus-mode #sidebar {
  border-right-color: rgba(34,211,238,.30);
  box-shadow: inset -1px 0 0 rgba(14,165,233,.15);
}
body.nexus-mode .card {
  border-color: rgba(56,189,248,.24);
  box-shadow: 0 10px 24px rgba(2,6,23,.46), inset 0 0 0 1px rgba(34,211,238,.05);
}
body.nexus-mode .page-header h2 i {
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(14,165,233,.38);
}
.tf-presets {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin:-6px 0 12px;
}
.tf-presets > span {
  font-size:.78rem;
  color:var(--text-soft);
}
.tf-btn {
  border:1px solid rgba(56,189,248,.35);
  background:rgba(56,189,248,.10);
  color:#9bdaf5;
}
.tf-btn:hover { background:rgba(56,189,248,.20); }
.tf-bot-grid {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap:12px;
  margin-bottom:16px;
}
.tf-bot-card {
  background: var(--card);
  border:1px solid rgba(102,116,144,.24);
  border-radius:14px;
  padding:12px;
  transition: border-color .25s ease, box-shadow .25s ease, transform .22s ease;
}
.tf-bot-card:hover {
  border-color: rgba(41, 98, 255, 0.4);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(41, 98, 255, 0.15);
  transform: translateY(-1px);
}
.tf-bot-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:8px;
}
.tf-bot-name {
  font-size:.9rem;
  font-weight:700;
  color:var(--text);
}
.tf-bot-sub {
  font-size:.78rem;
  color:var(--text-soft);
  margin-bottom:8px;
}
.tf-bot-badges {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:10px;
}
.tf-policy-badge {
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:.72rem;
  font-weight:700;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.35);
  letter-spacing:.2px;
}
.tf-policy-badge.lock-on {
  color:#fecdd3;
  background:rgba(244,63,94,.14);
  border-color:rgba(244,63,94,.45);
}
.tf-policy-badge.lock-off {
  color:#bfdbfe;
  background:rgba(37,99,235,.14);
  border-color:rgba(59,130,246,.40);
}
.tf-policy-badge.sl-on {
  color:#fde68a;
  background:rgba(245,158,11,.13);
  border-color:rgba(245,158,11,.45);
}
.tf-policy-badge.sl-off {
  color:#99f6e4;
  background:rgba(13,148,136,.14);
  border-color:rgba(20,184,166,.42);
}
.tf-policy-badge.src-manual {
  color:#dbeafe;
  background:rgba(37,99,235,.14);
  border-color:rgba(59,130,246,.40);
}
.tf-policy-badge.src-nexus {
  color:#f5d0fe;
  background:rgba(168,85,247,.14);
  border-color:rgba(192,132,252,.45);
}
.tf-policy-badge.src-monitor {
  color:#cffafe;
  background:rgba(8,145,178,.14);
  border-color:rgba(34,211,238,.4);
}
.tf-policy-badge.src-unknown {
  color:#cbd5e1;
  background:rgba(71,85,105,.18);
  border-color:rgba(148,163,184,.35);
}
.tf-bot-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

/* ═══ Grid Layouts ═══════════════════════════════════════ */
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; margin-bottom:16px; }
.grid-4 { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:16px; margin-bottom:16px; }

/* ═══ Card ═══════════════════════════════════════════════ */
.card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(255,255,255,.05), rgba(255,255,255,.00) 55%),
    var(--card);
  border:1px solid rgba(42,46,57,.95);
  border-radius:var(--radius);
  padding:18px;
  margin-bottom:16px;
  box-shadow: var(--glow-panel);
  backdrop-filter: blur(12px) saturate(1.08);
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease, background .28s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(41, 98, 255, 0.09) 48%,
    rgba(34, 211, 238, 0.07) 52%,
    transparent 62%
  );
  transform: translateX(-100%);
  animation: tv-card-sweep 8s ease-in-out infinite;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(41, 98, 255, 0.38);
  box-shadow: var(--glow-panel), var(--glow-cyan), 0 0 36px rgba(41, 98, 255, 0.12);
}
.card:hover::before {
  animation-duration: 4.5s;
}
@keyframes tv-card-sweep {
  0%, 35% { transform: translateX(-100%); opacity: 0; }
  50% { opacity: 1; }
  65%, 100% { transform: translateX(100%); opacity: 0; }
}
.card h3 {
  font-size:1.02rem; font-weight:650; color:var(--text);
  margin-bottom:14px; display:flex; align-items:center; gap:8px;
  letter-spacing:.15px;
}
.card h3 i { color:var(--primary); font-size:.9rem; }

/* ═══ Forms ══════════════════════════════════════════════ */
label {
  display:block; font-size:.78rem; color:var(--text-muted);
  margin-bottom:4px; margin-top:10px;
  text-transform:uppercase;
  letter-spacing:.55px;
  font-weight:650;
}
label:first-child { margin-top:0; }
input, select {
  width:100%; padding:8px 12px;
  background:linear-gradient(180deg, rgba(18,21,30,.95), rgba(14,17,24,.98));
  border:1px solid var(--border); border-radius:6px;
  color:var(--text); font-size:.9rem;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus {
  outline:none;
  border-color:var(--primary);
  box-shadow: 0 0 0 3px rgba(34,211,238,.18);
}

/* ═══ Log Box ════════════════════════════════════════════ */
.log-box {
  height:clamp(200px, 34vh, 320px); overflow-y:auto;
  background:var(--bg); border:1px solid var(--border); border-radius:6px;
  padding:10px; font-family:'Cascadia Code','Fira Code',monospace; font-size:.8rem;
  line-height:1.6;
}
.log-entry { padding:1px 0; }
.log-entry .log-time { color:var(--text-dim); margin-right:6px; }
.log-entry.info  .log-msg { color:var(--text-muted); }
.log-entry.warning .log-msg { color:var(--warning); }
.log-entry.error .log-msg { color:var(--danger); }

/* ═══ Strategy Terminal ══════════════════════════════════ */
.strategy-terminal {
  height:clamp(240px, 46vh, 420px); overflow-y:auto;
  background: #0a0c10; border:1px solid var(--border); border-radius:6px;
  padding:12px; font-family:'Cascadia Code','Fira Code','Consolas',monospace;
  font-size:.78rem; line-height:1.55;
}
.strat-block {
  margin-bottom:6px; padding-bottom:4px;
  border-bottom:1px solid rgba(38,45,61,.3);
}
.strat-line { white-space:pre-wrap; }
.strat-header { color:var(--primary); font-weight:600; }
.strat-direction { color:var(--accent); font-weight:600; }
.strat-indent { color:var(--text-muted); }
.strat-yes { color:var(--success); }
.strat-no { color:rgba(239,68,68,.7); }
.strat-signal {
  color:#fbbf24; font-weight:700; font-size:.85rem;
  background:rgba(251,191,36,.08); padding:2px 6px; border-radius:4px;
  display:inline-block; margin:2px 0;
}
.strat-no-trade { color:var(--text-dim); font-style:italic; }

/* ═══ Analysis Grid ══════════════════════════════════════ */
.analysis-grid {
  display:grid; grid-template-columns:repeat(4,1fr); gap:10px;
}
.analysis-item {
  background:var(--surface); border:1px solid var(--border);
  border-radius:8px; padding:10px 12px; text-align:center;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.analysis-item:hover {
  transform: translateY(-2px);
  border-color: rgba(96,165,250,.35);
  box-shadow: 0 10px 20px rgba(0,0,0,.24);
}
.analysis-item span { display:block; font-size:.75rem; color:var(--text-dim); margin-bottom:4px; }
.analysis-item strong { font-size:1rem; }

/* ═══ Tables ═════════════════════════════════════════════ */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th { text-align:left; padding:8px 10px; font-size:.8rem; color:var(--text-dim); border-bottom:1px solid var(--border); }
td { padding:8px 10px; font-size:.85rem; border-bottom:1px solid rgba(38,45,61,.5); }
tr:hover td { background:rgba(59,130,246,.04); }
.table-wrap table { font-variant-numeric: tabular-nums; }
th {
  text-transform: uppercase;
  letter-spacing: .55px;
  font-weight: 700;
  font-size: .72rem;
}
td {
  font-size: .81rem;
  letter-spacing: .15px;
}
.text-buy { color:var(--success); font-weight:600; }
.text-sell { color:var(--danger); font-weight:600; }
.text-profit { color:var(--success); }
.text-loss { color:var(--danger); }

/* ═══ Info Grid (Account Page) ═══════════════════════════ */
.info-grid { display:flex; flex-direction:column; gap:2px; }
.info-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 0; border-bottom:1px solid rgba(38,45,61,.4);
}
.info-row span { color:var(--text-muted); font-size:.85rem; }
.info-row strong { font-size:.95rem; }

/* AI & Adaptive page */
.page-desc { color:var(--text-muted); font-size:.9rem; margin:-8px 0 1.1rem; max-width:72ch; line-height:1.55; }
.header-meta { font-size:.8rem; color:var(--text-dim); }
.adaptive-explainer { margin-top:1rem; padding-top:1rem; border-top:1px solid var(--border); font-size:.85rem; color:var(--text-muted); }
.adaptive-explainer ul { margin:.5rem 0 0 1rem; padding:0; }
.adaptive-explainer li { margin:.35rem 0; }
.info-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.info-table th, .info-table td { padding:8px 10px; text-align:left; border-bottom:1px solid var(--border); }
.info-table th { color:var(--text-muted); font-weight:600; }
.adaptive-history { max-height:220px; overflow-y:auto; }
.text-dim { color:var(--text-dim); font-size:.85rem; }
.bot-review-summary-grid .pnl-value { font-size:1.4rem; }
.bot-review-filters { display:grid; grid-template-columns:repeat(6, minmax(0, 1fr)); gap:10px; }
.bot-review-filters input,
.bot-review-filters select { width:100%; }
.bot-review-table code {
  font-size:.73rem;
  color:#93c5fd;
  background:rgba(30,41,59,.72);
  border:1px solid rgba(71,85,105,.55);
  padding:2px 5px;
  border-radius:5px;
}
.bot-review-chip-row { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.bot-review-chip {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:78px;
  padding:3px 9px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.35);
  background:rgba(148,163,184,.12);
  color:var(--text-muted);
  font-size:.72rem;
  font-weight:700;
  letter-spacing:.35px;
  text-transform:uppercase;
}
.bot-review-chip.ok { color:#34d399; border-color:rgba(52,211,153,.45); background:rgba(16,185,129,.14); }
.bot-review-chip.warn { color:#fbbf24; border-color:rgba(251,191,36,.45); background:rgba(245,158,11,.14); }
.bot-review-chip.bad { color:#fca5a5; border-color:rgba(252,165,165,.45); background:rgba(239,68,68,.14); }
.bot-review-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.bot-review-card-head h3 { margin:0 0 4px; font-size:1rem; }
.bot-review-kpis { margin-bottom:8px; }
.bot-review-details {
  margin-top:8px;
  border-top:1px solid var(--border);
  padding-top:8px;
}
.bot-review-details summary {
  cursor:pointer;
  color:var(--text-muted);
  font-weight:600;
  margin-bottom:8px;
}
.bot-review-details-grid {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
.bot-review-details-grid h4 {
  font-size:.86rem;
  color:var(--text);
  margin:0 0 6px;
}
.bot-review-details-grid p {
  margin:0;
  color:var(--text-muted);
  font-size:.84rem;
  line-height:1.5;
}
.bot-review-details-grid ul {
  margin:0 0 0 16px;
  padding:0;
  color:var(--text-muted);
  font-size:.84rem;
  line-height:1.45;
}
.profile-bar {
  display:flex; align-items:center; gap:8px;
  margin:0 0 14px; padding:10px 12px;
  background:var(--surface); border:1px solid var(--border); border-radius:8px;
}
.profile-label { color:var(--text-muted); font-size:.85rem; margin-right:4px; }
.profile-btn { padding:6px 12px; font-size:.8rem; }
.profile-btn.active { border-color:var(--primary); color:var(--primary); background:rgba(59,130,246,.12); }

/* HFT target mode badge */
.hft-mode-badge {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:90px; padding:3px 9px; border-radius:999px;
  font-size:.74rem; font-weight:700; letter-spacing:.3px;
  border:1px solid rgba(148,163,184,.35);
  color:var(--text-muted); background:rgba(148,163,184,.12);
  text-transform:uppercase;
}
.hft-mode-badge.mode-scale_up {
  color:#34d399; border-color:rgba(52,211,153,.45); background:rgba(16,185,129,.14);
}
.hft-mode-badge.mode-lock_gains {
  color:#93c5fd; border-color:rgba(147,197,253,.45); background:rgba(59,130,246,.14);
}
.hft-mode-badge.mode-repair {
  color:#fca5a5; border-color:rgba(252,165,165,.45); background:rgba(239,68,68,.14);
}
.hft-mode-badge.mode-on_target {
  color:#c4b5fd; border-color:rgba(196,181,253,.45); background:rgba(139,92,246,.14);
}

/* ═══ P&L Cards ══════════════════════════════════════════ */
.pnl-card { text-align:center; padding:22px; }
.pnl-label { display:block; font-size:.85rem; color:var(--text-muted); margin-bottom:6px; }
.pnl-value { font-size:1.6rem; font-weight:700; }
.pnl-positive { color:var(--success); }
.pnl-negative { color:var(--danger); }
.metric-pulse-up { animation: metricPulseUp .55s ease; }
.metric-pulse-down { animation: metricPulseDown .55s ease; }
@keyframes metricPulseUp {
  0% { filter: drop-shadow(0 0 0 rgba(16,185,129,0)); transform: scale(1); }
  45% { filter: drop-shadow(0 0 8px rgba(16,185,129,.65)); transform: scale(1.03); }
  100% { filter: drop-shadow(0 0 0 rgba(16,185,129,0)); transform: scale(1); }
}
@keyframes metricPulseDown {
  0% { filter: drop-shadow(0 0 0 rgba(239,68,68,0)); transform: scale(1); }
  45% { filter: drop-shadow(0 0 8px rgba(239,68,68,.6)); transform: scale(1.03); }
  100% { filter: drop-shadow(0 0 0 rgba(239,68,68,0)); transform: scale(1); }
}

/* ── Main Dashboard ───────────────────────────────────── */
.dashboard-meta {
  display:flex;
  align-items:center;
  gap:10px;
}
.dashboard-meta label {
  margin:0;
  font-size:.7rem;
  color:var(--text-dim);
}
.dashboard-meta select {
  min-width:86px;
}
.dashboard-grid {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:14px;
}
.dashboard-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto auto;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.dashboard-hero-exec {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
.dashboard-hero-profit {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dashboard-hero-grid .dashboard-hero-exec .executive-summary-body {
  flex: 1 1 auto;
  min-height: 0;
}
.dashboard-hero-grid .dashboard-hero-profit .profit-metrics {
  flex: 1 1 auto;
  align-content: center;
}
.dashboard-hero-mission {
  grid-column: 1 / -1;
  grid-row: 2;
}
.dashboard-hero-grid > .card,
.dashboard-hero-grid > .profit-engine {
  animation: hero-tile-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.dashboard-hero-grid > *:nth-child(1) { animation-delay: 0.04s; }
.dashboard-hero-grid > *:nth-child(2) { animation-delay: 0.10s; }
.dashboard-hero-grid > *:nth-child(3) { animation-delay: 0.16s; }
@keyframes hero-tile-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
.dashboard-hero-grid .profit-engine { margin-bottom:0; }
.dashboard-more {
  margin-top:14px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--surface);
  padding:0 var(--space-2) var(--space-2);
}
.dashboard-more > summary {
  cursor:pointer;
  list-style:none;
  padding:var(--space-2) 4px;
  font-weight:600;
  color:var(--text);
  user-select:none;
}
.dashboard-more > summary::-webkit-details-marker { display:none; }
.dashboard-more > summary i { margin-right:8px; opacity:.85; }
.dashboard-more-body {
  display:flex;
  flex-direction:column;
  gap:14px;
  padding-top:4px;
}
#page-dashboard {
  position: relative;
  --ai-ambient-intensity: 0.18;
}
.ai-ambient-layer {
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:0;
  overflow:hidden;
}
.ai-pulse {
  position:absolute;
  border-radius:50%;
  filter: blur(26px);
  opacity: calc(var(--ai-ambient-intensity) * 0.55);
  animation: aiPulseDrift 9s ease-in-out infinite;
}
.ai-pulse.p1 {
  width:260px; height:260px; left:8%; top:6%;
  background: radial-gradient(circle, rgba(59,130,246,.85), rgba(59,130,246,0));
}
.ai-pulse.p2 {
  width:240px; height:240px; right:10%; top:24%;
  background: radial-gradient(circle, rgba(139,92,246,.78), rgba(139,92,246,0));
  animation-delay:-3s;
}
.ai-pulse.p3 {
  width:220px; height:220px; left:34%; bottom:8%;
  background: radial-gradient(circle, rgba(16,185,129,.75), rgba(16,185,129,0));
  animation-delay:-6s;
}
.si-grid {
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(rgba(59,130,246,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,92,246,.08) 1px, transparent 1px);
  background-size: 56px 56px, 56px 56px;
  opacity: calc(var(--ai-ambient-intensity) * 0.50);
}
@keyframes aiPulseDrift {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(12px,-10px,0) scale(1.06); }
}
.mission-core, .profit-engine, .dashboard-card {
  position:relative;
  z-index:1;
}
.profit-engine {
  margin-bottom: 14px;
  border:1px solid rgba(42,46,57,.85);
  background:linear-gradient(180deg, rgba(30,34,45,.9), rgba(19,23,34,.58));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.profit-engine-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}
.profit-rec {
  font-size:.74rem;
  letter-spacing:.45px;
  text-transform:uppercase;
  border-radius:999px;
  padding:4px 10px;
  border:1px solid rgba(148,163,184,.35);
  color:var(--text-muted);
}
.profit-rec.rec-scale {
  color:#6ee7b7; border-color:rgba(8,153,129,.5); background:rgba(8,153,129,.16);
  box-shadow:0 0 10px rgba(8,153,129,.2);
}
.profit-rec.rec-hold {
  color:#a5f3fc; border-color:rgba(34,211,238,.45); background:rgba(34,211,238,.1);
  box-shadow:0 0 10px rgba(34,211,238,.15);
}
.profit-rec.rec-defend {
  color:#fecdd3; border-color:rgba(242,54,69,.5); background:rgba(242,54,69,.12);
  box-shadow:0 0 10px rgba(242,54,69,.18);
}
.profit-metrics {
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap:10px;
}
.profit-metric {
  border:1px solid rgba(148,163,184,.22);
  border-radius:10px;
  padding:8px 10px;
  background:rgba(15,23,42,.45);
}
.profit-metric span {
  display:block;
  font-size:.69rem;
  text-transform:uppercase;
  color:var(--text-dim);
  letter-spacing:.42px;
  margin-bottom:4px;
}
.profit-metric strong {
  font-size:.94rem;
}
.guardrail-grid { margin-bottom:14px; }
.guardrail-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.guardrail-mode {
  font-size:.73rem;
  letter-spacing:.4px;
  text-transform:uppercase;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.35);
  color:var(--text-muted);
  background:rgba(15,23,42,.5);
}
.guardrail-metrics {
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:9px;
}
.guardrail-metric {
  border:1px solid rgba(148,163,184,.22);
  border-radius:10px;
  padding:8px 10px;
  background:rgba(15,23,42,.45);
}
.guardrail-metric span {
  display:block;
  font-size:.68rem;
  text-transform:uppercase;
  color:var(--text-dim);
  letter-spacing:.35px;
  margin-bottom:4px;
}
.guardrail-actions { margin-top:10px; }
.sandbox-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,.20);
  border-radius: 10px;
  background: rgba(15,23,42,.30);
}
.sandbox-controls + .sandbox-controls { margin-top: 8px; }
.sandbox-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-left: 6px;
}
.sandbox-controls #execution-profile-select {
  min-width: 140px;
  max-width: 180px;
}
.sandbox-controls-nexus-families .sandbox-label {
  margin-left: 0;
  margin-right: 4px;
}
.sandbox-controls-nexus-families .engine-pill {
  margin-left: auto;
}
.sandbox-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(2,6,23,.45);
}
.sandbox-input-wrap span {
  font-size: .68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sandbox-input-wrap input {
  width: 84px;
  min-width: 70px;
  padding: 5px 7px;
  font-size: .78rem;
}
.engine-status-row {
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.engine-pill {
  font-size:.7rem;
  text-transform:uppercase;
  letter-spacing:.35px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(16,185,129,.28);
  color:#86efac;
  background:rgba(16,185,129,.08);
}
.engine-pill.status-ok {
  border-color: rgba(16,185,129,.34);
  color: #86efac;
  background: rgba(16,185,129,.12);
}
.engine-pill.status-error {
  border-color: rgba(239,68,68,.38);
  color: #fecaca;
  background: rgba(239,68,68,.14);
}
.why-not-global {
  font-size:.82rem;
  color:var(--text-muted);
  margin-bottom:8px;
}
.replay-filters {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 8px;
}
.replay-presets {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 8px;
}
.replay-preset-btn {
  border-color: rgba(148,163,184,.28);
  color: var(--text-muted);
}
.replay-preset-btn.active {
  color: #bae6fd;
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 12px rgba(56,189,248,.22);
  background: linear-gradient(120deg, rgba(30,58,138,.30), rgba(14,165,233,.18));
}
.replay-filters select {
  min-width:140px;
  padding:6px 10px;
  border-radius:8px;
  border:1px solid rgba(148,163,184,.28);
  background:rgba(15,23,42,.55);
  color:var(--text-soft);
  font-size:.78rem;
}
.replay-filters select:focus {
  outline:none;
  border-color:rgba(56,189,248,.55);
  box-shadow:0 0 0 2px rgba(56,189,248,.15);
}
.replay-toggle {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:.78rem;
  color:var(--text-muted);
  padding:4px 8px;
  border:1px solid rgba(148,163,184,.28);
  border-radius:8px;
  background:rgba(15,23,42,.35);
}
.replay-bookmark-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
.replay-bookmark-controls input {
  min-width: 220px;
  flex: 1 1 240px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(15,23,42,.55);
  color: var(--text-soft);
  font-size: .78rem;
}
.replay-bookmark-controls input:focus {
  outline: none;
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 2px rgba(56,189,248,.15);
}
.replay-bookmark-list {
  max-height: 140px;
  margin-bottom: 8px;
}
.replay-bookmark-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.why-not-list {
  display:flex;
  flex-direction:column;
  gap:7px;
  max-height:185px;
  overflow:auto;
}
.why-not-item {
  border:1px solid rgba(148,163,184,.2);
  border-radius:10px;
  padding:7px 9px;
  background:rgba(15,23,42,.44);
}
.why-not-item strong {
  display:block;
  font-size:.78rem;
  color:var(--text);
}
.why-not-item span {
  display:block;
  font-size:.75rem;
  color:var(--text-muted);
  margin-top:3px;
}
.why-chain-item {
  border-left: 3px solid rgba(148,163,184,.45);
}
.why-chain-item.ok {
  border-left-color: rgba(52,211,153,.6);
}
.why-chain-item.warn {
  border-left-color: rgba(251,191,36,.65);
}
.why-chain-item.block {
  border-left-color: rgba(248,113,113,.75);
}
.burn-meter {
  margin: 4px 0 8px;
}
.burn-meter-track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15,23,42,.55);
  overflow: hidden;
}
.burn-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e 0%, #f59e0b 58%, #ef4444 100%);
  box-shadow: 0 0 12px rgba(239,68,68,.28);
  transition: width .35s ease;
}
@media (max-width: 1024px) {
  .guardrail-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .guardrail-metrics { grid-template-columns: 1fr; }
}
.dashboard-card {
  padding:12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(42,46,57,.9) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 32px rgba(0,0,0,.35);
}
.dashboard-card:hover {
  border-color: rgba(34,211,238,.45) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 0 1px rgba(34,211,238,.25), var(--glow-cyan);
}
.dashboard-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(34,211,238,.0), rgba(34,211,238,.14), rgba(232,121,249,.08), rgba(34,211,238,.0));
  transform: translateX(-110%);
  animation: dash-sweep 6.5s linear infinite;
  pointer-events: none;
}
.dashboard-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
  flex-wrap:wrap;
}
.dashboard-card-head h3 {
  margin:0;
}
.dashboard-controls {
  display:flex;
  align-items:center;
  gap:6px;
  margin-left:auto;
}
.dashboard-controls label {
  font-size:.68rem;
  text-transform:uppercase;
  color:var(--text-dim);
  letter-spacing:.08em;
}
.dash-tf-select {
  min-width:76px;
  padding:5px 9px;
  border-radius:9px;
  border:1px solid rgba(59,130,246,.35);
  background:rgba(10,16,28,.86);
  color:#cbd5e1;
  font-size:.78rem;
}
.dash-tf-select:focus {
  outline:none;
  border-color:rgba(56,189,248,.55);
  box-shadow:0 0 0 2px rgba(56,189,248,.18);
}
.dashboard-stats {
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  justify-content:flex-start;
  width:100%;
}
.dash-pill {
  font-size:.72rem;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.28);
  background:rgba(15,23,42,.6);
  color:var(--text-muted);
  transition: box-shadow .25s ease, border-color .25s ease;
}
.dash-pill.running {
  color:var(--success);
  border-color:rgba(8,153,129,.5);
  box-shadow:0 0 12px rgba(8,153,129,.25);
}
.dash-pill.live {
  color:#67e8f9;
  border-color:rgba(34,211,238,.45);
  box-shadow:0 0 10px rgba(96,165,250,.2);
}
.mt5-hb-list .why-not-item {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) repeat(4, minmax(90px, auto));
  gap: 8px;
  align-items: center;
}
.mt5-hb-list .why-not-item strong {
  margin-right: 6px;
}
#mt5-hb-tf-select {
  min-width: 78px;
}
#mt5-hb-tick-green,
#mt5-hb-tick-orange,
#mt5-hb-candle-green,
#mt5-hb-candle-orange {
  width: 108px;
  max-width: 108px;
}
#mt5-hb-threshold-status {
  margin-left: 4px;
}
.hb-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-muted);
}
.hb-chip.ok {
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--success);
}
.hb-chip.warn {
  border-color: rgba(245, 158, 11, 0.45);
  color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.16);
}
.hb-chip.bad {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.18);
}
@media (max-width: 980px) {
  .mt5-hb-list .why-not-item {
    grid-template-columns: 1fr 1fr;
  }
}
.dash-pill.stopped {
  color:var(--danger);
  border-color:rgba(239,68,68,.45);
}
.dashboard-chart {
  height:clamp(220px, 38vh, 290px);
  border:1px solid rgba(42,46,57,.95);
  border-radius:8px;
  background:linear-gradient(180deg, rgba(19,23,34,.92), rgba(19,23,34,.55));
  overflow:hidden;
  position:relative;
}
.dashboard-chart::after {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg, rgba(34,211,238,.0), rgba(34,211,238,.1), rgba(232,121,249,.06), rgba(34,211,238,.0));
  transform: translateY(-100%);
  animation: chart-scanline 4.5s linear infinite;
  pointer-events:none;
}
.dashboard-chart.event-pulse {
  box-shadow: 0 0 0 1px rgba(34,211,238,.4), 0 0 28px rgba(34,211,238,.22), inset 0 0 20px rgba(232,121,249,.08);
}
@keyframes chart-scanline {
  0% { transform: translateY(-100%); opacity:0; }
  8% { opacity:.55; }
  100% { transform: translateY(120%); opacity:0; }
}
@keyframes dash-sweep {
  0% { transform: translateX(-110%); opacity: .0; }
  30% { opacity: .55; }
  100% { transform: translateX(120%); opacity: 0; }
}
.dashboard-hero-mission .mission-gauges {
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
}
.dashboard-hero-grid .dashboard-hero-mission.mission-core {
  margin-bottom: 0;
}
.mission-core {
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(30,34,45,.88), rgba(19,23,34,.62));
  border: 1px solid rgba(42,46,57,.9);
  box-shadow: 0 0 24px rgba(34,211,238,.1), inset 0 0 28px rgba(232,121,249,.06);
}
.mission-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
  gap:12px;
}
.mission-sub {
  color: var(--text-muted);
  font-size: .78rem;
  letter-spacing: .35px;
}
.mission-gauges {
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:10px;
}
.mission-gauge {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:7px;
  padding:8px 4px;
  border:1px solid rgba(148,163,184,.2);
  border-radius:12px;
  background:rgba(10,14,24,.45);
}
.gauge-ring {
  --gauge-pct: 0%;
  --gauge-color: #3b82f6;
  width:78px;
  height:78px;
  border-radius:50%;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(circle at center, rgba(10,14,24,1) 54%, transparent 55%),
    conic-gradient(var(--gauge-color) var(--gauge-pct), rgba(71,85,105,.28) 0);
  box-shadow: 0 0 14px rgba(59,130,246,.25);
}
.gauge-value {
  font-size: .96rem;
  font-weight: 700;
  color: var(--text);
}
.gauge-label {
  font-size: .71rem;
  color: var(--text-muted);
  letter-spacing: .35px;
  text-transform: uppercase;
}

.risk-snapshot-card {
  margin-bottom: 14px;
  border: 1px solid rgba(251, 146, 60, 0.22);
  background: linear-gradient(165deg, rgba(28, 22, 18, 0.92), rgba(15, 18, 28, 0.9));
  box-shadow: 0 0 20px rgba(251, 146, 60, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.risk-snapshot-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.risk-snapshot-grid {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.risk-snapshot-gauge-col {
  display: flex;
  justify-content: center;
}
.commission-burn-gauge-wide {
  max-width: 200px;
  width: 100%;
  padding: 10px 8px 8px;
}
.gauge-ring-lg {
  width: 112px;
  height: 112px;
}
.gauge-ring-lg .gauge-value {
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  max-width: 96px;
}
.risk-snapshot-sub {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
}
.risk-snapshot-exposure {
  min-width: 0;
}
.risk-exposure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.risk-exposure-head strong {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.risk-family-buckets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.risk-family-buckets.hidden {
  display: none !important;
}
.risk-family-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(12, 18, 32, 0.65);
  min-width: 118px;
  max-width: 200px;
}
.risk-family-chip .rf-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7dd3fc;
}
.risk-family-chip .rf-stats {
  font-size: 0.76rem;
  color: var(--text-soft);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.risk-family-chip .rf-pnl-pos { color: #6ee7b7; }
.risk-family-chip .rf-pnl-neg { color: #fca5a5; }
.risk-exposure-body {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(10, 14, 24, 0.4);
  overflow: auto;
  max-height: 220px;
}
.risk-exposure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.risk-exposure-table th,
.risk-exposure-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.risk-exposure-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  background: rgba(15, 19, 30, 0.96);
  z-index: 1;
}
.risk-exposure-table th.num,
.risk-exposure-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.risk-exposure-table th.dim,
.risk-exposure-table td.dim {
  color: var(--text-dim);
}
.risk-exposure-empty {
  margin: 0;
  padding: 16px 12px;
  text-align: center;
  font-size: 0.82rem;
}
@media (max-width: 900px) {
  .risk-snapshot-grid {
    grid-template-columns: 1fr;
  }
  .risk-snapshot-gauge-col {
    justify-content: flex-start;
  }
}

.session-objectives-card {
  margin-bottom: 14px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  background: linear-gradient(160deg, rgba(15, 28, 24, 0.92), rgba(12, 18, 28, 0.9));
}
.session-obj-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.session-objectives-blurb {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.session-obj-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
@media (max-width: 720px) {
  .session-obj-bars {
    grid-template-columns: 1fr;
  }
}
.session-obj-bar-block {
  min-width: 0;
}
.session-obj-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.session-obj-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.session-obj-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.session-obj-track-floor {
  border-color: rgba(248, 113, 113, 0.25);
}
.session-obj-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 0.35s ease, background 0.25s ease;
}
.session-obj-fill-target {
  background: linear-gradient(90deg, #0d9488, #34d399);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.35);
}
.session-obj-fill-floor {
  background: linear-gradient(90deg, #b45309, #f87171);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.25);
}
.session-obj-fill-floor.session-obj-stress {
  background: linear-gradient(90deg, #dc2626, #fca5a5);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.45);
}
.session-obj-caption {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.session-obj-form {
  flex-wrap: wrap;
  margin-top: 4px;
}
.session-obj-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.session-obj-input {
  min-width: 100px;
  max-width: 140px;
}
.session-obj-enforce-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.session-obj-enforce-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.session-obj-enforce-label input {
  width: 16px;
  height: 16px;
  accent-color: #34d399;
}
.session-obj-block-sec {
  max-width: 88px;
}
.session-obj-enforce-hint {
  margin: 8px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
}

.news-vol-guard-card {
  margin-bottom: 14px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  background: linear-gradient(165deg, rgba(28, 22, 12, 0.92), rgba(14, 18, 28, 0.9));
}
.news-vol-guard-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.news-vol-guard-blurb {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.news-vol-guard-status-line {
  font-size: 0.74rem;
  margin-bottom: 10px;
  line-height: 1.4;
}
.news-vol-guard-form {
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 10px;
}
.news-vol-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 2px;
}
.news-vol-windows-ta {
  display: block;
  width: 100%;
  max-width: 520px;
  min-height: 88px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  resize: vertical;
  margin-top: 6px;
}

/* Drawdown cards */
.dd-card { position:relative; }
.dd-value { color:var(--danger); }
.dd-usd { display:block; font-size:.95rem; color:var(--danger); opacity:.85; margin-top:2px; }
.dd-peak { display:block; font-size:.78rem; color:var(--text-dim); margin-top:6px; }
.dd-date { font-size:.75rem; opacity:.7; }
.dd-reset-btns { display:flex; gap:6px; align-items:center; }
.btn-sm { font-size:.75rem; padding:4px 10px; }
.btn-ghost { background:transparent; border:1px solid var(--border); color:var(--text-dim); border-radius:6px; cursor:pointer; transition:all .15s; }
.btn-ghost:hover { border-color:var(--accent); color:var(--accent); }

/* ═══ Admin Console ═══════════════════════════════════════ */
.admin-login-form {
  max-width: 460px;
  display: grid;
  gap: 8px;
}
.admin-login-form .btn {
  margin-top: 8px;
  justify-content: center;
}
.admin-kpi-negative {
  color: var(--danger);
}
#admin-range-start,
#admin-range-end {
  max-width: 210px;
}
#admin-user-role {
  max-width: 160px;
}
#admin-current-password,
#admin-new-password {
  max-width: 320px;
}

/* ═══ Toast Notifications ════════════════════════════════ */
#toast-container {
  position:fixed; bottom:20px; right:20px; z-index:10000;
  display:flex; flex-direction:column; gap:8px;
}
.toast {
  padding:12px 20px; border-radius:var(--radius);
  font-size:.9rem; font-weight:500;
  box-shadow: var(--shadow);
  animation: slideIn .3s ease;
  max-width:360px;
}
.toast.success { background:rgba(16,185,129,.9); color:#fff; }
.toast.error   { background:rgba(239,68,68,.9); color:#fff; }
.toast.info    { background:rgba(59,130,246,.9); color:#fff; }
@keyframes slideIn { from{transform:translateX(40px);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes deck-sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ═══ Responsive ═════════════════════════════════════════ */
@media (max-width:900px) {
  #app { grid-template-columns:1fr; }
  #mobile-menu-toggle { display:flex; }
  #sidebar {
    position:fixed;
    left:0;
    top:0;
    width:min(280px, 84vw);
    height:100vh;
    z-index:1200;
    transform:translateX(-105%);
    transition:transform .24s ease;
  }
  body.mobile-sidebar-open #sidebar {
    transform:translateX(0);
  }
  #mobile-sidebar-backdrop {
    display:block;
    position:fixed;
    inset:0;
    background:rgba(2,6,23,.62);
    z-index:1100;
    opacity:0;
    pointer-events:none;
    transition:opacity .2s ease;
  }
  body.mobile-sidebar-open #mobile-sidebar-backdrop {
    opacity:1;
    pointer-events:auto;
  }
  .sidebar-logo span, .nav-item span, .nav-section { display:block; }
  .sidebar-tagline { display:none; }
  .sidebar-filter { padding:4px 8px 8px; }
  .filter-pill { font-size:.72rem; gap:6px; padding:5px 7px; }
  .filter-pill i { font-size:.8rem; }
  .filter-hidden-count { display:none !important; }
  .sidebar-logo { padding:0 12px 16px; justify-content:flex-start; }
  .sidebar-cp-hint { padding: 0 10px 8px; }
  .sidebar-cp-label { font-size: 0.68rem; }
  .nav-section { font-size:.62rem; letter-spacing:.08em; margin:8px 0 4px; }
  .nav-item { justify-content:flex-start; padding:10px 10px; gap:8px; }
  .nav-item span {
    font-size:.76rem;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .grid-2, .grid-3, .grid-4, .dashboard-grid, .dashboard-hero-grid { grid-template-columns:1fr; }
  .dashboard-hero-grid .dashboard-hero-exec,
  .dashboard-hero-grid .dashboard-hero-mission,
  .dashboard-hero-grid .dashboard-hero-profit {
    grid-column: 1;
    grid-row: auto;
  }
  .bot-review-filters { grid-template-columns:1fr 1fr; }
  .bot-review-details-grid { grid-template-columns:1fr; }
  .profit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mission-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-grid { grid-template-columns:repeat(2,1fr); }
  .command-deck { position:static; }
  .deck-sig { width:100%; justify-content:center; flex-wrap:wrap; }
  .deck-cp-mini { margin-left: 0; }
  .te-hub-nav { padding: 8px 10px; }
  .te-hub-scroll { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: thin; }
}

@media (max-width:600px) {
  #sidebar { width:min(250px, 88vw); }
  #mobile-menu-toggle { top:8px; left:8px; padding:7px 9px; }
  .nav-item { padding:9px 9px; }
  .nav-item span { font-size:.72rem; }
  .filter-pill { padding:4px 6px; font-size:.68rem; }
  #content { padding:12px; }
  .page-header { flex-direction:column; align-items:flex-start; gap:8px; }
  .controls-bar { flex-direction:column; align-items:stretch; }
  .status-pill { margin-left:0; justify-content:center; }
}

@media (max-width: 1024px) {
  .deck-pill { min-width: 96px; }
  .nexus-armed-pill { min-width: 0; }
  .deck-right,
  .deck-actions-primary,
  .deck-status-row,
  .deck-actions-danger { justify-content: flex-start; }
  .deck-right { min-width: 0; }
  .dd-reset-btns { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  .page-header { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .header-meta { display: flex; flex-wrap: wrap; gap: 8px; }
  .symbol-tag { margin-left: 0; margin-top: 6px; }
}

@media (max-width: 640px) {
  .profit-metrics, .mission-gauges, .analysis-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .loader-content { min-width: 0; width: min(100%, 320px); padding: 0 12px; }
  .loader-reactors { left: 10px; bottom: 10px; transform: scale(.82); transform-origin: left bottom; }
  .reactor-label { left: 2px; bottom: -24px; }
  .tf-bot-grid { grid-template-columns: 1fr; }
}

/* ═══ BOT Arena ═══════════════════════════════════════ */
.arena-top3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.arena-podium {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(160deg, rgba(20,26,38,.9), rgba(16,20,30,.92));
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
}
.arena-podium-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.arena-podium-skeleton {
  animation: none !important;
  border-style: dashed;
  opacity: 0.88;
  min-height: 96px;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(18,22,32,.75), rgba(14,18,28,.82));
}
.arena-podium-skeleton .te-skeleton-line {
  border-radius: 6px;
}
.arena-rank-badge {
  font-weight: 800;
  letter-spacing: .03rem;
}
.arena-rank-1 {
  border-color: rgba(245, 183, 35, .55);
  background: linear-gradient(150deg, rgba(80,58,18,.45), rgba(24,24,20,.92));
  animation: arenaGoldPulse 2.2s ease-in-out infinite;
}
.arena-rank-1 i { color: #f6c453; animation: arenaCrownGlow 1.7s ease-in-out infinite; }
.arena-rank-2 {
  border-color: rgba(148, 163, 184, .55);
  background: linear-gradient(150deg, rgba(51,62,78,.45), rgba(22,24,31,.92));
  animation: arenaSilverPulse 2.6s ease-in-out infinite;
}
.arena-rank-2 i { color: #cbd5e1; }
.arena-rank-3 {
  border-color: rgba(185, 103, 42, .55);
  background: linear-gradient(150deg, rgba(93,52,27,.45), rgba(24,21,20,.92));
  animation: arenaBronzeFloat 3.0s ease-in-out infinite;
}
.arena-rank-3 i { color: #d18a56; }
.arena-table tbody tr {
  transition: transform .18s ease, background .18s ease;
}
.arena-table tbody tr:hover {
  transform: translateX(3px);
  background: rgba(59,130,246,.07);
}
.arena-pnl-pos {
  color: #34d399;
  font-weight: 600;
}
.arena-pnl-neg {
  color: #f87171;
  font-weight: 600;
}
.arena-row-top {
  box-shadow: inset 3px 0 0 rgba(250, 204, 21, .65);
}
.arena-health-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.arena-health-low {
  color: #f87171;
}
.arena-quarantine-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(220, 38, 38, 0.22);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.arena-spark-cell {
  vertical-align: middle;
  padding: 4px 6px !important;
  min-width: 112px;
  max-width: 156px;
}
.arena-inline-spark {
  width: 100%;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(42, 46, 57, 0.85);
  background: rgba(8, 12, 22, 0.5);
}
.arena-inline-spark svg {
  display: block;
  width: 100%;
}
.arena-family-sparks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.arena-spark-card {
  border: 1px solid rgba(56,189,248,.24);
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(15,23,42,.72), rgba(2,6,23,.72));
  padding: 8px;
  display: grid;
  gap: 6px;
}
.arena-spark-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .73rem;
}
.arena-spark-head strong { color: #cfe8ff; letter-spacing: .03rem; }
.arena-spark-head span { color: var(--text-dim); }
.arena-spark-wrap {
  width: 100%;
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  border: 1px solid rgba(42, 46, 57, 0.95);
  background: #131722;
  /* Do not clip: CSS filter on inner SVG paths + overflow:hidden can blank the whole spark in Chrome/Edge */
  overflow: visible;
}
/* Row flex: basis was wrongly 48px wide — mount must span full chart width. */
.bot-spark-mount {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  height: 48px;
  display: block;
  line-height: 0;
  position: relative;
}
/* Ensure inline SVG paints full width (some flex layouts computed width late). */
.bot-spark-mount > svg.arena-spark-svg-tv {
  min-width: 100%;
  box-sizing: border-box;
}
.arena-spark-wrap-tv {
  border-color: rgba(41, 98, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(19, 23, 34, 0.9);
}
.arena-spark-svg { width: 100%; height: 100%; display: block; }
/* Avoid height:100% here — it fights explicit pixel height and can collapse the SVG */
.arena-spark-svg.arena-spark-svg-tv {
  width: 100% !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px;
  display: block;
  flex-shrink: 0;
  overflow: visible;
  background: #131722;
}
.arena-spark-chart-bg {
  fill: #131722;
}
.arena-spark-grid-tv {
  stroke: rgba(42, 46, 57, 0.85);
  stroke-width: 0.65;
  stroke-dasharray: 3 4;
  opacity: 0.9;
}
.arena-spark-area-tv {
  pointer-events: none;
}
.arena-spark-line-tv {
  pointer-events: none;
  stroke-width: 3px;
}
.arena-spark-line-tv.pos {
  stroke: #22d3ee;
}
.arena-spark-line-tv.neg {
  stroke: #f23645;
}
.bot-pl-spark-card .arena-spark-line-tv.pos {
  filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.45));
}
.bot-pl-spark-card .arena-spark-line-tv.neg {
  filter: drop-shadow(0 0 4px rgba(242, 54, 69, 0.4));
}

/* Sparkline draw + live glow (see animateTeSparkSvg in app.js) */
@keyframes te-spark-line-breathe-pos {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.42)); stroke-opacity: 1; }
  50% { filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.72)); stroke-opacity: 0.98; }
}
@keyframes te-spark-line-breathe-neg {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(242, 54, 69, 0.38)); stroke-opacity: 1; }
  50% { filter: drop-shadow(0 0 9px rgba(251, 113, 133, 0.62)); stroke-opacity: 0.98; }
}
.bot-pl-spark-card .arena-spark-line-tv.pos.arena-spark-line-animated {
  animation: te-spark-line-breathe-pos 2.6s ease-in-out infinite;
}
.bot-pl-spark-card .arena-spark-line-tv.neg.arena-spark-line-animated {
  animation: te-spark-line-breathe-neg 2.6s ease-in-out infinite;
}
.arena-spark-card .arena-spark-line-tv.pos.arena-spark-line-animated {
  animation: te-spark-line-breathe-pos 2.6s ease-in-out infinite;
}
.arena-spark-card .arena-spark-line-tv.neg.arena-spark-line-animated {
  animation: te-spark-line-breathe-neg 2.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .arena-spark-line-tv.arena-spark-line-animated {
    animation: none !important;
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
  }
  .arena-spark-area-tv {
    opacity: 1 !important;
    transition: none !important;
  }
}
/* Legacy polyline spark (fallback) */
.arena-spark-grid {
  stroke: rgba(125,211,252,.18);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
.arena-spark-line {
  fill: none;
  stroke: #22d3ee;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.45));
}
.arena-spark-line.neg { stroke: #f23645; filter: drop-shadow(0 0 4px rgba(242, 54, 69, 0.35)); }
.arena-spark-fill {
  fill: rgba(34, 211, 238, 0.18);
}
.arena-spark-fill.neg {
  fill: rgba(242, 54, 69, 0.14);
}
.bot-pl-spark-card {
  margin-bottom: 1rem;
}
.bot-pl-spark-card .arena-spark-wrap {
  min-height: 48px;
}
@keyframes arenaGoldPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(250,204,21,.20), var(--shadow); }
  50% { box-shadow: 0 0 22px rgba(250,204,21,.34), var(--shadow); }
}
@keyframes arenaCrownGlow {
  0%, 100% { text-shadow: 0 0 4px rgba(250,204,21,.45); transform: scale(1); }
  50% { text-shadow: 0 0 14px rgba(250,204,21,.8); transform: scale(1.08); }
}
@keyframes arenaSilverPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(148,163,184,.15), var(--shadow); }
  50% { box-shadow: 0 0 14px rgba(148,163,184,.32), var(--shadow); }
}
@keyframes arenaBronzeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@media (max-width: 980px) {
  .arena-top3 { grid-template-columns: 1fr; }
  .arena-family-sparks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .arena-family-sparks { grid-template-columns: 1fr; }
}

/* Bot families removed from sidebar; sections stay in DOM for grids/API */
.bot-family-hidden {
  display: none !important;
}
.nexus-families-advanced {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.35);
  width: 100%;
  box-sizing: border-box;
}
.nexus-families-advanced > summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-soft);
  user-select: none;
  list-style: none;
}
.nexus-families-advanced > summary::-webkit-details-marker {
  display: none;
}
.nexus-families-advanced-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
}

.external-eas-intro {
  margin-bottom: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-soft);
}
.external-eas-intro strong {
  color: var(--text-main, #e2e8f0);
}
.external-eas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.external-eas-card {
  margin: 0;
}
.external-eas-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.external-eas-card-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.external-eas-path code {
  font-size: 0.78rem;
  color: #7dd3fc;
  word-break: break-all;
}
.external-eas-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.4;
}
.external-eas-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  white-space: nowrap;
}
.external-eas-pill.hfbot {
  background: rgba(34, 211, 238, 0.22);
  color: #a5f3fc;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.15);
}
.external-eas-live {
  margin: 10px 0 6px;
  font-size: 0.88rem;
  color: #a5f3fc;
}
.external-eas-live.muted {
  color: var(--text-soft);
  opacity: 0.85;
}
.external-eas-live .text-pos { color: #6ee7b7; }
.external-eas-live .text-neg { color: #fca5a5; }
.external-eas-tickets {
  margin: 8px 0 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.35;
}
.external-eas-tickets li small {
  display: block;
  opacity: 0.85;
  word-break: break-word;
}
.external-eas-trunc {
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 4px;
}
.external-eas-unattrib {
  margin-top: 18px;
  border: 1px dashed rgba(248, 113, 113, 0.35);
}

/* HF Bot Jabbler — live wallet monitor (API: /api/monitor/jabbler_live) */
.jabbler-live-monitor {
  margin: 12px 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
}
.jabbler-live-monitor .jlm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}
.jabbler-live-monitor .jlm-stats {
  margin-top: 8px;
}
.jabbler-live-monitor .jlm-section-label {
  margin-top: 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.jabbler-live-monitor .jlm-open {
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 140px;
  overflow-y: auto;
  word-break: break-word;
  color: var(--text, #e5e7eb);
}
.jabbler-live-monitor .jlm-deals {
  margin-top: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
  word-break: break-word;
}

/* ── Executive summary + TF idle diagnostics (v2) ───────── */
.executive-summary-card {
  margin-bottom: var(--space-3);
  border: 1px solid rgba(96, 165, 250, 0.22);
  background: linear-gradient(165deg, rgba(24, 28, 40, 0.95), rgba(15, 23, 42, 0.88));
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}
.executive-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.executive-summary-head h3 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.executive-summary-body .exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
}
.executive-summary-body .exec-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.executive-summary-body .exec-costs {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
  font-size: 0.88rem;
}
.executive-summary-body .exec-note {
  margin-top: var(--space-2);
  font-size: 0.78rem;
  line-height: 1.45;
}
.tf-idle-reasons {
  margin: 6px 0 4px;
  font-size: 0.78rem;
}
.tf-idle-details summary {
  cursor: pointer;
  color: var(--text-muted);
  list-style: none;
}
.tf-idle-details summary::-webkit-details-marker { display: none; }
.tf-idle-list {
  margin: 6px 0 0 14px;
  padding: 0;
  color: var(--text-dim);
  line-height: 1.4;
}
.tf-idle-list li { margin-bottom: 4px; }

.deck-pill-sync strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.te-cp-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  pointer-events: none;
}
.te-cp-overlay:not(.hidden) {
  pointer-events: auto;
}
.te-cp-overlay.hidden {
  display: none !important;
}
.te-cp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 15, 0.72);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.te-cp-dialog {
  position: relative;
  width: min(520px, 100%);
  margin-top: 0;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.97), rgba(8, 15, 30, 0.94));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(34, 211, 238, 0.12);
  padding: 14px 16px 12px;
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.te-cp-dialog-narrow {
  width: min(420px, 100%);
}
.te-cp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.te-cp-title {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text, #e2e8f0);
}
.te-cp-kbd {
  font-size: 0.68rem;
  font-family: ui-monospace, monospace;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-dim);
}
.te-cp-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(10, 14, 24, 0.85);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.te-cp-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.15);
}
.te-cp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  max-height: 48vh;
}
.te-cp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--text-soft, #cbd5e1);
}
.te-cp-item i {
  width: 1.1rem;
  text-align: center;
  opacity: 0.88;
  color: #7dd3fc;
}
.te-cp-item span {
  flex: 1;
  font-size: 0.88rem;
}
.te-cp-item small {
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.85;
}
.te-cp-item:hover,
.te-cp-item.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.22);
}
.te-cp-item.active {
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.2);
}
.te-cp-empty {
  padding: 20px 10px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.te-cp-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.te-cp-hint kbd {
  font-size: 0.65rem;
  font-family: ui-monospace, monospace;
  padding: 2px 5px;
  margin: 0 1px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.5);
}
.te-sh-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.te-sh-list kbd {
  font-size: 0.68rem;
  font-family: ui-monospace, monospace;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  margin-right: 4px;
}
.te-sh-close-btn {
  align-self: flex-start;
}

@media (prefers-reduced-motion: reduce) {
  .page { animation: none !important; }
  body::before,
  body::after,
  .command-deck::before,
  .command-deck::after {
    animation: none !important;
  }
}
