/*
 * theme.css — BTC OptionEngine · Dark Trading Terminal
 * =====================================================
 * Design language: Professional options trading console cockpit.
 * Inspired by Bloomberg Terminal, Bybit, and 3Commas dark dashboards.
 *
 * Palette
 *   --bg-base:    #0a0e1a  (deep navy black — base layer)
 *   --bg-surface: #0f1724  (card/panel surface)
 *   --bg-raised:  #162033  (raised elements, sidebars)
 *   --bg-hover:   #1c2a3f  (hover states)
 *   --border:     rgba(255,255,255,0.07)
 *
 * Accents
 *   Teal   #00d4aa — primary positive / active / teal
 *   Blue   #3b8beb — informational / links
 *   Green  #22c55e — profit / success / connected
 *   Amber  #f59e0b — warning / caution / paper mode
 *   Red    #ef4444 — loss / danger / live mode / kill
 *   Purple #a78bfa — total trades / neutral accent
 *
 * Typography
 *   UI text:   'Inter' (san-serif chrome)
 *   Data/mono: 'JetBrains Mono' (prices, IDs, timestamps)
 */

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

:root {
  --bg-base:     #0a0e1a;
  --bg-surface:  #0f1724;
  --bg-raised:   #131d2e;
  --bg-hover:    #192336;
  --bg-elevated: #1c2a3f;

  --border:       rgba(255,255,255,0.07);
  --border-med:   rgba(255,255,255,0.12);
  --border-bright:rgba(255,255,255,0.18);

  --text-primary: #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:   #4b5d70;

  --teal:         #00d4aa;
  --teal-dim:     rgba(0, 212, 170, 0.12);
  --teal-glow:    rgba(0, 212, 170, 0.25);
  --blue:         #3b8beb;
  --blue-dim:     rgba(59, 139, 235, 0.12);
  --green:        #22c55e;
  --green-dim:    rgba(34, 197, 94, 0.12);
  --amber:        #f59e0b;
  --amber-dim:    rgba(245, 158, 11, 0.12);
  --red:          #ef4444;
  --red-dim:      rgba(239, 68, 68, 0.12);
  --red-glow:     rgba(239, 68, 68, 0.25);
  --purple:       #a78bfa;
  --purple-dim:   rgba(167, 139, 250, 0.12);

  --sidebar-w:    260px;
  --topbar-h:     60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono { font-family: var(--font-mono); }
.text-pos  { color: var(--green); }
.text-neg  { color: var(--red); }
.text-muted{ color: var(--text-muted) !important; }

/* ════════════════════════════════════════════════════════════
   AUTH SCREEN
   ════════════════════════════════════════════════════════════ */

.auth-body { min-height: 100vh; background: var(--bg-base); }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 480px 1fr;
}

@media (max-width: 960px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-right  { display: none; }
}

.auth-panel {
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 48px;
  gap: 24px;
}

.auth-brand { text-align: center; }
.auth-logo {
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  background: var(--teal-dim);
  border: 1px solid var(--teal-glow);
  color: var(--teal);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 32px var(--teal-glow);
}
.auth-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
}
.auth-subtitle {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: 0;
}

.auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.auth-alert-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }
.auth-alert-info  { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,139,235,0.25); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }

.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-icon {
  position: absolute; left: 14px;
  color: var(--text-muted); font-size: 15px;
  pointer-events: none;
}
.auth-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 12px 14px 12px 42px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}
.auth-eye-btn {
  position: absolute; right: 12px;
  background: none; border: none;
  color: var(--text-secondary);
  cursor: pointer; padding: 4px;
  font-size: 16px;
}
.auth-eye-btn:hover { color: var(--text-primary); }

.auth-submit-btn {
  background: var(--teal);
  color: #04231e;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  padding: 13px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.auth-submit-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.auth-submit-btn:active { transform: translateY(0); }

.auth-demo-box {
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-md);
  padding: 16px;
}
.auth-demo-label {
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.auth-demo-creds {
  display: flex;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 10px;
}
.auth-demo-note {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.auth-mode-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  justify-content: center;
}
.auth-mode-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(75,93,112,0.2);
}

/* Auth right panel */
.auth-right {
  background:
    radial-gradient(circle at 15% 25%, rgba(0,212,170,0.08), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(59,139,235,0.06), transparent 40%),
    var(--bg-base);
  display: flex;
  align-items: center;
  padding: 64px;
}
.auth-right-content { max-width: 500px; }
.auth-right-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--teal-dim);
  border: 1px solid var(--teal-glow);
  color: var(--teal);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-right-title {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 20px;
}
.auth-right-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.75;
  margin: 0 0 32px;
}
.auth-feature-list { display: flex; flex-direction: column; gap: 20px; }
.auth-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.auth-feature-item > i {
  font-size: 20px;
  color: var(--teal);
  flex-shrink: 0;
  margin-top: 2px;
}
.auth-feature-item > div { display: flex; flex-direction: column; gap: 3px; }
.auth-feature-item strong { font-size: 14px; font-weight: 600; }
.auth-feature-item span { font-size: 13px; color: var(--text-secondary); }

/* ════════════════════════════════════════════════════════════
   APP SHELL — SIDEBAR + TOPBAR + CONTENT
   ════════════════════════════════════════════════════════════ */

.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--teal-dim);
  border: 1px solid var(--teal-glow);
  color: var(--teal);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}
.sidebar-brand-name { font-weight: 700; font-size: 12.5px; line-height: 1.3; white-space: normal; overflow-wrap: break-word; }
.sidebar-brand-sub  { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.sidebar-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 16px; cursor: pointer; padding: 4px;
  margin-left: auto; flex-shrink: 0;
}

.sidebar-phase-tag {
  font-size: 10.5px;
  color: var(--amber);
  background: var(--amber-dim);
  border-bottom: 1px solid rgba(245,158,11,0.15);
  padding: 7px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-group { margin-bottom: 6px; }
.nav-group-label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 10px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.nav-link:hover:not(.disabled) { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
  background: var(--teal-dim);
  color: var(--teal);
  border-left: 2px solid var(--teal);
}
.nav-link.disabled { opacity: 0.45; cursor: not-allowed; color: var(--text-muted); }
.nav-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge-phase {
  font-size: 9px;
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-med);
  border-radius: 4px;
  padding: 1px 5px;
}

