/* ═══════════════════════════════════════════════════════════════════════════
   n-bot Design System — Minimalist Modern
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Token System ─────────────────────────────────────────────────────────── */
:root {
  /* Typography */
  --font-display: 'Calistoga', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Color — Light Theme */
  --background: #FAFAFA;
  --foreground: #0F172A;
  --muted: #F1F5F9;
  --muted-foreground: #64748B;
  --accent: #0052FF;
  --accent-secondary: #4D7CFF;
  --accent-foreground: #FFFFFF;
  --border: #E2E8F0;
  --card: #FFFFFF;
  --ring: #0052FF;

  /* Semantic Colors */
  --green: #10B981;
  --green-light: #34D399;
  --green-dim: rgba(16, 185, 129, 0.08);
  --red: #EF4444;
  --red-light: #F87171;
  --red-dim: rgba(239, 68, 68, 0.08);
  --amber: #F59E0B;
  --amber-light: #FBBF24;
  --amber-dim: rgba(245, 158, 11, 0.08);
  --blue: #0052FF;
  --blue-dim: rgba(0, 82, 255, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
  --shadow-accent: 0 4px 14px rgba(0, 82, 255, 0.25);
  --shadow-accent-lg: 0 8px 24px rgba(0, 82, 255, 0.35);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --duration-entrance: 700ms;

  /* Section padding */
  --section-py: clamp(4rem, 8vw, 7rem);
  --container-max: 72rem;
}

/* ── Legacy Variable Aliases ────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.625;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--accent-foreground);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  color: var(--foreground);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 6vw, 5.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.section-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.15;
  color: var(--foreground);
}

.card-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.body-text {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.625;
  color: var(--muted-foreground);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(to right, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Section Label Badges ─────────────────────────────────────────────────── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 1.125rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 82, 255, 0.25);
  background: rgba(0, 82, 255, 0.04);
  margin-bottom: 1.25rem;
}

.section-label-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.section-label-dot.pulsing {
  animation: pulse-dot 2s ease-in-out infinite;
}

.section-label-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 500;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(to right, var(--accent), var(--accent-secondary));
  color: var(--accent-foreground);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-accent);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background: var(--muted);
  border-color: rgba(0, 82, 255, 0.3);
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}

.btn-ghost:hover {
  color: var(--foreground);
  background: var(--muted);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  min-height: 36px;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.0625rem;
  min-height: 52px;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-arrow {
  transition: transform var(--duration-base) var(--ease-out);
}

.btn:hover .btn-arrow {
  transform: translateX(0.25rem);
}

.btn-danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
  transform: translateY(-0.125rem);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--duration-slow) var(--ease-out);
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-0.125rem);
}

.card-elevated {
  box-shadow: var(--shadow-lg);
}

.card-elevated:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-0.1875rem);
}

.card-gradient-border {
  position: relative;
  border-radius: var(--radius-xl);
  background: linear-gradient(to bottom right, var(--accent), var(--accent-secondary), var(--accent));
  padding: 2px;
}

.card-gradient-border > .card-inner {
  height: 100%;
  width: 100%;
  border-radius: calc(var(--radius-xl) - 2px);
  background: var(--card);
}

/* ── Inputs ───────────────────────────────────────────────────────────────── */
.input {
  height: 3rem;
  padding: 0 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: all var(--duration-base) var(--ease-out);
  outline: none;
  width: 100%;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.15);
}

.input::placeholder {
  color: var(--muted-foreground);
  opacity: 0.5;
}

.input-mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.input-sm {
  height: 2.5rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

/* ── Badges & Chips ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-accent {
  background: var(--blue-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 82, 255, 0.2);
}

.badge-green {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-red {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-amber {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.tier-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.tier-badge.S {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tier-badge.A {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tier-badge.B {
  background: rgba(0, 82, 255, 0.08);
  color: var(--accent);
  border: 1px solid rgba(0, 82, 255, 0.2);
}

.tier-badge.C {
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}

/* ── Connection Status ────────────────────────────────────────────────────── */
.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: all var(--duration-base) var(--ease-out);
  line-height: 1;
}

