/* CRUDE TRADER Institutional Dark & Light Design System */
:root {
  --bg-primary: #0b0e14;
  --bg-secondary: #121824;
  --bg-card: #182234;
  --bg-hover: #202d44;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --border-color: #26354d;
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.12);
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #f1f5f9;
  --bg-hover: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border-color: #cbd5e1;
  --accent-green: #059669;
  --accent-green-bg: rgba(5, 150, 105, 0.12);
  --accent-red: #dc2626;
  --accent-red-bg: rgba(220, 38, 38, 0.12);
  --accent-blue: #2563eb;
  --accent-amber: #d97706;
  --accent-cyan: #0284c7;
  --accent-purple: #7c3aed;
  --accent-indigo: #4f46e5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* Header */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem !important;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 0.65rem !important;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo-box {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  letter-spacing: 1px;
}
.brand-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.5px; }
.brand-sub { font-size: 0.7rem; color: var(--text-muted); }

/* Navigation Tabs */
.nav-tabs { display: flex; gap: 0.5rem; }
.nav-tab {
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-tab:hover { color: var(--text-main); background: var(--bg-hover); }
.nav-tab.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.header-pills { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.status-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-main);
}
.status-pill.info { color: var(--accent-blue); border-color: var(--accent-blue); }
.status-pill.pulse-green {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background-color: var(--accent-green-bg);
}
.status-pill.danger {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background-color: var(--accent-red-bg);
}
.telegram-pill {
  border-color: #229ED9;
  color: #229ED9;
  background: rgba(34, 158, 217, 0.1);
}
.telegram-pill:hover { background: rgba(34, 158, 217, 0.2); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.btn-action-broker {
  background: var(--bg-card);
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action-broker:hover { background: var(--accent-blue); color: #fff; }
.btn-kill {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  font-weight: 800;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: all 0.2s;
}
.btn-kill:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6); }
.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

/* Emergency Halted Top Banner */
.emergency-banner {
  background: linear-gradient(90deg, #991b1b, #dc2626);
  color: #fff;
  padding: 0.85rem 2rem;
  border-bottom: 2px solid #ef4444;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
  animation: pulseBg 2s infinite;
}
@keyframes pulseBg {
  0% { opacity: 0.95; }
  50% { opacity: 1; }
  100% { opacity: 0.95; }
}
.emergency-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.emergency-icon { font-size: 1.8rem; }
.emergency-text strong { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.5px; }
.emergency-text p { font-size: 0.8rem; opacity: 0.9; }
.btn-emergency-resume {
  background: #10b981;
  color: #064e3b;
  border: none;
  padding: 0.65rem 1.4rem;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}
.btn-emergency-resume:hover { background: #34d399; transform: scale(1.03); }

/* Toast */
.toast-notification {
  position: fixed;
  top: 75px;
  right: 25px;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Calendar Bar */
.calendar-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.calendar-inputs { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.date-picker-group { display: flex; flex-direction: column; gap: 0.35rem; }
.date-picker-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.date-picker-group input, .select-styled {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}
.select-styled { font-family: var(--font-family); font-weight: 600; }
.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.calendar-presets { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.preset-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-right: 0.3rem; }
.btn-preset {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-preset.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* KPI Banner */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem 0.5rem;
}
.kpi-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.kpi-card.highlight { border-left: 4px solid var(--accent-green); }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.kpi-val { font-size: 1.4rem; font-weight: 800; }
.kpi-val.mono { font-family: var(--font-mono); }
.kpi-val.danger { color: var(--accent-red); }
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); }
.safe-buffer { color: var(--accent-green); font-weight: 600; }
.badge-gate {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border-radius: 4px;
}
.badge-normal {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border-radius: 4px;
  font-weight: 700;
}

/* Layouts */
.main-layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 1.5rem;
  padding: 1rem 2rem;
}
.analytics-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 2rem;
}
@media (max-width: 1100px) {
  .main-layout { grid-template-columns: 1fr; }
}

.panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.panel-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h2 { font-size: 0.92rem; font-weight: 700; }
.panel-body { padding: 1.25rem; }

/* --- Strategy Matrix & Real-Time Commentary (Compact Institutional Redesign) --- */
.strategy-matrix-panel .panel-header.matrix-header {
  padding: 0.55rem 0.9rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}
.matrix-header-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.matrix-header-title-group h2 {
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
}
.matrix-badge {
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  padding: 0.15rem 0.5rem !important;
  border-radius: 4px !important;
}
.matrix-tg-link {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-blue);
  text-decoration: none;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.matrix-tg-link:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--accent-blue);
  color: #60a5fa;
}

.strategy-matrix-panel .panel-body.matrix-panel-body {
  padding: 0.55rem 0.85rem 0.75rem !important;
}

/* Compact AI Commentary Strip */
.matrix-commentary-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-left: 3px solid var(--accent-blue);
  border-radius: 5px;
  padding: 0.32rem 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
}
.matrix-pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}
.matrix-commentary-tag {
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--accent-blue);
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.matrix-commentary-text {
  color: var(--text-muted);
  font-size: 0.71rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* 2-Column Responsive Matrix Grid */
.checklist-container.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}
@media (max-width: 540px) {
  .checklist-container.matrix-grid {
    grid-template-columns: 1fr;
  }
}

/* High-Tech Compact Matrix Card */
.matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.42rem 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.22rem;
  min-height: 52px;
  transition: all 0.15s ease-in-out;
  position: relative;
  overflow: hidden;
}
.matrix-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}
.matrix-card.status-pass {
  border-left: 3px solid var(--accent-green);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-card) 60%);
}
.matrix-card.status-wait {
  border-left: 3px solid var(--accent-amber);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-card) 60%);
}
.matrix-card.status-fail {
  border-left: 3px solid var(--accent-red);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-card) 60%);
}
.matrix-card.status-bypass {
  border-left: 3px solid #3b82f6;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, var(--bg-card) 60%);
}