.sidebar-kill-wrap { padding: 12px 10px; flex-shrink: 0; }
.sidebar-kill-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-weight: 700;
  font-size: 13.5px;
  cursor: not-allowed;
  opacity: 0.75;
}
.sidebar-kill-btn i { font-size: 16px; }
.sidebar-kill-btn span { flex: 1; }
.ks-phase { font-size: 9.5px; font-family: var(--font-mono); color: var(--text-muted); background: var(--bg-elevated); padding: 1px 5px; border-radius: 3px; }

.sidebar-env {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.env-indicator {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.06em;
}
.env-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.env-php { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-muted); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1030;
}
.sidebar-overlay.show { display: block; }

/* ── MAIN AREA ── */

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */

.app-topbar {
  height: var(--topbar-h);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 1020;
}

.topbar-toggle {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 20px; cursor: pointer; padding: 4px;
  display: none;
}

.topbar-left { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-page-title { font-size: 15px; font-weight: 700; }
.topbar-breadcrumb { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

.topbar-spacer { flex: 1; }

/* Compact mode badge in topbar */
.topbar-mode-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid;
  letter-spacing: 0.05em;
}
.mode-dot { width: 7px; height: 7px; border-radius: 50%; }

.topbar-mode-badge.mode-off  { background: rgba(75,93,112,0.15); border-color: rgba(75,93,112,0.3); color: var(--text-muted); }
.topbar-mode-badge.mode-off .mode-dot { background: var(--text-muted); }

.topbar-mode-badge.mode-paper{ background: var(--amber-dim); border-color: rgba(245,158,11,0.35); color: var(--amber); }
.topbar-mode-badge.mode-paper .mode-dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: blink 2s infinite; }

.topbar-mode-badge.mode-live { background: var(--red-dim); border-color: rgba(239,68,68,0.35); color: var(--red); }
.topbar-mode-badge.mode-live .mode-dot { background: var(--red); box-shadow: 0 0 8px var(--red); animation: blink 1s infinite; }

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

.topbar-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
}
.clock-tz { font-size: 10px; color: var(--text-muted); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  border-radius: 999px;
  padding: 5px 14px 5px 5px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
}
.topbar-user:hover { border-color: var(--border-bright); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal-dim);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  font-family: var(--font-mono);
}
.user-label { font-weight: 500; }

/* Bootstrap dropdown override */
.dropdown-menu {
  background: var(--bg-raised);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  padding: 6px;
}
.dropdown-item { color: var(--text-primary); border-radius: var(--radius-sm); font-size: 13.5px; padding: 8px 12px; }
.dropdown-item:hover:not(.disabled) { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.text-danger { color: var(--red) !important; }
.dropdown-item.text-danger:hover { background: var(--red-dim); }
.dropdown-divider { border-color: var(--border); }
.dropdown-item-text { font-size: 13px; padding: 8px 12px; color: var(--text-primary); display: block; }
.dropdown-item.disabled { color: var(--text-muted) !important; }

/* ── CONTENT AREA ── */

.app-content {
  flex: 1;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ── FOOTER ── */

.app-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  justify-content: center;
  flex-wrap: wrap;
}
.sep { color: var(--border-bright); }

/* ════════════════════════════════════════════════════════════
   DASHBOARD — MODE STRIP
   ════════════════════════════════════════════════════════════ */

.mode-strip {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-med);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
  flex-wrap: wrap;
}
.mode-strip::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(600px circle at left center, var(--mode-glow, transparent), transparent 55%);
  opacity: 0.6;
}

.mode-strip.mode-off   { --mode-glow: rgba(75,93,112,0.2); }
.mode-strip.mode-paper { --mode-glow: rgba(245,158,11,0.2); border-color: rgba(245,158,11,0.25); }
.mode-strip.mode-live  { --mode-glow: rgba(239,68,68,0.25); border-color: rgba(239,68,68,0.4); }

.mode-strip-status { display: flex; align-items: center; gap: 16px; z-index: 1; }

.mode-pulse-ring {
  position: relative;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}
.mode-pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: block;
}
.mode-off   .mode-pulse-dot { background: var(--text-muted); box-shadow: 0 0 0 5px rgba(75,93,112,0.2); }
.mode-paper .mode-pulse-dot { background: var(--amber); box-shadow: 0 0 0 5px var(--amber-dim); animation: pulse 1.8s infinite; }
.mode-live  .mode-pulse-dot { background: var(--red); box-shadow: 0 0 0 5px var(--red-dim); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }

.mode-strip-text { display: flex; flex-direction: column; line-height: 1.2; }
.mode-strip-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.mode-strip-value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; }
.mode-off   .mode-strip-value { color: var(--text-secondary); }
.mode-paper .mode-strip-value { color: var(--amber); }
.mode-live  .mode-strip-value { color: var(--red); }

.mode-selector { display: flex; align-items: center; gap: 6px; z-index: 1; flex-wrap: wrap; }
.mode-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-med);
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: not-allowed;
  letter-spacing: 0.04em;
}
.mode-btn-active-off   { background: rgba(75,93,112,0.2); color: var(--text-secondary); border-color: rgba(75,93,112,0.4); }
.mode-btn-active-paper { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,158,11,0.4); }
.mode-btn-active-live  { background: var(--red-dim); color: var(--red); border-color: rgba(239,68,68,0.4); }
.mode-change-note { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

.mode-strip-right { display: flex; align-items: center; gap: 10px; margin-left: auto; z-index: 1; flex-wrap: wrap; }

.conn-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}
.conn-badge .conn-val { font-family: var(--font-mono); font-size: 10.5px; }
.conn-ok  { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,0.3); }
.conn-off { background: rgba(75,93,112,0.1); color: var(--text-muted); border-color: var(--border); }

.kill-switch-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  cursor: not-allowed;
  opacity: 0.7;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   STAT CARDS ROW
   ════════════════════════════════════════════════════════════ */