.conn-badge.live {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.conn-badge.offline {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.conn-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.conn-dot.live {
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.conn-dot.offline {
  background: var(--red);
}

.evt-badge {
  background: var(--amber-dim);
  color: var(--amber-light);
  gap: 0.25rem;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.evt-badge .conn-dot {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}
.evt-badge #ms-event-in {
  font-weight: 800;
  color: var(--amber);
}

/* ── Status Badge ─────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

.status-badge.live {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.disconnected {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Navigation ───────────────────────────────────────────────────────────── */
.terminal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  min-height: 3.5rem;
  position: sticky;
  top: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-logo {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--accent);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: var(--radius-sm);
  color: white;
}

.nav-links {
  display: flex;
  gap: 0.125rem;
  align-items: center;
}

.nav-links a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--foreground);
  background: var(--muted);
}

.nav-links a.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(0, 82, 255, 0.06);
}

.nav-metrics {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  flex-shrink: 1;
  scrollbar-width: none;
}

.nav-metrics::-webkit-scrollbar { display: none; }

.nav-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.75rem;
  gap: 0.0625rem;
  border-right: 1px solid var(--border);
  min-width: 3.5rem;
}

.nav-metric:last-child {
  border-right: none;
}

.nav-metric .m-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  line-height: 1;
}

.nav-metric .m-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.3;
}

.nav-metric .m-change {
  font-size: 0.5625rem;
  font-weight: 500;
  font-family: var(--font-mono);
  line-height: 1;
  color: var(--muted-foreground);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
  line-height: 1;
}

.nav-hamburger:hover {
  color: var(--foreground);
  border-color: var(--muted-foreground);
}

