/* ==========================================================================
   UNYKORN SOVEREIGN NETWORK OS & SCAN EXPLORER DESIGN SYSTEM
   ========================================================================== */

:root {
  /* DARK THEME TOKENS (Default) */
  --bg-darkest: #06080e;
  --bg-deep: #0a0e1a;
  --bg-surface: #101626;
  --bg-card: rgba(18, 26, 44, 0.75);
  --bg-card-hover: rgba(26, 38, 64, 0.85);
  --bg-card-active: rgba(32, 48, 80, 0.95);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(0, 240, 255, 0.5);
  --glass-blur: blur(16px);
  
  --cyan-core: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.25);
  --emerald-core: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --violet-core: #8b5cf6;
  --violet-glow: rgba(139, 92, 246, 0.25);
  --amber-core: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --rose-core: #ef4444;
  --rose-glow: rgba(239, 68, 68, 0.25);
  
  --text-pure: #ffffff;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --table-header-bg: #0a0e1a;
  --table-row-hover: rgba(255, 255, 255, 0.02);
  --input-bg: rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(10, 14, 26, 0.85);
  --ticker-bg: rgba(16, 22, 38, 0.9);
  --svg-bg: radial-gradient(circle at center, #0f1629 0%, #080c16 100%);
  --svg-card-bg: #10182b;
  --svg-card-text: #e2e8f0;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   PRISTINE HIGH-CONTRAST INSTITUTIONAL LIGHT THEME
   Zero eye strain, crystal-clear readability, no neon glare
   ========================================================================== */
body.theme-light {
  --bg-darkest: #f8fafc;
  --bg-deep: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #ffffff;
  --bg-card-active: #f1f5f9;

  --border-subtle: #e2e8f0;
  --border-card: #cbd5e1;
  --border-focus: #2563eb;
  --glass-blur: none;

  /* Calmer, deeply readable institutional tones */
  --cyan-core: #0284c7;        /* Clean Sky/Ocean Blue */
  --cyan-glow: rgba(2, 132, 199, 0.1);
  --emerald-core: #059669;     /* Deep Emerald */
  --emerald-glow: rgba(5, 150, 105, 0.1);
  --violet-core: #7c3aed;      /* Institutional Purple */
  --violet-glow: rgba(124, 58, 237, 0.1);
  --amber-core: #d97706;       /* Crisp Amber */
  --amber-glow: rgba(217, 119, 6, 0.1);
  --rose-core: #dc2626;        /* High-contrast Red */
  --rose-glow: rgba(220, 38, 38, 0.1);

  --text-pure: #0f172a;        /* Deep rich slate */
  --text-primary: #1e293b;     /* High contrast body text */
  --text-secondary: #475569;   /* Sub-labels */
  --text-muted: #64748b;

  --table-header-bg: #f1f5f9;
  --table-row-hover: #f8fafc;
  --input-bg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.95);
  --ticker-bg: #ffffff;
  --svg-bg: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
  --svg-card-bg: #ffffff;
  --svg-card-text: #1e293b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body.theme-light .bg-glow {
  display: none;
}
body.theme-light .bg-mesh {
  opacity: 0.4;
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

body.theme-light .highlight-cyan {
  color: #0369a1 !important;
  text-shadow: none !important;
}
body.theme-light .highlight-emerald {
  color: #047857 !important;
  text-shadow: none !important;
}
body.theme-light .highlight-violet {
  color: #6d28d9 !important;
  text-shadow: none !important;
}
body.theme-light .highlight-amber {
  color: #b45309 !important;
  text-shadow: none !important;
}

body.theme-light .card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
body.theme-light .block-card-item {
  background: #ffffff;
  border-color: #e2e8f0;
}
body.theme-light .block-card-item:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
}
body.theme-light .registry-item {
  background: #ffffff;
  border-color: #e2e8f0;
}
body.theme-light .validator-enclave-card {
  background: #ffffff;
  border-color: #e2e8f0;
}
body.theme-light .canvas-wrapper {
  background: var(--svg-bg);
  border-right: 1px solid #e2e8f0;
}
body.theme-light .node-inspector {
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
}
body.theme-light .code-preview-pane {
  background: #0f172a;
}
body.theme-light .search-box {
  background: #ffffff;
  border-color: #cbd5e1;
}
body.theme-light .search-box input {
  color: #0f172a;
}
body.theme-light .quick-filter-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
body.theme-light .radio-card {
  background: #ffffff;
  border-color: #cbd5e1;
}
body.theme-light .radio-card.selected {
  background: #f0f9ff;
  border-color: #0284c7;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.2);
}
body.theme-light .form-group input, body.theme-light .form-group select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
body.theme-light .network-status-pill {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
body.theme-light .corp-badge {
  background: #fef3c7;
  border-color: #fde68a;
  color: #b45309;
}
body.theme-light .badge-network {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
body.theme-light .nav-tabs {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
body.theme-light .nav-tab {
  color: #475569;
}
body.theme-light .nav-tab.active {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body.theme-light .modal-container {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 12px 36px rgba(0,0,0,0.15);
}
body.theme-light .sub-nav-btn {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}
body.theme-light .sub-nav-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: none;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-darkest);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 { top: -150px; left: -100px; background: var(--cyan-core); }
.bg-glow-2 { bottom: -150px; right: -100px; background: var(--violet-core); }

.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.glass-card:hover {
  border-color: rgba(0, 0, 0, 0.15);
}
body.theme-dark .glass-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   TOP NAVIGATION BAR
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-card);
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.2), rgba(124, 58, 237, 0.2));
  border: 1px solid var(--cyan-core);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-core);
}
.brand-logo-icon svg {
  width: 20px;
  height: 20px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-network {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

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

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.nav-tab:hover {
  color: var(--text-pure);
}

.live-dot-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-core);
  box-shadow: 0 0 8px var(--emerald-core);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-toggle-btn:hover {
  border-color: var(--cyan-core);
}

.network-status-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.status-indicator.online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-core);
}

