:root {
  --bg-primary: #090b10;
  --bg-secondary: #0f131a;
  --bg-card: rgba(18, 23, 33, 0.75);
  --bg-card-hover: rgba(24, 31, 45, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --blue: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --blur: blur(12px);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* APP LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: block;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.domain-selector-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.domain-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.domain-select {
  width: 100%;
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  outline: none;
  cursor: pointer;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-email {
  display: block;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN CONTENT */
.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 32px 40px;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.topbar-left h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.server-badge {
  display: inline-block;
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  margin-top: 6px;
}

.topbar-right {
  display: flex;
  gap: 12px;
}

/* TAB CONTENT */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 10px 0 4px 0;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.text-green { color: var(--success); }
.text-blue { color: #60a5fa; }
.text-gold { color: #fbbf24; }

/* SECTION CARD */
.section-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* NODE GRID (NODEPULSE) */
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.node-card {
  background: rgba(10, 14, 22, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.node-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.node-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 0;
}

.node-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.node-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* TABLE STYLING */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* BADGES */
.badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-suspended {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.btn-outline:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block { width: 100%; justify-content: center; }

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  color: var(--text-muted);
}
.btn-icon:hover { color: var(--text-main); }

/* MODALS */
.auth-overlay, .modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-card, .modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  animation: modalScale 0.2s ease;
}

.modal-card { max-width: 520px; }

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group { flex: 1; }

.error-msg {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* KEY DISPLAY */
.key-display-box {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.key-display-box input {
  flex: 1;
  padding: 10px 14px;
  background: #000;
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* DOCS BOX */
.code-banner {
  background: #05070a;
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 1rem;
}

.highlight-domain { color: #60a5fa; }
.highlight-network { color: #f43f5e; font-weight: 700; }
.highlight-key { color: #34d399; }

.endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.endpoint-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.badge-network {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-network.trx { background: #ef4444; color: #fff; }
.badge-network.ltc { background: #3b82f6; color: #fff; }
.badge-network.btc { background: #f59e0b; color: #000; }
.badge-network.bsc { background: #eab308; color: #000; }
.badge-network.pol { background: #8b5cf6; color: #fff; }
.badge-network.avax { background: #dc2626; color: #fff; }
.badge-network.eth { background: #6366f1; color: #fff; }
.badge-network.xrp { background: #23292f; color: #fff; border: 1px solid #475569; }
.badge-network.ws { background: #10b981; color: #000; }

.text-blue { color: #3b82f6 !important; }
.text-gold { color: #f59e0b !important; }

.endpoint-url {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* WEBSOCKET TERMINAL CONSOLE */
.ws-terminal-console {
  background: #020408;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.ws-log-line {
  word-break: break-all;
  line-height: 1.4;
}

.ws-log-line.info { color: #60a5fa; }
.ws-log-line.in { color: #34d399; }
.ws-log-line.out { color: #fbbf24; }
.ws-log-line.error { color: #f87171; }
