/* ===================================================================
   polytrader-core.css — Consolidated Design System
   Crypto15min PolyTrader · Premium Dark Trading Terminal
   Purple/Blue gradient · Gold/Amber profit · Frosted glass
   Fraunces serif + IBM Plex Mono typography
   =================================================================== */


/* ===== 1. CSS VARIABLES ===== */

:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg: #05060a;
  --bg0: #070a14;
  --bg1: #0a1024;
  --bg2: #0b1535;
  --bg-sidebar: #080910;
  --bg-card: rgba(13, 22, 53, 0.55);
  --bg-card2: rgba(11, 18, 41, 0.80);
  --bg-elevated: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.05);

  /* Panel overlays */
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.085);

  /* Borders */
  --border: rgba(120, 155, 255, 0.18);
  --border2: rgba(167, 110, 255, 0.18);
  --border-hover: rgba(255, 255, 255, 0.15);
  --line: rgba(255, 255, 255, 0.10);

  /* Text */
  --text: rgba(245, 248, 255, 0.92);
  --text-secondary: rgba(245, 248, 255, 0.72);
  --text-tertiary: #8b949e;
  --muted: rgba(245, 248, 255, 0.62);

  /* Accent */
  --accent: #7c3aed;
  --accent2: #2563eb;
  --accent3: #22c55e;

  /* Semantic */
  --gold: #d7b25a;
  --mint: #3fb950;
  --red: #f85149;
  --warn: #f59e0b;

  /* Layout */
  --radius: 14px;
  --radius-sm: 8px;
  --topbar-height: 52px;
  --sidebar-w: 208px;

  /* Typography */
  --font-heading: 'Fraunces', ui-serif, Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --font-ui: 'IBM Plex Mono', ui-monospace, monospace;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Shadows */
  --shadow: 0 10px 45px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.36);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.25);
}


/* ===== 2. RESET & BASE ===== */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-heading);
  background:
    radial-gradient(1200px 700px at 12% 8%, rgba(124, 58, 237, 0.18), transparent 60%),
    radial-gradient(900px 650px at 80% 5%, rgba(37, 99, 235, 0.18), transparent 62%),
    radial-gradient(900px 650px at 60% 92%, rgba(34, 197, 94, 0.08), transparent 62%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 45%, var(--bg2));
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

::selection {
  background: rgba(124, 58, 237, 0.30);
  color: #fff;
}

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.10) transparent;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.20); }

/* Reduced motion (accessibility) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

/* Focus-visible (keyboard navigation) */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}


/* ===== 3. TYPOGRAPHY ===== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text);
  line-height: 1.3;
}

.mono, .text-mono { font-family: var(--font-mono); }

.up, .text-up, .text-profit { color: var(--mint); }
.down, .text-down, .text-loss { color: var(--red); }
.gold, .text-gold { color: var(--gold); }
.text-warning { color: var(--warn); }
.text-info { color: var(--accent2); }
.text-muted, .muted, .subtle, .hint { color: var(--muted); }
.danger { color: var(--red); }

.text-center { text-align: center; }
.text-right, .right { text-align: right; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.fw-600 { font-weight: 600; }
.ls-03 { letter-spacing: 0.3px; }
.truncate, .clip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clip { max-width: 260px; }
.nowrap { white-space: nowrap; }

.small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.small b { color: rgba(255, 255, 255, 0.82); }
.small ol, .small ul { margin: 6px 0; padding-left: 20px; }
.small li { margin-bottom: 4px; }
.small a { color: var(--gold); text-decoration: none; }
.small a:hover { text-decoration: underline; }

.fs-14 { font-size: 14px; }
.fs-11, .font-11 { font-size: 11px; }

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.caption {
  font-size: 0.7rem;
  color: var(--muted);
}


/* ===== 4. LAYOUT ===== */

/* Dashboard Layout (sidebar + main) */
.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background:
    radial-gradient(600px 500px at 20% 10%, rgba(124, 58, 237, 0.20), transparent 60%),
    radial-gradient(700px 600px at 60% 70%, rgba(37, 99, 235, 0.18), transparent 65%),
    rgba(6, 9, 20, 0.72);
  border-right: 1px solid rgba(120, 155, 255, 0.20);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.1rem;
}
.brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--gold), rgba(215, 178, 90, 0.6));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--bg);
  flex-shrink: 0;
}
.sidebar-brand h2 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #fff 20%, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-brand .version {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.4px;
}
.sidebar .brand-badge {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(13, 22, 53, 0.65);
  border: 1px solid rgba(120, 155, 255, 0.20);
  color: var(--text);
}

/* Sidebar sections */
.sidebar-section { margin-top: 0.1rem; }
.sidebar-section-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.35rem;
  padding-top: 0.4rem;
}
.sidebar-status {
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: var(--mono);
}