.stat-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

@media (max-width: 1200px) { .stat-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .stat-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .stat-row { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--border-med); }

.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.icon-teal   { background: var(--teal-dim);   color: var(--teal);   }
.icon-blue   { background: var(--blue-dim);   color: var(--blue);   }
.icon-green  { background: var(--green-dim);  color: var(--green);  }
.icon-red    { background: var(--red-dim);    color: var(--red);    }
.icon-amber  { background: var(--amber-dim);  color: var(--amber);  }
.icon-purple { background: var(--purple-dim); color: var(--purple); }

.stat-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat-card-value { font-family: var(--font-mono); font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-card-value small { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.stat-card-sub { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ════════════════════════════════════════════════════════════
   CHART ROW
   ════════════════════════════════════════════════════════════ */

.chart-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}
@media (max-width: 1100px) { .chart-row { grid-template-columns: 1fr; } }

.chart-right-col { display: flex; flex-direction: column; gap: 14px; }

/* ════════════════════════════════════════════════════════════
   PANEL (shared card style)
   ════════════════════════════════════════════════════════════ */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-header-left  { display: flex; flex-direction: column; gap: 2px; }
.panel-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-title    { font-size: 14px; font-weight: 700; margin: 0; display: flex; align-items: center; }
.panel-subtitle { font-size: 11.5px; color: var(--text-muted); }
.panel-tag {
  font-size: 10.5px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--font-mono);
}
.panel-badge-count {
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid var(--teal-glow);
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 10px;
}
.panel-link { font-size: 12.5px; color: var(--text-muted); text-decoration: none; }
.panel-link.disabled { opacity: 0.5; cursor: not-allowed; }

/* ── BTC Chart ── */

.panel-chart { min-height: 340px; }
.chart-body { position: relative; flex: 1; min-height: 260px; }
.chart-body canvas { width: 100% !important; height: 100% !important; }

.chart-meta { display: flex; align-items: baseline; gap: 10px; }
.chart-price { font-family: var(--font-mono); font-size: 20px; font-weight: 700; }
.chart-change { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.chart-change.pos { color: var(--green); }
.chart-change.neg { color: var(--red); }

.chart-tf-pills { display: flex; gap: 4px; }
.tf-pill {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-mono);
}
.tf-pill.active { background: var(--teal-dim); color: var(--teal); border-color: var(--teal-glow); }
.tf-pill:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }

/* ── Active Signal ── */

.signal-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.signal-waiting { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: blink 1.5s infinite; }

.signal-body { display: flex; flex-direction: column; gap: 14px; }
.signal-type {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.signal-sell-ce    { background: var(--teal-dim); color: var(--teal); border: 1px solid var(--teal-glow); }
.signal-sell-pe    { background: var(--red-dim);  color: var(--red);  border: 1px solid rgba(239,68,68,0.3); }
.signal-buy-ce     { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,139,235,0.3); }
.signal-buy-pe     { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(167,139,250,0.3); }
.signal-re-sell-ce { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,139,235,0.3); }
.signal-re-sell-pe { background: var(--red-dim);  color: var(--red);  border: 1px solid rgba(239,68,68,0.3); }

.signal-details { display: flex; flex-direction: column; gap: 8px; }
.signal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}
.signal-row:last-child { border-bottom: none; padding-bottom: 0; }
.signal-row span { color: var(--text-muted); }
.signal-row strong { font-family: var(--font-mono); font-size: 12px; }

.badge-signal-status {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}
.badge-waiting  { background: var(--amber-dim); color: var(--amber); }
.badge-processed{ background: var(--green-dim); color: var(--green); }
.badge-blocked  { background: var(--red-dim);   color: var(--red);   }
.badge-disabled { background: var(--border-med); color: var(--text-muted); }
.badge-default  { background: var(--blue-dim);   color: var(--blue);  }

