/* ═══════════════════════════════════════════════════════════════════════════
   RetailInterest BTC Terminal — global.css
   Foundation: reset, CSS variables, typography, layout, topbar,
   animations, responsive breakpoints, utility classes.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;500;700&family=Outfit:wght@300;500;700;800&display=swap');


/* ─── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --void:         #04070b;
  --deep:         #070d14;
  --surface:      #0a1220;
  --surface2:     #0d1826;

  /* Borders */
  --border:       rgba(0, 200, 255, 0.07);
  --border2:      rgba(0, 200, 255, 0.18);
  --border-gold:  rgba(240, 185, 11, 0.18);

  /* Deribit — cyan */
  --cyan:         #00c8ff;
  --cyan-dim:     rgba(0, 200, 255, 0.10);
  --cyan-glow:    rgba(0, 200, 255, 0.20);
  --cyan-subtle:  rgba(0, 200, 255, 0.04);

  /* Binance — gold */
  --gold:         #f0b90b;
  --gold-dim:     rgba(240, 185, 11, 0.10);
  --gold-glow:    rgba(240, 185, 11, 0.20);
  --gold-subtle:  rgba(240, 185, 11, 0.04);

  /* Signals */
  --green:        #00ff9d;
  --green-dim:    rgba(0, 255, 157, 0.10);
  --red:          #ff4066;
  --red-dim:      rgba(255, 64, 102, 0.10);
  --amber:        #ffb800;
  --amber-dim:    rgba(255, 184, 0, 0.10);

  /* Text */
  --text:         #b8cfe0;
  --text2:        #5a7488;
  --text3:        #2a3a48;

  /* Layout */
  --topbar-h:        54px;
  --topbar-h-mobile: 48px;
  --tabbar-h:        58px;
  --mobile-bp:       900px;
  --gap:             1px;
  --pad:             18px 20px;
  --radius:          2px;
  --radius-sm:       1px;

  /* Fonts */
  --font-ui:      'Outfit', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transitions */
  --trans-fast:   0.12s ease;
  --trans-mid:    0.22s ease;
  --trans-slow:   0.4s ease;
}


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

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

body {
  font-family: var(--font-ui);
  font-weight: 500;
  background: var(--void);
  color: var(--text);
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-ui); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font-mono); outline: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
img { display: block; max-width: 100%; }


/* ─── Animated CSS Grid Background ─────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 200, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: grid-drift 40s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes grid-drift {
  0%   { background-position: 0 0; }
  100% { background-position: 48px 48px; }
}

/* Scanline texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* Ambient corner glows */
.ambient-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
}
.ambient-glow--cyan {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.08) 0%, transparent 70%);
  animation: glow-float-cyan 12s ease-in-out infinite alternate;
}
.ambient-glow--gold {
  width: 400px;
  height: 400px;
  bottom: -100px;
  right: -100px;
  background: radial-gradient(circle, rgba(240, 185, 11, 0.07) 0%, transparent 70%);
  animation: glow-float-gold 14s ease-in-out infinite alternate;
}

@keyframes glow-float-cyan {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, 30px) scale(1.1); }
}
@keyframes glow-float-gold {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-20px, -30px) scale(1.08); }
}


/* ─── App Shell ─────────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* overflow intentionally not set — let pages scroll */
}

.page-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}


/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0;
  background: transparent;
  border-bottom: 1px solid var(--border);
  overflow: visible;
}
/* backdrop-filter moved to ::before so it doesn't create a stacking context
   that clips dropdown children */
.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 11, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: -1;
  pointer-events: none;
}

/* Bottom gradient line on topbar */
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--cyan) 25%,
    var(--gold) 75%,
    transparent 100%
  );
  opacity: 0.4;
}

/* Topbar Left */
.topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  flex-shrink: 0;
}

.topbar__logo {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--cyan);
  white-space: nowrap;
  text-transform: uppercase;
}

.topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--border2);
  flex-shrink: 0;
}

.topbar__price {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__price-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  transition: color var(--trans-fast);
  white-space: nowrap;
}
.topbar__price-value.up   { color: var(--green); }
.topbar__price-value.down { color: var(--red); }