/* Mode switcher (sidebar variant) */
.mode-switcher {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  width: 100%;
}
.mode-switcher form.inline { display: inline; margin: 0; flex: 1; }
.mode-btn {
  padding: 5px 0;
  border-radius: 999px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.mode-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.mode-btn.active {
  color: var(--gold);
  background: rgba(215, 178, 90, 0.12);
  border-color: rgba(215, 178, 90, 0.30);
}
.mode-btn.active-live {
  color: var(--mint);
  background: rgba(63, 185, 80, 0.10);
  border-color: rgba(63, 185, 80, 0.28);
}
.mode-btn.active-paper {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Sidebar buttons */
.sidebar-btns {
  display: flex;
  gap: 0.35rem;
}
.sidebar-btns form.inline { display: inline; margin: 0; flex: 1; }
.btn-sidebar {
  padding: 5px 0;
  border-radius: var(--radius-sm);
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.30);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 600;
}
.btn-sidebar:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); border-color: rgba(255, 255, 255, 0.18); }
.btn-sidebar:active { transform: scale(0.96); }
.btn-sidebar.start { color: var(--mint); border-color: rgba(63, 185, 80, 0.25); }
.btn-sidebar.start:hover { background: rgba(63, 185, 80, 0.10); }
.btn-sidebar.stop { color: var(--red); border-color: rgba(248, 81, 73, 0.20); }
.btn-sidebar.stop:hover { background: rgba(248, 81, 73, 0.08); }

/* Sidebar form fields */
.config-field { margin-bottom: 0.4rem; }
.config-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.12rem;
  font-family: var(--mono);
}
.config-field input,
.config-field select {
  padding: 0.32rem 0.5rem;
  font-size: 0.76rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.config-field input:focus,
.config-field select:focus {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

/* Sidebar footer */
.sidebar-footer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: 0.5rem;
  padding-bottom: 0.2rem;
  border-top: 1px solid var(--line);
  background: var(--bg-sidebar);
  z-index: 2;
}
.sidebar-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}
.sidebar-version {
  font-size: 11px;
  color: var(--muted);
}
.btn-check-update {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-check-update:hover {
  color: var(--mint);
  border-color: rgba(63, 185, 80, 0.3);
  background: rgba(63, 185, 80, 0.08);
}
.btn-check-update:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
a.logout-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  display: block;
  text-align: center;
  padding: 5px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
a.logout-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

/* Update banner */
.update-banner {
  background: rgba(63, 185, 80, 0.08);
  border: 1px solid rgba(63, 185, 80, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.5rem;
}
.update-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.update-icon {
  font-size: 1.1rem;
  color: var(--mint);
  animation: updatePulse 2s ease-in-out infinite;
}
.update-text strong {
  display: block;
  font-size: 0.8rem;
  color: var(--mint);
}
.btn-update {
  width: 100%;
  padding: 6px 10px;
  background: rgba(63, 185, 80, 0.15);
  color: var(--mint);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
.btn-update:hover {
  background: rgba(63, 185, 80, 0.25);
  border-color: rgba(63, 185, 80, 0.5);
}
.btn-update:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.update-progress { margin-top: 0.4rem; }
.update-progress-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.update-progress-fill {
  height: 100%;
  background: var(--mint);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

/* Ribbon */
.bot-ribbon {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(120, 155, 255, 0.20);
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22), rgba(37, 99, 235, 0.16) 45%, rgba(0, 0, 0, 0));
  backdrop-filter: blur(10px);
}
.bot-ribbon .pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-weight: 800;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.65), rgba(37, 99, 235, 0.55));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 40px rgba(124, 58, 237, 0.18);
}
.bot-ribbon .sub {
  color: rgba(245, 248, 255, 0.70);
  font-size: 12.5px;
}

/* Top bar (legacy) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand .icon { font-size: 1.4rem; }
.topbar-brand .name { font-weight: 600; font-size: 1rem; }
.topbar-brand .subtitle { color: var(--text-secondary); font-size: 0.8rem; }
.topbar-center { color: var(--text-secondary); font-size: 0.8rem; }
.topbar-center a { color: var(--text-tertiary); }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; }

/* Main content area */
.main-content {
  padding: 1.3rem 1.6rem;
  overflow-y: auto;
  width: 100%;
  max-width: 1180px;
}

/* Breadcrumbs / section dividers */
.section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1.2rem 0 0.8rem;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Centered page (login, setup) */
.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 70px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.2px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 20%, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand .sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* Login page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.login-box h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-box .subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 24px; }

/* Setup page */
.setup-container {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 20px;
}
.setup-container h1 { font-size: 1.3rem; margin-bottom: 4px; }
.setup-container .subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 24px; }

.setup-section { margin-bottom: 4px; }
.setup-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}
.setup-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  font-family: var(--mono);
}
.setup-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.7;
  margin-bottom: 12px;
}
.setup-text b { color: rgba(255, 255, 255, 0.85); }
.setup-text a { color: var(--gold); text-decoration: none; }
.setup-text a:hover { text-decoration: underline; }
.setup-text ol, .setup-text ul { margin: 8px 0; padding-left: 22px; }
.setup-text li { margin-bottom: 5px; }

/* Step bar (setup wizard) */
.step-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 18px;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}


/* ===== 5. CARDS & PANELS ===== */

.card {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(120, 155, 255, 0.14);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: visible;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.85), rgba(37, 99, 235, 0.75), rgba(34, 197, 94, 0.45));
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  pointer-events: none;
}
.card:hover {
  border-color: var(--border-hover);
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }

.card .hd {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.12);
}
.card .hd h2 {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.2px;
  font-weight: 700;
}
.card .hd .hd-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.card .bd { padding: 16px; }