.matrix-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.matrix-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
}
.matrix-card-icon {
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
}
.matrix-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.matrix-card-badge {
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 0.1rem 0.38rem;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.matrix-card-badge.pass {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.matrix-card-badge.wait {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.matrix-card-badge.fail {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.matrix-card-badge.bypass {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.matrix-card-rule {
  font-size: 0.63rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.matrix-card-rule b {
  color: var(--text-main);
  font-weight: 600;
}
.matrix-card-val {
  font-size: 0.67rem;
  font-family: var(--font-mono);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Events Grid */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.event-top { display: flex; justify-content: space-between; align-items: center; }
.event-country { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.event-impact {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: var(--accent-red-bg);
  color: var(--accent-red);
}
.event-title { font-size: 0.85rem; font-weight: 700; }
.event-time { font-size: 0.75rem; color: var(--accent-blue); font-family: var(--font-mono); }
.event-meta { font-size: 0.7rem; color: var(--text-muted); display: flex; gap: 0.75rem; }

/* Tactical Playbook */
.playbook-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.playbook-header {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-hover);
  font-size: 0.85rem;
}
.playbook-content { padding: 1rem; font-size: 0.82rem; }
.playbook-steps { padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.playbook-steps li { line-height: 1.45; }

/* Canvas */
#equityCanvas {
  width: 100%;
  height: 280px;
  display: block;
  background: var(--bg-card);
  border-radius: 6px;
}

/* Position View */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.radar-scan {
  width: 36px;
  height: 36px;
  border: 2px solid var(--accent-blue);
  border-radius: 50%;
  margin-bottom: 0.85rem;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.hint-text { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; }
.hidden { display: none !important; }

.pos-details { display: flex; flex-direction: column; gap: 1rem; }
.pos-row { display: flex; justify-content: space-between; align-items: center; }
.pos-sym { font-weight: 800; font-size: 1.1rem; }
.pos-badge-lots {
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}
.pos-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.85rem;
  border-radius: 8px;
}
.pos-metrics div { display: flex; flex-direction: column; gap: 0.2rem; }
.pos-metrics .lbl { font-size: 0.65rem; color: var(--text-muted); }
.pos-metrics .val { font-size: 0.95rem; font-weight: 700; }
.val.danger { color: var(--accent-red); }
.val.success { color: var(--accent-green); }
.be-banner {
  background: var(--accent-green-bg);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

/* Modal Backdrop & Card */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 650px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.lock-icon-box { font-size: 2.5rem; text-align: center; }
.modal-body h3 { font-size: 1rem; font-weight: 700; text-align: center; }
.modal-sub { font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.pin-input-box { display: flex; justify-content: center; margin: 0.5rem 0; }
.pin-input-box input {
  font-size: 1.5rem;
  letter-spacing: 6px;
  text-align: center;
  width: 200px;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--accent-blue);
  color: var(--text-main);
  border-radius: 8px;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}
.settings-section h3 {
  font-size: 0.85rem;
  text-align: left;
  margin-bottom: 0.75rem;
  color: var(--accent-blue);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.form-group input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.65rem;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.75rem;
}
.full-width { width: 100%; }

/* Table */
.table-responsive { overflow-x: auto; max-height: 380px; }
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.ledger-table th, .ledger-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.ledger-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  z-index: 10;
}
.btn-small {
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.text-center { text-align: center; color: var(--text-muted); }


/* --- Angel Connect Disabled State --- */
.btn-action-broker.btn-disabled-connected {
  background: var(--bg-card) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-color) !important;
  cursor: not-allowed !important;
  opacity: 0.65 !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

/* --- Compact 7-Day Events Grid --- */
.events-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.event-card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.event-card-compact:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}
.event-days-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.event-title-compact {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}
.event-time-compact {
  font-size: 0.72rem;
  color: var(--accent-blue);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.event-meta-compact {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.3rem;
  margin-top: 0.2rem;
}

/* Compact Tactical Playbook */
.playbook-box-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}
.playbook-header-compact {
  padding: 0.5rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-hover);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.playbook-header-compact:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* Badges for Lots & Trade Results */
.badge-lot {
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
  display: inline-block;
}
.badge-lot-3 { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-lot-2 { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-lot-1 { background: rgba(168, 85, 247, 0.15); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }

.badge-call { background: rgba(34, 197, 94, 0.12); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.25); }
.badge-put { background: rgba(239, 68, 68, 0.12); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-win { background: rgba(34, 197, 94, 0.12); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.25); }
.badge-loss { background: rgba(239, 68, 68, 0.12); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-be { background: rgba(234, 179, 8, 0.12); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.25); }

/* Interactive Filter Pills for Lots & Strategies */
.filter-pill {
  cursor: pointer;
  user-select: none;
  transition: all 0.16s ease-in-out;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: inherit;
  border: 1px solid transparent;
  background: transparent;
  outline: none;
}
.filter-pill:hover {
  filter: brightness(1.3);
  transform: translateY(-1px);
}
.filter-pill.active {
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  outline: 2px solid #38bdf8;
  filter: brightness(1.2);
}
.badge-strat-all { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-strat-classic { background: rgba(148, 163, 184, 0.18); color: #e2e8f0; border: 1px solid rgba(148, 163, 184, 0.4); }
.badge-strat-profit_lock { background: rgba(245, 158, 11, 0.18); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.45); }
.badge-strat-wick_armor { background: rgba(96, 165, 250, 0.18); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.45); }
.badge-strat-kavach_pro { background: rgba(16, 185, 129, 0.18); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.45); }
.badge-strat-ng_flow { background: rgba(6, 182, 212, 0.18); color: #06b6d4; border: 1px solid rgba(6, 182, 212, 0.45); }

/* --- Light Theme Optimizations for Filter Pills & Strategy Badges --- */
body.light-theme .badge-strat-all {
  background: #e2e8f0 !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}
body.light-theme .badge-strat-classic {
  background: #e2e8f0 !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}
body.light-theme .badge-strat-profit_lock {
  background: rgba(217, 119, 6, 0.12) !important;
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.35) !important;
}
body.light-theme .badge-strat-wick_armor {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}
body.light-theme .badge-strat-kavach_pro {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #047857 !important;
  border: 1px solid rgba(5, 150, 105, 0.35) !important;
}
body.light-theme .badge-strat-ng_flow {
  background: rgba(14, 165, 233, 0.12) !important;
  color: #0369a1 !important;
  border: 1px solid rgba(14, 165, 233, 0.35) !important;
}

body.light-theme .badge-lot-3 {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #047857 !important;
  border: 1px solid rgba(5, 150, 105, 0.35) !important;
}
body.light-theme .badge-lot-2 {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #1d4ed8 !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}
body.light-theme .badge-lot-1 {
  background: rgba(147, 51, 234, 0.12) !important;
  color: #7e22ce !important;
  border: 1px solid rgba(147, 51, 234, 0.35) !important;
}

body.light-theme .badge-call {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #047857 !important;
  border: 1px solid rgba(5, 150, 105, 0.3) !important;
}
body.light-theme .badge-put {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(220, 38, 38, 0.3) !important;
}
body.light-theme .badge-win {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #047857 !important;
  border: 1px solid rgba(5, 150, 105, 0.3) !important;
}
body.light-theme .badge-loss {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #b91c1c !important;
  border: 1px solid rgba(220, 38, 38, 0.3) !important;
}
body.light-theme .badge-be {
  background: rgba(217, 119, 6, 0.12) !important;
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.3) !important;
}

body.light-theme .filter-pill {
  font-weight: 700 !important;
}
body.light-theme .filter-pill b {
  font-weight: 800 !important;
}
body.light-theme .filter-pill:hover {
  filter: none !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}
body.light-theme .filter-pill.active {
  box-shadow: 0 0 0 1px #0284c7, 0 2px 5px rgba(2, 132, 199, 0.25) !important;
  outline: 2px solid #0284c7 !important;
  filter: none !important;
}
body.light-theme .badge-strat-all.active {
  background: rgba(2, 132, 199, 0.14) !important;
  color: #0369a1 !important;
  border-color: #0284c7 !important;
}
body.light-theme .badge-strat-classic.active {
  background: rgba(2, 132, 199, 0.14) !important;
  color: #0369a1 !important;
  border-color: #0284c7 !important;
}

/* --- Strategy Conditions Matrix: Light Theme High-Contrast Aesthetics --- */
body.light-theme .strategy-matrix-panel {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
}
body.light-theme .strategy-matrix-panel .panel-header.matrix-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
body.light-theme .matrix-header-title-group h2 {
  color: #0f172a !important;
  font-weight: 800 !important;
}
body.light-theme .matrix-badge {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #10b981 !important;
  font-weight: 800 !important;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.15) !important;
}
body.light-theme .matrix-tg-link {
  background: #eff6ff !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
}
body.light-theme .matrix-tg-link:hover {
  background: #dbeafe !important;
  border-color: #2563eb !important;
  color: #1e40af !important;
}

/* Commodity Switcher Bar in Light Theme */
body.light-theme .commodity-switcher-bar {
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  padding: 0.45rem 0.85rem !important;
}
body.light-theme .comm-pill {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .comm-pill:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}
body.light-theme .comm-pill.active#commPill-CRUDEOIL {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  color: #1d4ed8 !important;
  box-shadow: 0 0 0 1px #2563eb, 0 2px 4px rgba(37, 99, 235, 0.15) !important;
}
body.light-theme .comm-pill.active#commPill-NATURALGAS {
  background: #fef2f2 !important;
  border-color: #dc2626 !important;
  color: #b91c1c !important;
  box-shadow: 0 0 0 1px #dc2626, 0 2px 4px rgba(220, 38, 38, 0.15) !important;
}
body.light-theme .comm-price-badge {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #0f172a !important;
  font-weight: 800 !important;
}

/* Strategy Switcher Bar in Light Theme */
body.light-theme .strategy-switcher-bar {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
body.light-theme .strat-pill {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .strat-pill:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}
body.light-theme .strat-pill.active {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  color: #1d4ed8 !important;
  box-shadow: 0 0 0 1px #2563eb, 0 2px 4px rgba(37, 99, 235, 0.15) !important;
}
body.light-theme .strat-pill.active[data-strat="KAVACH_PRO"] {
  background: #ecfdf5 !important;
  border-color: #059669 !important;
  color: #047857 !important;
  box-shadow: 0 0 0 1px #059669, 0 2px 4px rgba(5, 150, 105, 0.15) !important;
}
body.light-theme .strat-pill.active[data-strat="WICK_ARMOR"] {
  background: #fffbeb !important;
  border-color: #d97706 !important;
  color: #b45309 !important;
  box-shadow: 0 0 0 1px #d97706, 0 2px 4px rgba(217, 119, 6, 0.15) !important;
}
body.light-theme .strat-pill.active[data-strat="PROFIT_LOCK"] {
  background: #faf5ff !important;
  border-color: #9333ea !important;
  color: #7e22ce !important;
  box-shadow: 0 0 0 1px #9333ea, 0 2px 4px rgba(147, 51, 234, 0.15) !important;
}
body.light-theme .strat-pill.active[data-strat="NG_FLOW"] {
  background: #ecfeff !important;
  border-color: #0891b2 !important;
  color: #0e7490 !important;
  box-shadow: 0 0 0 1px #0891b2, 0 2px 4px rgba(8, 145, 178, 0.15) !important;
}
body.light-theme .rank-tag {
  background: rgba(15, 23, 42, 0.08) !important;
}

/* Strategy DNA Badges Strip in Light Theme */
body.light-theme .strategy-dna-strip {
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  padding: 0.45rem 0.85rem !important;
}
body.light-theme .dna-badge {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}
body.light-theme .dna-badge b {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* AI Commentary Strip in Light Theme */
body.light-theme .matrix-commentary-strip {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-left: 4px solid #2563eb !important;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.05) !important;
}
body.light-theme .matrix-commentary-tag {
  color: #1d4ed8 !important;
  font-weight: 800 !important;
}
body.light-theme .matrix-commentary-text {
  color: #1e293b !important;
  font-weight: 600 !important;
}
body.light-theme .matrix-pulse-dot {
  background: #2563eb !important;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.5) !important;
}

/* Strategy Matrix Panel Body */
body.light-theme .strategy-matrix-panel .panel-body.matrix-panel-body {
  background: #f8fafc !important;
}

/* Strategy Matrix Cards (High Contrast & Vibrant in Light Theme) */
body.light-theme .matrix-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 0.5rem 0.65rem !important;
  min-height: 56px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
body.light-theme .matrix-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04) !important;
}

/* Status: PASS */
body.light-theme .matrix-card.status-pass {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%) !important;
  border: 1px solid #86efac !important;
  border-left: 4px solid #059669 !important;
}
body.light-theme .matrix-card.status-pass:hover {
  border-color: #4ade80 !important;
  border-left-color: #047857 !important;
}
body.light-theme .matrix-card.status-pass .matrix-card-val {
  color: #065f46 !important;
  font-weight: 700 !important;
}

/* Status: FAIL */
body.light-theme .matrix-card.status-fail {
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%) !important;
  border: 1px solid #fca5a5 !important;
  border-left: 4px solid #dc2626 !important;
}
body.light-theme .matrix-card.status-fail:hover {
  border-color: #f87171 !important;
  border-left-color: #b91c1c !important;
}
body.light-theme .matrix-card.status-fail .matrix-card-val {
  color: #991b1b !important;
  font-weight: 700 !important;
}

/* Status: WAIT / PENDING */
body.light-theme .matrix-card.status-wait {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%) !important;
  border: 1px solid #fde68a !important;
  border-left: 4px solid #d97706 !important;
}
body.light-theme .matrix-card.status-wait:hover {
  border-color: #fcd34d !important;
  border-left-color: #b45309 !important;
}
body.light-theme .matrix-card.status-wait .matrix-card-val {
  color: #92400e !important;
  font-weight: 700 !important;
}

/* Status: BYPASS / ARMED */
body.light-theme .matrix-card.status-bypass {
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%) !important;
  border: 1px solid #bfdbfe !important;
  border-left: 4px solid #2563eb !important;
}
body.light-theme .matrix-card.status-bypass:hover {
  border-color: #93c5fd !important;
  border-left-color: #1d4ed8 !important;
}
body.light-theme .matrix-card.status-bypass .matrix-card-val {
  color: #1e40af !important;
  font-weight: 700 !important;
}

/* Card Elements Typography */
body.light-theme .matrix-card-title {
  font-size: 0.74rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  letter-spacing: -0.2px !important;
}
body.light-theme .matrix-card-icon {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1)) !important;
}
body.light-theme .matrix-card-rule {
  font-size: 0.64rem !important;
  color: #475569 !important;
  font-weight: 500 !important;
}
body.light-theme .matrix-card-rule b {
  color: #1e293b !important;
  font-weight: 700 !important;
}
body.light-theme .matrix-card-val {
  font-size: 0.68rem !important;
  font-family: var(--font-mono) !important;
  background: rgba(241, 245, 249, 0.75) !important;
  padding: 0.12rem 0.4rem !important;
  border-radius: 4px !important;
  border: 1px solid rgba(203, 213, 225, 0.5) !important;
  letter-spacing: -0.2px !important;
}

