/* ==========================================================================
   ALGEX SDX — Home 5-Step Interactive Presentation Prototype (Dark/Light)
   ========================================================================== */

.prototype-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--quantum-blue-light);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  max-width: 100%;
  line-height: 1.4;
  text-align: right;
}

[data-theme="light"] .hero-tag {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.hero-title span {
  background: linear-gradient(135deg, var(--quantum-blue-light), var(--parity-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 780px;
  margin: 0 auto;
}

/* Stage Panels */
.stage-panel {
  display: none;
  animation: fadeInStage 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.stage-panel.active {
  display: block;
}

@keyframes fadeInStage {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stage Header Layout */
.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
  flex-wrap: wrap;
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.stage-title-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: var(--quantum-blue);
  color: #FFFFFF;
  font-size: 0.88rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stage-title-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stage-title-ar {
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.3;
}

.stage-title-en {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--font-family);
  direction: ltr;
  text-align: right;
}

/* ==========================================
   STAGE 1: Hardware Telemetry & Ingestion
   ========================================== */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.cargo-selector-group {
  margin-bottom: 1rem;
}

.cargo-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.cargo-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px; /* Explicit height for identical rendering on Safari iOS, Opera, Chrome */
  min-height: 44px;
  line-height: 42px;
  padding: 0 2.25rem 0 1rem;
  background-color: var(--bg-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233B82F6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.85rem center;
  background-size: 14px 14px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: var(--transition-smooth);
}

[data-theme="light"] .cargo-select {
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  color: #0F172A;
  border-color: #CBD5E1;
}

.cargo-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
}

[data-theme="light"] .cargo-select option {
  background-color: #FFFFFF;
  color: #0F172A;
}

.cargo-select:focus {
  border-color: var(--quantum-blue);
  box-shadow: 0 0 10px var(--quantum-glow);
}

.hsm-lock-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--instant-green);
  font-weight: 800;
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

[data-theme="light"] .hsm-lock-badge {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #047857;
}

.telemetry-action-wrap {
  margin-top: 1.25rem;
  text-align: center;
}

/* ==========================================
   STAGE 2: Mass Balance Verification Engine
   ========================================== */
.verification-dashboard {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.comparison-chart-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.balance-meter-wrap {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: var(--transition-smooth);
}

[data-theme="light"] .balance-meter-wrap {
  background: #F1F5F9;
  border-color: #CBD5E1;
}

.balance-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.balance-meter-title {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.35;
}

.balance-discrepancy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.25rem 0.75rem;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-full);
  color: var(--instant-green);
  direction: rtl;
  unicode-bidi: embed;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

[data-theme="light"] .balance-discrepancy-pill {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #047857;
}

.balance-discrepancy-pill.tampered {
  color: var(--danger-red-light) !important;
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

[data-theme="light"] .balance-discrepancy-pill.tampered {
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
  color: #DC2626 !important;
}

.balance-meter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 700;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meter-track {
  height: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin: 0.75rem 0;
  border: 1px solid var(--border-glass);
}

[data-theme="light"] .meter-track {
  background: #E2E8F0;
  border-color: #CBD5E1;
}

.meter-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--quantum-blue), var(--instant-green));
  width: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease, background 0.5s ease;
}

.meter-bar.tampered {
  background: linear-gradient(90deg, #F59E0B, var(--danger-red));
  width: 115%;
}

.demo-controls-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.demo-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Security Alert Status Box */
.status-result-box {
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: var(--transition-smooth);
}

.status-result-verified {
  background: rgba(16, 185, 129, 0.12);
  border: 2px solid var(--instant-green);
  color: var(--instant-green);
  box-shadow: var(--shadow-green);
}

[data-theme="light"] .status-result-verified {
  background: #ECFDF5;
  border-color: #059669;
  color: #047857;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.15);
}

.status-result-tampered {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid var(--danger-red);
  color: var(--danger-red-light);
  box-shadow: var(--shadow-red);
  animation: shakeAlert 0.4s ease-in-out;
}

[data-theme="light"] .status-result-tampered {
  background: #FEF2F2;
  border-color: #DC2626;
  color: #991B1B;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.15);
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==========================================
   STAGE 3: Equivalence Algorithm & Minting
   ========================================== */
.minting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.mint-certificate {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(11, 15, 25, 0.95));
  border: 2px solid var(--border-glass-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-gold);
  text-align: center;
  transition: var(--transition-smooth);
}

[data-theme="light"] .mint-certificate {
  background: #FFFFFF;
  border: 2px solid #F59E0B;
  box-shadow: 0 10px 30px rgba(217, 119, 6, 0.12);
}

.mint-amount {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--parity-gold);
  font-family: var(--font-mono);
  margin: 0.5rem 0;
  text-shadow: 0 0 15px var(--parity-gold-glow);
}