.card-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* KPI grid */
.kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 0;
}
.kpi-card .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.kpi-card .value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-card .subtext {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.value.profit { color: var(--mint); }
.value.loss { color: var(--red); }

/* Metric cards */
.metric {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.metric:hover { border-color: rgba(255, 255, 255, 0.14); background: rgba(0, 0, 0, 0.14); }
.metric.full { grid-column: 1 / -1; }
.metric .label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.metric .value { font-size: 22px; margin-top: 5px; line-height: 1.1; }

/* Metrics row (performance tab) */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.metric-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.metric-card .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.metric-card .value {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
}
.metric-card .caption {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}
.metric-card .delta { font-size: 0.75rem; margin-top: 2px; }
.delta-positive { color: var(--mint); }
.delta-negative { color: var(--red); }

/* P/L Cards */
.pnl-cards { gap: 10px; }
.pnl-card {
  position: relative;
  overflow: hidden;
  padding: 14px 14px 12px;
}
.pnl-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
  background: rgba(255, 255, 255, 0.08);
}
.pnl-card-pos::before { background: linear-gradient(90deg, rgba(52, 199, 89, 0.7), rgba(52, 199, 89, 0.3)); }
.pnl-card-neg::before { background: linear-gradient(90deg, rgba(255, 69, 58, 0.7), rgba(255, 69, 58, 0.3)); }
.pnl-card-pos { border-color: rgba(52, 199, 89, 0.2); background: rgba(52, 199, 89, 0.04); }
.pnl-card-neg { border-color: rgba(255, 69, 58, 0.2); background: rgba(255, 69, 58, 0.04); }
.pnl-card-pos:hover { border-color: rgba(52, 199, 89, 0.35); background: rgba(52, 199, 89, 0.07); }
.pnl-card-neg:hover { border-color: rgba(255, 69, 58, 0.35); background: rgba(255, 69, 58, 0.07); }
.pnl-card .value { font-size: 24px; font-weight: 700; }

/* Dual section stacking */
.dual-section { margin-bottom: 1.4rem; }
.dual-section:last-child { margin-bottom: 0; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}
.empty-state .icon { font-size: 2rem; margin-bottom: 8px; }
.empty-state .message { font-size: 0.85rem; }

/* Status block empty states */
.status-block { text-align: center; padding: 24px 0; }
.status-icon { font-size: 36px; line-height: 1; }
.status-msg { margin-top: 10px; }


/* ===== 6. BUTTONS ===== */

button {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(120, 155, 255, 0.22);
  background: rgba(13, 22, 53, 0.55);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
  font-weight: 600;
}
button:hover {
  border-color: rgba(124, 58, 237, 0.40);
  box-shadow: 0 10px 35px rgba(124, 58, 237, 0.16);
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(120, 155, 255, 0.22);
  background: rgba(13, 22, 53, 0.55);
  color: var(--text);
  transition: all 0.15s;
  font-family: var(--font-ui);
  text-decoration: none;
}
.btn:hover {
  border-color: rgba(124, 58, 237, 0.40);
  box-shadow: 0 10px 35px rgba(124, 58, 237, 0.16);
  color: var(--text);
  text-decoration: none;
}

.btn-primary {
  border-color: rgba(124, 58, 237, 0.55);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.65), rgba(37, 99, 235, 0.55));
  color: #fff;
}
.btn-primary:hover {
  box-shadow: 0 10px 40px rgba(124, 58, 237, 0.25);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.35);
  color: var(--red);
}
.btn-danger:hover {
  background: rgba(248, 81, 73, 0.2);
  border-color: rgba(248, 81, 73, 0.5);
}

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-save {
  padding: 0.45rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(215, 178, 90, 0.3);
  background: linear-gradient(180deg, rgba(215, 178, 90, 0.15), rgba(215, 178, 90, 0.05));
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-save:hover {
  background: linear-gradient(180deg, rgba(215, 178, 90, 0.25), rgba(215, 178, 90, 0.12));
  border-color: rgba(215, 178, 90, 0.5);
}

.btn-save-sidebar {
  width: 100%;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(215, 178, 90, 0.22);
  background: linear-gradient(180deg, rgba(215, 178, 90, 0.14), rgba(215, 178, 90, 0.05));
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
  margin-top: 0.4rem;
}
.btn-save-sidebar:hover {
  background: linear-gradient(180deg, rgba(215, 178, 90, 0.24), rgba(215, 178, 90, 0.10));
  border-color: rgba(215, 178, 90, 0.38);
}

.btn-danger-sm {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 81, 73, 0.25);
  background: rgba(248, 81, 73, 0.08);
  color: var(--red);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.btn-danger-sm:hover {
  background: rgba(248, 81, 73, 0.16);
  border-color: rgba(248, 81, 73, 0.40);
}

.btn-secondary-sm {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.80);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary-sm:hover {
  border-color: rgba(215, 178, 90, 0.30);
  background: rgba(215, 178, 90, 0.06);
  color: var(--text);
}


/* ===== 7. FORMS & INPUTS ===== */

form { display: grid; gap: 10px; }
form.inline { display: inline; margin: 0; gap: 0; }
form.form-tight { gap: 0; }
form.form-compact { gap: 8px; }

input, select, textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(120, 155, 255, 0.18);
  background: rgba(6, 9, 20, 0.45);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(124, 58, 237, 0.50);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.20);
}
input::placeholder { color: rgba(255, 255, 255, 0.22); }

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: 8px;
}