/* High-Contrast Badges */
body.light-theme .matrix-card-badge {
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.4px !important;
  padding: 0.12rem 0.45rem !important;
  border-radius: 4px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .matrix-card-badge.pass {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}
body.light-theme .matrix-card-badge.fail {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1px solid #fca5a5 !important;
}
body.light-theme .matrix-card-badge.wait {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fcd34d !important;
}
body.light-theme .matrix-card-badge.bypass {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #93c5fd !important;
}


/* ============================================================= */
/* RESPONSIVE LAYOUT ENGINE (OPTIMIZED FOR 1366px & ALL DESKTOPS) */
/* ============================================================= */

/* --- Top Navigation Bar --- */
.top-nav {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.45rem 1.25rem !important;
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  gap: 0.75rem !important;
  min-height: 56px !important;
  box-sizing: border-box !important;
}

.brand {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex-shrink: 0 !important;
}
.logo-box {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  padding: 0.3rem 0.6rem !important;
  border-radius: 6px !important;
}
.brand-title {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.3px !important;
  line-height: 1 !important;
  margin: 0 !important;
}
.brand-sub {
  font-size: 0.65rem !important;
  color: var(--text-muted) !important;
  margin: 0 !important;
}

@media (max-width: 1450px) {
  .brand-sub {
    display: none !important;
  }
}

.nav-tabs {
  display: flex !important;
  gap: 0.25rem !important;
  flex-shrink: 0 !important;
}
.nav-tab {
  padding: 0.32rem 0.55rem !important;
  border-radius: 5px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-muted) !important;
  font-weight: 700 !important;
  font-size: 0.76rem !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
}
.nav-tab.active {
  background: var(--accent-blue) !important;
  color: #fff !important;
  border-color: var(--accent-blue) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
}