.signal-mode-note {
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(75,93,112,0.1);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Connections Panel ── */

.conn-list { display: flex; flex-direction: column; gap: 10px; }
.conn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.conn-row:last-child { border-bottom: none; padding-bottom: 0; }
.conn-row-left { display: flex; align-items: center; gap: 10px; }
.conn-icon-sm { font-size: 15px; color: var(--text-muted); }
.conn-row-name   { display: block; font-size: 12.5px; font-weight: 600; }
.conn-row-detail { display: block; font-size: 11px; color: var(--text-muted); }

.conn-status-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.badge-ok  { background: var(--green-dim); color: var(--green); }
.badge-off { background: rgba(75,93,112,0.12); color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   RISK MANAGER
   ════════════════════════════════════════════════════════════ */

.risk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .risk-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px)  { .risk-grid { grid-template-columns: 1fr; } }

.risk-metric { display: flex; flex-direction: column; gap: 8px; }
.risk-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.risk-metric-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.risk-metric-val { font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.risk-bar { height: 6px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.risk-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.risk-fill-normal { background: linear-gradient(90deg, var(--teal), var(--blue)); }
.risk-fill-warn   { background: var(--amber); }
.risk-fill-danger { background: var(--red); }
.risk-pct { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.risk-flags { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.risk-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 6px 0;
}
.flag-on     { color: var(--green); }
.flag-off    { color: var(--text-muted); }
.flag-danger { color: var(--red); }
.risk-flag i { font-size: 14px; }

/* ════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.empty-row {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-ui);
  padding: 32px 14px !important;
}
.text-end { text-align: right; }

/* Pills / badges */
.type-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
}
.type-sell-ce { background: var(--teal-dim); color: var(--teal); }
.type-sell-pe { background: var(--red-dim);  color: var(--red);  }

.signal-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.signal-sell-ce    { background: var(--teal-dim); color: var(--teal); }
.signal-sell-pe    { background: var(--red-dim);  color: var(--red); }
.signal-buy-ce     { background: var(--blue-dim); color: var(--blue); }
.signal-buy-pe     { background: var(--purple-dim); color: var(--purple); }
.signal-re-sell-ce { background: var(--blue-dim); color: var(--blue); }
.signal-re-sell-pe { background: var(--red-dim);  color: var(--red); }

.mode-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.mode-pill-paper { background: var(--amber-dim); color: var(--amber); }
.mode-pill-live  { background: var(--red-dim);   color: var(--red); }
.mode-pill-off   { background: rgba(75,93,112,0.12); color: var(--text-muted); }

.status-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.status-open   { background: var(--blue-dim);  color: var(--blue); }
.status-closed { background: var(--green-dim); color: var(--green); }
.status-validated          { background: var(--green-dim); color: var(--green); }
.status-processed          { background: var(--green-dim); color: var(--green); }
.status-received           { background: var(--amber-dim); color: var(--amber); }
.status-rejected_duplicate { background: rgba(75,93,112,0.15); color: var(--text-secondary); }
.status-rejected_invalid   { background: var(--red-dim);   color: var(--red); }
.status-rejected_risk      { background: var(--red-dim);   color: var(--red); }

/* ════════════════════════════════════════════════════════════
   LOGS ROW
   ════════════════════════════════════════════════════════════ */

.logs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px) { .logs-row { grid-template-columns: 1fr; } }

/* Webhook log statuses */
.wh-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.wh-received  { background: var(--blue-dim);  color: var(--blue); }
.wh-processed { background: var(--green-dim); color: var(--green); }
.wh-blocked   { background: var(--amber-dim); color: var(--amber); }
.wh-rejected  { background: var(--red-dim);   color: var(--red); }

/* System logs feed */
.syslog-feed { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.syslog-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  line-height: 1.4;
  border-left: 2px solid transparent;
}
.syslog-entry.log-info { border-left-color: var(--blue); background: rgba(59,139,235,0.04); }
.syslog-entry.log-warn { border-left-color: var(--amber); background: rgba(245,158,11,0.04); }
.syslog-entry.log-error{ border-left-color: var(--red); background: rgba(239,68,68,0.04); }
.syslog-time  { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.syslog-level { font-weight: 700; white-space: nowrap; flex-shrink: 0; width: 38px; }
.log-info  .syslog-level { color: var(--blue); }
.log-warn  .syslog-level { color: var(--amber); }
.log-error .syslog-level { color: var(--red); }
.syslog-msg { color: var(--text-secondary); }

/* ════════════════════════════════════════════════════════════
   COMING SOON MODAL — Phase 2 preview items
   ════════════════════════════════════════════════════════════ */

.cs-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 8, 15, 0.72);
  animation: csFadeIn 0.15s ease-out;
}
.cs-modal-overlay[hidden] { display: none; }

.cs-modal {
  width: 340px;
  max-width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  animation: csPopIn 0.18s ease-out;
}
.cs-modal-icon  { font-size: 30px; line-height: 1; margin-bottom: 10px; }
.cs-modal-title {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.cs-modal-desc {
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 20px;
}
.cs-modal-btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--bg-base);
  background: var(--teal);
  border: none;
  border-radius: var(--radius-md);
  padding: 9px 30px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.cs-modal-btn:hover  { opacity: 0.88; }
.cs-modal-btn:active { transform: scale(0.97); }
.cs-modal-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@keyframes csFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes csPopIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 991px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.7); }
  .app-main { margin-left: 0; }
  .topbar-toggle { display: block; }
  .mode-strip-right { width: 100%; }
}

@media (max-width: 600px) {
  .app-content { padding: 14px 14px 24px; gap: 12px; }
  .mode-strip  { flex-direction: column; align-items: flex-start; }
  .mode-selector { width: 100%; }
}

/* ════════════════════════════════════════════════════════════
   DELTA API PAGE — Module 1
   ════════════════════════════════════════════════════════════ */

.deltaapi-panel { margin-bottom: 18px; }

.deltaapi-kv { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.deltaapi-kv-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.deltaapi-kv-row:last-child { border-bottom: none; }
.deltaapi-kv-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.deltaapi-kv-value { font-size: 13px; color: var(--text-primary); }
.deltaapi-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

.deltaapi-empty-hint {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 14px; padding: 12px 14px;
  background: var(--amber-dim); color: var(--amber);
  border: 1px solid rgba(245,158,11,0.3); border-radius: var(--radius-md);
  font-size: 12.5px; line-height: 1.6;
}
.deltaapi-empty-hint code {
  background: rgba(0,0,0,0.25); padding: 1px 5px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 11.5px; color: inherit;
}

.deltaapi-actions {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
.deltaapi-test-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--teal-dim); color: var(--teal);
  border: 1px solid rgba(0,212,170,0.35);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.deltaapi-test-btn:hover:not(:disabled) { background: rgba(0,212,170,0.2); }
.deltaapi-test-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.deltaapi-test-btn-loading i { animation: deltaapi-spin 0.8s linear infinite; }
@keyframes deltaapi-spin { to { transform: rotate(360deg); } }
.deltaapi-test-note { font-size: 11.5px; color: var(--text-muted); max-width: 480px; line-height: 1.6; }
.deltaapi-test-note code { font-family: var(--font-mono); color: var(--text-secondary); }

.deltaapi-result {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 12.5px; font-family: var(--font-mono); line-height: 1.6;
  border: 1px solid var(--border);
}
.deltaapi-result-ok   { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,0.3); }
.deltaapi-result-fail { background: var(--red-dim);   color: var(--red);   border-color: rgba(239,68,68,0.3); }

.deltaapi-roadmap { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.roadmap-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; font-size: 13px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.roadmap-item:last-child { border-bottom: none; }
.roadmap-item.roadmap-done { color: var(--green); }
.roadmap-item.roadmap-done i { color: var(--green); }
.roadmap-item.roadmap-next { color: var(--text-primary); font-weight: 600; }
.roadmap-item.roadmap-lock { color: var(--red); }
.roadmap-item.roadmap-lock i { color: var(--red); }

/* ════════════════════════════════════════════════════════════
   WEBHOOK LOGS PAGE — Module 2
   ════════════════════════════════════════════════════════════ */

.webhook-url-row { display: flex; align-items: center; gap: 8px; }
.webhook-url-row code {
  background: rgba(0,0,0,0.25); padding: 3px 8px; border-radius: 4px;
  font-size: 11.5px; color: var(--text-secondary); word-break: break-all;
}
.webhook-copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.webhook-copy-btn:hover { background: var(--teal-dim); color: var(--teal); }

.webhook-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 16px; color: var(--text-muted); text-align: center;
}
.webhook-empty-state i { font-size: 26px; }
.webhook-empty-state p { margin: 0; font-size: 12.5px; max-width: 420px; }