.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 2px; }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.60);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: var(--mono);
  margin-bottom: -4px;
  margin-top: 4px;
}
.field-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: -4px;
}

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
}
.toggle-wrap .toggle-label {
  font-size: 0.76rem;
  color: var(--muted);
  font-family: var(--mono);
}
.toggle {
  position: relative;
  width: 34px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  transition: 0.2s;
}
.toggle .slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  bottom: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .slider { background: var(--gold); }
.toggle input:checked + .slider::before { transform: translateX(16px); background: #fff; }

/* Range row */
.range-row { display: flex; gap: 8px; align-items: center; }
.range-row .range { flex: 1; }
.range-row .range-num { width: 72px; }

/* Row checkbox */
.row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }

/* Settings view filters */
html[data-settings-view="basic"] .settings-advanced,
html[data-settings-view="basic"] .settings-expert {
  display: none;
}
html[data-settings-view="advanced"] .settings-expert {
  display: none;
}

.settings-view-row { display: grid; gap: 8px; }
.settings-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}
.settings-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.settings-toggle-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(9, 16, 36, 0.72);
}
.settings-toggle-card label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text);
}


/* ===== 8. TABLES ===== */

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.data-table tr:hover { background: var(--bg-elevated); }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.table-scroll table { min-width: 580px; }

.ops-scroll {
  max-height: 520px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.18);
}


/* ===== 9. TABS ===== */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.2rem;
  overflow-x: auto;
}
.tab-bar a, .tab-bar button {
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  cursor: pointer;
  font-family: var(--font-ui);
}
.tab-bar a:hover, .tab-bar button:hover { color: var(--text); text-decoration: none; }
.tab-bar a.active, .tab-bar button.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 700;
}

.tab-btn {
  padding: 0.6rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: var(--font-heading);
}
.tab-btn:hover { color: rgba(255, 255, 255, 0.78); }
.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: 700;
}

.tab-content { padding: 16px; max-width: 1400px; margin: 0 auto; }
.tab-panel { display: none; animation: fadeTab 0.2s ease; }
.tab-panel.active { display: block; }


/* ===== 10. BADGES & TAGS ===== */

.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-live { background: rgba(63, 185, 80, 0.15); color: var(--mint); }
.badge-dry { background: rgba(215, 178, 90, 0.15); color: var(--gold); }
.badge-paper { background: rgba(120, 155, 255, 0.15); color: var(--accent2); }
.badge-polymarket { background: rgba(120, 155, 255, 0.15); color: var(--accent2); }

.mode-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  vertical-align: middle;
  margin-left: 4px;
}
.mode-badge.paper { color: var(--muted); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); }
.mode-badge.dry { color: var(--gold); background: rgba(215, 178, 90, 0.10); border: 1px solid rgba(215, 178, 90, 0.22); }
.mode-badge.live { color: var(--mint); background: rgba(63, 185, 80, 0.10); border: 1px solid rgba(63, 185, 80, 0.22); }

/* Status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.status-dot.connected { background: var(--mint); box-shadow: 0 0 4px var(--mint); }
.status-dot.disconnected { background: var(--red); }

.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.live-dot.on { background: var(--mint); box-shadow: 0 0 6px var(--mint); animation: pulse-dot 2s infinite; }
.live-dot.off { background: var(--muted); }

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.20);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}
.tag.live { color: var(--mint); border-color: rgba(63, 185, 80, 0.30); background: rgba(63, 185, 80, 0.08); }
.tag.warn { color: var(--gold); border-color: rgba(215, 178, 90, 0.30); background: rgba(215, 178, 90, 0.06); }
.tag.off { color: var(--muted); }
.tag-sm { font-size: 11px; }
.tag-xs { padding: 2px 6px; }

.paused-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.25);
  background: rgba(248, 81, 73, 0.08);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

/* Tier badges */
.tier-badge {
  font-size: 0.58rem;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  font-family: var(--mono);
}
.tier-badge.basic { background: rgba(63, 185, 80, 0.10); color: rgba(63, 185, 80, 0.7); }
.tier-badge.advanced { background: rgba(215, 178, 90, 0.10); color: rgba(215, 178, 90, 0.7); }
.tier-badge.expert { background: rgba(248, 81, 73, 0.10); color: rgba(248, 81, 73, 0.7); }

/* Fill probability badge (Liquidity Heat) */
.fill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid rgba(120, 155, 255, 0.18);
  background: rgba(6, 9, 20, 0.35);
  color: var(--text);
}
.fill-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.75);
  box-shadow: 0 0 12px rgba(148, 163, 184, 0.25);
}
.fill-good { border-color: rgba(34, 197, 94, 0.40); background: rgba(34, 197, 94, 0.10); }
.fill-good::before { background: rgba(34, 197, 94, 0.95); box-shadow: 0 0 14px rgba(34, 197, 94, 0.35); }
.fill-warn { border-color: rgba(245, 158, 11, 0.40); background: rgba(245, 158, 11, 0.10); }
.fill-warn::before { background: rgba(245, 158, 11, 0.95); box-shadow: 0 0 14px rgba(245, 158, 11, 0.30); }
.fill-bad { border-color: rgba(239, 68, 68, 0.40); background: rgba(239, 68, 68, 0.10); }
.fill-bad::before { background: rgba(239, 68, 68, 0.95); box-shadow: 0 0 14px rgba(239, 68, 68, 0.30); }
.fill-unk { opacity: 0.85; }