.header-right {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
}
.status-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  flex-wrap: nowrap !important;
  flex-shrink: 1 !important;
}
.action-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
}
.status-pill {
  padding: 0.18rem 0.42rem !important;
  border-radius: 20px !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  text-decoration: none !important;
  color: var(--text-main) !important;
  white-space: nowrap !important;
}

@media (max-width: 1400px) {
  #latencyPill, #netPill {
    display: none !important;
  }
}
@media (max-width: 1220px) {
  #modePill {
    display: none !important;
  }
}

.btn-action-broker {
  padding: 0.32rem 0.65rem !important;
  font-weight: 700 !important;
  font-size: 0.72rem !important;
  border-radius: 5px !important;
  white-space: nowrap !important;
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  color: #fff !important;
  border: none !important;
  padding: 0.32rem 0.65rem !important;
  font-weight: 800 !important;
  font-size: 0.72rem !important;
  border-radius: 5px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}
.btn-gear, .btn-icon {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 5px !important;
  cursor: pointer !important;
  font-size: 0.88rem !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}

/* --- Top Metrics Ribbon (5 Side-by-Side Cards) --- */
.metrics-ribbon {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 0.75rem !important;
  padding: 0.85rem 1.25rem !important;
  box-sizing: border-box !important;
}
.metric-card {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  padding: 0.65rem 0.85rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.2rem !important;
}
.metric-card:first-child { border-left: 3px solid var(--accent-blue) !important; }
.metric-card:nth-child(4) { border-left: 3px solid var(--accent-green) !important; }
.metric-label {
  font-size: 0.68rem !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
  letter-spacing: 0.4px !important;
}
.metric-value {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
  line-height: 1.2 !important;
}
.metric-value.mono { font-family: var(--font-mono) !important; }
.metric-sub {
  font-size: 0.66rem !important;
  color: var(--text-muted) !important;
  line-height: 1.3 !important;
}

/* --- Terminal Dual Grid Layout (Left Col / Right Col) --- */
.terminal-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
  padding: 0 1.25rem 1.5rem !important;
  align-items: start !important;
  box-sizing: border-box !important;
}
.left-col {
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  min-width: 0 !important;
}
.right-col {
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  min-width: 0 !important;
}

/* --- Panels & Headers --- */
.panel {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  margin-bottom: 0 !important;
}
.panel-header {
  padding: 0.65rem 1rem !important;
  border-bottom: 1px solid var(--border-color) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.5rem !important;
  background: rgba(255, 255, 255, 0.015) !important;
}
.panel-header h2 {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}
.panel-body {
  padding: 0.85rem 1rem !important;
}

/* --- Responsive Adaptations for 1366px Laptop Screens --- */
@media (max-width: 1400px) {
  .brand-sub { display: none !important; }
  .status-pill { padding: 0.22rem 0.45rem !important; font-size: 0.65rem !important; }
  .nav-tab { padding: 0.38rem 0.65rem !important; font-size: 0.74rem !important; }
  .btn-action-broker { padding: 0.35rem 0.65rem !important; font-size: 0.72rem !important; }
  .btn-danger { padding: 0.35rem 0.65rem !important; font-size: 0.72rem !important; }
}

@media (max-width: 1100px) {
  .terminal-grid { grid-template-columns: 1fr !important; }
  .metrics-ribbon { grid-template-columns: repeat(3, 1fr) !important; }
  .events-grid-compact { grid-template-columns: 1fr 1fr !important; }
}


    /* Prevent ANY horizontal scroll */
    html, body {
      max-width: 100vw !important;
      overflow-x: hidden !important;
    }

    /* Compact Header on 1366px screens */
    .top-nav {
      max-width: 100vw !important;
      overflow: visible !important;
      padding: 0.35rem 1rem !important;
      min-height: 52px !important;
      gap: 0.5rem !important;
    }
    .brand-title {
      font-size: 1rem !important;
    }
    .status-pill {
      padding: 0.2rem 0.45rem !important;
      font-size: 0.67rem !important;
    }
    .btn-action-broker {
      padding: 0.32rem 0.6rem !important;
      font-size: 0.72rem !important;
    }
    .btn-danger {
      padding: 0.32rem 0.65rem !important;
      font-size: 0.72rem !important;
    }
    .btn-gear, .btn-icon {
      padding: 0.32rem 0.5rem !important;
      font-size: 0.9rem !important;
    }

    /* Horizontal Calendar Controls Bar */
    .calendar-bar {
      background: var(--bg-secondary) !important;
      border-bottom: 1px solid var(--border-color) !important;
      padding: 0.75rem 1.25rem !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 0.6rem !important;
    }
    .calendar-controls {
      display: flex !important;
      flex-direction: row !important;
      align-items: flex-end !important;
      gap: 0.75rem !important;
      flex-wrap: wrap !important;
    }
    .calendar-controls .input-group {
      display: flex !important;
      flex-direction: column !important;
      gap: 0.2rem !important;
    }
    .calendar-controls label {
      font-size: 0.72rem !important;
      font-weight: 700 !important;
      color: var(--text-muted) !important;
      white-space: nowrap !important;
    }
    .calendar-controls input[type="date"],
    .calendar-controls select {
      height: 34px !important;
      padding: 0.3rem 0.55rem !important;
      background: var(--bg-card) !important;
      border: 1px solid var(--border-color) !important;
      color: var(--text-main) !important;
      border-radius: 6px !important;
      font-size: 0.8rem !important;
      outline: none !important;
      box-sizing: border-box !important;
    }
    .calendar-controls .btn-primary {
      height: 34px !important;
      padding: 0 0.9rem !important;
      font-size: 0.78rem !important;
      font-weight: 700 !important;
      border-radius: 6px !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      white-space: nowrap !important;
      cursor: pointer !important;
      box-sizing: border-box !important;
    }


/* --- ULTRA-COMPACT HEADER GUARANTEE FOR 1366px --- */
html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

.top-nav {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.35rem 1rem !important;
  min-height: 52px !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  gap: 0.5rem !important;
  overflow: visible !important;
}

.header-right {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex-shrink: 0 !important;
}

.status-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.3rem !important;
  flex-shrink: 1 !important;
}

.action-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  flex-shrink: 0 !important;
}