.topbar__price-change {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius);
  transition: background var(--trans-fast), color var(--trans-fast);
  white-space: nowrap;
}
.topbar__price-change.up {
  background: var(--green-dim);
  color: var(--green);
}
.topbar__price-change.down {
  background: var(--red-dim);
  color: var(--red);
}

/* Topbar Center (ticker + nav wrapped) */
.topbar__center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: var(--topbar-h);
  justify-content: center;
}

/* Ticker tape */
.ticker-wrap {
  height: 20px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.ticker-wrap::before,
.ticker-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  z-index: 2;
  pointer-events: none;
}
.ticker-wrap::before {
  left: 0;
  background: linear-gradient(90deg, rgba(4,7,11,0.9) 0%, transparent 100%);
}
.ticker-wrap::after {
  right: 0;
  background: linear-gradient(270deg, rgba(4,7,11,0.9) 0%, transparent 100%);
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  width: max-content;
}

.ticker-wrap:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  font-size: 10px;
  letter-spacing: 1px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}

.ticker-item__label {
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
}

.ticker-item__value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.ticker-item__value--cyan { color: var(--cyan); }
.ticker-item__value--gold { color: var(--gold); }
.ticker-item__value--green { color: #4caf50; }
.ticker-item__value--amber { color: #ffa500; }

/* Navigation */
.topbar__nav {
  display: flex;
  align-items: center;
  gap: 0;
  height: 34px;
  overflow: visible;
  scrollbar-width: none;
}
.topbar__nav::-webkit-scrollbar { display: none; }

.nav-tab {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text2);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--trans-fast), border-color var(--trans-fast),
              background var(--trans-fast);
  position: relative;
  text-decoration: none;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--cyan-subtle);
}

.nav-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: var(--cyan-dim);
}

/* Topbar Right */
.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  flex-shrink: 0;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--green);
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: live-pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px var(--green); }
  50%       { opacity: 0.6; transform: scale(0.8); box-shadow: 0 0 3px var(--green); }
}

.topbar__username {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--trans-fast), border-color var(--trans-fast),
              background var(--trans-fast);
}
.btn-logout:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-dim);
}


/* ─── Panel / Card Foundation ───────────────────────────────────────────────── */
.panel {
  background: rgba(7, 13, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* 3px left accent bar */
.panel--cyan::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--cyan) 0%, transparent 100%);
}

.panel--gold::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold) 0%, transparent 100%);
}

.panel--green::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--green) 0%, transparent 100%);
}

/* Top edge gradient highlight */
.panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--border2), transparent);
  opacity: 0.6;
}

.panel--gold::after {
  background: linear-gradient(90deg, rgba(240,185,11,0.3), transparent);
}
/* Signal cards expand to show condition panels */
.signal-card {
  overflow: visible !important;
}

.panel__header {
  padding: 12px 20px 10px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.panel__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
}

.panel__body {
  padding: var(--pad);
  overflow-y: auto;
  flex: 1;
}
.panel__body::-webkit-scrollbar { width: 4px; }
.panel__body::-webkit-scrollbar-track { background: transparent; }
.panel__body::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}

/* Card hover effect */
.panel.hoverable {
  transition: transform var(--trans-mid), border-color var(--trans-mid);
}
.panel.hoverable:hover {
  transform: translateY(-2px);
  border-color: var(--border2);
}


/* ─── Typography ─────────────────────────────────────────────────────────────── */
.label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
}

.label--cyan  { color: var(--cyan); }
.label--gold  { color: var(--gold); }
.label--green { color: var(--green); }
.label--red   { color: var(--red); }
.label--amber { color: var(--amber); }

.value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.value--lg  { font-size: 22px; font-weight: 700; }
.value--xl  { font-size: 28px; font-weight: 700; }
.value--xxl { font-size: 36px; font-weight: 700; }

.value--cyan  { color: var(--cyan); }
.value--gold  { color: var(--gold); }
.value--green { color: var(--green); }
.value--red   { color: var(--red); }
.value--amber { color: var(--amber); }
.value--muted { color: var(--text2); }