[data-theme="light"] .mint-amount {
  color: #D97706;
  text-shadow: none;
}

.mint-basis {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ==========================================
   STAGE 4: Instant Atomic Clearing & Seal
   ========================================== */
.clearing-animation-container {
  position: relative;
  background: rgba(11, 15, 25, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  overflow: hidden;
  transition: var(--transition-smooth);
}

[data-theme="light"] .clearing-animation-container {
  background: linear-gradient(135deg, #F8FAFC, #EFF6FF);
  border-color: #BFDBFE;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.08);
}

.party-wallet-box {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  z-index: 2;
  transition: var(--transition-smooth);
}

[data-theme="light"] .party-wallet-box {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.swap-energy-channel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.swap-arrows-icon {
  font-size: 2rem;
  color: var(--parity-gold);
  animation: swapPulse 1.5s infinite ease-in-out;
}

@keyframes swapPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px var(--parity-gold)); }
  50% { transform: scale(1.2); filter: drop-shadow(0 0 16px var(--parity-gold-light)); }
}

.clearing-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.clearing-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  transition: var(--transition-smooth);
}

[data-theme="light"] .clearing-metric-card {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.clearing-metric-card.gold-highlight {
  border-color: var(--border-glass-gold);
  box-shadow: 0 0 15px var(--parity-gold-glow);
}

.clearing-metric-card.green-highlight {
  border-color: var(--border-glass-green);
  box-shadow: 0 0 15px var(--instant-green-glow);
}

.metric-value-huge {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 900;
  margin: 0.35rem 0;
}

/* Sovereign Seal Badge */
.sovereign-seal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
  border: 2px solid var(--parity-gold);
  border-radius: var(--radius-md);
  padding: 1.25rem 2rem;
  color: var(--parity-gold-light);
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: var(--shadow-gold);
}

[data-theme="light"] .sovereign-seal-badge {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border-color: #F59E0B;
  color: #92400E;
  box-shadow: 0 8px 25px rgba(217, 119, 6, 0.15);
}

/* ==========================================
   STAGE 5: Macro Impact & Strategic Roadmap
   ========================================== */
.macro-impact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.donut-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.donut-center-pct {
  font-size: 2rem;
  font-weight: 900;
  color: var(--quantum-blue);
  font-family: var(--font-mono);
}

[data-theme="light"] .donut-center-pct {
  color: #2563EB;
}

.donut-center-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.38rem 0.6rem;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

[data-theme="light"] .legend-item {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.5rem;
}

.legend-color-dot.empty-slice {
  background: var(--chart-empty-bg);
}