.btn-gear, .btn-icon {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.95rem !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

/* Universal Interactive Tactile Button Feedback (:active micro-interactions) */
button:active,
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active,
.btn-icon:active,
.btn-gear:active,
.btn-preset:active,
.btn-pause-engine:active,
.btn-action-broker:not(.btn-disabled-connected):active,
.nav-tab:active,
.comm-pill:active,
.strat-score-card:active,
.strat-pill:active,
.btn-small:active,
.btn-apply:active,
.btn-tiny-refresh:active {
  transform: scale(0.95) translateY(1.5px) !important;
  filter: brightness(1.25) contrast(1.1) !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 10px rgba(59, 130, 246, 0.4) !important;
  transition: transform 0.04s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.04s ease !important;
}

button:focus-visible,
.btn:focus-visible,
.nav-tab:focus-visible {
  outline: 2px solid var(--accent-blue, #3b82f6) !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsive Architecture (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    padding-bottom: 3.5rem !important;
  }

  /* --- Mobile Top Navigation Header --- */
  .top-nav {
    display: flex !important;
    flex-direction: column !important;
    padding: 0.4rem 0.55rem !important;
    min-height: auto !important;
    gap: 0.35rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .brand {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    width: 100% !important;
    justify-content: flex-start !important;
  }
  .logo-box {
    font-size: 0.8rem !important;
    padding: 0.2rem 0.45rem !important;
  }
  .brand-title {
    font-size: 0.95rem !important;
    letter-spacing: -0.01em !important;
  }
  .brand-sub {
    display: none !important;
  }
  .header-right {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.35rem !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  .status-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .live-clock-badge {
    font-size: 0.70rem !important;
    padding: 0.15rem 0.45rem !important;
  }
  .live-clock-badge .clock-icon {
    font-size: 0.72rem !important;
  }
  .action-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .status-pill {
    padding: 0.15rem 0.4rem !important;
    font-size: 0.62rem !important;
    white-space: nowrap !important;
  }
  .btn-pause-engine {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.68rem !important;
    white-space: nowrap !important;
  }
  .btn-danger {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.68rem !important;
    white-space: nowrap !important;
  }
  .btn-gear, .btn-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.82rem !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .nav-tabs {
    width: 100% !important;
    order: 3 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.3rem !important;
    padding: 0.25rem 0 !important;
    border-top: 1px solid var(--border-color) !important;
    margin: 0 !important;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none !important;
  }
  .nav-tab {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.72rem !important;
    flex: 0 0 auto !important;
    text-align: center !important;
    white-space: nowrap !important;
  }
  .nav-dropdown {
    position: relative !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
  }
  .nav-dropdown .nav-tab {
    width: 100% !important;
  }
  #navToolsDropdown {
    left: auto !important;
    right: 0 !important;
    min-width: 210px !important;
  }

  /* --- Mobile Top Metrics Ribbon --- */
  .metrics-ribbon {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0.75rem !important;
  }
  .metric-card {
    padding: 0.5rem 0.65rem !important;
    min-width: 0 !important;
  }
  .metric-card:nth-child(3) {
    grid-column: span 2 !important;
  }
  .metric-card:last-child {
    grid-column: span 2 !important;
  }
  .metric-label {
    font-size: 0.62rem !important;
  }
  .metric-value {
    font-size: 1.05rem !important;
  }
  .metric-sub {
    font-size: 0.62rem !important;
    word-break: break-word !important;
  }

  /* --- Dual Column Terminal Layout on Mobile --- */
  .terminal-grid {
    grid-template-columns: 1fr !important;
    padding: 0 0.75rem 1rem !important;
    gap: 0.75rem !important;
  }
  .left-col, .right-col {
    width: 100% !important;
    gap: 0.75rem !important;
  }

  /* --- Active Position View on Mobile --- */
  .pos-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.35rem !important;
  }
  .pos-sym {
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    word-break: break-all !important;
    line-height: 1.25 !important;
  }
  .pos-badge-lots {
    align-self: flex-start !important;
    font-size: 0.64rem !important;
    padding: 0.15rem 0.5rem !important;
  }
  .pos-metrics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
  }
  .greeks-panel-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.3rem !important;
  }
  .greeks-strike-badge {
    font-size: 0.64rem !important;
    word-break: break-all !important;
  }
  .greeks-telemetry-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.4rem !important;
  }
  .greek-cell {
    padding: 0.35rem 0.45rem !important;
  }
  .g-name {
    font-size: 0.58rem !important;
  }
  .g-num {
    font-size: 0.85rem !important;
  }
  .g-hint {
    font-size: 0.58rem !important;
  }
  .friction-strip {
    flex-wrap: wrap !important;
    gap: 0.35rem 0.65rem !important;
    font-size: 0.68rem !important;
    padding: 0.35rem 0.55rem !important;
  }
  .rr-labels {
    font-size: 0.66rem !important;
  }

  /* --- Strategy Conditions Matrix on Mobile --- */
  .matrix-header {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }
  .matrix-header-title-group h2 {
    font-size: 0.80rem !important;
  }
  .commodity-switcher-bar {
    padding: 0.35rem 0.6rem !important;
    gap: 0.35rem !important;
  }
  .comm-pill {
    padding: 0.3rem 0.45rem !important;
    font-size: 0.68rem !important;
  }
  .strategy-switcher-bar {
    padding: 0.35rem 0.6rem !important;
    gap: 0.35rem !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .strategy-switcher-bar::-webkit-scrollbar {
    display: none !important;
  }
  .strat-pill {
    padding: 0.28rem 0.55rem !important;
    font-size: 0.67rem !important;
    flex-shrink: 0 !important;
  }
  .strategy-dna-strip {
    padding: 0.35rem 0.6rem !important;
    gap: 0.3rem !important;
    flex-wrap: wrap !important;
  }
  .dna-badge {
    font-size: 0.63rem !important;
    padding: 0.15rem 0.4rem !important;
  }
  .matrix-commentary-strip {
    white-space: normal !important;
    line-height: 1.35 !important;
    padding: 0.35rem 0.55rem !important;
  }
  .matrix-commentary-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 0.69rem !important;
  }
  .checklist-container.matrix-grid {
    grid-template-columns: 1fr !important;
    gap: 0.4rem !important;
  }
  .matrix-card {
    min-height: auto !important;
    padding: 0.45rem 0.6rem !important;
  }

  /* --- 15M Candlestick Chart on Mobile --- */
  .candle-chart-panel .panel-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.4rem !important;
  }
  .chart-legend-indicators {
    flex-wrap: wrap !important;
    gap: 0.3rem !important;
  }

  /* --- Upcoming Events Grid on Mobile --- */
  .events-grid-compact {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .event-card-compact {
    padding: 0.55rem 0.7rem !important;
  }

  /* --- Trade Ledger on Mobile --- */
  .multi-strat-scoreboard {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
  }
  .multi-strat-scoreboard .strat-score-card:last-child {
    grid-column: span 2 !important;
  }
  .ledger-header-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.4rem !important;
  }
  .ledger-header-controls select,
  .ledger-header-controls button {
    width: 100% !important;
    height: 38px !important;
    box-sizing: border-box !important;
  }
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    scrollbar-width: thin !important;
  }
  .ledger-table {
    min-width: 680px !important;
  }
  .ledger-table th, .ledger-table td {
    padding: 0.4rem 0.45rem !important;
    font-size: 0.72rem !important;
  }

  /* --- Sticky Bottom Telemetry Bar on Mobile --- */
  .ticker-right {
    display: none !important;
  }
  .ticker-content {
    display: none !important;
  }
  .terminal-ticker-footer {
    padding: 0.35rem 0.75rem !important;
    min-height: 40px !important;
    height: 40px !important;
  }
  .ticker-title {
    font-size: 0.65rem !important;
  }
  .btn-ticker-drawer {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.45rem !important;
  }

  /* --- Modals on Mobile --- */
  .modal-backdrop {
    padding: 0.5rem !important;
  }
  .modal-card, .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    margin: auto !important;
    padding: 1rem !important;
  }
  .modal-header h3 {
    font-size: 0.95rem !important;
  }
  .settings-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Calendar & Analytics Tab on Mobile --- */
  .calendar-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .calendar-controls .input-group {
    width: 100% !important;
  }
  .calendar-controls input,
  .calendar-controls select,
  .calendar-controls button {
    width: 100% !important;
    height: 38px !important;
  }
}

/* Extra small devices (iPhone SE, small Androids <= 375px) */
@media (max-width: 375px) {
  .brand-title {
    font-size: 0.88rem !important;
  }
  .metrics-ribbon {
    grid-template-columns: 1fr !important;
  }
  .metric-card:nth-child(3),
  .metric-card:last-child {
    grid-column: span 1 !important;
  }
}