.mono { font-family: var(--font-mono); }
.bold { font-weight: 700; }
.dim  { color: var(--text2); }
.caps { text-transform: uppercase; letter-spacing: 1.5px; }


/* ─── Signal Badge ───────────────────────────────────────────────────────────── */
.signal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid;
}

.signal-badge--long {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(0, 255, 157, 0.3);
}
.signal-badge--short {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(255, 64, 102, 0.3);
}
.signal-badge--neutral {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: rgba(255, 184, 0, 0.3);
}

/* Signal flash animation on new signal */
.signal-badge.flash {
  animation: signal-flash 0.6s ease-in-out 3;
}
@keyframes signal-flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}


/* ─── Exchange Badge ─────────────────────────────────────────────────────────── */
.exchange-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius);
}
.exchange-badge--deribit {
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 200, 255, 0.2);
}
.exchange-badge--binance {
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid rgba(240, 185, 11, 0.2);
}


/* ─── Status / Connection Badges ─────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot--red   { background: var(--red);   box-shadow: 0 0 6px var(--red); }
.status-dot--amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-dot--cyan  { background: var(--cyan);  box-shadow: 0 0 6px var(--cyan); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius);
}
.status-pill--green { color: var(--green); background: var(--green-dim); }
.status-pill--red   { color: var(--red);   background: var(--red-dim); }
.status-pill--amber { color: var(--amber); background: var(--amber-dim); }
.status-pill--cyan  { color: var(--cyan);  background: var(--cyan-dim); }


/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--trans-fast), border-color var(--trans-fast),
              color var(--trans-fast), transform 0.08s ease,
              box-shadow var(--trans-fast);
  border: 1px solid;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--cyan-dim);
  border-color: rgba(0, 200, 255, 0.4);
  color: var(--cyan);
}
.btn--primary:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.2);
}

.btn--gold {
  background: var(--gold-dim);
  border-color: rgba(240, 185, 11, 0.4);
  color: var(--gold);
}
.btn--gold:hover {
  background: rgba(240, 185, 11, 0.18);
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(240, 185, 11, 0.2);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border2);
  color: var(--text2);
}
.btn--ghost:hover {
  border-color: var(--text2);
  color: var(--text);
  background: rgba(184, 207, 224, 0.05);
}

.btn--danger {
  background: var(--red-dim);
  border-color: rgba(255, 64, 102, 0.4);
  color: var(--red);
}
.btn--danger:hover {
  background: rgba(255, 64, 102, 0.2);
  border-color: var(--red);
  box-shadow: 0 0 12px rgba(255, 64, 102, 0.2);
}

.btn--green {
  background: var(--green-dim);
  border-color: rgba(0, 255, 157, 0.4);
  color: var(--green);
}
.btn--green:hover {
  background: rgba(0, 255, 157, 0.18);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.2);
}

.btn--sm { font-size: 9px; padding: 5px 10px; letter-spacing: 1px; }
.btn--lg { font-size: 12px; padding: 11px 22px; }
.btn--full { width: 100%; }

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

/* Toggle button group */
.btn-group {
  display: inline-flex;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 6px 14px;
}
.btn-group .btn:last-child { border-right: none; }
.btn-group .btn:hover { background: var(--cyan-subtle); color: var(--text); }
.btn-group .btn.active {
  background: var(--cyan-dim);
  color: var(--cyan);
}


/* ─── Form Inputs ────────────────────────────────────────────────────────────── */
.input {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--radius);
  width: 100%;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
  -webkit-appearance: none;
}
.input::placeholder { color: var(--text3); }
.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}
.input:focus.gold-focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.select {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 28px 8px 10px;
  border-radius: var(--radius);
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a7488' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--trans-fast);
}
.select:focus { border-color: var(--cyan); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
}
.form-error {
  font-size: 11px;
  color: var(--red);
  font-family: var(--font-ui);
}