/* ════════════════════════════════════════════════════════════
   GENERIC SETTINGS FORMS — Module 3 (Orders / contract config)
   ════════════════════════════════════════════════════════════ */

.form-flash {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; padding: 11px 14px;
  border-radius: var(--radius-md); font-size: 12.5px; line-height: 1.6;
}
.form-flash-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.form-flash-error    { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,0.3); }

.settings-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; min-width: 160px; }
.form-field-wide { flex: 1 1 100%; }
.form-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, .form-select {
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: var(--font-mono); font-size: 13px;
  padding: 9px 12px; width: 100%;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--teal); }
.form-input::placeholder { color: var(--text-muted); }
.form-select:disabled, .form-option-locked { color: var(--text-muted); }
.form-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.btn-save {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--teal-dim); color: var(--teal);
  border: 1px solid rgba(0,212,170,0.35);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-save:hover { background: rgba(0,212,170,0.2); }

.contract-side-block {
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255,255,255,0.015);
}
.contract-side-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-weight: 700; font-size: 12.5px;
  margin-bottom: 12px;
}
.contract-side-title.ce { color: var(--teal); }
.contract-side-title.pe { color: var(--red); }

.mode-option-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mode-radio {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-hover);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.mode-radio input { accent-color: var(--teal); }
.mode-radio.locked { opacity: 0.45; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════
   OPTION DISCOVERY PAGE — Module 4, Step 4.1.1
   All rules below are scoped under .option-discovery-page (set on a
   wrapper div in app/Views/optiondiscovery/index.php) so they can never
   affect any other page — Dashboard, Orders, Trade History, Risk
   Manager, etc. — even if a class name were ever reused elsewhere.
   ════════════════════════════════════════════════════════════ */

.option-discovery-page .discovery-refresh-controls { display: flex; align-items: center; gap: 10px; }
.option-discovery-page .discovery-autorefresh-row { margin-top: 14px; }

/* Sticky header within a bounded, scrollable table area — not the whole
   page. Only applies to tables inside .option-discovery-page; the
   existing global .data-table styling elsewhere is untouched. */
.option-discovery-page .discovery-table-scroll {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.option-discovery-page .discovery-table-scroll table.data-table { margin: 0; border: none; }
.option-discovery-page .discovery-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-raised);
  box-shadow: 0 1px 0 var(--border);
}

.option-discovery-page .discovery-pagination {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.option-discovery-page .discovery-pagination-links { display: flex; gap: 10px; }

/* ════════════════════════════════════════════════════════════
   OPTION CHAIN — Module 4, Step 4.1.4
   Old list-view rules above (discovery-table-scroll, discovery-pagination,
   etc.) are now unused by the rewritten chain page but left in place —
   additive-only, no functional risk in keeping harmless dead CSS.
   All rules below stay scoped under .option-discovery-page.
   ════════════════════════════════════════════════════════════ */

.option-discovery-page .chain-header-panel { margin-bottom: 12px; }

.option-discovery-page .chain-top-row {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.option-discovery-page .chain-underlying-tabs { display: flex; gap: 6px; }
.option-discovery-page .chain-underlying-tab {
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--teal-dim); color: var(--teal);
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 700;
}
.option-discovery-page .chain-price-block { display: flex; flex-direction: column; gap: 2px; }
.option-discovery-page .chain-price-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.option-discovery-page .chain-price-value { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--text-primary); }
.option-discovery-page .chain-refresh-block { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.option-discovery-page .chain-autorefresh-label { padding: 6px 10px; font-size: 11.5px; }
.option-discovery-page .chain-status-text { font-size: 11.5px; color: var(--text-muted); min-width: 90px; }

.option-discovery-page .chain-expiry-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
  overflow-x: auto; padding-bottom: 4px;
}
.option-discovery-page .chain-expiry-tab {
  flex: 0 0 auto; padding: 7px 14px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text-secondary); font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s ease, color 0.15s ease;
}
.option-discovery-page .chain-expiry-tab:hover { background: var(--teal-dim); color: var(--teal); }
.option-discovery-page .chain-expiry-tab.active { background: var(--teal-dim); color: var(--teal); border-color: rgba(0,212,170,0.35); }

.option-discovery-page .chain-metrics-bar {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted); font-family: var(--font-mono);
}
.option-discovery-page .chain-metric { white-space: nowrap; }

/* Chain table — CSS grid rows, not a native <table>, so the strike
   column can use position:sticky reliably for the "sticky center
   column" requirement. */
