/**
 * Stock AI Lab v2.0 - Chat 2: Twin-Engine Alpha & DAG Telemetry Styles
 * Namespace: src/ui/twin_engine_bento.css
 * Theme: Obsidian Dark (#090A0F) with Koyfin / Linear Hairlines
 */

/* ==========================================================================
   1. TWIN-ENGINE BENTO CONTAINER & WRAPPER
   ========================================================================== */
.twin-bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  width: 100%;
  margin-top: 14px;
  box-sizing: border-box;
}

.twin-bento-card {
  background: var(--bg-surface, #0E1017);
  border: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
  border-radius: var(--r-outer, 16px);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.twin-bento-card:hover {
  border-color: var(--border-hover, rgba(255, 255, 255, 0.14));
}

.twin-bento-card.col-12 { grid-column: span 12; }
.twin-bento-card.col-8  { grid-column: span 8; }
.twin-bento-card.col-6  { grid-column: span 6; }
.twin-bento-card.col-4  { grid-column: span 4; }

/* Header & Controls */
.twin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
}

.twin-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-primary, #F3F4F6);
}

.twin-badge-cap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  border-radius: var(--r-pill, 6px);
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.24);
  color: var(--emerald, #10B981);
}

.twin-badge-quarantine {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.24);
  color: var(--amber, #F59E0B);
}