/* ── Dashboard Layout ─────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.25rem;
  flex: 1;
  min-height: 0;
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: stretch;
  flex-wrap: wrap;
}

.metric-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.chip-pnl { flex: 0 0 auto; }
.chip-sentiment { flex: 1; min-width: 0; gap: 0.25rem; flex-wrap: wrap; }
.chip-signal { flex: 1; min-width: 0; }
.chip-value-mono { font-family:var(--font-mono);font-size:0.8125rem;font-weight:800; }
.chip-label { font-size:0.5625rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:var(--muted-foreground); }
.tape-chip { font-size:0.5625rem;font-weight:700;padding:0.0625rem 0.375rem;border-radius:var(--radius-sm); }
.tape-chip.bullish { background:var(--green-dim);color:var(--green); }
.tape-chip.bearish { background:var(--red-dim);color:var(--red); }
.tape-chip.neutral { background:var(--blue-dim);color:var(--accent); }
.chip-gauge { width:2.5rem;height:0.25rem;background:var(--muted);border-radius:99px;overflow:hidden;display:inline-block;vertical-align:middle; }
.chip-gauge-fill { height:100%;border-radius:99px;transition:width 0.5s cubic-bezier(0.22,1,0.36,1); }

/* ── Metrics Bar (in body, not nav) ────────────────────────────────────────── */
.metrics-bar {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.metrics-bar::-webkit-scrollbar { display: none; }
.metrics-bar .nav-metric {
  flex: 1;
  min-width: 0;
  padding: 0.375rem 0.5rem;
  white-space: nowrap;
}
.metrics-bar .nav-metric .m-value { font-size: 0.8125rem; }
.metrics-bar .nav-metric .m-change { font-size: 0.5625rem; }

.main-panels {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.25rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-strategies, .panel-positions, .panel-chart, .panel-options {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Option Chain Table ──────────────────────────────────────────────────── */
.oc-table { width:100%; border-collapse:collapse; font-size:0.625rem; }
.oc-table th { position:sticky; top:0; background:var(--card); padding:0.25rem 0.375rem; text-align:right; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; color:var(--muted-foreground); border-bottom:1px solid var(--border); z-index:1; }
.oc-table th:first-child { text-align:center; }
.oc-table td { padding:0.2rem 0.375rem; text-align:right; font-family:var(--font-mono); font-size:0.625rem; border-bottom:1px solid var(--border); white-space:nowrap; }
.oc-table td:first-child { text-align:center; font-weight:800; color:var(--muted-foreground); }
.oc-table tr:hover td { background:var(--muted); }
.oc-strike-atm { background:rgba(0,82,255,0.04); }
.oc-strike-atm td:first-child { color:var(--accent); }
.oc-ce { color:var(--green); }
.oc-pe { color:var(--red); }
.oc-oi { color:var(--muted-foreground); font-size:0.5625rem; }
.oc-oi-change { font-size:0.5rem; }
.oc-oi-up { color:var(--green); }
.oc-oi-down { color:var(--red); }
.oc-wrapper { flex:1; overflow-y:auto; min-height:0; scrollbar-width:thin; }
.oc-wrapper::-webkit-scrollbar { width:3px; }
.oc-wrapper::-webkit-scrollbar-thumb { background:var(--border); border-radius:99px; }

/* ── P&L Hero ─────────────────────────────────────────────────────────────── */
.hero-pnl {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.75rem 1.25rem;
  box-shadow: var(--shadow-md);
}

.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.hero-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
}

.hero-refresh {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
}

.hero-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.hero-number {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 3.5rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.hero-number.positive {
  background: linear-gradient(to right, var(--green), var(--green-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-number.negative {
  background: linear-gradient(to right, var(--red), var(--red-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-stats-line {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0 0.25rem;
}

.hero-footnotes {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.3;
  margin-top: 0.375rem;
  flex-wrap: wrap;
}

.hero-footnote {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.hero-footnote .fn-label {
  color: var(--muted-foreground);
}

.hero-footnote .fn-val {
  font-weight: 600;
}

.hero-footnote .fn-best {
  color: var(--green);
}

.hero-footnote .fn-worst {
  color: var(--red);
}

/* Mini Progress Bar */
.mini-progress {
  width: 100%;
  height: 0.25rem;
  background: var(--muted);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.375rem;
}

.mini-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
}

/* ── Section Headers ──────────────────────────────────────────────────────── */
.section-hdr {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.section-hdr .section-pip {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}

.ml-auto {
  margin-left: auto;
}

.last-refresh {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  white-space: nowrap;
}

/* ── Tier Filter ──────────────────────────────────────────────────────────── */
.tier-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  flex-shrink: 0;
  overflow-x: auto;
}

.tier-filter-bar::-webkit-scrollbar { display: none; }

.tier-filter-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.125rem;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.tier-filter-count {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Ink-Slide Group */
.ink-slide-group {
  position: relative;
  display: inline-flex;
  gap: 0.125rem;
  padding: 0.1875rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.ink-slide-btn {
  position: relative;
  z-index: 2;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out);
}

.ink-slide-btn:hover {
  color: var(--foreground);
}

.ink-slide-btn.active {
  color: white;
}

.ink-slide-indicator {
  position: absolute;
  top: 0.1875rem;
  bottom: 0.1875rem;
  z-index: 1;
  background: linear-gradient(to right, var(--accent), var(--accent-secondary));
  border-radius: var(--radius-sm);
  transition: left 0.25s var(--ease-spring), width 0.25s var(--ease-spring);
  pointer-events: none;
}

/* ── Signal Grid ──────────────────────────────────────────────────────────── */
.signals-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ── Setup Tiles ──────────────────────────────────────────────────────────── */
.setup-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  min-height: 3rem;
}

.setup-tile:hover {
  border-color: var(--muted-foreground);
  box-shadow: var(--shadow-sm);
}

.setup-tile.signal-active {
  border-left: 3px solid var(--amber);
  background: linear-gradient(to right, var(--amber-dim), var(--card));
}

.setup-tile.signal-buy {
  border-left: 3px solid var(--green);
  background: linear-gradient(to right, var(--green-dim), var(--card));
}

.setup-tile.signal-sell {
  border-left: 3px solid var(--red);
  background: linear-gradient(to right, var(--red-dim), var(--card));
}

.tile-num {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  min-width: 1.75rem;
  flex-shrink: 0;
}

.tile-body {
  flex: 1;
  min-width: 0;
}

.tile-name {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
  font-family: var(--font-mono);
}

.tile-badges {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.ind-badge {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.ind-badge.vwap   { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; border: 1px solid rgba(139, 92, 246, 0.2); }
.ind-badge.ema    { background: rgba(0, 82, 255, 0.08); color: var(--accent); border: 1px solid rgba(0, 82, 255, 0.15); }
.ind-badge.bb     { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.15); }
.ind-badge.orb    { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.15); }
.ind-badge.pivot  { background: rgba(236, 72, 153, 0.1); color: #EC4899; border: 1px solid rgba(236, 72, 153, 0.15); }
.ind-badge.rsi    { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.15); }
.ind-badge.adx    { background: rgba(6, 182, 212, 0.1); color: #06B6D4; border: 1px solid rgba(6, 182, 212, 0.15); }
.ind-badge.atr    { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.15); }
.ind-badge.range7 { background: rgba(0, 82, 255, 0.06); color: var(--accent-secondary); border: 1px solid rgba(0, 82, 255, 0.15); }

.tile-signal {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  flex-shrink: 0;
  line-height: 1.4;
}

.tile-signal.scanning {
  color: var(--muted-foreground);
  background: var(--muted);
  border-color: var(--border);
}

.tile-signal.buy {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(16, 185, 129, 0.25);
}

.tile-signal.sell {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.25);
}

.tile-signal.active {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: rgba(245, 158, 11, 0.25);
}

/* ── Signal Detail ────────────────────────────────────────────────────────── */
.signal-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out), opacity 0.25s ease, padding 0.3s var(--ease-out);
  opacity: 0;
  padding: 0 1rem;
  margin-bottom: 0.25rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.signal-detail.open {
  max-height: 400px;
  opacity: 1;
  padding: 0.625rem 1rem;
}

.sd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

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

.sd-label {
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.6875rem;
}

.sd-val {
  color: var(--foreground);
  font-weight: 600;
}

.sd-check { color: var(--green); }
.sd-cross { color: var(--red); }

/* ── Category Labels ──────────────────────────────────────────────────────── */
.cat-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  padding: 0.5rem 0.375rem 0.25rem;
  margin-top: 0.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
}

/* ── Sentiment Panel ──────────────────────────────────────────────────────── */
.sentiment-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.panel-header h3 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  margin: 0;
}

.sentiment-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.625rem 0;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0;
}

.metric-label {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}

.gauge-bar {
  width: 100%;
  height: 0.375rem;
  background: var(--muted);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.25rem;
}

.gauge-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
  background: linear-gradient(to right, var(--accent), var(--accent-secondary));
}

.tape-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  text-align: center;
  border: 1px solid var(--border);
  transition: all var(--duration-base) var(--ease-out);
}

.tape-status.bullish {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.25);
}

.tape-status.bearish {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.25);
}