.option-discovery-page .chain-table-panel { padding: 0; overflow: hidden; }
.option-discovery-page .chain-table-scroll { overflow-x: auto; }
.option-discovery-page .chain-header-row,
.option-discovery-page .chain-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(64px, 1fr)) 88px repeat(6, minmax(64px, 1fr));
  min-width: 900px;
}
.option-discovery-page .chain-header-row {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted);
  position: sticky; top: 0; z-index: 2;
}
.option-discovery-page .chain-row {
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px;
}
.option-discovery-page .chain-row:hover { background: var(--bg-hover); }
.option-discovery-page .chain-col,
.option-discovery-page .chain-strike-col {
  padding: 9px 8px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.option-discovery-page .chain-col-mark { color: var(--text-primary); font-weight: 600; }
.option-discovery-page .chain-strike-col {
  font-weight: 700; color: var(--amber);
  background: var(--bg-raised);
  position: sticky; left: 50%; transform: translateX(-50%);
  z-index: 1;
  box-shadow: -1px 0 0 var(--border), 1px 0 0 var(--border);
}
.option-discovery-page .chain-header-row .chain-strike-col { z-index: 3; color: var(--text-muted); }

/* ATM row — orange horizontal line, per spec. */
.option-discovery-page .chain-row.atm {
  background: var(--amber-dim);
  border-top: 2px solid var(--amber);
  border-bottom: 2px solid var(--amber);
}
.option-discovery-page .chain-row.atm .chain-strike-col { background: var(--amber-dim); }

@media (max-width: 700px) {
  .option-discovery-page .chain-top-row { gap: 12px; }
  .option-discovery-page .chain-refresh-block { margin-left: 0; width: 100%; justify-content: space-between; }
}

/* Module 9 UI Polish — "Not Available" card state (Balance/P&L cards
   with no persisted data source). Purely visual: reduced emphasis so
   these cards read as honestly-empty rather than broken or equal in
   weight to real, populated cards. */
.stat-card-unavailable {
  opacity: 0.72;
  border-style: dashed;
}
.stat-card-unavailable .stat-card-value {
  font-weight: 500;
}

/* Module 9 UI Polish — Delta/Dhan broker columns (two-column responsive
   grid, same pattern as .logs-row) and a denser 2-column stat grid
   inside each column since only 4 cards fit per broker. */
.broker-columns-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .broker-columns-row { grid-template-columns: 1fr; } }

.stat-row-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 500px) { .stat-row-compact { grid-template-columns: 1fr; } }

/* ==================================================================
   Module 9 UI Polish v5 — final round before freeze
   ================================================================== */

/* Dashboard-only Premium Header — Option (a): global topbar.php is
   untouched, this block exists solely inside dashboard/index.php. */
.dash-premium-header {
  padding: 18px 24px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-med);
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-surface-2, var(--bg-surface)));
}
.dash-premium-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
  white-space: normal;
}
.dash-premium-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.dash-premium-sep { color: var(--text-muted); }
.dash-premium-mode { font-weight: 600; }
.dash-premium-time { color: var(--text-muted); }

/* Generic 2-column / 4-column responsive row helpers used throughout
   the v5 dashboard hierarchy. */
.dash-row { margin-bottom: 16px; }
.dash-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px) { .dash-row-2col { grid-template-columns: 1fr; } }
.dash-row-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .dash-row-4col { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .dash-row-4col { grid-template-columns: 1fr; } }

/* Compact Engine Status — additive modifier, does not alter the base
   .mode-strip rule (which today is only used on this page, but kept
   untouched in case a future page reuses the base style). */
.mode-strip-compact {
  padding: 10px 18px;
  gap: 12px;
}
.mode-strip-compact .mode-pulse-ring { width: 28px; height: 28px; }
.mode-strip-compact .mode-strip-label { font-size: 11px; }
.mode-strip-compact .mode-strip-value { font-size: 15px; }

/* Broker Summary — two distinct panels, own background/border/heading,
   not loose cards. */
.broker-summary-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) { .broker-summary-wrap { grid-template-columns: 1fr; } }

.broker-panel {
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.broker-panel-header {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: var(--bg-surface-2, rgba(255,255,255,0.03));
  border-bottom: 1px solid var(--border);
}
.broker-panel-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.broker-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.broker-row > span:first-child { color: var(--text-secondary); }
.broker-panel-footer { padding: 8px 16px 12px; margin: 0; }

/* Market Controls — grey disabled-switch look. Purely visual: no
   <button>, no <input>, no JS listener, no data-* toggle attribute
   anywhere in the markup that produces this. */
.market-control-list { display: flex; flex-direction: column; gap: 10px; }
.market-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.market-control-row:last-child { border-bottom: none; }
.market-control-name { flex: 1; font-weight: 600; font-size: 13px; }
.market-control-state { color: var(--text-muted); font-size: 12px; }
.market-control-switch {
  width: 34px; height: 18px;
  border-radius: 999px;
  background: var(--border-med);
  display: inline-block;
  position: relative;
  opacity: 0.6;
}
.market-control-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* Quick-link tiles (Row 4) — reuse already-fetched overview counts,
   link to the matching ?view= tab. Plain <a>, GET only, no write. */
.quick-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}
.quick-tile:hover { border-color: var(--border-med); text-decoration: none; color: inherit; }
.quick-tile-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.quick-tile-value { font-size: 20px; font-weight: 700; }

/* Module 16 — auto-refresh live indicator + progress bar (external CSS, CSP-compliant, no inline styles) */
.mi-live-badge { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600; color: var(--green); }
.mi-live-dot { width:7px; height:7px; border-radius:50%; background: var(--green); flex-shrink:0; }
.mi-refresh-track { width:80px; height:6px; border-radius:3px; background: var(--border-med); overflow:hidden; display:inline-block; vertical-align:middle; }
.mi-refresh-fill { height:100%; background: var(--green); transition: width 1s linear; }
.mi-refresh-fill-0   { width:0%; }
.mi-refresh-fill-10  { width:10%; }
.mi-refresh-fill-20  { width:20%; }
.mi-refresh-fill-30  { width:30%; }
.mi-refresh-fill-40  { width:40%; }
.mi-refresh-fill-50  { width:50%; }
.mi-refresh-fill-60  { width:60%; }
.mi-refresh-fill-70  { width:70%; }
.mi-refresh-fill-80  { width:80%; }
.mi-refresh-fill-90  { width:90%; }
.mi-refresh-fill-100 { width:100%; }

/* Module 16 — full CSP cleanup: every inline style="" attribute
   replaced with a semantic class below. Color variants
   (.mi-structure-bullish/-bearish/-range) are selected in PHP purely
   by class name — no dynamic color value is ever written into HTML. */
.mi-header-controls { display:flex; align-items:center; gap:12px; font-size:13px; white-space:nowrap; }
.mi-toggle-link { text-decoration:none; }

.mi-structure-panel { margin-top:16px; padding:16px; border-radius:10px; }
.mi-structure-bullish { background: var(--green-dim); border: 1px solid var(--green); }
.mi-structure-bearish { background: var(--red-dim);   border: 1px solid var(--red); }
.mi-structure-range   { background: var(--amber-dim); border: 1px solid var(--amber); }