/* Roadmap Phase Tabs */
.phase-tabs-wrap {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.phase-tab-btn {
  flex: 1;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

[data-theme="light"] .phase-tab-btn {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.phase-tab-btn.active {
  background: #2563EB !important;
  color: #FFFFFF !important;
  border-color: #1D4ED8 !important;
  box-shadow: 0 0 14px var(--quantum-glow);
}

.phase-content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

[data-theme="light"] .phase-content-card {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .verification-dashboard,
  .minting-grid,
  .macro-impact-grid,
  .clearing-metrics-grid {
    grid-template-columns: 1fr;
  }

  .clearing-animation-container {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.45rem;
  }
  .stage-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
  .stage-title-ar {
    font-size: 1.05rem;
  }
  .stage-title-en {
    font-size: 0.76rem;
  }
  .telemetry-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .cyber-card {
    padding: 1rem 0.85rem;
  }
}

/* Roadmap Desktop Tabs vs Mobile 3D Dropdown */
.desktop-phase-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mobile-phase-dropdown-wrap {
  display: none;
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
}

.phase-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.phase-title {
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.phase-title-green { color: var(--instant-green); }
.phase-title-gold { color: var(--parity-gold); }
.phase-title-blue { color: var(--quantum-blue-light); }

[data-theme="light"] .phase-title-green { color: #047857; }
[data-theme="light"] .phase-title-gold { color: #B45309; }
[data-theme="light"] .phase-title-blue { color: #1D4ED8; }

@media (max-width: 768px) {
  .desktop-phase-tabs {
    display: none !important;
  }
  .mobile-phase-dropdown-wrap {
    display: block !important;
  }
  .phase-header-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .phase-title {
    font-size: 0.94rem;
  }
}

/* ==========================================================================
   Automated Clearing Certificate & Smart Contract Generator Box
   ========================================================================== */
.certificate-generator-box {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 58, 138, 0.35) 100%);
  border: 1.5px solid var(--quantum-blue);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin: 1.75rem 0;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 25px var(--quantum-glow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

[data-theme="light"] .certificate-generator-box {
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 100%);
  border-color: #3B82F6;
  box-shadow: 0 15px 40px rgba(37, 99, 235, 0.08);
}

.cert-gen-head {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.cert-gen-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.2);
  border: 1.5px solid var(--quantum-blue);
  color: var(--quantum-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.cert-gen-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.cert-gen-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.cert-gen-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-glass);
  padding-top: 1.25rem;
}

.btn-download-pdf-cert {
  background: linear-gradient(135deg, #10B981 0%, #047857 100%) !important;
  color: #FFFFFF !important;
  font-weight: 900 !important;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4) !important;
  border: none !important;
  padding: 0.85rem 1.5rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.6rem !important;
  text-decoration: none !important;
  border-radius: var(--radius-md) !important;
  transition: var(--transition-bounce) !important;
}

.btn-download-pdf-cert:hover,
.btn-download-pdf-cert:focus,
.btn-download-pdf-cert:active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #FFFFFF !important;
  text-decoration: none !important;
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 12px 35px rgba(16, 185, 129, 0.6) !important;
}

.btn-download-pdf-cert span,
.btn-download-pdf-cert i {
  color: #FFFFFF !important;
}

.btn-cyber-outline {
  background: transparent;
  border: 1.5px solid var(--border-glass-hover);
  color: var(--text-primary);
  font-weight: 800;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-decoration: none;
  transition: var(--transition-fast);
}

.btn-cyber-outline:hover {
  border-color: var(--quantum-blue);
  background: rgba(59, 130, 246, 0.1);
  color: var(--quantum-blue-light);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .cert-gen-head {
    flex-direction: column;
  }
  .cert-gen-actions {
    flex-direction: column;
  }
}

/* ==========================================================================
   AI Stage Insight Cards & Smart Contract Code Preview (Dark/Light)
   ========================================================================== */
.stage-ai-insight-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.75) 0%, rgba(30, 41, 59, 0.6) 100%);
  border: 1px solid var(--border-glass-hover);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  transition: var(--transition-fast);
}

[data-theme="light"] .stage-ai-insight-card {
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 100%);
  border-color: #BFDBFE;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.05);
}

.ai-insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-insight-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-live-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38BDF8;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

[data-theme="light"] .ai-live-tag {
  background: #E0F2FE;
  border-color: #BAE6FD;
  color: #0284C7;
}

.ai-insight-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-metric-mini-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  padding: 0.55rem 0.85rem;
}

[data-theme="light"] .ai-metric-mini-row {
  background: #F8FAFC;
  border-color: #E2E8F0;
}

.ai-mini-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ai-mini-stat .lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ai-mini-stat .val {
  font-size: 0.8rem;
  font-weight: 800;
}

.ai-insight-text {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.smart-contract-preview-box {
  background: #020617;
  border: 1px solid #1E293B;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 0.85rem 0;
}

[data-theme="light"] .smart-contract-preview-box {
  background: #0F172A;
}

.sc-header {
  background: #0B132B;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1E293B;
}

.sc-badge {
  font-size: 0.65rem;
  color: var(--instant-green);
}

.sc-code {
  padding: 0.75rem 0.85rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  color: #38BDF8;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
}

/* ==========================================================================
   Sovereign Room & Global Order Book Context Bar
   ========================================================================== */
.sovereign-room-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--border-glass-hover);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .sovereign-room-context-bar {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.room-indicator-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.room-indicator-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.room-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981;
  animation: pulseDot 1.8s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

.room-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.room-title {
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 800;
}

.room-badge {
  font-size: 0.72rem;
  color: var(--parity-gold);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.room-mode-toggle-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-room-tab {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

[data-theme="light"] .btn-room-tab {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.btn-room-tab.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--quantum-blue);
  color: var(--quantum-blue-light);
  box-shadow: 0 0 12px var(--quantum-glow);
}

[data-theme="light"] .btn-room-tab.active {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
}

/* ==========================================================================
   Global Sovereign Exergy Order Book Panel
   ========================================================================== */
.global-orderbook-panel {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(11, 15, 25, 0.98));
  border: 2px solid var(--parity-gold);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 25px rgba(245, 158, 11, 0.15);
  animation: fadeInMsg 0.25s ease-out;
}

[data-theme="light"] .global-orderbook-panel {
  background: #FFFFFF;
  border-color: #F59E0B;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.08);
}

.orderbook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.orderbook-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.orderbook-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FBBF24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.orderbook-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-primary);
  margin: 0;
}