/* Notices */
.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.22);
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
}
.notice b { color: rgba(255, 255, 255, 0.88); }
.notice a { color: var(--gold); text-decoration: none; }
.notice a:hover { text-decoration: underline; }
.notice.warn {
  border-color: rgba(215, 178, 90, 0.24);
  background: rgba(215, 178, 90, 0.06);
}
.notice.danger {
  border-color: rgba(248, 81, 73, 0.22);
  background: rgba(248, 81, 73, 0.06);
}
.notice .badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted);
}
.notice.danger .badge { color: var(--red); border-color: rgba(248, 81, 73, 0.28); background: rgba(248, 81, 73, 0.06); }
.notice.warn .badge { color: var(--gold); border-color: rgba(215, 178, 90, 0.30); background: rgba(215, 178, 90, 0.06); }

.danger-box {
  background: rgba(248, 81, 73, 0.06);
  border: 1px solid rgba(248, 81, 73, 0.18);
  border-radius: 10px;
  padding: 14px 16px;
}
.danger-box b { color: var(--red); }

/* Symbol switcher */
.symbol-switcher { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sym-btn {
  padding: 5px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--mono);
  letter-spacing: 0.05em;
  transition: all 0.15s ease;
}
.sym-btn:hover { border-color: rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.85); }
.sym-btn.active {
  background: rgba(215, 178, 90, 0.22);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(215, 178, 90, 0.35);
}


/* ===== 11. SIGNAL & TRADING ===== */

/* Signal hero display */
.signal-hero {
  text-align: center;
  padding: 10px 0 16px;
}
.signal-dir { font-size: 52px; font-weight: 700; line-height: 1; }
.signal-dir-sm { font-size: 42px; font-weight: 700; line-height: 1; }
.signal-sub { margin-top: 10px; }
.signal-slug { margin-top: 4px; font-size: 11px; letter-spacing: 0.3px; }
.signal-sym { text-align: center; padding: 20px 14px; }
.signal-sym .label { margin-bottom: 6px; }

.signal-direction { font-size: 2rem; font-weight: 700; font-family: var(--font-mono); }
.signal-direction.buy { color: var(--mint); }
.signal-direction.sell { color: var(--red); }
.signal-direction.hold { color: var(--text-tertiary); }
.signal-confidence {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent);
}

/* Live trading panel */
.window-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.window-row-right { text-align: right; }
.countdown-big { font-size: 28px; margin-top: 2px; }
.progress-track { margin-top: 10px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--mint), var(--gold)); border-radius: 3px; transition: width 1s linear; }
.trade-zone-label { margin-top: 8px; }
.section-gap { margin-bottom: 14px; }

/* Scoring bars */
.scoring-card { padding: 0.5rem 0; }
.scoring-bars { padding: 0 1rem; }
.scoring-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px 50px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.7rem;
}
.scoring-label {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.scoring-bar-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.scoring-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.scoring-bar-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--muted);
  opacity: 0.4;
}
.scoring-value {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.7rem;
}
.scoring-weight {
  color: var(--muted);
  font-size: 0.6rem;
}
.scoring-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}
.scoring-direction { font-size: 1rem; font-weight: 700; }
.scoring-conf { font-family: var(--mono); font-size: 0.8rem; color: var(--gold); }
.scoring-dominant { font-size: 0.7rem; color: var(--muted); }

/* Gate rows */
.gates-list { padding: 0 1rem; }
.gate-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.gate-row:last-child { border-bottom: none; }
.gate-icon { font-size: 0.75rem; text-align: center; }
.gate-pass .gate-icon { color: var(--mint); }
.gate-fail .gate-icon { color: var(--red); }
.gate-name { color: var(--text); }
.gate-value {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
}
.gate-threshold {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.6;
}

/* Maker order timeline */
.maker-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 1rem;
  overflow-x: auto;
}
.maker-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  min-width: 80px;
}
.maker-step::after {
  content: '';
  position: absolute;
  top: 8px;
  left: calc(50% + 10px);
  right: calc(-50% + 10px);
  height: 2px;
  background: var(--line);
}
.maker-step:last-child::after { display: none; }
.maker-step.done::after { background: var(--mint); }
.maker-step.active::after {
  background: linear-gradient(90deg, var(--mint), var(--line));
}
.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--line);
  border: 2px solid var(--line);
  z-index: 1;
  margin-bottom: 0.5rem;
}
.maker-step.done .step-dot {
  background: var(--mint);
  border-color: var(--mint);
}
.maker-step.active .step-dot {
  background: transparent;
  border-color: var(--gold);
  animation: pulse-maker-dot 1.5s infinite;
}
.step-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
}
.maker-step.done .step-label,
.maker-step.active .step-label { color: var(--text); }
.step-value {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--gold);
  margin-top: 2px;
}
.maker-details {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.7rem;
  color: var(--muted);
}
.maker-details strong { color: var(--text); }