.block-height {
  color: var(--cyan-core);
  font-weight: 600;
}

.corp-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.corp-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}
.corp-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   GLOBAL METRICS TICKER
   ========================================================================== */
.ticker-banner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.6rem 1.5rem;
  background: var(--ticker-bg);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  gap: 1rem;
}

.ticker-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  white-space: nowrap;
}
.metric-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-pure);
}

.ticker-separator {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

/* ==========================================================================
   MAIN CONTENT & VIEW PANELS
   ========================================================================== */
.main-content {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  max-width: 1700px;
  margin: 0 auto;
}

.view-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}
.view-panel.active {
  display: block;
}

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

/* ==========================================================================
   VIEW 1: UNYSCAN EXPLORER
   ========================================================================== */
.search-banner {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 0.4rem 0.6rem 0.4rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.search-box:focus-within {
  border-color: var(--cyan-core);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-pure);
  font-family: var(--font-mono);
}
.search-box input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.search-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  background: var(--cyan-core);
  border: none;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.search-btn:hover {
  opacity: 0.9;
}

.search-quick-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.tag-title {
  color: var(--text-muted);
  font-weight: 600;
}
.quick-filter-btn {
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.card-icon {
  font-size: 1.1rem;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-pure);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.pulse-emerald {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-core);
  box-shadow: 0 0 6px var(--emerald-core);
  animation: pulse-dot 1.2s infinite;
}

.blocks-stream {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 520px;
  overflow-y: auto;
}

.block-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
  cursor: pointer;
}
.block-card-item:hover {
  transform: translateX(3px);
}