/* ─── Tables ─────────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 13, 20, 0.95);
  backdrop-filter: blur(8px);
}

.data-table th {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text2);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}

.data-table th.r { text-align: right; }
.data-table th.c { text-align: center; }

.data-table td {
  padding: 0 12px;
  height: 36px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
  color: var(--text);
}

.data-table td.r { text-align: right; }
.data-table td.c { text-align: center; }

.data-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr:hover td {
  background: rgba(0, 200, 255, 0.05);
  cursor: default;
}

/* Level rows */
.data-table tr.row-support    td { background:rgba(76,175,80,0.08) !important; border-top:1px solid rgba(76,175,80,0.2); border-bottom:1px solid rgba(76,175,80,0.2); }
.data-table tr.row-tp         td { background:rgba(0,188,212,0.08) !important; border-top:1px solid rgba(0,188,212,0.2); border-bottom:1px solid rgba(0,188,212,0.2); }
.data-table tr.row-target     td { background:rgba(255,152,0,0.08) !important; border-top:1px solid rgba(255,152,0,0.2); border-bottom:1px solid rgba(255,152,0,0.2); }
.data-table tr.row-resistance td { background:rgba(244,67,54,0.08) !important; border-top:1px solid rgba(244,67,54,0.2); border-bottom:1px solid rgba(244,67,54,0.2); }
/* Max Pain row highlight */
.data-table tr.max-pain td {
  background: rgba(0, 200, 255, 0.06);
  font-weight: 700;
  border-top: 1px solid rgba(0, 200, 255, 0.2);
  border-bottom: 1px solid rgba(0, 200, 255, 0.2);
}
.data-table tr.max-pain--gold td {
  background: rgba(240, 185, 11, 0.06);
  border-top-color: rgba(240, 185, 11, 0.2);
  border-bottom-color: rgba(240, 185, 11, 0.2);
}

/* PCR color in tables */
.pcr-bull { color: var(--green); }
.pcr-bear { color: var(--red); }

/* Sortable columns */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table th.sortable:hover { color: var(--text); }
.data-table th.sortable.asc::after  { content: ' ↑'; color: var(--cyan); }
.data-table th.sortable.desc::after { content: ' ↓'; color: var(--cyan); }

/* Table container with scroll */
.table-wrap {
  overflow: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px;
}


/* ─── Pain Bar (inline table pill) ─────────────────────────────────────────── */
.pain-bar-wrap {
  width: 80px;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.pain-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--cyan);
  transition: width 0.3s ease;
}
.pain-bar-fill--gold { background: var(--gold); }


/* ─── PCR Bar Chart ──────────────────────────────────────────────────────────── */
.pcr-chart {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
}

.pcr-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;       /* prevent bleed that shrinks the right maxpain panel */
  min-width: 0;
  overflow: hidden;  /* contain value label */
}

.pcr-bar-strike {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  text-align: right;
  white-space: nowrap;
}
.pcr-bar-strike.max-pain { color: var(--cyan); font-weight: 700; }
.pcr-bar-strike.max-pain--gold { color: var(--gold); }

.pcr-bar-track {
  position: relative;
  height: 20px;
  background: var(--surface2);
  border-radius: var(--radius);
  overflow: hidden; /* keep clip on bar fill */
}

.pcr-bar-fill {
  height: 100%;
  border-radius: var(--radius);
  width: 0;
  max-width: 100%;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.pcr-bar-fill--bull {
  background: linear-gradient(90deg, rgba(0,255,157,0.6), var(--green));
}
.pcr-bar-fill--bear {
  background: linear-gradient(90deg, rgba(255,64,102,0.6), var(--red));
}

/* Neutral line at PCR=1.0 */
.pcr-neutral-line {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
}
.pcr-neutral-line::after {
  content: '1.0';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  white-space: nowrap;
}

.pcr-bar-value {
  position: absolute;
  right: 4px;          /* inside the track, not -38px outside */
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  mix-blend-mode: difference; /* stays readable on any bar color */
  color: #fff;
  z-index: 2;
}


/* ─── Expiry Toggle ──────────────────────────────────────────────────────────── */
.expiry-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}