.mi-structure-header { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.mi-structure-icon { font-size:18px; }
.mi-structure-bullish .mi-structure-icon, .mi-structure-bullish .mi-structure-zone-label { color: var(--green); }
.mi-structure-bearish .mi-structure-icon, .mi-structure-bearish .mi-structure-zone-label { color: var(--red); }
.mi-structure-range   .mi-structure-icon, .mi-structure-range   .mi-structure-zone-label { color: var(--amber); }

.mi-structure-price-block { text-align:center; margin-bottom:16px; }
.mi-structure-price-block .form-hint { margin-bottom:2px; }
.mi-structure-price-value { font-size:24px; font-weight:600; }

.mi-levels-ladder { display:flex; flex-direction:column; gap:6px; max-width:320px; margin:0 auto; }
.mi-level-row { display:flex; justify-content:space-between; padding:6px 10px; border-radius:6px; }
.mi-level-bullish { background: rgba(34, 197, 94, 0.08); }
.mi-level-range   { background: rgba(245, 158, 11, 0.08); }
.mi-level-bearish { background: rgba(239, 68, 68, 0.08); }

.mi-metrics-row { display:flex; justify-content:center; gap:24px; margin-top:14px; flex-wrap:wrap; }
.mi-metric-block { text-align:center; }
.mi-metric-block .form-hint { margin-bottom:2px; }

.mi-structure-warning { margin-top:14px; padding:10px 14px; border-radius:8px; background: var(--amber-dim); border: 1px solid var(--amber); text-align:center; }
.mi-structure-warning .bi { color: var(--amber); }

.mi-structure-sentence { margin-top:14px; margin-bottom:0; text-align:center; }

.mi-reasons-block { margin-top:12px; }
.mi-reasons-list { list-style:none; padding-left:0; margin-top:8px; }
.mi-reasons-list li { padding:4px 0; }

/* Module 16 — live broker price vs. confirmed candle close, kept
   visually distinct on purpose (see MarketConditionRuleEngine's own
   docblock for why they must never be conflated). */
.mi-dual-price-row { display:flex; justify-content:center; gap:32px; flex-wrap:wrap; margin-bottom:16px; }
.mi-price-meta { margin-top:2px; font-size:11px; }
.mi-structure-price-value-secondary { font-size:18px; font-weight:600; opacity:0.85; }

.mi-live-position { margin-bottom:16px; padding:10px 14px; border-radius:8px; text-align:center; }
.mi-live-position-label { display:block; font-size:11px; text-transform:uppercase; letter-spacing:0.3px; opacity:0.8; margin-bottom:3px; }

/* Module 17 Phase 1 — Live Markets Strip. Freshness badges reuse the
   existing --green/--amber/--border-med variables, same convention as
   every badge class since Module 9. */
.live-markets-strip { display:flex; gap:12px; flex-wrap:wrap; padding:14px 16px; border-radius:var(--radius-lg); border:1px solid var(--border); background:var(--bg-surface); }
.live-markets-strip.live-markets-reconnecting { border-color:var(--amber); }
.live-market-card { display:flex; flex-direction:column; gap:2px; min-width:130px; flex:1; }
.live-market-symbol { font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.3px; }
.live-market-price { font-size:18px; font-weight:700; }
.live-market-status { font-size:11px; padding:2px 0; }
.live-market-badge-live { color:var(--green); }
.live-market-badge-delayed { color:var(--amber); }
.live-market-badge-off { color:var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   MODULE 18C — POSITION ANALYTICS PAGE
   Additive only. Does not modify any rule above this point.
   New classes only — no existing selector is redefined.
   ════════════════════════════════════════════════════════════ */

.pa-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Page-level refresh-state badge. Distinct from .badge-signal-status
   variants (which are used for per-position risk/fetch state) so the
   two concepts never share a visual vocabulary that could be confused. */
.pa-refresh-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.pa-refresh-loading       { background: var(--border-med);  color: var(--text-muted); }
.pa-refresh-live          { background: var(--green-dim);   color: var(--green); }
.pa-refresh-reconnecting  { background: var(--amber-dim);   color: var(--amber); }
.pa-refresh-stale         { background: var(--amber-dim);   color: var(--amber); }

/* Genuine-zero P&L — deliberately distinct from .text-pos/.text-neg so a
   real zero is never visually implied to be a gain or a loss. */
.pa-zero { color: var(--text-secondary); }

/* One panel per open position. Base .panel is reused as-is; this only
   adds the INVALID_POSITION visual treatment, matching the existing
   .stat-card-unavailable "honestly empty, not broken" language. */
.pa-position-panel-invalid {
  opacity: 0.72;
  border-style: dashed;
}

/* Responsive 2-column grouping of field-sections (Identity, Premium & P&L,
   Market Data, Greeks, Risk & Data State) inside one position panel. */
.pa-panel-groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 10px;
}
@media (max-width: 700px) {
  .pa-panel-groups { grid-template-columns: 1fr; }
}

.pa-field-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

/* Secondary, smaller "Contract" (raw, non-position-adjusted) Greek value,
   shown alongside the primary position-adjusted value — never implies a
   unit or percentage, matches .form-hint's existing muted-caption weight. */
.pa-greek-contract {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* Compact secondary Market Data / IV row — smaller than the primary
   .deltaapi-kv-value rows used elsewhere in the same panel. */
.pa-iv-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.pa-iv-row .mono { color: var(--text-primary); }

/* ════════════════════════════════════════════════════════════
   MODULE 19C — EXIT INTELLIGENCE (Position Analytics page)
   Additive only. Does not modify any rule above this point.
   All selectors scoped under .pa-ei-* — zero existing selectors touched.
   No animation/flashing/pulsing anywhere in this block.
   ════════════════════════════════════════════════════════════ */

.pa-ei-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 8px;
}

.pa-ei-rec-badge,
.pa-ei-conf-badge,
.pa-ei-ds-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Recommendation tones — six distinct visual treatments, no reuse of
   .badge-signal-status's four existing tones, since that vocabulary
   cannot express six genuinely distinct severities without ambiguity. */
.pa-ei-rec-hold        { background: var(--blue-dim); color: var(--blue); }
.pa-ei-rec-monitor     { background: var(--amber-dim); color: var(--amber); }
.pa-ei-rec-protect     { background: var(--teal-dim); color: var(--teal); }
.pa-ei-rec-exitsoon    { background: var(--amber-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.4); }
.pa-ei-rec-exit        { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }
.pa-ei-rec-unavailable { background: var(--border-med); color: var(--text-muted); }

/* Confidence tones — reuse the existing green/amber/gray palette,
   same polarity as risk/confidence badges used elsewhere in this project. */
.pa-ei-conf-high        { background: var(--green-dim); color: var(--green); }
.pa-ei-conf-medium      { background: var(--amber-dim); color: var(--amber); }
.pa-ei-conf-unavailable { background: var(--border-med); color: var(--text-muted); }

/* Data-state tones — BLOCKED uses gray, not red, so it never visually
   competes with the EXIT recommendation badge on the same panel. */
.pa-ei-ds-complete { background: var(--green-dim); color: var(--green); }
.pa-ei-ds-partial  { background: var(--amber-dim); color: var(--amber); }
.pa-ei-ds-blocked  { background: var(--border-med); color: var(--text-muted); }

.pa-ei-primary-reason {
  font-size: 12.5px;
  color: var(--text-primary);
  margin: 4px 0 6px;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.pa-ei-missing {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin: 4px 0;
}

.pa-ei-supporting-list,
.pa-ei-data-list,
.pa-ei-other-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.pa-ei-supporting-item,
.pa-ei-data-item,
.pa-ei-other-item {
  font-size: 11.5px;
  color: var(--text-secondary);
  padding: 2px 0 2px 14px;
  position: relative;
  line-height: 1.4;
  overflow-wrap: break-word;
}
.pa-ei-supporting-item::before,
.pa-ei-data-item::before,
.pa-ei-other-item::before {
  content: '\2022';
  position: absolute;
  left: 2px;
  color: var(--text-muted);
}

.pa-ei-positive { color: var(--green); }
.pa-ei-negative { color: var(--text-secondary); }

/* Data-state reasons get a distinct muted treatment so a missing-input
   fact is never confused with an advisory judgment. */
.pa-ei-data-item { color: var(--text-muted); font-style: italic; }

.pa-ei-inputs {
  margin: 6px 0 8px;
  font-size: 11.5px;
}
.pa-ei-inputs summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 0;
}
.pa-ei-inputs[open] summary {
  color: var(--text-primary);
}

.pa-ei-input-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border-med);
}
.pa-ei-input-row:last-child { border-bottom: none; }