/* Dual Mode Toggle */
.twin-mode-toggle {
  display: inline-flex;
  background: var(--bg-elevated, #131620);
  border: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
  border-radius: var(--r-control, 8px);
  padding: 3px;
  gap: 4px;
}

.twin-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #9CA3AF);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.twin-mode-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.twin-mode-btn.active {
  background: var(--emerald, #10B981);
  color: #090A0F;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.4);
}

.twin-mode-btn.active.titan {
  background: var(--cyan, #06B6D4);
  color: #090A0F;
  box-shadow: 0 1px 4px rgba(6, 182, 212, 0.4);
}

/* ==========================================================================
   2. BRAHMASTRA-1 SINGULARITY SIEVE CARD
   ========================================================================== */
.brahma-candidate-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.brahma-candidate-card {
  background: var(--bg-elevated, #131620);
  border: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
  border-radius: var(--r-inner, 10px);
  padding: 12px 14px;
  position: relative;
  transition: border-color 0.15s ease;
}

.brahma-candidate-card.apex {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04) 0%, rgba(19, 22, 32, 1) 100%);
}

.brahma-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.brahma-sym-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.brahma-score-badge {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald, #10B981);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Kill-Switch Indicators */
.brahma-ks-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.brahma-ks-pill {
  font-size: 9.5px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.brahma-ks-pill.disarmed {
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.brahma-ks-pill.armed {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose, #F43F5E);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* 9-Gate Forensic Verification Grid */
.brahma-gates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
}

.brahma-gate-cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 10px;
}

.brahma-gate-cell.pass {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.04);
}

.brahma-gate-cell.fail {
  border-color: rgba(244, 63, 94, 0.25);
  background: rgba(244, 63, 94, 0.04);
}

.brahma-gate-tag {
  font-weight: 700;
  font-size: 9.5px;
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brahma-gate-cell.pass .brahma-gate-tag { color: var(--emerald, #10B981); }
.brahma-gate-cell.fail .brahma-gate-tag { color: var(--rose, #F43F5E); }

.brahma-gate-desc {
  color: var(--text-muted, #64748B);
  font-size: 9px;
  line-height: 1.2;
}

/* Nuance Multiplier Dials */
.brahma-nuance-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  margin-top: 8px;
  font-size: 10.5px;
}

.brahma-nuance-val {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: var(--indigo, #6366F1);
}

/* ==========================================================================
   3. PHOENIX-1 FALLEN TITAN RADAR & RUBBER-BAND DISCOUNT DIAL
   ========================================================================== */
.phoenix-radar-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: center;
}

@media (max-width: 900px) {
  .phoenix-radar-wrapper {
    grid-template-columns: 1fr;
  }
}

.rubberband-dial-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--r-inner, 10px);
  text-align: center;
}

.rubberband-dial-svg {
  width: 180px;
  height: 110px;
  overflow: visible;
}

.rubberband-needle {
  transform-origin: 90px 90px;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rubberband-dial-val {
  font-family: var(--font-mono, monospace);
  font-size: 19px;
  font-weight: 700;
  color: var(--amber, #F59E0B);
  margin-top: -6px;
}

.rubberband-dial-label {
  font-size: 10.5px;
  color: var(--text-secondary, #9CA3AF);
  margin-top: 2px;
}

/* Valuation Compression Comparison Bars */
.valuation-bars-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.val-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.val-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.val-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.val-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.val-bar-fill.discount {
  background: linear-gradient(90deg, #10B981, #06B6D4);
}

.val-bar-fill.danger {
  background: var(--rose, #F43F5E);
}

.val-bar-hurdle-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  opacity: 0.6;
  z-index: 2;
}

/* Reversal Ignition Metrics (RSI curl & Delivery Z-Score) */
.reversal-ignition-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.ignition-pill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
}

.ignition-pill.active {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

/* ==========================================================================
   4. 6-SECTOR VALUE-CHAIN BOTTLENECK INTERACTIVE SVG DAG
   ========================================================================== */
.dag-theme-selector {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
}

.dag-theme-tab {
  background: var(--bg-elevated, #131620);
  border: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
  color: var(--text-secondary, #9CA3AF);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-control, 8px);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.dag-theme-tab:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.dag-theme-tab.active {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.35);
  color: var(--cyan, #06B6D4);
  font-weight: 700;
}

/* SVG Canvas */
.dag-canvas-container {
  width: 100%;
  height: 280px;
  background: radial-gradient(circle at 50% 50%, rgba(14, 16, 23, 0.95) 0%, rgba(9, 10, 15, 1) 100%);
  border: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
  border-radius: var(--r-inner, 10px);
  position: relative;
  overflow: hidden;
}

.dag-svg-canvas {
  width: 100%;
  height: 100%;
}

/* Node Styling */
.dag-node-box {
  cursor: pointer;
  transition: filter 0.2s ease;
}

.dag-node-box:hover {
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
}

.dag-node-glow {
  animation: dagPulse 2s infinite ease-in-out;
}

@keyframes dagPulse {
  0% {
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(16, 185, 129, 0.9));
  }
  100% {
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.4));
  }
}

/* Live Reg-30 Stream Blotter */
.reg30-blotter-container {
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-hairline, rgba(255, 255, 255, 0.07));
  border-radius: var(--r-inner, 10px);
  padding: 10px 14px;
}

.reg30-blotter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary, #9CA3AF);
  margin-bottom: 8px;
}

.reg30-stream-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.reg30-stream-table th {
  text-align: left;
  color: var(--text-muted, #64748B);
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.reg30-stream-table td {
  padding: 6px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.reg30-pill-pass {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald, #10B981);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
}

.reg30-pill-reject {
  background: rgba(244, 63, 94, 0.12);
  color: var(--rose, #F43F5E);
  border: 1px solid rgba(244, 63, 94, 0.25);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
}


/* ============================================================================
   ARGON TIER 0 AESTHETIC ELEVATION: FIGMA / LINEAR OBSIDIAN DARK MATRIX
   ============================================================================ */

.te-glass-card {
  background: linear-gradient(165deg, rgba(22, 25, 35, 0.95) 0%, rgba(13, 15, 22, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
  margin-bottom: 16px;
}

.te-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 12px;
}

.te-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.te-eyebrow {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan, #06B6D4);
}

.te-main-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #F8FAFC);
  letter-spacing: -0.01em;
}

/* 3x3 FORENSIC VERIFICATION GRID (G1 - G9) */
.forensic-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 900px) {
  .forensic-grid-3x3 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.forensic-cell {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  transition: all 0.18s ease;
}

.forensic-cell:hover {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.04);
  transform: translateY(-1px);
}

.f-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 700;
}

.f-gate-id {
  color: var(--cyan, #06B6D4);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.f-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald, #10B981);
  box-shadow: 0 0 8px var(--emerald, #10B981);
}

.f-cell-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #E2E8F0;
}

.f-cell-metric {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10.5px;
  color: #94A3B8;
}

/* NUANCE DIALS (N1 - N5) */
.nuance-dials-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  background: rgba(9, 10, 15, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 10px;
}

@media (max-width: 900px) {
  .nuance-dials-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.nuance-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.dial-svg {
  width: 52px;
  height: 52px;
}

.dial-label {
  font-size: 10px;
  font-weight: 600;
  color: #CBD5E1;
  line-height: 1.2;
}

/* KILL SWITCHES (K1 - K6) */
.kill-switch-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 900px) {
  .kill-switch-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.kill-pill {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.kill-id {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  font-weight: 700;
  color: var(--emerald, #10B981);
}

.kill-name {
  font-size: 10px;
  color: #94A3B8;
}

/* 6-SECTOR VALUE-CHAIN BOTTLENECK DAG STYLES */
.sector-pills-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sector-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94A3B8;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sector-tab-btn.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan, #06B6D4);
  color: #F8FAFC;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.dag-circuit-stage {
  background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.07) 0%, rgba(9, 10, 15, 0.9) 80%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px;
  height: 220px;
  position: relative;
}

.three-lock-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.lock-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.reg30-blotter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reg30-row {
  display: grid;
  grid-template-columns: 80px 100px 1fr 90px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 11px;
}