/* Liquidity Heat (Market Quality) widget */
.mq-heat-wrap {
  margin-top: 14px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.mq-heat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mq-heat-title { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: 0.02em; }
.mq-heat-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.78);
}
.mq-meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  margin-top: 10px;
}
.mq-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 280ms ease, filter 280ms ease;
  background: linear-gradient(90deg, rgba(255, 59, 48, 0.95), rgba(255, 204, 0, 0.95), rgba(52, 199, 89, 0.95));
  filter: saturate(1.1);
}
.mq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.mq-kv {
  padding: 10px 10px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.mq-kv .k { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.mq-kv .v { margin-top: 4px; font-size: 14px; font-weight: 650; color: rgba(255, 255, 255, 0.86); }
.mq-hint { margin-top: 10px; font-size: 12px; color: rgba(255, 255, 255, 0.60); display: flex; gap: 10px; align-items: flex-start; }
.mq-dot { width: 8px; height: 8px; border-radius: 999px; margin-top: 4px; background: rgba(255, 255, 255, 0.25); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05); }
.mq-dot.good { background: rgba(52, 199, 89, 0.95); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.14); }
.mq-dot.mid { background: rgba(255, 204, 0, 0.95); box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.14); }
.mq-dot.bad { background: rgba(255, 59, 48, 0.95); box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.14); }

/* Learning phase indicator */
.learning-phase-bar {
  margin-top: 14px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: rgba(255, 204, 0, 0.05);
  border: 1px solid rgba(255, 204, 0, 0.15);
}
.learning-phase-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.learning-phase-title { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: 0.02em; font-size: 13px; }
.lp-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 204, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
  transition: background 0.4s, box-shadow 0.4s;
}
.lp-dot.active {
  background: rgba(255, 204, 0, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.20);
  animation: lp-pulse 1.8s ease-in-out infinite;
}
.lp-dot.idle { background: rgba(52, 199, 89, 0.95); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.15); }
.lp-track { height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.06); margin-top: 8px; }
.lp-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 1s linear;
  background: linear-gradient(90deg, rgba(255, 204, 0, 0.7), rgba(255, 204, 0, 1));
}


/* ===== 12. SETTINGS ===== */

/* Collapsible sections */
.collapse-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  background: var(--bg-card);
  user-select: none;
}
.collapse-header:hover { background: var(--bg-elevated); }
.collapse-header .arrow { transition: transform 0.2s; font-size: 0.7rem; }
.collapse-section.open .collapse-header .arrow { transform: rotate(90deg); }
.collapse-body {
  padding: 12px 16px;
  display: none;
  background: var(--bg-card);
}
.collapse-section.open .collapse-body { display: block; }

/* Sub-section headers inside collapse bodies */
.collapse-body h4 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--border);
}
.collapse-body h4:not(:first-child) { margin-top: 20px; }

.settings-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* Settings card accordion */
.settings-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: background 0.2s ease;
}
.settings-card::before { display: none; }
.settings-card:last-of-type { border-bottom: none; }
.settings-card:hover {
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
}
.settings-card-header {
  display: flex;
  align-items: center;
  padding: 0.9rem 1rem;
  cursor: pointer;
  user-select: none;
  gap: 0.6rem;
}
.settings-card-header h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.settings-card-header .chevron {
  transition: transform 0.25s ease;
  color: var(--muted);
  font-size: 0.65rem;
  opacity: 0.5;
}
.settings-card.open .chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}
.settings-card-header .section-hint {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--mono);
  opacity: 0.7;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-card.open .settings-card-header .section-hint { display: none; }
.settings-card-body {
  display: none;
  padding: 0 1rem 1rem 1rem;
}
.settings-card.open .settings-card-body { display: block; }

/* Settings grid layout */
.settings-grid {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-header-bar .sh-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.settings-save-row {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Field rows */
.field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.field-row + .field-row {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.field-row > label:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  flex: 1;
  font-size: 0.76rem;
  color: var(--text);
}
.field-row > label.toggle { flex: none; }
.field-row input[type="text"],
.field-row input:not([type]),
.field-row select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.76rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  align-self: center;
}
.field-row input:focus,
.field-row select:focus {
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
}

.field-desc {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.4;
  margin-top: -0.15rem;
  opacity: 0.8;
}

/* Hide help tip in Settings tab (replaced by inline desc) */
#tab-settings .help-tip { display: none; }


/* ===== 13. CHARTS ===== */

.chart-container { width: 100%; height: 350px; position: relative; }
.chart-container-sm { width: 100%; height: 200px; position: relative; }
.chartBox {
  height: 180px;
  max-height: 180px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.20);
  padding: 10px;
}
.chartBox canvas { width: 100%; height: 100%; display: block; }
.chartBox.h240 { height: 240px; max-height: 240px; }
.chartBox.h300 { height: 300px; max-height: 300px; }

/* uPlot overrides */
.u-wrap { position: relative; }
.u-over { cursor: crosshair; }


/* ===== 14. HELP & ONBOARDING ===== */