/* --- Expandable Month-by-Month Strategy Rows & Period Strategy Matrix --- */
.btn-month-expand {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  padding: 0.32rem 0.65rem !important;
  border-radius: 6px !important;
  font-family: var(--font-mono) !important;
  font-size: 0.76rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-weight: 700 !important;
}
.btn-month-expand:hover {
  background: var(--bg-hover) !important;
  border-color: var(--accent-blue) !important;
  color: #fff !important;
  transform: translateY(-1px);
}
.btn-month-expand.active {
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: var(--accent-blue) !important;
  color: var(--accent-blue) !important;
}
.month-exp-icon {
  font-size: 0.72rem !important;
  display: inline-block !important;
  transition: transform 0.2s ease !important;
}
.badge-strats-count {
  font-size: 0.62rem !important;
  font-weight: 700 !important;
  padding: 0.1rem 0.4rem !important;
  border-radius: 10px !important;
  background: rgba(59, 130, 246, 0.18) !important;
  color: var(--accent-blue) !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}
.month-strategy-subrow {
  background: var(--bg-card) !important;
}
.month-strategy-subrow td {
  padding: 0 !important;
  border-bottom: 2px solid var(--border-color) !important;
}
.strategy-nested-container {
  padding: 0.65rem 0.9rem 0.85rem 1.2rem !important;
  border-left: 3px solid var(--accent-blue) !important;
  background: rgba(0, 0, 0, 0.18) !important;
}
body.light-theme .strategy-nested-container {
  background: rgba(0, 0, 0, 0.02) !important;
}
.strategy-subtable {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.74rem !important;
}
.strategy-subtable th {
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-muted) !important;
  font-weight: 700 !important;
  font-size: 0.66rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 0.4rem 0.6rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.strategy-subtable td {
  padding: 0.45rem 0.6rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  vertical-align: middle !important;
}
.strategy-subtable tr:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}
.btn-filter-strat {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-muted) !important;
  padding: 0.2rem 0.5rem !important;
  border-radius: 4px !important;
  font-size: 0.65rem !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  font-weight: 600 !important;
}
.btn-filter-strat:hover {
  background: var(--accent-blue) !important;
  color: #fff !important;
  border-color: var(--accent-blue) !important;
}
.winrate-bar-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}
.winrate-bar-track {
  width: 48px !important;
  height: 6px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 3px !important;
  overflow: hidden !important;
}
.winrate-bar-fill {
  height: 100% !important;
  border-radius: 3px !important;
}

/* =====================================================================
   ABHAYA TERMINAL - Index Quant Desk (NIFTY 50 & BANK NIFTY) Styles
   ===================================================================== */
.regime-banner {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.6), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 12px;
  padding: 1.25rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.regime-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
  pointer-events: none;
}
.regime-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 820px;
}
.regime-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.regime-label {
  font-size: 0.70rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.regime-pill {
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid #818cf8;
  color: #c7d2fe;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.regime-strat-pill {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #34d399;
  color: #a7f3d0;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
}
.regime-desc {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.45;
}
.regime-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.btn-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  color: var(--text-main, #f8fafc);
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}
.btn-toggle.active-green {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}
.btn-toggle.active-indigo {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
}

/* KPI Cards Grid for Index Desk */
.idx-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 1024px) {
  .idx-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .idx-kpi-grid { grid-template-columns: 1fr; }
}

.idx-kpi-card {
  background: var(--bg-card, #0d1524);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s ease;
}
.idx-kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}
.idx-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.idx-kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.idx-kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Execution Setup Cards Grid */
.idx-execution-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
  .idx-execution-grid { grid-template-columns: 1fr; }
}