.expiry-toggle__btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
  cursor: pointer;
  border-right: 1px solid var(--border2);
  transition: background var(--trans-fast), color var(--trans-fast);
}
.expiry-toggle__btn:last-child { border-right: none; }
.expiry-toggle__btn:hover { background: var(--cyan-subtle); color: var(--text); }
.expiry-toggle__btn.active {
  background: var(--cyan-dim);
  color: var(--cyan);
}


/* ─── Metric Card ────────────────────────────────────────────────────────────── */
.metric-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric-card__label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text2);
}
.metric-card__value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  line-height: 1.1;
}
.metric-card__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
}


/* ─── Loading / Skeleton ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface) 25%,
    var(--surface2) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius);
}

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

.skeleton-text {
  height: 12px;
  width: 80%;
  margin: 4px 0;
}
.skeleton-text--sm { width: 40%; }
.skeleton-text--lg { height: 20px; width: 60%; }
.skeleton-value    { height: 28px; width: 50%; }

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner--gold { border-top-color: var(--gold); }
.spinner--sm { width: 12px; height: 12px; }
.spinner--lg { width: 24px; height: 24px; border-width: 3px; }

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


/* ─── Page-load Fade-up Animation ───────────────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(10px);
  animation: fade-up-in 0.4s ease forwards;
}

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

/* Staggered delays for multiple cards */
.fade-up:nth-child(1)  { animation-delay: 0ms; }
.fade-up:nth-child(2)  { animation-delay: 50ms; }
.fade-up:nth-child(3)  { animation-delay: 100ms; }
.fade-up:nth-child(4)  { animation-delay: 150ms; }
.fade-up:nth-child(5)  { animation-delay: 200ms; }
.fade-up:nth-child(6)  { animation-delay: 250ms; }
.fade-up:nth-child(7)  { animation-delay: 300ms; }
.fade-up:nth-child(8)  { animation-delay: 350ms; }
.fade-up:nth-child(9)  { animation-delay: 400ms; }
.fade-up:nth-child(10) { animation-delay: 450ms; }

/* Force specific delay via data attribute override */
[data-delay="0"]   { animation-delay: 0ms !important; }
[data-delay="1"]   { animation-delay: 50ms !important; }
[data-delay="2"]   { animation-delay: 100ms !important; }
[data-delay="3"]   { animation-delay: 150ms !important; }
[data-delay="4"]   { animation-delay: 200ms !important; }
[data-delay="5"]   { animation-delay: 250ms !important; }


/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 11, 0.80);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans-mid);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--deep);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  position: relative;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--trans-mid);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

/* Top edge glow */
.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}
.modal__close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color var(--trans-fast);
}
.modal__close:hover { color: var(--red); }

.modal__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal__footer {
  padding: 12px 20px 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}


/* ─── Toast Notifications ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(7, 13, 20, 0.95);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  min-width: 220px;
  max-width: 360px;
  pointer-events: all;
  animation: toast-in 0.25s ease;
  backdrop-filter: blur(10px);
}
.toast.out { animation: toast-out 0.25s ease forwards; }

.toast--success { border-color: rgba(0,255,157,0.3); }
.toast--success .toast-icon { color: var(--green); }


.toast--error   { border-color: rgba(255,64,102,0.3); }
.toast--error   .toast-icon { color: var(--red); }
.toast--info    { border-color: rgba(0,200,255,0.3); }
.toast--info    .toast-icon { color: var(--cyan); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}


/* ─── Divider ────────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.divider--bright { background: var(--border2); }


/* ─── Scrollbar (global) ─────────────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }


/* ─── Utility ────────────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-end    { display: flex; align-items: center; justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* Positive / Negative colors for P&L */
.pos { color: var(--green); }
.neg { color: var(--red); }
.neu { color: var(--amber); }


/* ─── Mobile warning banner ─────────────────────────────────────────────────── */
.mobile-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--amber-dim);
  border-bottom: 1px solid rgba(255, 184, 0, 0.3);
  padding: 10px 16px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--amber);
  line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1440p+ Enhanced ───────────────────────────────────────────────────────── */