/* Help system - inline descriptions */
.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.55rem;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.help-tip:hover {
  background: rgba(215, 178, 90, 0.2);
  color: var(--gold);
  opacity: 1;
}
.help-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #1a1c24;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.help-tip:hover .help-popup,
.help-tip.active .help-popup {
  display: block;
  pointer-events: auto;
}
.help-popup-title {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
  display: block;
}
.help-popup-short {
  font-size: 0.7rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  display: block;
}
.help-popup-detail {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.5;
  display: block;
}

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.heatmap-cell {
  text-align: center;
  padding: 6px;
  border-radius: 4px;
}
.heatmap-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
}
.heatmap-value {
  font-size: 0.75rem;
}
.heatmap-detail {
  font-size: 0.6rem;
  color: var(--text-tertiary);
}

/* Stats bar */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  font-size: 0.8rem;
}
.stats-item {
  display: inline;
}
.stats-label {
  color: var(--muted);
}
.stats-value {
  margin-left: 4px;
}

/* Step number (circle badge) */
.step-number {
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Step cards */
.step-cards { display: grid; gap: 10px; margin: 8px 0; }
.step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s;
}
.step-card:hover { border-color: rgba(255, 255, 255, 0.12); }
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), rgba(215, 178, 90, 0.6));
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-body .step-title { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.88); margin-bottom: 3px; }
.step-body .step-desc { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* Setup step dots */
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.step-dot.active { background: var(--gold); color: #05060a; border: none; }

/* Legend / glossary */
.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0;
}
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.legend-icon { font-size: 16px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.legend-text .legend-term { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.88); margin-bottom: 2px; }
.legend-text .legend-def { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* FAQ */
.faq-item { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  padding: 12px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
}
.faq-q:hover { color: var(--gold); }
.faq-q::before { content: '+'; font-family: var(--mono); font-size: 14px; color: var(--gold); width: 16px; flex-shrink: 0; }
details[open] > .faq-q::before { content: '\2212'; }
.faq-a { padding: 0 0 14px 24px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.faq-a b { color: rgba(255, 255, 255, 0.80); }
.faq-a code { font-family: var(--mono); font-size: 11px; color: var(--gold); background: rgba(215, 178, 90, 0.08); padding: 1px 5px; border-radius: 4px; }

/* Details/Summary */
details summary { cursor: pointer; color: var(--muted); }
details summary:hover { color: var(--text); }
details[open] summary { margin-bottom: 10px; }


/* ===== 15. TOAST & NOTIFICATIONS ===== */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text);
  background: rgba(13, 22, 53, 0.92);
  border: 1px solid rgba(120, 155, 255, 0.22);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(12px);
  animation: toast-in 0.25s ease forwards;
}
.toast.toast-out { animation: toast-out 0.2s ease forwards; }
.toast.toast-ok, .toast-success { border-color: rgba(34, 197, 94, 0.4); }
.toast.toast-err, .toast-error { border-color: rgba(248, 81, 73, 0.4); }
.toast.toast-warn { border-color: rgba(245, 158, 11, 0.4); }


/* ===== 16. ANIMATIONS ===== */

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Only animate cards on initial page load, not on HTMX swaps */
body.page-loading .card { animation: cardIn 0.4s ease both; }
body.page-loading .card:nth-child(2) { animation-delay: 0.05s; }
body.page-loading .card:nth-child(3) { animation-delay: 0.10s; }
body.page-loading .card:nth-child(4) { animation-delay: 0.15s; }

@keyframes fadeTab {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

@keyframes pulse-maker-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(215, 178, 90, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(215, 178, 90, 0); }
}

@keyframes lp-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

@keyframes updatePulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(12px); }
}

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

/* Smooth number transitions */
.animate-value {
  transition: color 0.3s ease, opacity 0.3s ease;
  display: inline-block;
}
.animate-value.updating {
  opacity: 0.5;
}


/* ===== 17. DECORATIVE ===== */

/* Body left rail (purple-to-blue gradient, 10px wide) */
body::before {
  content: "";
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.9), rgba(37, 99, 235, 0.85));
  box-shadow: var(--shadow-glow);
  z-index: 9998;
  pointer-events: none;
}

/* Body watermark ("SWING 15m") */
body::after {
  content: "SWING 15m";
  position: fixed;
  right: 22px;
  bottom: 14px;
  font-size: 120px;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(124, 58, 237, 0.055);
  pointer-events: none;
  z-index: 0;
}

/* Terminal box */
.terminal-box {
  background: #010409;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #c9d1d9;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.codebox {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.30);
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--mono);
  font-size: 11px;
  overflow: auto;
  max-height: 220px;
}