.tape-status.neutral {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.25);
}

/* ── Trades / Positions ───────────────────────────────────────────────────── */
.trades-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 1.25rem 1.5rem;
}

.trades-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.trade-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  transition: all var(--duration-fast) var(--ease-out);
  border-left: 3px solid var(--accent);
}

.trade-row:hover {
  border-color: var(--muted-foreground);
  box-shadow: var(--shadow-sm);
}

.trade-setup {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.125rem;
}

.trade-detail {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-weight: 500;
  line-height: 1.4;
}

.td-prem {
  font-weight: 700;
  color: var(--foreground);
}

.td-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.td-pct.text-positive {
  color: var(--green);
  background: var(--green-dim);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.td-pct.text-negative {
  color: var(--red);
  background: var(--red-dim);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.td-pnl-num {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1rem;
}

.td-pnl-num.text-positive { color: var(--green); }
.td-pnl-num.text-negative { color: var(--red); }

.exit-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.375rem 1rem;
  border: 1px solid var(--red);
  border-radius: var(--radius-md);
  background: var(--red-dim);
  color: var(--red);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  line-height: 1.2;
  white-space: nowrap;
}

.exit-btn:hover {
  background: var(--red);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.exit-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* SL/TP Inputs */
input[class^="usl-"], input[class^="utp-"] {
  width: 4.5rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  text-align: center;
  transition: border-color var(--duration-fast) var(--ease-out);
  outline: none;
}

input[class^="usl-"]:focus, input[class^="utp-"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}

.sl-tp-wrap {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.75rem;
}

/* ── Active Signal Banner ─────────────────────────────────────────────────── */
.active-signal-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-xl);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.active-banner-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.active-banner-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.active-banner-name {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--foreground);
}