.pa-ei-input-label {
  color: var(--text-secondary);
  flex: 1 1 auto;
  min-width: 110px;
}
.pa-ei-input-value {
  color: var(--text-primary);
}
.pa-ei-input-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pa-ei-disclaimer {
  font-size: 10.5px;
  color: var(--text-muted);
  margin: 6px 0 2px;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.pa-ei-computed-at {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin: 0;
}

@media (max-width: 700px) {
  .pa-ei-input-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* ════════════════════════════════════════════════════════════
   MODULE 19D — COMPACT EXIT INTELLIGENCE (Main Dashboard)
   Additive only. Does not modify any rule above this point,
   including no change to any Module 19C .pa-ei-* selector.
   All new selectors scoped under .dashboard-ei*.
   No animation/flashing/pulsing/keyframes anywhere in this block.
   ════════════════════════════════════════════════════════════ */

.dashboard-ei {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-med);
}

.dashboard-ei-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.dashboard-ei-summary-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dashboard-ei-headline {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dashboard-ei-degraded-badge {
  font-size: 10.5px;
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 320px;
}

.dashboard-ei-degraded-strong {
  border: 1px solid var(--amber);
}

.dashboard-ei-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 8px;
}

.dashboard-ei-count-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.dashboard-ei-positions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.dashboard-ei-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-med);
  font-size: 11px;
}
.dashboard-ei-row:last-child { border-bottom: none; }

.dashboard-ei-row-symbol {
  flex: 1 1 auto;
  min-width: 120px;
  color: var(--text-primary);
  overflow-wrap: break-word;
  word-break: break-word;
}

.dashboard-ei-row-rec,
.dashboard-ei-row-conf,
.dashboard-ei-row-ds {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dashboard-ei-more {
  display: inline-block;
  font-size: 11px;
  color: var(--blue);
  text-decoration: none;
}
.dashboard-ei-more:hover { text-decoration: underline; }
.dashboard-ei-more[hidden] { display: none; }

@media (max-width: 700px) {
  .dashboard-ei-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .dashboard-ei-degraded-badge {
    max-width: 100%;
  }
}

/* ════════════════════════════════════════════════════════════
   MODULE 20B-3 — Dashboard secondary summary lines (Position
   Health / Profit Protection). Additive only. Reuses every
   existing .pa-ei-rec-*/.dashboard-ei-* tone/layout class
   unchanged — only this one new layout selector is added.
   No animation/flashing/pulsing.
   ════════════════════════════════════════════════════════════ */

.dashboard-ei-summary-secondary {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-med);
}

/* BEGIN MODULE21A0 QR SIZE FIX */
.totp-qr-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}
.totp-qr-wrap svg {
  display: block;
  width: 260px;
  max-width: 100%;
  height: auto;
}
/* END MODULE21A0 QR SIZE FIX */

/* BEGIN MODULE21A0 AUTH CARD FIX */
.auth-card {
  width: calc(100% - 32px);
  max-width: 460px;
  margin: 40px auto;
  padding: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.auth-card-wide { max-width: 620px; }
.auth-card .auth-logo { margin: 0 auto 18px; }
.auth-card > .auth-title,
.auth-card > .auth-subtitle { text-align: center; }
@media (max-width: 576px) {
  .auth-card {
    margin: 16px auto;
    padding: 22px 18px;
  }
}
/* END MODULE21A0 AUTH CARD FIX */