.orderbook-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0.2rem 0 0;
}

.orderbook-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 840px) {
  .orderbook-grid {
    grid-template-columns: 1fr;
  }
}

.orderbook-column {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

[data-theme="light"] .orderbook-column {
  background: #F8FAFC;
  border-color: #E2E8F0;
}

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-glass);
}

.side-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-supply {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--instant-green);
}

.badge-demand {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--quantum-blue-light);
}

.col-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.orderbook-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ob-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  gap: 0.75rem;
  transition: var(--transition-fast);
}

[data-theme="light"] .ob-item {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

.ob-item:hover {
  border-color: var(--quantum-blue);
  transform: translateX(-2px);
}

.ob-item-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ob-flag {
  font-size: 1.4rem;
  line-height: 1;
}

.ob-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ob-name {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 800;
}

.ob-entity {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ob-val-group {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.ob-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  direction: ltr;
}

.ob-status {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
}

.status-available {
  background: rgba(16, 185, 129, 0.12);
  color: var(--instant-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-clearing {
  background: rgba(245, 158, 11, 0.12);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.orderbook-footer-note {
  margin-top: 1.15rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

[data-theme="light"] .orderbook-footer-note {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #475569;
}

/* ==========================================================================
   GEX Thermodynamic Lifecycle: Consumption & Burn Simulator (Stage 4)
   ========================================================================== */
.gex-burn-container {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: var(--transition-smooth);
  overflow: hidden;
  box-sizing: border-box;
}

[data-theme="light"] .gex-burn-container {
  background: #F8FAFC;
  border-color: #10B981;
}

.gex-burn-container.is-burned {
  border-color: rgba(100, 116, 139, 0.5);
  background: rgba(15, 23, 42, 0.95);
}

[data-theme="light"] .gex-burn-container.is-burned {
  background: #F1F5F9;
  border-color: #94A3B8;
}

.gex-burn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.85rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.gex-burn-header #gex-burn-status-badge {
  white-space: normal;
  max-width: 100%;
  line-height: 1.45;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  box-sizing: border-box;
  text-align: right;
  word-break: break-word;
}

.gex-burn-header #gex-burn-status-badge i {
  flex-shrink: 0;
}

.gex-burn-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.gex-burn-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  display: block;
}

.gex-burn-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .gex-burn-container {
    padding: 1.1rem 0.85rem;
  }

  .gex-burn-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .gex-burn-header #gex-burn-status-badge {
    width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    line-height: 1.5;
  }

  .gex-burn-cards-grid {
    grid-template-columns: 1fr;
  }
}

.token-lifecycle-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

[data-theme="light"] .token-lifecycle-card {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

.token-lifecycle-card.token-state-bright {
  border-color: #10B981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.token-lifecycle-card.token-state-bright .token-amount-display {
  color: #10B981;
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
}

.token-lifecycle-card.token-state-burned {
  border-color: rgba(100, 116, 139, 0.4);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0.65;
}

[data-theme="light"] .token-lifecycle-card.token-state-burned {
  background: #E2E8F0;
  opacity: 0.75;
}

.token-lifecycle-card.token-state-burned .token-amount-display {
  color: #64748B;
  text-decoration: line-through;
  text-shadow: none;
}

.token-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.token-origin {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.token-state-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.badge-bright {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10B981;
  color: #10B981;
}

.badge-burned {
  background: rgba(100, 116, 139, 0.2);
  border: 1px solid #64748B;
  color: #94A3B8;
}

.token-amount-display {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 900;
  direction: ltr;
  text-align: right;
  transition: var(--transition-smooth);
}

.token-commodity {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.token-state-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.burn-action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn-burn-action {
  background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-burn-action:hover {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
}

.burn-audit-note {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

[data-theme="light"] .burn-audit-note {
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: #475569;
}

