:root {
  --bg-texture: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.05) 0%, rgba(11, 15, 20, 0) 70%),
                radial-gradient(circle at 80% 20%, rgba(245, 166, 35, 0.03) 0%, transparent 60%);
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --focus-ring: 0 0 0 2px rgba(56, 189, 248, 0.45);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, 0.08);

  /* Unified ecosystem palette */
  --bg-base: #070a0e;
  --bg-surface: #0c1017;
  --bg-card: #121822;
  --bg-card-hover: #17202d;
  --bg-input: #090d14;
  --border-subtle: #172030;
  --border-default: #1e293b;
  --border-accent: rgba(56, 189, 248, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.25);
  --green: #00e599;
  --green-glow: rgba(0, 229, 153, 0.25);
  --red: #ff3864;
  --red-glow: rgba(255, 56, 100, 0.25);
  --gold: #f5a623;
  --gold-glow: rgba(245, 166, 35, 0.25);
  --purple: #a855f7;
}

/* Custom modern scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #090c10;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

body {
  font-family: var(--font-sans) !important;
  background-color: var(--bg-base);
  background-image: var(--bg-texture);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

pre, code, .addr, .mono {
  font-family: var(--font-mono) !important;
}

/* Top accent strip on headers */
header {
  position: relative;
}
header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8 0%, #a855f7 50%, #f5a623 100%);
  opacity: 0.8;
}

/* Unified institutional pro navbar */
.pro-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  background: rgba(12, 16, 23, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.brand-logo:hover {
  opacity: 0.9;
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f5a623, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #070a0e;
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.35);
}

.env-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(245, 166, 35, 0.1);
  color: var(--gold);
  border: 1px solid rgba(245, 166, 35, 0.25);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-tab-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
  opacity: 0.92;
}

.module-tab-btn .tab-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.nav-btn.active {
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.25);
  font-weight: 600;
}
.nav-btn.cta {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(168, 85, 247, 0.15));
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--cyan);
  font-weight: 600;
}
.nav-btn.cta:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(168, 85, 247, 0.25));
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* Pulsing status indicators */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  display: inline-block;
  animation: pulse-glow 2s infinite ease-in-out;
}
@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.65; }
}

/* Improved nav pills and buttons */
nav a, .wallet-bar button, button {
  transition: all 0.15s ease;
}
nav a:hover, button:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* Modern Card Depth & Glassmorphism */
.card, section, .modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--card-inset), 0 4px 16px rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover, section:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--card-inset), 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Focus-visible rings */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Smooth transitions */
input, select {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
input:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Keep fail-closed disclaimers visible */
.role, footer, .chip, .sub {
  font-weight: 500;
}