.block-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.block-cube-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid var(--cyan-core);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-core);
  font-weight: 700;
  font-size: 0.85rem;
}
.block-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-pure);
  font-size: 0.85rem;
}
.block-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.block-right {
  text-align: right;
  font-family: var(--font-mono);
}
.block-txs-badge {
  font-size: 0.75rem;
  color: var(--cyan-core);
  font-weight: 600;
}
.block-proposer {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Transactions Table */
.txs-table-container {
  max-height: 520px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table th {
  position: sticky;
  top: 0;
  background: var(--table-header-bg);
  color: var(--text-muted);
  text-align: left;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 2;
}
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.data-table tr:hover td {
  background: var(--table-row-hover);
}

.tx-hash-link {
  color: var(--cyan-core);
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.tx-hash-link:hover {
  text-decoration: underline;
}

.tx-type-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}
.type-lien { background: rgba(217, 119, 6, 0.15); border: 1px solid var(--amber-core); color: var(--amber-core); }
.type-mandate { background: rgba(2, 132, 199, 0.15); border: 1px solid var(--cyan-core); color: var(--cyan-core); }
.type-draw { background: rgba(124, 58, 237, 0.15); border: 1px solid var(--violet-core); color: var(--violet-core); }
.type-dvp { background: rgba(5, 150, 105, 0.15); border: 1px solid var(--emerald-core); color: var(--emerald-core); }
.type-anchor { background: rgba(100, 116, 139, 0.15); border: 1px solid var(--text-muted); color: var(--text-primary); }

.status-badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--emerald-core);
  font-weight: 600;
  font-size: 0.72rem;
}
.status-badge-ok::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--emerald-core);
}

.inspect-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 4px;
  color: var(--text-secondary);
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
}
.inspect-btn:hover {
  background: var(--cyan-core);
  color: #ffffff;
  border-color: var(--cyan-core);
}

/* Secondary Grid */
.secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 992px) {
  .secondary-grid {
    grid-template-columns: 1fr;
  }
}

.sub-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.registry-list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.registry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}
.reg-name {
  font-weight: 600;
  color: var(--text-pure);
}
.reg-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.reg-val {
  font-family: var(--font-mono);
  color: var(--cyan-core);
  font-weight: 600;
}

.validators-grid {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (max-width: 600px) {
  .validators-grid {
    grid-template-columns: 1fr;
  }
}

.validator-enclave-card {
  padding: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}
.val-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.val-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-pure);
}
.val-badge-active {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid var(--emerald-core);
  color: var(--emerald-core);
  font-family: var(--font-mono);
}
.val-detail {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.2rem;
}

/* ==========================================================================
   VIEW 2: ARCHITECTURE & MIND MAPS
   ========================================================================== */
.sub-nav-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.sub-nav-btn {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mindmap-container {
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 720px;
  border-radius: 12px;
  overflow: hidden;
}
@media (max-width: 1200px) {
  .mindmap-container {
    grid-template-columns: 1fr;
  }
}

.canvas-wrapper {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.interactive-svg {
  width: 100%;
  max-width: 1400px;
  height: auto;
}

.node-inspector {
  display: flex;
  flex-direction: column;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}
.inspector-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-pure);
}
.close-inspector-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.inspector-body {
  padding: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  overflow-y: auto;
  flex: 1;
}

.inspector-placeholder {
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

.node-detail-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.detail-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}
.detail-sec-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 0;
}
.detail-list li {
  font-size: 0.8rem;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}
.detail-list li::before {
  content: '▸';
  color: var(--cyan-core);
}

/* ==========================================================================
   VIEW 3: TOKEN & SECURITIES FORGE
   ========================================================================== */
.studio-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 1100px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
}

.regulatory-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid var(--emerald-core);
  color: var(--emerald-core);
}

.forge-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: block;
}

.instrument-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (max-width: 650px) {
  .instrument-selector-grid {
    grid-template-columns: 1fr;
  }
}

.radio-card {
  position: relative;
  display: flex;
  padding: 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s;
}
.radio-card input {
  position: absolute;
  opacity: 0;
}

.radio-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.radio-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--cyan-core);
}
.radio-title {
  font-size: 0.88rem;
  color: var(--text-pure);
}
.radio-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 700px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-group input, .form-group select {
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
}

.btn-primary-mint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan-core) 0%, #2563eb 100%);
  border: none;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary-mint:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