/* Pill (setup wizard & misc) */
.pill {
  font-family: var(--mono);
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill b { color: var(--text); }
.pill form.inline { display: inline; margin: 0; }
.pill .sep { width: 1px; height: 16px; background: var(--line); flex-shrink: 0; }


/* ===== 18. UTILITIES ===== */

/* Spacing */
.mt-4  { margin-top: 4px; }
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mb-6  { margin-bottom: 6px; }
.mb-8  { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mr-0  { margin-right: 0; }
.p-12  { padding: 12px; }
.p-16  { padding: 16px; }

/* Flex */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flex-center { display: flex; align-items: center; }
.row { display: flex; align-items: center; gap: 10px; font-family: var(--mono); color: var(--muted); font-size: 12px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.two   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Gap */
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* Widths */
.mw-520 { max-width: 520px; }
.mw-720 { max-width: 720px; }
.w-160  { width: 160px; }

/* Visibility */
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* HR */
.hr { height: 1px; background: rgba(255, 255, 255, 0.06); margin: 10px 0; }

/* HTMX loading indicator */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* Backward-compat aliases */
.hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.hd h2 { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; margin: 0; }
.hd-badge { font-size: 0.7rem; color: var(--text-tertiary); }
.bd { font-size: 0.85rem; }


/* ===== 19. MODERN CSS ===== */

/* View transitions (progressive enhancement) */
@supports (view-transition-name: root) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.25s;
  }
}

/* Container queries (progressive enhancement) */
@supports (container-type: inline-size) {
  .main-content {
    container-type: inline-size;
    container-name: main;
  }

  @container main (max-width: 600px) {
    .grid-2 { grid-template-columns: 1fr; }
    .kpi { grid-template-columns: 1fr; }
    .kpi-3 { grid-template-columns: 1fr; }
  }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent;
  user-select: none;
  pointer-events: none;
}
.skeleton-line {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
}
.skeleton-block {
  height: 60px;
  border-radius: var(--radius-sm);
}


/* ===== 20. RESPONSIVE ===== */

/* 1024px breakpoint */
@media (max-width: 1024px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* 860px / 768px breakpoint */
@media (max-width: 860px) {
  .dashboard-layout { grid-template-columns: 1fr; }

  .sidebar {
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.8rem;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-brand { padding-bottom: 0; border-bottom: none; margin-bottom: 0; }
  .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; }

  .main-content { padding: 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  html { font-size: 13px; }

  .kpi-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 8px 10px; }
  .topbar { padding: 0 10px; }
  .topbar-center { display: none; }
  .tab-bar { padding: 0 8px; }
  .tab-bar a, .tab-bar button { padding: 10px 12px; font-size: 0.8rem; }
  .tab-content { padding: 10px; }
  .signal-hero { flex-direction: column; text-align: center; }
  .card { padding: 12px; }

  /* Mobile: tables scroll horizontally (positions, performance) */
  .card { overflow: visible; }
  .card > .table-scroll,
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll table { min-width: 580px; }

  /* Mobile: trade history → card layout (Robinhood/Coinbase pattern) */
  .table-scroll .data-table[data-mobile-cards] { min-width: 0; }
  .data-table[data-mobile-cards] thead { display: none; }
  .data-table[data-mobile-cards] tbody tr {
    display: flex; flex-direction: column;
    margin-bottom: 8px; padding: 10px 12px;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: var(--radius-sm, 8px);
    background: var(--bg-card, rgba(13,22,53,0.55));
  }
  .data-table[data-mobile-cards] td {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 3px 0; border-bottom: none; white-space: normal; font-size: 0.78rem;
  }
  .data-table[data-mobile-cards] td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--text-tertiary, #8b949e);
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
    flex-shrink: 0; margin-right: 12px; min-width: 48px;
  }
  /* Priority order: Result first, then Dir, Entry, USDC, When, Mode, Window last */
  .data-table[data-mobile-cards] td:nth-child(6) { order: -3; font-size: 0.88rem; padding-bottom: 6px; border-bottom: 1px solid var(--border, rgba(255,255,255,0.06)); margin-bottom: 4px; }
  .data-table[data-mobile-cards] td:nth-child(3) { order: -2; }
  .data-table[data-mobile-cards] td:nth-child(4) { order: -1; }
  .data-table[data-mobile-cards] td:nth-child(1) { order: 4; font-size: 0.68rem; color: var(--text-tertiary, #8b949e); }
  .data-table[data-mobile-cards] td:nth-child(2) { order: 5; }
  .data-table[data-mobile-cards] td:nth-child(7) { order: 6; font-size: 0.68rem; color: var(--muted, rgba(245,248,255,0.62)); }

  /* Non-trade tables keep scroll behavior */
  .data-table:not([data-mobile-cards]) { min-width: 580px; }
  .data-table:not([data-mobile-cards]) th,
  .data-table:not([data-mobile-cards]) td { font-size: 0.72rem; padding: 5px 6px; white-space: nowrap; }
  .data-table:not([data-mobile-cards]) td.truncate { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

  /* Touch target minimum */
  .btn, button, .tab-btn, .mode-btn, .btn-sidebar {
    min-height: 44px;
    min-width: 44px;
  }

  /* Bottom tab bar for mobile */
  .tab-bar-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 0;
  }
  .tab-bar-mobile button {
    flex: 1;
    padding: 8px 4px;
    font-size: 0.65rem;
    text-align: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-ui);
    min-height: 44px;
  }
  .tab-bar-mobile button.active { color: var(--gold); }
  .tab-bar-mobile .tab-icon { display: block; font-size: 1.1rem; margin-bottom: 2px; }
}

/* 520px breakpoint */
@media (max-width: 520px) {
  .kpi { grid-template-columns: 1fr; }
  .kpi-3 { grid-template-columns: 1fr; }
  .metric.full { grid-column: 1; }
  .clip { max-width: 140px; }
  .tab-btn { padding: 0.5rem 0.7rem; font-size: 0.75rem; }
  .legend-grid { grid-template-columns: 1fr; }

  .scoring-bar-row {
    grid-template-columns: 70px 1fr 40px 40px;
    font-size: 0.65rem;
  }

  .maker-step { min-width: 60px; }
  .step-label { font-size: 0.6rem; }
}