.active-banner-side {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.active-banner-side.CE {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.active-banner-side.PE {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Empty & Error States ─────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--muted-foreground);
  gap: 0.5rem;
}

.empty-icon {
  opacity: 0.3;
}

.empty-text {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0.5rem;
}

.error-icon {
  font-size: 1.25rem;
  color: var(--red);
}

.error-text {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red);
}

.error-retry {
  margin-top: 0.25rem;
}

/* ── Skeleton Loading ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-tile {
  height: 3.25rem;
  margin-bottom: 0.25rem;
  background: linear-gradient(90deg, var(--muted) 25%, var(--border) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-lg);
}

/* ── Textures & Decorative Elements ────────────────────────────────────────── */
.dot-pattern {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
}

.radial-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(150px);
  pointer-events: none;
  opacity: 0.05;
}

.radial-glow.accent {
  background: var(--accent);
}

/* ── Keyframes ────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(1.75rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.4); }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.625rem); }
}

@keyframes float-reverse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(0.625rem); }
}

/* ── Animation Classes ────────────────────────────────────────────────────── */
.animate-in {
  animation: fadeIn 0.22s var(--ease-out) forwards;
}

.number-roll {
  animation: countUp 0.45s var(--ease-out) forwards;
  display: inline-block;
}

.loading-pulse {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes signalPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes signalPulseSell {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.setup-tile.signal-buy {
  animation: signalPulse 1.5s ease-out;
}

.setup-tile.signal-sell {
  animation: signalPulseSell 1.5s ease-out;
}

/* ── Data Tables ──────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  white-space: nowrap;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  color: var(--foreground);
  transition: background var(--duration-fast) var(--ease-out);
}

.data-table tr:hover td {
  background: rgba(0, 82, 255, 0.03);
}

.data-table .pnl-pos { color: var(--green) !important; font-weight: 700; }
.data-table .pnl-neg { color: var(--red) !important; font-weight: 700; }
.data-table .status-open { color: var(--amber); }
.data-table .status-closed { color: var(--muted-foreground); }

/* ── Stats Cards ──────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  flex-shrink: 0;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  text-align: center;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}

.stat-card:hover {
  border-color: var(--muted-foreground);
  box-shadow: var(--shadow-sm);
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.1;
}

.stat-lbl {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

.stat-card.total .stat-val { color: var(--accent); }
.stat-card.live  .stat-val { color: var(--green); }
.stat-card.paper .stat-val { color: var(--amber); }
.stat-card.active-sigs .stat-val { color: var(--accent-secondary); }

/* ── Utils ────────────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.flex-1      { flex: 1; }
.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.p-3 { padding: 0.75rem; } .p-4 { padding: 1rem; } .p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; }
.min-h-0 { min-height: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.hidden { display: none !important; }
.text-positive { color: var(--green) !important; }
.text-negative { color: var(--red) !important; }
.text-warning  { color: var(--amber) !important; }
.text-accent   { color: var(--accent) !important; }
.text-mono     { font-family: var(--font-mono); }
.text-muted    { color: var(--muted-foreground); }
.truncate  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* ── Back Link ────────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 0.25rem 0;
  margin-bottom: 0.5rem;
  transition: color var(--duration-fast) var(--ease-out);
}

.back-link:hover {
  color: var(--accent);
}

.back-link svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

/* ── Page Sections ────────────────────────────────────────────────────────── */
.page-section {
  padding: 1.5rem 2rem;
  margin-bottom: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.section-label-lg {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
  display: block;
}

/* ── Journal ──────────────────────────────────────────────────────────────── */
.journal-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.journal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.journal-filter-tabs {
  display: flex;
  gap: 0;
}

.jf-tab {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-family: var(--font-sans);
}

.jf-tab:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.jf-tab:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.jf-tab.active {
  background: linear-gradient(to right, var(--accent), var(--accent-secondary));
  color: white;
  border-color: transparent;
}

.jf-tab:hover:not(.active) {
  color: var(--foreground);
  border-color: var(--muted-foreground);
  background: var(--muted);
}

.journal-summary {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.j-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.0625rem;
}

.j-stat .j-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
}

.j-stat .j-lbl {
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}

.journal-table-wrap {
  overflow-x: auto;
}

.journal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.journal-pagination button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
}

.journal-pagination button:hover {
  background: var(--muted);
  color: var(--foreground);
}

.journal-pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

.journal-pagination span {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
}

/* ── Pill Filters ─────────────────────────────────────────────────────────── */
.pill-filter {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pill-filter-btn {
  padding: 0.375rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  letter-spacing: 0.04em;
}

.pill-filter-btn:hover {
  border-color: var(--muted-foreground);
  color: var(--foreground);
  background: var(--muted);
}

.pill-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Accessibility ────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@supports not selector(:focus-visible) {
  :focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 10000;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ── PIN Lock ─────────────────────────────────────────────────────────────── */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.pin-overlay.pin-unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pin-card {
  width: 340px;
  padding: 2.25rem 1.75rem 2rem;
  text-align: center;
  background: var(--card);
  border: 1px solid rgba(0, 82, 255, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-accent);
  animation: pinCardIn 0.45s var(--ease-spring) forwards;
}

@keyframes pinCardIn {
  from { opacity: 0; transform: translateY(1.5rem) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.pin-logo {
  width: 3.5rem;
  height: 3.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.5rem;
  color: white;
  margin: 0 auto 1rem;
  box-shadow: 0 0 24px rgba(0, 82, 255, 0.35);
}

.pin-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.pin-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 1.75rem;
  font-weight: 500;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 0.875rem;
  margin-bottom: 0.5rem;
}

.pin-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.2s var(--ease-spring);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 82, 255, 0.4);
  transform: scale(1.15);
}

.pin-dot.error {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.pin-dot.success {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.pin-error {
  font-size: 0.6875rem;
  color: var(--red);
  font-weight: 600;
  min-height: 1.25rem;
  margin-bottom: 1.25rem;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.2s;
}

.pin-error.visible {
  opacity: 1;
}

.pin-lockout {
  font-size: 0.6875rem;
  color: var(--amber);
  font-weight: 600;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.pin-key {
  height: 3.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-key:hover {
  background: rgba(0, 82, 255, 0.06);
  border-color: rgba(0, 82, 255, 0.3);
  color: var(--accent);
}

.pin-key:active {
  transform: scale(0.93);
}

.pin-key.pin-delete {
  font-size: 1rem;
  color: var(--muted-foreground);
}

.pin-key.pin-enter {
  font-size: 0.875rem;
  background: rgba(0, 82, 255, 0.06);
  border-color: rgba(0, 82, 255, 0.3);
  color: var(--accent);
}

.pin-key.pin-enter:hover {
  background: linear-gradient(to right, var(--accent), var(--accent-secondary));
  color: white;
  box-shadow: var(--shadow-accent);
}

.pin-key.pin-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-0.625rem); }
  30% { transform: translateX(0.625rem); }
  45% { transform: translateX(-0.5rem); }
  60% { transform: translateX(0.5rem); }
  75% { transform: translateX(-0.3125rem); }
  90% { transform: translateX(0.3125rem); }
}

.pin-card.shake {
  animation: pinShake 0.5s ease-in-out;
}

@keyframes pinSuccess {
  0% { transform: scale(1); }
  30% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.pin-card.success-anim {
  animation: pinSuccess 0.4s ease-out;
}

/* ── Stat Chip ────────────────────────────────────────────────────────────── */
.stat-chip {
  display: inline-flex;
  flex-direction: column;
  padding: 0.625rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat-chip-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--foreground);
  line-height: 1.1;
}

.stat-chip-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

/* ── Search / Select ──────────────────────────────────────────────────────── */
.search-input, .select-dropdown {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

.search-input:focus, .select-dropdown:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}

.select-dropdown {
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.75rem;
  padding-right: 2rem;
}

/* ── Inverted Section ─────────────────────────────────────────────────────── */
.section-inverted {
  background: var(--foreground);
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  overflow: hidden;
}

.section-inverted .section-headline {
  color: white;
}

.section-inverted .body-text {
  color: rgba(255, 255, 255, 0.7);
}

.section-inverted .section-label {
  border-color: rgba(0, 82, 255, 0.4);
  background: rgba(0, 82, 255, 0.1);
}

/* ── Editorial Table ──────────────────────────────────────────────────────── */
.editorial-table {
  width: 100%;
  border-collapse: collapse;
}

.editorial-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  padding: 0.625rem 0.875rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}

.editorial-table td {
  padding: 0.625rem 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
}

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

.editorial-table tr:hover td {
  background: rgba(0, 82, 255, 0.03);
}

/* ── Legacy Classes (Backward Compatibility) ──────────────────────────────── */
.btn-raised {
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}
.btn-raised:hover {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--muted-foreground);
}
.btn-control {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.375rem 0.75rem;
  letter-spacing: 0.05em;
}

.status-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; flex-shrink: 0; }
.dot-queue { background: var(--muted-foreground); }
.dot-backtest { background: var(--accent); }
.dot-paper { background: var(--amber); }
.dot-live { background: var(--green); }
.dot-drop { background: var(--red); }