.preview-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}
.preview-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}
.preview-tab-btn.active {
  color: var(--cyan-core);
  background: rgba(2, 132, 199, 0.12);
}

.code-preview-pane {
  padding: 1.2rem;
  max-height: 380px;
  overflow-y: auto;
}
.code-block {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #93c5fd;
  line-height: 1.6;
}

.mint-summary-box {
  padding: 1.2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.summary-metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}
.summary-metric .val {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ==========================================================================
   VIEW 4: DYNAMIC LTV & RISK SIMULATOR
   ========================================================================== */
.ltv-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1100px) {
  .ltv-layout {
    grid-template-columns: 1fr;
  }
}

.sliders-container {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.slider-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}
.slider-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: rgba(0, 0, 0, 0.15);
  height: 6px;
  border-radius: 3px;
  outline: none;
}
body.theme-dark input[type="range"] {
  background: rgba(255, 255, 255, 0.1);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan-core);
  cursor: pointer;
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.status-pill-safe {
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid var(--emerald-core);
  color: var(--emerald-core);
  font-size: 0.72rem;
  font-weight: 700;
}
.status-pill-warn {
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(217, 119, 6, 0.15);
  border: 1px solid var(--amber-core);
  color: var(--amber-core);
  font-size: 0.72rem;
  font-weight: 700;
}
.status-pill-call {
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid var(--rose-core);
  color: var(--rose-core);
  font-size: 0.72rem;
  font-weight: 700;
}

.ltv-gauge-wrapper {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.ltv-numeric-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
}
.ltv-percent {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-pure);
}
.ltv-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.progress-bar-track {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.1);
  overflow: visible;
  margin-bottom: 1.5rem;
}
body.theme-dark .progress-bar-track {
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--emerald-core), var(--cyan-core));
  transition: width 0.2s ease;
}

.marker {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
}
body.theme-dark .marker {
  background: rgba(255, 255, 255, 0.4);
}
.marker-warn { background: var(--amber-core); }
.marker-margin { background: #ea580c; }
.marker-liq { background: var(--rose-core); }

.gauge-legend {
  display: flex;
  gap: 1.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.dot-safe { background: var(--emerald-core); }
.dot-warn { background: var(--amber-core); }
.dot-call { background: #ea580c; }
.dot-liq { background: var(--rose-core); }

.financial-breakdown {
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}
.breakdown-row.highlight {
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-subtle);
  font-weight: 700;
}
.b-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Ledger Subsystem */
.ledger-feed-card {
  margin-top: 1.5rem;
}
.ledger-table-wrapper {
  max-height: 260px;
  overflow-y: auto;
}

/* ==========================================================================
   VIEW 5: X402 AUTONOMOUS PAYMENT & EDGE MONETIZATION RAILS
   ========================================================================== */
.x402-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1100px) {
  .x402-grid {
    grid-template-columns: 1fr;
  }
}

.x402-banner {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.x402-banner p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.x402-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
}
@media (max-width: 700px) {
  .x402-stats-row {
    grid-template-columns: 1fr;
  }
}

.x402-stat-box {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.x402-stat-box .num {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.x402-links-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.x402-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  background: var(--bg-card);
  color: var(--text-pure);
  font-weight: 600;
  transition: all 0.2s;
}
.x402-link-item:hover {
  border-color: var(--cyan-core);
  transform: translateX(4px);
}
.x402-link-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--cyan-core);
}

.x402-sim-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sim-step-box {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ==========================================================================
   MODAL & TOASTS
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-overlay.active {
  display: flex;
}

.modal-container {
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: var(--text-pure);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  font-size: 0.85rem;
}

.modal-detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.modal-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.modal-val {
  font-family: var(--font-mono);
  color: var(--text-pure);
  word-break: break-all;
}

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-pure);
  animation: slideIn 0.3s ease-out;
}
.toast.toast-success { border-color: var(--emerald-core); }
.toast.toast-info { border-color: var(--cyan-core); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.5);
}