@media (min-width: 1440px) {
  html { font-size: 15px; }

  .data-table td   { height: 40px; }
  .data-table th   { font-size: 10px; padding: 12px 14px; }
  .data-table td   { padding: 0 14px; }

  .metric-card__value { font-size: 22px; }
  .value--xxl         { font-size: 42px; }
  .value--xl          { font-size: 34px; }
  .value--lg          { font-size: 26px; }

  .pcr-bar-row { grid-template-columns: 86px 1fr; }
}

/* ─── 1280px Laptop ─────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .nav-tab { padding: 0 9px; font-size: 10px; }
  .topbar__logo { font-size: 13px; }
}

/* ─── 1024px Small Laptop ───────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hide-1024 { display: none !important; }
  .nav-tab   { padding: 0 8px; font-size: 10px; letter-spacing: 0.5px; }

  .topbar__price-change { display: none; }
}

/* ─── 768px Tablet ──────────────────────────────────────────────────────────── */
/* ── Mobile layout (≤900px, matches tab-bar partial breakpoint) ──
   Enforce strict viewport heights so flex chain (body → #app → page-content → ri)
   can fill exactly: topbar(48) + page-content(rest). Tab bar is position:fixed,
   so body padding-bottom keeps content above it. */
@media (max-width: 900px) {
  html, body {
    height: 100dvh;
    overflow: hidden;
  }
  #app {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  /* Topbar must NOT be sticky on mobile — sticky inside an overflow:hidden flex
     parent causes the inner content area to slide under it. Use static flex item. */
  .topbar { position: relative !important; flex-shrink: 0; }
  .page-content { flex: 1; min-height: 0; }

  .topbar {
    grid-template-columns: 1fr auto;
    height: var(--topbar-h-mobile, 48px);
    min-height: var(--topbar-h-mobile, 48px);
    padding: 0 12px;
  }

  /* Hide ticker on tablet */
  .ticker-wrap { display: none; }

  /* Nav moves to bottom tab bar */
  .topbar__center { display: none; }
  .topbar__nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 52px;
    background: rgba(4, 7, 11, 0.96);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border2);
    display: flex;
    justify-content: space-around;
    overflow-x: auto;
    padding: 0 4px;
  }

  .nav-tab {
    flex: 1;
    flex-direction: column;
    height: 52px;
    font-size: 8px;
    padding: 0 4px;
    border-bottom: none;
    border-top: 2px solid transparent;
    gap: 2px;
    justify-content: center;
    text-align: center;
  }
  .nav-tab.active {
    border-bottom: none;
    border-top-color: var(--cyan);
  }

  /* .page-content padding-bottom removed — body padding-bottom (from mobile_nav.html
     partial) already accounts for the bottom tab bar. Stacking both = 110px wasted. */

  .topbar__right { gap: 8px; }
  .live-badge span { display: none; }

  /* Tables scroll horizontally */
  .table-wrap { overflow-x: auto; }

  /* Touch targets */
  .btn    { min-height: 44px; }
  .input  { min-height: 44px; }
  .select { min-height: 44px; }

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

  /* Expiry toggle becomes select on tablet */
  .expiry-toggle { display: none; }
  .expiry-select-mobile { display: block !important; }
}

/* ─── 480px Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .mobile-warning { display: block; }

  html { font-size: 13px; }

  .topbar__logo { font-size: 12px; }
  .topbar__price-value { font-size: 13px; }

  /* Paper Trade hidden on mobile */
  .papertrade-disabled-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text2);
    font-size: 13px;
  }

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

/* Default hidden — shown on mobile only */
.expiry-select-mobile { display: none; }


/* ─── Chart exchange toggle colors ──────────────────────────────────────── */
#chart-exchange-toggle[data-exchange="binance"] .btn.active {
  background: var(--gold-dim);
  color: var(--gold);
}
#chart-exchange-toggle[data-exchange="both"] .btn.active {
  background: rgba(184,207,224,0.08);
  color: var(--text);
}