.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; line-height: 1.4; }
.badge-buy { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-sell { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-spread { background: var(--blue-dim); color: var(--accent); border: 1px solid rgba(0, 82, 255, 0.25); }

.text-accent { color: var(--accent) !important; }
.text-warning { color: var(--amber) !important; }

.tracker-section { margin-bottom: 1rem; }

/* ── Loading Spinner ──────────────────────────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin-slow 0.65s linear infinite;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-panels {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .page-section {
    padding: 1rem 1.25rem;
  }
}

@media (max-width: 768px) {
  .terminal-nav {
    flex-wrap: wrap;
    padding: 0.625rem 1rem;
    gap: 0.375rem;
    min-height: auto;
  }

  .nav-brand {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.125rem;
    margin: 0.25rem 0 0;
    padding: 0.25rem;
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
  }

  .nav-links a {
    padding: 0.5rem 0.75rem;
  }

  .nav-links a.active {
    background: rgba(0, 82, 255, 0.06);
  }

  .nav-open .nav-links {
    display: flex;
  }

  .nav-open .nav-hamburger {
    color: var(--accent);
    border-color: var(--accent);
  }

  .nav-hamburger {
    display: block;
  }

  .nav-metrics {
    width: 100%;
  }

  .nav-metric {
    min-width: 20%;
    padding: 0.1875rem 0.375rem;
    flex: 1;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
    padding: 0.125rem 0;
  }

  .hide-mobile {
    display: none !important;
  }

  .dashboard-grid {
    gap: 0.375rem;
    padding: 0.5rem;
  }

  .top-bar {
    gap: 0.25rem;
  }

  .metric-chip {
    padding: 0.25rem 0.5rem;
  }

  .main-panels {
    gap: 0.5rem;
  }

  .metrics-bar .nav-metric {
    padding: 0.25rem 0.375rem;
  }

  .metrics-bar .nav-metric .m-value {
    font-size: 0.6875rem;
  }

  .hero-number {
    font-size: 2.5rem;
  }

  .hero-footnotes {
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
  }

  .hero-pnl {
    padding: 1rem 1.125rem 0.875rem;
  }

  .trade-row {
    flex-wrap: wrap;
    padding: 0.625rem;
  }

  .trade-row > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .journal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .journal-filter-tabs {
    overflow-x: auto;
  }

  .journal-summary {
    width: 100%;
    justify-content: space-between;
  }

  .j-stat {
    flex: 1;
    min-width: 3rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.6875rem !important;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
  }

  .stat-val {
    font-size: 1.25rem;
  }

  .active-signal-banner {
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .active-banner-name {
    font-size: 0.8125rem;
  }

  .setup-tile {
    min-height: 2.75rem;
    padding: 0.5rem 0.625rem;
  }

  .tile-name {
    font-size: 0.8125rem;
  }

  .tile-signal {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
  }

  .page-section {
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
  }

  .pin-card {
    width: 90vw;
    padding: 1.75rem 1.25rem 1.5rem;
  }
}