.idx-strat-card {
  background: var(--bg-card, #0d1524);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.2s ease;
}
.idx-strat-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: var(--bg-card-hover, #131d31);
}
.idx-strat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}
.idx-strat-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.idx-strat-underlying-badge {
  font-size: 0.70rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.idx-strat-strikes-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.strikes-desc-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: #93c5fd;
}
.legs-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  margin-top: 0.3rem;
}
.leg-pill {
  font-size: 0.74rem;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.leg-pill.sell { border-left: 3px solid var(--accent-red, #ef4444); }
.leg-pill.buy { border-left: 3px solid var(--accent-green, #10b981); }

.idx-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 0.75rem;
}
.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.metric-cell-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}
.metric-cell-val {
  font-size: 0.95rem;
  font-weight: 800;
}
.btn-deploy-paper {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
}
.btn-deploy-paper:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

/* Active Open Position Panel */
.active-pos-card {
  background: linear-gradient(135deg, rgba(16, 26, 46, 0.85), rgba(13, 21, 36, 0.95));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 12px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.25rem;
}
.active-pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.pos-live-mtm-badge {
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.pos-live-mtm-badge.green {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}
.pos-live-mtm-badge.red {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}
.btn-pos-action {
  padding: 0.5rem 0.9rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.btn-pos-profit {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.btn-pos-profit:hover { background: rgba(16, 185, 129, 0.3); }
.btn-pos-sl {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.btn-pos-sl:hover { background: rgba(239, 68, 68, 0.3); }
.btn-pos-manual {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color, rgba(255, 255, 255, 0.1));
  color: var(--text-main, #f8fafc);
}
.btn-pos-manual:hover { background: rgba(255, 255, 255, 0.15); }

/* Ledger Table */
.idx-ledger-container {
  background: var(--bg-card, #0d1524);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.table-index-trades {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}
.table-index-trades th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.table-index-trades td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  vertical-align: middle;
}
.table-index-trades tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.badge-status-open {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #60a5fa;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}
.badge-status-closed {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}

/* Guardrails Card */
.guardrails-card {
  background: rgba(13, 21, 36, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
  .guardrails-card { grid-template-columns: 1fr; }
}
.guardrail-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.guardrail-item-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.guardrail-item-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Tool dropdown hover */
.tool-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* =====================================================================
   ABHAYA TERMINAL - Index Quant Desk Light Theme Palette
   ===================================================================== */
body.light-theme .regime-banner {
  background: linear-gradient(135deg, #eef2ff, #f8fafc) !important;
  border-color: #c7d2fe !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08) !important;
}
body.light-theme .regime-label { color: #64748b !important; }
body.light-theme .regime-desc { color: #334155 !important; }
body.light-theme .regime-pill {
  background: #e0e7ff !important;
  border-color: #818cf8 !important;
  color: #3730a3 !important;
}
body.light-theme .regime-strat-pill {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}
body.light-theme .btn-toggle {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
body.light-theme .btn-toggle.active-green {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
}
body.light-theme .btn-toggle.active-indigo {
  background: #eef2ff !important;
  border-color: #6366f1 !important;
  color: #4338ca !important;
}

/* KPI Cards in Light Theme */
body.light-theme .idx-kpi-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .idx-kpi-header { color: #64748b !important; }
body.light-theme .idx-kpi-value { color: #0f172a !important; }
body.light-theme .idx-kpi-subtext { color: #64748b !important; }
body.light-theme .idx-kpi-subtext b.text-main { color: #0f172a !important; }

/* Strategy Cards in Light Theme */
body.light-theme .idx-strat-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .idx-strat-card:hover {
  border-color: #818cf8 !important;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.12) !important;
}
body.light-theme .idx-strat-title { color: #0f172a !important; }
body.light-theme .idx-strat-underlying-badge {
  background: #f1f5f9 !important;
  color: #475569 !important;
}
body.light-theme .idx-strat-strikes-box {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
body.light-theme .strikes-desc-text { color: #1e40af !important; }
body.light-theme .leg-pill {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}
body.light-theme .leg-pill.sell {
  background: #fff5f5 !important;
  border-color: #fecaca !important;
  border-left: 3px solid #ef4444 !important;
}
body.light-theme .leg-pill.buy {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  border-left: 3px solid #10b981 !important;
}
body.light-theme .idx-metrics-row {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}
body.light-theme .metric-cell-label { color: #64748b !important; }
body.light-theme .metric-cell-val { color: #0f172a !important; }

/* Active Position Card in Light Theme */
body.light-theme .active-pos-card {
  background: #ffffff !important;
  border-color: #86efac !important;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12) !important;
}
body.light-theme #idxOpenUnderlying { color: #0f172a !important; }
body.light-theme .pos-live-mtm-badge.green {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #15803d !important;
}
body.light-theme .pos-live-mtm-badge.red {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}
body.light-theme .btn-pos-manual {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
body.light-theme .btn-pos-manual:hover {
  background: #e2e8f0 !important;
}

/* Ledger Table in Light Theme */
body.light-theme .idx-ledger-container {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}
body.light-theme .table-index-trades th {
  background: #f8fafc !important;
  color: #64748b !important;
  border-bottom-color: #e2e8f0 !important;
}
body.light-theme .table-index-trades td {
  border-bottom-color: #f1f5f9 !important;
  color: #1e293b !important;
}
body.light-theme .table-index-trades tbody tr:hover {
  background: #f8fafc !important;
}
body.light-theme .badge-status-closed {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

/* Guardrails Card in Light Theme */
body.light-theme .guardrails-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .guardrail-item-title { color: #0f172a !important; font-weight: 700 !important; }
body.light-theme .guardrail-item-text { color: #475569 !important; }

/* Global Contrast & Utility Classes in Light Theme */
body.light-theme .text-cyan { color: #0284c7 !important; }
body.light-theme .text-purple { color: #7c3aed !important; }
body.light-theme .text-indigo { color: #4338ca !important; }
body.light-theme .text-amber { color: #b45309 !important; }
body.light-theme .text-green { color: #15803d !important; }
body.light-theme .text-red { color: #dc2626 !important; }
body.light-theme .text-main { color: #0f172a !important; }
body.light-theme #tabIndex .section-title { color: #0f172a !important; }
body.light-theme .badge-status-open {
  background: #ecfdf5 !important;
  border-color: #86efac !important;
  color: #166534 !important;
  font-weight: 700 !important;
}
body.light-theme .btn-deploy-paper {
  background: linear-gradient(135deg, #4f46e5, #4338ca) !important;
  border: 1px solid #6366f1 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25) !important;
}
body.light-theme .btn-deploy-paper:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35) !important;
}

/* Tools Dropdown Menu in Light Theme */
body.light-theme #navToolsDropdown,
body.light-theme .nav-tools-dropdown-menu {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15) !important;
}
body.light-theme .tool-dropdown-item {
  color: #1e293b !important;
}
body.light-theme .tool-dropdown-item:hover {
  background: #f1f5f9 !important;
}

/* =====================================================================
   Mobile Responsive Adjustments for Index Terminal & Layout
   ===================================================================== */
@media (max-width: 768px) {
  .regime-banner {
    padding: 0.85rem 1rem !important;
    gap: 0.85rem !important;
  }
  .regime-info { max-width: 100% !important; }
  .regime-title-row { gap: 0.4rem !important; }
  .regime-pill, .regime-strat-pill {
    font-size: 0.72rem !important;
    padding: 0.2rem 0.55rem !important;
  }
  .regime-desc {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
  }
  .regime-controls {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 0.4rem !important;
  }
  .regime-controls button {
    flex: 1 !important;
    justify-content: center !important;
    padding: 0.45rem 0.4rem !important;
    font-size: 0.72rem !important;
  }
  .idx-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    margin-bottom: 0.85rem !important;
  }
  .idx-kpi-card { padding: 0.75rem 0.85rem !important; }
  .idx-kpi-header { font-size: 0.62rem !important; }
  .idx-kpi-value { font-size: 1.2rem !important; }
  .idx-kpi-subtext { font-size: 0.62rem !important; gap: 0.2rem !important; }
  .idx-execution-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }
  .idx-strat-card { padding: 1rem !important; gap: 0.75rem !important; }
  .idx-strat-title { font-size: 1rem !important; }
  .legs-list { grid-template-columns: 1fr !important; }
  .idx-metrics-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
  }
  .active-pos-card { padding: 1rem !important; gap: 0.85rem !important; }
  #idxOpenLegsGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.4rem !important;
  }
  .pos-live-mtm-badge {
    font-size: 1rem !important;
    padding: 0.35rem 0.75rem !important;
  }
  .btn-deploy-paper {
    padding: 0.65rem 0.85rem !important;
    font-size: 0.82rem !important;
  }
  .guardrails-card {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
  }
  .idx-ledger-container { padding: 0.75rem !important; }
}

@media (max-width: 480px) {
  .idx-kpi-grid { grid-template-columns: 1fr !important; }
  .idx-metrics-row { grid-template-columns: 1fr !important; }
  #idxOpenLegsGrid { grid-template-columns: 1fr !important; }
}

/* --- Market Regime Alpha & Trend Intelligence Styling --- */
.regime-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.regime-intel-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.regime-intel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.regime-intel-card.regime-high-vol {
  border-left: 4px solid #ef4444;
}
.regime-intel-card.regime-mod-trend {
  border-left: 4px solid #3b82f6;
}
.regime-intel-card.regime-low-range {
  border-left: 4px solid #10b981;
}
.regime-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.regime-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
}
.regime-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.regime-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  text-align: center;
}
body.light-theme .regime-card-metrics {
  background: rgba(0, 0, 0, 0.04);
}
.regime-metric-item .val {
  font-weight: 800;
  font-size: 0.95rem;
  font-family: 'JetBrains Mono', monospace;
}
.regime-metric-item .lbl {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}
.regime-alpha-leader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  font-size: 0.72rem;
  border: 1px dashed var(--border-color);
}
body.light-theme .regime-alpha-leader {
  background: rgba(0, 0, 0, 0.03);
}

/* Charts Grid for Analytics */
.analytics-dual-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .analytics-dual-charts {
    grid-template-columns: 1fr;
  }
}

/* Regime Filter Badges & Search Input */
.badge-regime-all { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-regime-high { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-regime-mod { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-regime-low { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

body.light-theme .badge-regime-all { background: #e2e8f0 !important; color: #1e293b !important; border: 1px solid #cbd5e1 !important; }
body.light-theme .badge-regime-high { background: rgba(239, 68, 68, 0.12) !important; color: #dc2626 !important; border: 1px solid rgba(239, 68, 68, 0.35) !important; }
body.light-theme .badge-regime-mod { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; border: 1px solid rgba(37, 99, 235, 0.35) !important; }
body.light-theme .badge-regime-low { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; border: 1px solid rgba(5, 150, 105, 0.35) !important; }

.trade-search-input {
  background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  width: 220px;
  outline: none;
  transition: border-color 0.2s ease, width 0.2s ease;
}
.trade-search-input:focus {
  border-color: var(--accent-blue);
  width: 260px;
}

/* --- Ultra-Premium Chart Container & TOD Segregation Styling --- */
.chart-card-box {
  background: radial-gradient(130% 120% at 50% 0%, #1e293b 0%, #0b1120 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.chart-card-box:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 20px 45px -8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.chart-card-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.8), rgba(56, 189, 248, 0.8), transparent);
  pointer-events: none;
}

body.light-theme .chart-card-box {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 6px 24px -2px rgba(0, 0, 0, 0.06), inset 0 1px 0 #ffffff !important;
}
body.light-theme .chart-card-box::before {
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), rgba(2, 132, 199, 0.5), transparent) !important;
}

/* TOD Segregation Cards */
.tod-segments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.tod-seg-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.tod-seg-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}
.tod-seg-card.tod-golden {
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: radial-gradient(120% 120% at 50% 0%, rgba(245, 158, 11, 0.12) 0%, rgba(15, 23, 42, 0.7) 100%);
}
body.light-theme .tod-seg-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}
body.light-theme .tod-seg-card.tod-golden {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
  border: 1px solid #fcd34d !important;
}

.tod-seg-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tod-seg-title {
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tod-seg-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}
.tod-seg-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  text-align: center;
}
body.light-theme .tod-seg-metrics {
  background: rgba(0, 0, 0, 0.04) !important;
}
.tod-seg-metric .val {
  font-weight: 800;
  font-size: 0.88rem;
  font-family: 'JetBrains Mono', monospace;
}
.tod-seg-metric .lbl {
  font-size: 0.58rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 1px;
}
.tod-seg-leader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
}
body.light-theme .tod-seg-leader {
  background: rgba(0, 0, 0, 0.02) !important;
}

/* TOD Mode Switcher Pills */
.tod-mode-pills {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}
.tod-mode-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tod-mode-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}
.tod-mode-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}
body.light-theme .tod-mode-btn {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}
/* ====================================================
   PROFESSIONAL QUANT ANALYTICS LAYOUT & ACCORDION DRAWER
   ==================================================== */
.analytics-control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
}
body.light-theme .analytics-control-bar {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.preset-pill-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-preset:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-preset.active {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.45);
}
body.light-theme .btn-preset {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}
body.light-theme .btn-preset.active {
  background: #0284c7;
  color: #ffffff;
}

.date-range-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.input-date-styled {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.28rem 0.55rem;
  font-size: 0.74rem;
  font-family: inherit;
}
body.light-theme .input-date-styled {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.filter-dropdown-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.btn-apply-filter {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.32rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-apply-filter:hover {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

/* 2-Column Balanced Dashboard Grid */
.analytics-grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 1100px) {
  .analytics-grid-two-col {
    grid-template-columns: 1fr;
  }
}

/* Trade Accordion Table Styles */
.trade-accordion-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.trade-accordion-row:hover {
  background-color: rgba(255, 255, 255, 0.04) !important;
}
body.light-theme .trade-accordion-row:hover {
  background-color: #f1f5f9 !important;
}
.trade-accordion-row.is-expanded {
  background-color: rgba(56, 189, 248, 0.06) !important;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.3) !important;
}

.btn-expand-trade {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}
.btn-expand-trade:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.1);
}
.trade-accordion-row.is-expanded .btn-expand-trade {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}
.chevron-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}
.trade-accordion-row.is-expanded .chevron-icon {
  transform: rotate(180deg);
}

/* Expanded Detail Drawer */
.trade-detail-drawer {
  background: rgba(11, 17, 32, 0.95) !important;
  border-bottom: 2px solid rgba(56, 189, 248, 0.25) !important;
}
body.light-theme .trade-detail-drawer {
  background: #f8fafc !important;
  border-bottom: 2px solid #0284c7 !important;
}
.trade-drawer-content {
  padding: 0.75rem 1rem;
}
.trade-drawer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.trade-drawer-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}
body.light-theme .trade-drawer-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.trade-drawer-card-title {
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.trade-drawer-card-title b {
  color: var(--text-main);
}
.trade-drawer-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  padding: 0.18rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
body.light-theme .trade-drawer-metric-row {
  border-bottom: 1px solid #f1f5f9;
}
.trade-drawer-metric-row:last-child {
  border-bottom: none;
}
.trade-drawer-metric-row .lbl {
  color: var(--text-muted);
}
.trade-drawer-metric-row .val {
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   UNIFIED PORTFOLIO POSITIONS DESK (ANGEL ONE INSPIRED)
   ========================================================================== */
.positions-desk-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 5rem; /* Room for sticky summary footer */
}

.positions-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
}

.positions-title-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.positions-title-area h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.positions-count-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.positions-controls-area {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.positions-search-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  font-size: 0.80rem;
  outline: none;
  min-width: 180px;
  transition: border-color 0.2s;
}

.positions-search-input:focus {
  border-color: var(--accent-blue);
}

.positions-filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.38rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.positions-filter-pill:hover,
.positions-filter-pill.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  color: #60a5fa;
}

.btn-secure-exit-all {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.4));
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.45rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.btn-secure-exit-all:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Accordion Group by Underlying */
.pos-group-accordion {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
}

.pos-group-accordion:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.pos-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease;
}

.pos-group-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pos-group-accordion.expanded .pos-group-header {
  border-bottom-color: var(--border-color);
}

.pos-group-title-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pos-group-name {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--text-main);
}

.pos-group-count-pill {
  font-size: 0.70rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.pos-group-meta-box {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.pos-group-gl-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
}

.pos-group-gl-badge.positive {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pos-group-gl-badge.negative {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pos-group-gl-badge.neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.pos-group-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.pos-group-accordion.expanded .pos-group-chevron {
  transform: rotate(180deg);
}

/* Positions Table: Fitted Layout with ZERO Horizontal Scrollbar */
.pos-table-wrapper {
  overflow-x: hidden !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.pos-table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  font-size: 0.78rem !important;
}

.pos-table th {
  padding: 0.55rem 0.65rem !important;
  text-align: left;
  font-size: 0.68rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  box-sizing: border-box !important;
}

.pos-table td {
  padding: 0.60rem 0.65rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.pos-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.pos-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Grouping Toggle Button (Angel One Style circled button) */
.positions-group-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.positions-group-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  color: var(--text-main);
  border-color: rgba(59, 130, 246, 0.35);
}

.positions-group-toggle-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
  color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

/* Angel One Style Option Badges */
.badge-opt-type {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  display: inline-block;
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.badge-opt-type.ce {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}
.badge-opt-type.pe {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-opt-type.spread {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.badge-cf-type {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}
.badge-cf-type.buy {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-cf-type.sell {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.badge-cf-type.closed {
  background: rgba(100, 116, 139, 0.18);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

body.light-theme .pos-table td {
  border-bottom: 1px solid #f1f5f9;
}

.pos-scrip-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pos-scrip-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-pos-asset {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.badge-pos-asset.crude {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-pos-asset.ng {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-pos-asset.nifty {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-pos-asset.banknifty {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.pos-scrip-name {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-main);
}

.pos-scrip-sub {
  font-size: 0.70rem;
  color: var(--text-muted);
}

.pos-action-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.pos-action-badge.buy {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pos-action-badge.sell {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pos-action-badge.spread {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

/* SL & Target Cells with Distinct Highlights */
.pos-sl-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pos-sl-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: #f87171;
}

.pos-sl-dist {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.pos-tgt-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pos-tgt-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: #34d399;
}

.pos-tgt-dist {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.pos-pnl-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pos-pnl-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.90rem;
}

.pos-pnl-pct {
  font-size: 0.68rem;
  font-weight: 700;
}

.btn-sqoff-inline {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.btn-sqoff-inline:hover {
  background: #ef4444;
  color: #fff;
}

.pos-empty-row {
  text-align: center;
  padding: 1.25rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Sticky Portfolio Summary Footer */
.positions-summary-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
}

body.light-theme .positions-summary-footer {
  background: rgba(255, 255, 255, 0.95);
  border-top-color: #cbd5e1;
}

.positions-summary-stats {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.pos-sum-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pos-sum-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.pos-sum-val {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
}

.pos-sum-val.positive {
  color: #34d399;
}

.pos-sum-val.negative {
  color: #f87171;
}

/* Multi-position deck container inside MCX terminal */
.mcx-multi-pos-deck {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.mcx-pos-item-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s ease;
}

.mcx-pos-item-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}






