:root {
  color-scheme: dark;

  /* --- Hyper-Glass Palette --- */
  --bg-dark: #000000;
  --bg-deep: #050508;
  
  --glass-base: rgba(18, 18, 24, 0.72);
  --glass-light: rgba(255, 255, 255, 0.03);
  --glass-lighter: rgba(255, 255, 255, 0.08);
  --glass-shine: rgba(255, 255, 255, 0.15);
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-shine: rgba(255, 255, 255, 0.15);

  --shadow-dock: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3);
  
  /* --- Neons --- */
  --neon-blue: #00d4ff;
  --neon-purple: #7b2fff;
  --neon-green: #00ff9d;
  --neon-red: #ff3366;
  --neon-amber: #ffae00;
  --neon-cyan: #00e5ff;
  --edge-light: rgba(200, 220, 255, 0.12);

  /* --- Typography --- */
  --font-display: "SF Pro Display", "Inter", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", monospace;

  /* --- Easing --- */
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --health-diamond-pulse-duration: 6.5s;
  --health-diamond-glow-alpha: 0.25;
}

body[data-health-state="degraded"] {
  --health-diamond-pulse-duration: 2.8s;
  --health-diamond-glow-alpha: 0.6;
}

body[data-health-state="offline"],
body[data-health-state="unknown"] {
  --health-diamond-pulse-duration: 8.5s;
  --health-diamond-glow-alpha: 0.14;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  font-family: var(--font-display);
  color: #fff;
  overflow: hidden;
  user-select: none; /* App-like feel */
}

/* --- Immersive Background: Nebula Flow --- */
.glass-background {
  position: fixed;
  inset: 0;
  z-index: -10;
  /* Multi-layer mesh gradient for depth */
  background:
    radial-gradient(ellipse 80% 50% at 20% 80%, rgba(15, 5, 40, 0.9) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(0, 30, 60, 0.7) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(10, 0, 25, 0.5) 0%, transparent 80%),
    radial-gradient(ellipse 120% 60% at 50% 110%, rgba(25, 5, 50, 0.8) 0%, transparent 50%),
    linear-gradient(180deg, #020108 0%, #07030f 40%, #030812 100%);
  overflow: hidden;
}

/* --- Aurora Orbs: Complex organic motion --- */
.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  will-change: transform, opacity;
  /* No blend mode — normal compositing avoids additive brightening */
}

.aurora-orb.one {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(80, 0, 180, 0.22) 0%, rgba(40, 0, 120, 0.08) 50%, transparent 70%);
  top: -15%; left: -10%;
  animation: nebulaOrb1 28s infinite ease-in-out;
}

.aurora-orb.two {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0, 120, 200, 0.18) 0%, rgba(0, 50, 140, 0.06) 50%, transparent 70%);
  bottom: -10%; right: -8%;
  animation: nebulaOrb2 35s infinite ease-in-out;
}

.aurora-orb.three {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0, 180, 120, 0.12) 0%, rgba(0, 100, 60, 0.04) 50%, transparent 70%);
  top: 35%; left: 55%;
  animation: nebulaOrb3 22s infinite ease-in-out;
}

.aurora-orb.four {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(120, 0, 180, 0.10) 0%, rgba(60, 0, 120, 0.04) 50%, transparent 70%);
  top: 60%; left: 10%;
  animation: nebulaOrb4 30s infinite ease-in-out;
}

.aurora-orb.five {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(0, 140, 200, 0.08) 0%, rgba(0, 60, 120, 0.03) 50%, transparent 70%);
  top: 10%; right: 25%;
  animation: nebulaOrb5 25s infinite ease-in-out;
}

/* Subtle geometric mesh grid */
.mesh-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(0,0,0,0.4) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(0,0,0,0.4) 0%, transparent 70%);
  pointer-events: none;
  animation: meshDrift 40s linear infinite;
}

/* Film grain noise - more visible than before */
.noise-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.7;
}

/* Top-edge ambient light bleed */
.ambient-glow {
  position: absolute;
  top: -2px; left: 10%; right: 10%;
  height: 200px;
  background: linear-gradient(180deg,
    rgba(0, 180, 255, 0.03) 0%,
    rgba(0, 120, 200, 0.015) 40%,
    transparent 100%);
  filter: blur(40px);
  pointer-events: none;
  animation: ambientPulse 8s ease-in-out infinite alternate;
}

/* --- Aurora Keyframes: Multi-point organic paths --- */
@keyframes nebulaOrb1 {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.37; }
  20%  { transform: translate(80px, 40px) scale(1.15); opacity: 0.46; }
  40%  { transform: translate(30px, 80px) scale(1.05); opacity: 0.31; }
  60%  { transform: translate(-50px, 50px) scale(1.2); opacity: 0.43; }
  80%  { transform: translate(-20px, -30px) scale(0.95); opacity: 0.34; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.37; }
}

@keyframes nebulaOrb2 {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.31; }
  25%  { transform: translate(-60px, -50px) scale(1.1); opacity: 0.40; }
  50%  { transform: translate(-90px, 20px) scale(1.2); opacity: 0.25; }
  75%  { transform: translate(-30px, -70px) scale(0.9); opacity: 0.34; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.31; }
}

@keyframes nebulaOrb3 {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.28; }
  30%  { transform: translate(-40px, -60px) scale(1.3); opacity: 0.37; }
  60%  { transform: translate(50px, -20px) scale(0.85); opacity: 0.22; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.28; }
}

@keyframes nebulaOrb4 {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.25; }
  35%  { transform: translate(70px, -40px) scale(1.15); opacity: 0.34; }
  70%  { transform: translate(20px, 60px) scale(0.9); opacity: 0.19; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.25; }
}

@keyframes nebulaOrb5 {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.22; }
  40%  { transform: translate(-50px, 50px) scale(1.2); opacity: 0.31; }
  80%  { transform: translate(30px, -40px) scale(0.95); opacity: 0.16; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.22; }
}

@keyframes meshDrift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

@keyframes ambientPulse {
  0%   { opacity: 0.3; transform: scaleX(1); }
  100% { opacity: 0.6; transform: scaleX(1.05); }
}

/* --- Pulse Canvas --- */
#pulse-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -5;
  pointer-events: none;
  opacity: 0.15;
}

/* --- Center Energy Field: Breathing Core --- */
.center-energy-field {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(0, 212, 255, 0.025) 0%,
    rgba(0, 180, 255, 0.008) 30%,
    transparent 70%
  );
  filter: blur(70px);
  z-index: -4;
  pointer-events: none;
  animation: energyBreath 12s ease-in-out infinite alternate;
}

@keyframes energyBreath {
  0%   { opacity: 0.25; transform: translate(-50%, -50%) scale(0.97); }
  100% { opacity: 0.42; transform: translate(-50%, -50%) scale(1.03); }
}

/* --- Atmosphere Response: Corner Flash --- */
.glass-background.atmosphere-warning::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 300px; height: 300px;
  background: radial-gradient(circle at top right,
    rgba(255, 174, 0, 0.12) 0%,
    transparent 70%
  );
  animation: cornerFlash 0.6s ease-out forwards;
  pointer-events: none;
  z-index: 5;
}

.glass-background.atmosphere-critical::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 400px; height: 400px;
  background: radial-gradient(circle at top right,
    rgba(255, 51, 102, 0.10) 0%,
    transparent 70%
  );
  animation: cornerFlash 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 5;
}

@keyframes cornerFlash {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --- App Shell --- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 10;
}

/* --- Status Bar --- */
.status-bar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  background: linear-gradient(180deg, rgba(10, 10, 15, 0.3) 0%, transparent 100%);
}

.status-left,
.status-center,
.status-right {
  display: flex;
  align-items: center;
}

.status-left,
.status-right {
  gap: 12px;
  flex-shrink: 0;
}

.status-center {
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand-logo {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.96);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  border-radius: 2px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, var(--health-diamond-glow-alpha)));
  animation: healthDiamondSpin 12s linear infinite,
    healthDiamondPulse var(--health-diamond-pulse-duration) ease-in-out infinite;
}

.brand-logo::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: rgba(255, 255, 255, 0.24);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.brand-name {
  font-size: 13px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes healthDiamondSpin {
  to { transform: rotate(360deg); }
}

@keyframes healthDiamondPulse {
  0%, 55%, 100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

.user-pill {
  cursor: pointer;
}

.action-pill {
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  appearance: none;
}

.action-pill:active {
  transform: translateY(1px);
}

/* Refresh Button — Compact Glass Circle */
#btn-page-refresh {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  font-family: inherit;
}

#btn-page-refresh:not(:disabled):hover {
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 180, 255, 0.3);
  background: rgba(0, 180, 255, 0.08);
  box-shadow: 0 0 16px rgba(0, 180, 255, 0.12), 0 0 4px rgba(0, 180, 255, 0.06) inset;
}

#btn-page-refresh:not(:disabled):active {
  transform: scale(0.92);
}

#btn-page-refresh .refresh-icon {
  display: block;
  transform-origin: 50% 50%;
  transform-box: fill-box;
  will-change: transform;
  transition: transform 0.3s ease;
}

#btn-page-refresh:not(:disabled):hover .refresh-icon {
  transform: rotate(30deg);
}

@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}

#btn-page-refresh.is-refreshing {
  cursor: wait;
  border-color: rgba(0, 180, 255, 0.24);
  background: rgba(0, 180, 255, 0.04);
  box-shadow: 0 0 12px rgba(0, 180, 255, 0.10), 0 0 3px rgba(0, 180, 255, 0.04) inset;
}

#btn-page-refresh.is-refreshing .refresh-icon {
  animation: refresh-spin 0.7s linear infinite;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 180, 255, 0.3), rgba(120, 0, 255, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.glass-pill {
  background: var(--glass-light);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s var(--ease-smooth);
}

.glass-pill:hover {
  background: var(--glass-lighter);
  border-color: var(--border-shine);
  box-shadow: 0 0 15px rgba(255,255,255,0.1);
}

.status-pill:not(.glass-pill) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  margin-right: 2px;
}

.status-pill .dot {
  width: 6px; height: 6px;
  background: var(--neon-amber);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-amber);
  transition: background 0.3s;
}

.status-pill.ok .dot { background: var(--neon-green); box-shadow: 0 0 8px var(--neon-green); }
.status-pill.warn .dot { background: var(--neon-amber); box-shadow: 0 0 8px var(--neon-amber); }
.status-pill.error .dot { background: var(--neon-red); box-shadow: 0 0 8px var(--neon-red); }
.status-pill.muted .dot { background: rgba(255,255,255,0.35); box-shadow: none; }

/* --- Dynamic Island --- */
.dynamic-island {
  height: 36px;
  background: #000;
  border-radius: 999px;
  min-width: 120px;
  transition: all 0.4s var(--ease-elastic);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-size: 13px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.dynamic-island.hidden {
  opacity: 0;
  transform: translateY(-20px) scale(0.8);
}

/* --- Viewport --- */
.viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 40px 120px 40px; /* Bottom padding for Dock */
  scroll-behavior: smooth;
}

.viewport::-webkit-scrollbar { width: 6px; }
.viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* --- Floating Dock --- */
.dock-container {
  position: fixed;
  bottom: 30px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  z-index: 100;
  pointer-events: none; /* Let clicks pass through outside dock */
}

.dock {
  pointer-events: auto;
  background: rgba(10, 10, 14, 0.75);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  border-radius: 24px;
  display: flex;
  gap: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-origin: bottom center;
  transition: transform 0.2s;
}

.dock-item {
  width: 54px; height: 54px;
  border: none;
  background: transparent; /* var(--glass-light); */
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s var(--ease-elastic);
}

.dock-item .icon {
  font-size: 24px;
  transition: transform 0.2s;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.dock-item .label {
  position: absolute;
  top: -36px;
  background: rgba(0,0,0,0.9);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: none;
  white-space: nowrap;
  color: #fff;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-8px) scale(1.1);
  margin: 0 6px; /* Spreading effect */
}

.dock-item:hover .label {
  opacity: 1;
  transform: translateY(0);
}

.dock-item.is-active {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.dock-item.is-active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--neon-blue);
  box-shadow: 0 0 8px var(--neon-blue);
}

.dock-separator {
  width: 1px;
  background: rgba(255,255,255,0.15);
  margin: 6px 4px;
}

/* --- Common UI Components --- */

/* --- Subtabs / Panels --- */
.subtab-bar {
  display: flex;
  gap: 12px;
  margin: 16px 0 24px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 4px; /* Scrollbar space */
  -webkit-overflow-scrolling: touch;
}

.subtab-btn {
  border: 1px solid var(--border-glass);
  background: var(--glass-light);
  color: #fff;
  border-radius: 999px;
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s var(--ease-smooth);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.subtab-btn.is-active {
  background: var(--glass-lighter);
  border-color: var(--border-shine);
  color: var(--neon-blue);
  font-weight: 500;
}

.subtab-panel { display: none; }
.subtab-panel.is-active { display: block; }

/* --- Tables / Lists --- */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-glass);
  font-size: 13px;
}

.version-list { list-style: none; margin: 0; padding: 0; }
.version-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-glass); }
.version-meta { font-size: 11px; color: rgba(255,255,255,0.5); }
.muted { color: rgba(255,255,255,0.55); font-size: 12px; }

/* --- Forms --- */
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  flex: 1;
}
.form-hint {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  line-height: 1.4;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.divider {
  height: 1px;
  background: var(--border-glass);
  margin: 8px 0;
}

.ai-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.ai-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-settings-current {
  margin-bottom: 12px;
  background: rgba(255,255,255,0.02);
  font-size: 12px;
}

.ai-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.ai-meta-grid .label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.ai-meta-grid .value {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  word-break: break-word;
}

.ai-test-output {
  margin: 0;
  font-size: 11px;
  overflow: auto;
  min-height: 200px;
  flex: 1;
}

.ai-test-meta {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s, color 0.2s;
}

.ai-test-meta.pending {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
}

.ai-test-meta.success {
  border-color: rgba(0, 240, 255, 0.4);
  color: var(--neon-green);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.12);
}

.ai-test-meta.error {
  border-color: rgba(255, 51, 102, 0.4);
  color: var(--neon-red);
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.12);
}

.ai-key-form {
  grid-template-columns: 1fr 2fr auto;
  align-items: end;
}

.ai-key-add-btn {
  height: 42px;
}

.action-group { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-list { display: flex; flex-direction: column; gap: 12px; }
.settings-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border-glass); border-radius: 12px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Chips / badges --- */
.chip-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { border: 1px solid var(--border-glass); padding: 4px 8px; border-radius: 999px; font-size: 12px; }

/* --- Modals --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal.hidden { display: none; }
.modal .modal-card { padding: 20px; border-radius: 16px; background: rgba(0,0,0,0.8); }

/* --- Misc --- */
.stream-list { display: flex; flex-direction: column; gap: 10px; }
.stream-item { padding: 12px; border: 1px solid var(--border-glass); border-radius: 12px; background: var(--glass-base); }
.stream-header { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.7; }
.cell-title { font-weight: 600; }

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.bento-card {
  background: rgba(12, 12, 18, 0.82);
  border: 1px solid rgba(0, 212, 255, 0.08);
  border-radius: 28px;
  padding: 24px;
  backdrop-filter: blur(18px) saturate(0.9);
  -webkit-backdrop-filter: blur(18px) saturate(0.9);
  transition: all 0.4s var(--ease-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 20px rgba(0, 212, 255, 0.03);
}

/* Subtle top-left shine highlight */
.bento-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Hover glow aura */
.bento-card::after {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 48px;
  background: radial-gradient(ellipse at center,
    rgba(0, 212, 255, 0.04) 0%,
    transparent 70%
  );
  filter: blur(30px);
  pointer-events: none;
  transition: opacity 0.5s;
  opacity: 0;
}

.bento-card:hover {
  background: rgba(18, 18, 28, 0.86);
  border-color: rgba(0, 212, 255, 0.15);
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    0 0 40px rgba(0, 180, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 30px rgba(0, 212, 255, 0.05);
}

.bento-card:hover::after {
  opacity: 1;
}

.bento-card.col-2 { grid-column: span 2; }
.bento-card.row-2 { grid-row: span 2; }

/* Staggered entrance animation */
.bento-card { animation: bentoCardIn 0.5s var(--ease-smooth) both; }
.bento-grid > .bento-card:nth-child(1) { animation-delay: 0.03s; }
.bento-grid > .bento-card:nth-child(2) { animation-delay: 0.08s; }
.bento-grid > .bento-card:nth-child(3) { animation-delay: 0.13s; }
.bento-grid > .bento-card:nth-child(4) { animation-delay: 0.18s; }
.bento-grid > .bento-card:nth-child(5) { animation-delay: 0.23s; }
.bento-grid > .bento-card:nth-child(6) { animation-delay: 0.28s; }

@keyframes bentoCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Typography in Cards */
.bento-title {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  font-weight: 600;
}

.bento-value {
  font-size: 42px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: linear-gradient(to bottom, #fff, rgba(200, 210, 230, 0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Loader --- */
.view-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Form Elements --- */
.glass-input {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  width: 100%;
  outline: none;
  transition: 0.3s;
}
.glass-input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

/* Native select dropdown option styling */
select.glass-input,
.nav-pill-group-select {
  color-scheme: dark;
}
select.glass-input option,
.nav-pill-group-select option {
  background: #14141c;
  color: rgba(255, 255, 255, 0.9);
  padding: 6px 8px;
}

.glass-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  padding: 10px 20px;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: 0.3s;
  font-weight: 600;
}
.glass-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}
.glass-btn.primary {
  background: var(--neon-blue);
  color: #000;
  border: none;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}
.glass-btn.primary:hover {
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
  transform: scale(1.05);
}

.ide-container {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px;
}

.ide-textarea {
  width: 100%;
  min-height: 220px;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  resize: vertical;
  outline: none;
}

.code {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px;
  color: #cbd5f5;
  font-family: var(--font-mono);
  white-space: pre-wrap;
}

.mono {
  font-family: var(--font-mono);
}

.card {
  background: var(--glass-base);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}

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

.card-title {
  font-weight: 700;
}

/* --- Bot Grid --- */
.tg-bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 10px 0;
}

.tg-fleet-full-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 10px 0;
}

.bot-card-full {
  width: 100%;
}

/* --- Fleet UI --- */
.fleet-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.fleet-summary-card {
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
}
.fleet-summary-card .label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}
.fleet-summary-card .value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}
.fleet-summary-card.ok { border-color: rgba(61, 210, 120, 0.35); }
.fleet-summary-card.warn { border-color: rgba(255, 183, 77, 0.4); }
.fleet-summary-card.bad { border-color: rgba(255, 99, 99, 0.45); }

.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.fleet-card {
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fleet-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.fleet-identity {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fleet-title {
  font-size: 16px;
  font-weight: 700;
}
.fleet-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.fleet-dot {
  opacity: 0.5;
}
.fleet-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-glass);
  width: fit-content;
}
.fleet-badge.collector { border-color: rgba(0, 188, 212, 0.5); }
.fleet-badge.publisher { border-color: rgba(76, 175, 80, 0.5); }
.fleet-badge.search { border-color: rgba(255, 193, 7, 0.5); }
.fleet-badge.custom { border-color: rgba(156, 39, 176, 0.5); }

.fleet-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.fleet-status-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
}
.fleet-status-pill.ok { color: var(--neon-green); border-color: rgba(61, 210, 120, 0.45); }
.fleet-status-pill.warn { color: var(--neon-amber); border-color: rgba(255, 183, 77, 0.5); }
.fleet-status-pill.bad { color: var(--neon-red); border-color: rgba(255, 99, 99, 0.6); }
.fleet-status-pill.muted { color: rgba(255,255,255,0.6); }

.fleet-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.fleet-card-metrics .label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}
.fleet-card-metrics .value {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.fleet-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.fleet-card-details {
  display: none;
  padding-top: 10px;
  border-top: 1px solid var(--border-glass);
}
.fleet-card.is-expanded .fleet-card-details {
  display: block;
}
.fleet-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
}
.fleet-detail-list .label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}
.fleet-detail-list .value {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

@media (max-width: 700px) {
  .bot-card-full {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px;
  }
  .bot-card-full > div {
    width: 100%;
    justify-content: flex-start;
    text-align: left !important;
    align-items: flex-start !important;
  }
  .fleet-summary {
    grid-template-columns: 1fr 1fr;
  }
  .ai-summary-grid {
    grid-template-columns: 1fr;
  }
  .ai-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ai-meta-grid {
    grid-template-columns: 1fr;
  }
  .ai-key-form {
    grid-template-columns: 1fr;
  }
  .ai-key-add-btn {
    width: 100%;
    height: 40px;
  }
}

/* --- Progress Bars (Dashboard) --- */
.progress-track {
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  height: 8px;
  width: 100%;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--neon-blue);
  border-radius: 999px;
  transition: width 1s var(--ease-elastic);
}
.progress-fill.ok { background: var(--neon-green); }
.progress-fill.warn { background: var(--neon-amber); }
.progress-fill.bad { background: var(--neon-red); }

/* --- Modals Input Fix --- */
.modal .glass-input {
  background: rgba(40, 40, 45, 0.9);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 500;
}
.modal .glass-input:focus {
  background: rgba(50, 50, 60, 1);
  border-color: var(--neon-blue);
}
.modal ::placeholder {
  color: rgba(255,255,255,0.4);
}

/* --- Subchannels Grid --- */
.subchannels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.subchannel-card {
  background: var(--glass-base);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s var(--ease-smooth);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.subchannel-card:hover {
  transform: translateY(-5px);
  background: rgba(30, 30, 40, 0.82);
  border-color: var(--border-shine);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.subchannel-card.is-disabled {
  opacity: 0.6;
  filter: grayscale(0.8);
}

.sc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.sc-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--neon-blue);
}

.sc-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sc-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.sc-tag {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
}

.sc-actions {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 8px;
}

/* --- Subchannel Tag Options --- */
.tag-group-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.tag-group-title {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 6px;
}
.tag-group-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-option {
  cursor: pointer;
  font-size: 12px;
}
.tag-option input {
  margin: 0 6px 0 0;
}

/* --- Dashboard Extra --- */
.dash-chart-container {
  height: 200px;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 20px 0 0 0;
}

.dash-bar {
  flex: 1;
  background: var(--neon-blue);
  opacity: 0.2;
  border-radius: 4px 4px 0 0;
  transition: all 0.3s;
}
.dash-bar:hover { opacity: 0.8; }

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}
.activity-item:last-child { border-bottom: none; }

.activity-time {
  font-family: var(--font-mono);
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  min-width: 60px;
}

/* --- Broadcast --- */
.broadcast-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}
.broadcast-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
}
.broadcast-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.broadcast-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.broadcast-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.broadcast-selected-count {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}
.broadcast-targets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}
.broadcast-target {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.broadcast-target.is-disabled {
  opacity: 0.5;
}
.broadcast-target-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.broadcast-target-title {
  font-size: 13px;
  font-weight: 600;
}
.broadcast-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* --- Channel Nav View --- */
/* ─── Channel Nav Page ─── */

/* Action bar reuse */
.nav-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(18, 18, 24, 0.72);
  backdrop-filter: blur(20px) saturate(0.9);
  -webkit-backdrop-filter: blur(20px) saturate(0.9);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.nav-action-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-amber), var(--neon-purple), var(--neon-blue));
  background-size: 200% 100%;
  animation: stgGradientSlide 5s linear infinite;
  opacity: 0.7;
}
.nav-action-bar .nav-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-action-bar .nav-bar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.nav-action-bar .nav-bar-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}
.nav-action-bar .nav-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Container */
.nav-groups-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 0 80px;
}

/* Group Panel — premium glass card */
.nav-group-panel {
  background: rgba(18, 18, 24, 0.82);
  backdrop-filter: blur(16px) saturate(0.9);
  -webkit-backdrop-filter: blur(16px) saturate(0.9);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  position: relative;
  animation: stgCardIn 0.45s var(--ease-smooth) both;
}
.nav-group-panel:nth-child(1) { animation-delay: 0.03s; }
.nav-group-panel:nth-child(2) { animation-delay: 0.08s; }
.nav-group-panel:nth-child(3) { animation-delay: 0.13s; }
.nav-group-panel:nth-child(4) { animation-delay: 0.18s; }
.nav-group-panel:nth-child(5) { animation-delay: 0.23s; }
.nav-group-panel:nth-child(6) { animation-delay: 0.28s; }
.nav-group-panel:nth-child(7) { animation-delay: 0.33s; }

/* Subtle top-left shine (same as stg-card) */
.nav-group-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,255,255,0.07), transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Colored top accent per group */
.nav-group-panel::after {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  opacity: 0.5;
  transition: opacity 0.35s;
  pointer-events: none;
}
.nav-group-panel:hover::after { opacity: 0.85; }
.nav-group-panel[data-accent="amber"]::after  { background: linear-gradient(90deg, transparent, var(--neon-amber), transparent); }
.nav-group-panel[data-accent="green"]::after  { background: linear-gradient(90deg, transparent, var(--neon-green), transparent); }
.nav-group-panel[data-accent="purple"]::after { background: linear-gradient(90deg, transparent, var(--neon-purple), transparent); }
.nav-group-panel[data-accent="red"]::after    { background: linear-gradient(90deg, transparent, var(--neon-red), transparent); }
.nav-group-panel[data-accent="blue"]::after   { background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); }
.nav-group-panel[data-accent="cyan"]::after   { background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); }

.nav-group-panel:hover {
  border-color: var(--border-shine);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Hidden group variant */
.nav-group-panel.nav-group-hidden {
  border-style: dashed;
  opacity: 0.65;
}
.nav-group-panel.nav-group-hidden:hover { opacity: 0.85; }

/* Group Header */
.nav-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.nav-group-header .nav-group-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  margin-right: 12px;
  transition: transform 0.3s var(--ease-elastic), box-shadow 0.3s;
}
.nav-group-panel:hover .nav-group-icon { transform: scale(1.08); }
.nav-group-icon.amber  { background: linear-gradient(135deg, rgba(255,174,0,0.18), rgba(200,120,0,0.1)); box-shadow: 0 4px 14px rgba(255,174,0,0.1); }
.nav-group-icon.green  { background: linear-gradient(135deg, rgba(0,255,157,0.18), rgba(0,180,90,0.1)); box-shadow: 0 4px 14px rgba(0,255,157,0.1); }
.nav-group-icon.purple { background: linear-gradient(135deg, rgba(189,0,255,0.18), rgba(100,0,180,0.1)); box-shadow: 0 4px 14px rgba(189,0,255,0.08); }
.nav-group-icon.red    { background: linear-gradient(135deg, rgba(255,0,85,0.18), rgba(180,0,50,0.1)); box-shadow: 0 4px 14px rgba(255,0,85,0.08); }
.nav-group-icon.blue   { background: linear-gradient(135deg, rgba(0,240,255,0.18), rgba(0,100,220,0.1)); box-shadow: 0 4px 14px rgba(0,240,255,0.1); }
.nav-group-icon.cyan   { background: linear-gradient(135deg, rgba(0,240,255,0.18), rgba(0,160,180,0.1)); box-shadow: 0 4px 14px rgba(0,240,255,0.08); }
.nav-group-header .nav-group-tag {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}

/* Pills Zone */
.nav-pills-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 40px;
  align-items: center;
  padding: 16px 24px 20px;
}

/* Individual Pill — elevated style */
.nav-item-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px 16px;
  font-size: 13px;
  color: #fff;
  cursor: grab;
  transition: all 0.25s var(--ease-smooth);
  user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-item-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}
.nav-item-pill:active {
  transform: scale(0.97);
}
.nav-item-pill.is-dragging {
  opacity: 0.35;
  transform: scale(0.92);
  box-shadow: none;
}
.nav-item-pill.is-hidden {
  opacity: 0.4;
  filter: grayscale(0.6);
  text-decoration: line-through;
}
.nav-item-pill.is-system {
  cursor: default;
  border-color: rgba(0, 240, 255, 0.2);
  background: rgba(0, 240, 255, 0.06);
  box-shadow: 0 2px 10px rgba(0,240,255,0.08);
}
.nav-item-pill.is-system:hover {
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0,240,255,0.12);
}

.nav-pill-label {
  pointer-events: none;
  font-weight: 500;
}
.nav-pill-action {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
}
.nav-pill-action:hover {
  opacity: 1;
  transform: scale(1.15);
}
.nav-pill-badge {
  font-size: 10px;
  opacity: 0.5;
  padding: 2px 8px;
  border: 1px solid rgba(0,240,255,0.15);
  border-radius: 999px;
  color: var(--neon-blue);
}
.nav-pill-group-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.nav-pill-group-select:focus {
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 0 2px rgba(0,240,255,0.1);
}

/* Region sub-labels */
.nav-region-label {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.35);
  padding: 6px 0 4px;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.nav-region-label:first-child {
  margin-top: 0;
  border-top: none;
}

/* Drop indicator */
.nav-drop-indicator {
  width: 100%;
  height: 3px;
  background: var(--neon-blue);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.2);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .nav-action-bar { padding: 14px 16px; border-radius: 16px; }
  .nav-group-panel { border-radius: 20px; }
  .nav-group-panel::after { left: 18px; right: 18px; }
  .nav-group-header { padding: 14px 18px 0; }
  .nav-pills-zone { padding: 12px 18px 16px; }
}

/* ─── Settings Page ─── */

/* ── Animations ── */
@keyframes stgGradientSlide {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes stgDotPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.35); }
}
@keyframes stgCardIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Action Bar ── */
.settings-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(255,255,255,0.025);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
/* Animated rainbow accent line */
.settings-action-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple), var(--neon-green), var(--neon-blue));
  background-size: 200% 100%;
  animation: stgGradientSlide 4s linear infinite;
  opacity: 0.75;
}
.settings-action-bar .stg-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-action-bar .stg-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Status Dot ── */
.stg-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: all 0.4s var(--ease-smooth);
}
.stg-status-dot.on {
  background: var(--neon-green);
  box-shadow: 0 0 12px rgba(0,255,157,0.6), 0 0 24px rgba(0,255,157,0.2);
  animation: stgDotPulse 2.4s ease-in-out infinite;
}
.stg-status-dot.off {
  background: var(--neon-red);
  box-shadow: 0 0 12px rgba(255,0,85,0.5), 0 0 24px rgba(255,0,85,0.15);
}

/* ── Grid Layouts ── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.settings-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ── Card — premium glass ── */
.stg-card {
  background: rgba(18, 18, 24, 0.82);
  backdrop-filter: blur(16px) saturate(0.9);
  -webkit-backdrop-filter: blur(16px) saturate(0.9);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.4s;
  transition-timing-function: var(--ease-smooth);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Entrance animation */
  animation: stgCardIn 0.5s var(--ease-smooth) both;
}
/* Stagger entrance per child position */
.settings-grid > .stg-card:nth-child(1) { animation-delay: 0.05s; }
.settings-grid > .stg-card:nth-child(2) { animation-delay: 0.12s; }
.settings-bottom-grid > .stg-card:nth-child(1) { animation-delay: 0.19s; }
.settings-bottom-grid > .stg-card:nth-child(2) { animation-delay: 0.26s; }

/* Subtle top-left shine */
.stg-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,255,255,0.08), transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Colored top accent stripe per card variant */
.stg-card::after {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  opacity: 0.55;
  transition: opacity 0.35s;
  pointer-events: none;
}
.stg-card:hover::after { opacity: 0.9; }
.stg-card.accent-blue::after   { background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); }
.stg-card.accent-green::after  { background: linear-gradient(90deg, transparent, var(--neon-green), transparent); }
.stg-card.accent-purple::after { background: linear-gradient(90deg, transparent, var(--neon-purple), transparent); }
.stg-card.accent-cyan::after   { background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); }

.stg-card:hover {
  border-color: var(--border-shine);
  box-shadow: 0 16px 48px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-2px);
}

/* ── Card Header ── */
.stg-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px 0;
}
.stg-card-head .stg-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.3s var(--ease-elastic), box-shadow 0.3s;
}
.stg-card:hover .stg-card-head:first-child .stg-icon {
  transform: scale(1.08);
}
.stg-icon.blue {
  background: linear-gradient(135deg, rgba(0,240,255,0.18), rgba(0,100,220,0.1));
  box-shadow: 0 4px 16px rgba(0,240,255,0.12);
}
.stg-card:hover .stg-icon.blue { box-shadow: 0 6px 24px rgba(0,240,255,0.22); }
.stg-icon.green {
  background: linear-gradient(135deg, rgba(0,255,157,0.18), rgba(0,180,90,0.1));
  box-shadow: 0 4px 16px rgba(0,255,157,0.12);
}
.stg-card:hover .stg-icon.green { box-shadow: 0 6px 24px rgba(0,255,157,0.22); }
.stg-icon.purple {
  background: linear-gradient(135deg, rgba(189,0,255,0.18), rgba(100,0,180,0.1));
  box-shadow: 0 4px 16px rgba(189,0,255,0.1);
}
.stg-card:hover .stg-icon.purple { box-shadow: 0 6px 24px rgba(189,0,255,0.2); }
.stg-icon.amber {
  background: linear-gradient(135deg, rgba(255,174,0,0.18), rgba(200,120,0,0.1));
  box-shadow: 0 4px 16px rgba(255,174,0,0.1);
}
.stg-card:hover .stg-icon.amber { box-shadow: 0 6px 24px rgba(255,174,0,0.2); }
.stg-icon.cyan {
  background: linear-gradient(135deg, rgba(0,240,255,0.18), rgba(0,160,180,0.1));
  box-shadow: 0 4px 16px rgba(0,240,255,0.1);
}
.stg-card:hover .stg-icon.cyan { box-shadow: 0 6px 24px rgba(0,240,255,0.2); }

.stg-card-head .stg-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.stg-card-head .stg-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 3px;
}
.stg-card-head .stg-hdr-text {
  flex: 1;
  min-width: 0;
}
.stg-card-head .stg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ── Card Body ── */
.stg-card-body {
  padding: 18px 24px 24px;
  flex: 1;
}

/* ── Divider ── */
.stg-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glass), transparent);
  margin: 8px 24px;
}

/* ── Form Grid ── */
.stg-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.stg-form-grid .form-field {
  min-width: 0;
}

/* ── Form Label ── */
.stg-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 6px;
}

/* ── Section Separator ── */
.stg-section-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  margin: 18px 0;
}

/* ── Advanced Settings (Telegram) ── */
.stg-advanced {
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
}
.stg-advanced > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
}
.stg-advanced > summary::-webkit-details-marker {
  display: none;
}
.stg-advanced[open] {
  border-color: rgba(255, 0, 85, 0.35);
  box-shadow: 0 0 0 2px rgba(255, 0, 85, 0.08);
}
.stg-advanced-body {
  margin-top: 10px;
}
.stg-advanced-warn {
  border: 1px solid rgba(255, 0, 85, 0.45);
  background: rgba(255, 0, 85, 0.08);
  color: var(--neon-red);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 12px;
}
.stg-advanced-warn-title {
  font-weight: 700;
  margin-bottom: 4px;
}

/* ── Enhanced focus within stg-card ── */
.stg-card .glass-input:focus {
  box-shadow: 0 0 0 3px rgba(0,240,255,0.1), 0 0 20px rgba(0,240,255,0.15);
}
.stg-card.accent-purple .glass-input:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 0 3px rgba(189,0,255,0.1), 0 0 20px rgba(189,0,255,0.12);
}
.stg-card.accent-green .glass-input:focus {
  border-color: var(--neon-green);
  box-shadow: 0 0 0 3px rgba(0,255,157,0.08), 0 0 20px rgba(0,255,157,0.12);
}

/* ── Count Badge (optional, in card header) ── */
.stg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-glass);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.6);
}
.stg-badge.blue   { border-color: rgba(0,240,255,0.3); color: var(--neon-blue); }
.stg-badge.green  { border-color: rgba(0,255,157,0.3); color: var(--neon-green); }
.stg-badge.purple { border-color: rgba(189,0,255,0.3); color: var(--neon-purple); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .bento-grid { grid-template-columns: 1fr; }
  .bento-card.col-2 { grid-column: span 1; }
  .dock { overflow-x: auto; max-width: 90vw; }
  .broadcast-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-bottom-grid { grid-template-columns: 1fr; }
  .stg-form-grid { grid-template-columns: 1fr; }
  .settings-action-bar { padding: 14px 16px; border-radius: 16px; }
  .stg-card { border-radius: 20px; }
  .stg-card::after { left: 18px; right: 18px; }
  .stg-card-head { padding: 16px 18px 0; }
  .stg-card-body { padding: 14px 18px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .stg-card { animation: none; }
  .stg-status-dot.on { animation: none; }
  .settings-action-bar::before { animation: none; }
  .center-energy-field { animation: none; opacity: 0.35; }
  .glass-background.atmosphere-warning::after,
  .glass-background.atmosphere-critical::after { animation: none; }
}

/* ── Search Bot Admin: Routing Rules ── */
.routing-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.routing-rule-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--glass-base);
  border: 1px solid var(--border-glass);
  transition: border-color 0.2s;
}
.routing-rule-card:hover {
  border-color: rgba(255,255,255,0.15);
}
.routing-rule-card .rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.routing-rule-card .rule-match {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.routing-rule-card .rule-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.routing-rule-card .rule-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.match-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--neon-blue);
}
.match-badge.region {
  background: rgba(0, 255, 157, 0.08);
  border-color: rgba(0, 255, 157, 0.2);
  color: var(--neon-green);
}
.match-badge.exclude {
  background: rgba(255, 0, 85, 0.08);
  border-color: rgba(255, 0, 85, 0.2);
  color: var(--neon-red);
}

.target-pill {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(189, 0, 255, 0.08);
  border: 1px solid rgba(189, 0, 255, 0.2);
  color: var(--neon-purple);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.status-dot.ok {
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
}
.status-dot.off {
  background: rgba(255,255,255,0.15);
}

/* Glass Table */
.glass-table {
  width: 100%;
  border-collapse: collapse;
}
.glass-table th,
.glass-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
}
.glass-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
}
.glass-table tr:hover td {
  background: var(--glass-light);
}

/* Small glass-btn variant */
.glass-btn.small {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}
.glass-btn.danger {
  border-color: rgba(255, 0, 85, 0.3);
  color: var(--neon-red);
}
.glass-btn.danger:hover {
  background: rgba(255, 0, 85, 0.15);
  border-color: var(--neon-red);
}

/* Glass Input */
.glass-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  resize: vertical;
}
.glass-input:focus {
  outline: none;
  border-color: rgba(0, 240, 255, 0.4);
}

/* Page Section Head */
.page-section-head {
  margin-bottom: 16px;
}
.page-section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-section-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

@media (max-width: 900px) {
  .routing-rules-grid { grid-template-columns: 1fr; }
}

/* ─── Auth Modal ─── */

/* Animations */
@keyframes authBorderGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes authPulseGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes authScanLine {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes authShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
@keyframes authIconFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(3deg); }
}
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Card — animated gradient border + deep glass */
.auth-modal-card {
  width: min(540px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: rgba(8, 8, 16, 0.94);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border-radius: 28px;
  position: relative;
  overflow-x: hidden;
  animation: authSlideUp 0.45s var(--ease-elastic) both;
  /* Animated gradient border via padding trick */
  padding: 1px;
}
/* Animated gradient border */
.auth-modal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1px;
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple), var(--neon-green), var(--neon-blue));
  background-size: 300% 300%;
  animation: authBorderGlow 6s ease infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
}
/* Outer glow */
.auth-modal-card::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple), var(--neon-green), var(--neon-blue));
  background-size: 300% 300%;
  animation: authBorderGlow 6s ease infinite;
  filter: blur(20px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}
/* Inner container */
.auth-modal-inner {
  background: rgba(8, 8, 16, 0.97);
  border-radius: 27px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
/* Scanning line effect */
.auth-modal-inner::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
  z-index: 10;
  pointer-events: none;
  animation: authScanLine 4s linear infinite;
  box-shadow: 0 0 15px 3px rgba(0,240,255,0.15);
}
.auth-modal-card::-webkit-scrollbar { width: 5px; }
.auth-modal-card::-webkit-scrollbar-thumb { background: rgba(0,240,255,0.15); border-radius: 3px; }
.auth-modal-card::-webkit-scrollbar-thumb:hover { background: rgba(0,240,255,0.3); }

/* Header */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  position: relative;
  background: linear-gradient(180deg, rgba(0,240,255,0.03) 0%, transparent 100%);
}
/* Top accent bar — animated rainbow */
.auth-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple), var(--neon-green), var(--neon-blue));
  background-size: 200% 100%;
  animation: stgGradientSlide 3s linear infinite;
}
.auth-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-header-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,240,255,0.2), rgba(189,0,255,0.15));
  box-shadow: 0 4px 20px rgba(0,240,255,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  animation: authIconFloat 3s ease-in-out infinite;
  position: relative;
}
/* Icon glow ring */
.auth-header-icon::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
  opacity: 0.15;
  filter: blur(8px);
  z-index: -1;
  animation: authPulseGlow 2.5s ease-in-out infinite;
}
.auth-header-text h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--neon-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-header-text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.3px;
}
.auth-close-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-smooth);
}
.auth-close-btn:hover {
  background: rgba(255,0,85,0.15);
  color: var(--neon-red);
  border-color: rgba(255,0,85,0.3);
  box-shadow: 0 0 15px rgba(255,0,85,0.1);
  transform: rotate(90deg);
}

/* Divider after header */
.auth-header-divider {
  height: 1px;
  margin: 0 28px;
  background: linear-gradient(90deg, transparent, rgba(0,240,255,0.15), rgba(189,0,255,0.15), transparent);
}

/* Body */
.auth-body {
  padding: 8px 28px 0;
}

/* Sections — colored left accent + glass */
.auth-section {
  position: relative;
  padding: 18px 18px 18px 22px;
  margin: 14px 0;
  border-radius: 16px;
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.35s var(--ease-smooth);
  /* Stagger entrance */
  animation: authFadeIn 0.4s var(--ease-smooth) both;
}
.auth-section:nth-child(1) { animation-delay: 0.1s; }
.auth-section:nth-child(2) { animation-delay: 0.2s; }
.auth-section:nth-child(3) { animation-delay: 0.3s; }

/* Left accent bar per section */
.auth-section::before {
  content: '';
  position: absolute;
  top: 12px; bottom: 12px; left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  transition: all 0.35s;
}
/* Shimmer overlay on hover */
.auth-section::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-100%);
  transition: opacity 0.3s;
}
.auth-section:hover::after {
  opacity: 1;
  animation: authShimmer 1.2s ease-in-out;
}

/* Color variants */
.auth-section.accent-blue::before { background: linear-gradient(180deg, var(--neon-blue), rgba(0,240,255,0.2)); box-shadow: 0 0 12px rgba(0,240,255,0.2); }
.auth-section.accent-blue:hover { border-color: rgba(0,240,255,0.15); background: rgba(0,240,255,0.02); }
.auth-section.accent-green::before { background: linear-gradient(180deg, var(--neon-green), rgba(0,255,157,0.2)); box-shadow: 0 0 12px rgba(0,255,157,0.2); }
.auth-section.accent-green:hover { border-color: rgba(0,255,157,0.15); background: rgba(0,255,157,0.02); }
.auth-section.accent-purple::before { background: linear-gradient(180deg, var(--neon-purple), rgba(189,0,255,0.2)); box-shadow: 0 0 12px rgba(189,0,255,0.2); }
.auth-section.accent-purple:hover { border-color: rgba(189,0,255,0.15); background: rgba(189,0,255,0.02); }

/* Section title with glow icon */
.auth-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 14px;
}
.auth-section-title .auth-sec-icon {
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0;
}
.auth-section.accent-blue .auth-sec-icon {
  background: rgba(0,240,255,0.1);
  box-shadow: 0 0 10px rgba(0,240,255,0.08);
}
.auth-section.accent-green .auth-sec-icon {
  background: rgba(0,255,157,0.1);
  box-shadow: 0 0 10px rgba(0,255,157,0.08);
}
.auth-section.accent-purple .auth-sec-icon {
  background: rgba(189,0,255,0.1);
  box-shadow: 0 0 10px rgba(189,0,255,0.08);
}

/* Form elements */
.auth-form-group {
  margin-bottom: 12px;
}
.auth-form-group:last-child {
  margin-bottom: 0;
}
.auth-form-group > label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 7px;
}
.auth-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.auth-form-grid .auth-form-group {
  margin-bottom: 0;
}

/* Enhanced glass inputs inside auth modal */
.auth-modal-card .glass-input {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  transition: all 0.3s var(--ease-smooth);
  width: 100%;
}
.auth-modal-card .glass-input:focus {
  outline: none;
  border-color: rgba(0,240,255,0.4);
  background: rgba(0,240,255,0.03);
  box-shadow: 0 0 0 3px rgba(0,240,255,0.06), 0 0 20px rgba(0,240,255,0.08);
}
.auth-modal-card .glass-input::placeholder {
  color: rgba(255,255,255,0.2);
}

/* Token input with toggle */
.auth-token-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-token-wrap .glass-input {
  padding-right: 44px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
}
.auth-token-toggle {
  position: absolute;
  right: 6px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}
.auth-token-toggle:hover {
  color: var(--neon-blue);
  background: rgba(0,240,255,0.08);
  border-color: rgba(0,240,255,0.2);
  box-shadow: 0 0 10px rgba(0,240,255,0.1);
}

/* Security row */
.auth-security-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.015);
  transition: all 0.25s;
}
.auth-check-label:hover {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
}
.auth-check-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.25s;
}
.auth-check-label input[type="checkbox"]:checked {
  background: var(--neon-blue);
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(0,240,255,0.3);
}
.auth-check-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
  font-size: 12px;
  font-weight: 900;
}
.auth-security-row .auth-ttl-select {
  width: 140px;
  flex-shrink: 0;
}
.auth-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  margin-top: 8px;
  line-height: 1.5;
  padding-left: 2px;
}

/* Revoke section (collapsible) */
.auth-revoke-details {
  margin: 14px 0;
  border: 1px dashed rgba(255,174,0,0.12);
  border-radius: 16px;
  padding: 0;
  background: rgba(255,174,0,0.01);
  overflow: hidden;
  transition: all 0.3s;
  animation: authFadeIn 0.4s var(--ease-smooth) 0.35s both;
}
.auth-revoke-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(255,174,0,0.55);
  transition: all 0.25s;
  user-select: none;
}
.auth-revoke-details > summary::-webkit-details-marker { display: none; }
.auth-revoke-details > summary:hover { color: var(--neon-amber); background: rgba(255,174,0,0.03); }
.auth-revoke-details > summary .auth-chevron {
  margin-left: auto;
  transition: transform 0.3s var(--ease-elastic);
  font-size: 12px;
  opacity: 0.6;
}
.auth-revoke-details[open] > summary .auth-chevron {
  transform: rotate(90deg);
}
.auth-revoke-details[open] {
  border-color: rgba(255,174,0,0.25);
  border-style: solid;
  background: rgba(255,174,0,0.02);
  box-shadow: inset 0 0 30px rgba(255,174,0,0.02);
}
.auth-revoke-body {
  padding: 0 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-revoke-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.auth-revoke-row .glass-input { flex: 1; }
.auth-revoke-body .auth-check-label {
  border-color: rgba(255,174,0,0.08);
}

/* Footer — gradient top border */
.auth-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px 24px;
  flex-wrap: wrap;
  position: relative;
}
.auth-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 28px; right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
.auth-footer .auth-footer-left {
  margin-right: auto;
}

/* Enhanced buttons in auth modal */
.auth-modal-card .glass-btn {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  border-radius: 10px;
  padding: 9px 18px;
  transition: all 0.3s var(--ease-smooth);
  position: relative;
  overflow: hidden;
}
.auth-modal-card .glass-btn:not(:disabled):hover {
  transform: translateY(-1px);
}
.auth-modal-card .glass-btn:active {
  transform: translateY(0) scale(0.98);
}
/* Primary save button — neon glow */
.auth-modal-card .glass-btn.primary {
  background: linear-gradient(135deg, var(--neon-blue), rgba(0,180,255,0.9));
  color: #000;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0,240,255,0.25);
}
.auth-modal-card .glass-btn.primary:hover {
  box-shadow: 0 6px 30px rgba(0,240,255,0.4), 0 0 40px rgba(0,240,255,0.15);
}
/* Danger button */
.auth-modal-card .glass-btn.danger {
  border-color: rgba(255,0,85,0.2);
  color: rgba(255,0,85,0.7);
}
.auth-modal-card .glass-btn.danger:hover {
  background: rgba(255,0,85,0.1);
  border-color: rgba(255,0,85,0.4);
  color: var(--neon-red);
  box-shadow: 0 0 20px rgba(255,0,85,0.1);
}

/* --- Searchable Select (custom dropdown) --- */
.searchable-select {
  position: relative;
}
.searchable-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.searchable-select-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.searchable-select-arrow {
  margin-left: 8px;
  opacity: 0.5;
  font-size: 12px;
  transition: transform 0.2s;
}
.searchable-select.is-open .searchable-select-arrow {
  transform: rotate(180deg);
}
.searchable-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(20, 20, 28, 0.98);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
}
.searchable-select.is-open .searchable-select-dropdown {
  display: block;
}
.searchable-select-search {
  margin-bottom: 6px;
  font-size: 12px !important;
  padding: 8px 12px !important;
}
.searchable-select-list {
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.searchable-select-list::-webkit-scrollbar {
  width: 4px;
}
.searchable-select-list::-webkit-scrollbar-track {
  background: transparent;
}
.searchable-select-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}
.searchable-select-option {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  transition: background 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.searchable-select-option:hover {
  background: rgba(0, 240, 255, 0.08);
}
.searchable-select-option.is-selected {
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-blue);
}
.searchable-select-empty {
  padding: 16px;
  text-align: center;
  opacity: 0.4;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 540px) {
  .auth-modal-card { border-radius: 22px; }
  .auth-modal-inner { border-radius: 21px; }
  .auth-header { padding: 20px 20px 14px; }
  .auth-header-divider { margin: 0 20px; }
  .auth-body { padding: 4px 20px 0; }
  .auth-footer { padding: 14px 20px 20px; }
  .auth-form-grid { grid-template-columns: 1fr; }
  .auth-security-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .auth-security-row .auth-ttl-select { width: 100%; }
  .auth-footer { justify-content: stretch; }
  .auth-footer .glass-btn { flex: 1; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora-orb,
  .mesh-grid,
  .ambient-glow {
    animation: none !important;
  }
  .auth-modal-card, .auth-section, .auth-revoke-details { animation: none; }
  .auth-modal-inner::before { animation: none; display: none; }
  .auth-header-icon { animation: none; }
  .auth-modal-card::before { animation: none; }
  .auth-modal-card::after { animation: none; }
}

/* ============================================================
   EFFECTS LAYER — View Transitions · Scanlines · Scroll Reveal
                   Ripple · Number Counter · 3D Tilt
   ============================================================ */

/* --- Scanlines overlay (subtle CRT texture) --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 150; /* above dock(100), below modal(200) */
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.022) 3px,
    rgba(0, 0, 0, 0.022) 4px
  );
}

/* --- Viewport: enable CSS transitions for view switching --- */
.viewport {
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Exit state: fade + slide down + blur */
.viewport.view-out {
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  filter: blur(2px);
  pointer-events: none;
}

/* Enter animation: slide up from below + un-blur */
@keyframes viewEnterAnim {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
.viewport.view-in {
  animation: viewEnterAnim 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
  transition: none; /* prevent conflict with animation */
}

/* --- Scroll Reveal --- */
.anim-ready {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.anim-in {
  opacity: 1;
  transform: translateY(0);
}

/* --- Ripple wave --- */
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transform: scale(0);
  animation: rippleExpand 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
  z-index: 0;
}
@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* --- bento-card ::after: mouse-tracking glow via CSS variable --- */
.bento-card::after {
  background: radial-gradient(
    circle 180px at var(--shine-x, 50%) var(--shine-y, 50%),
    rgba(0, 212, 255, 0.07) 0%,
    transparent 100%
  );
  /* inset and other properties remain from original rule */
}

/* reduced-motion: disable new effects too */
@media (prefers-reduced-motion: reduce) {
  .viewport, .viewport.view-out, .viewport.view-in { animation: none; transition: none; }
  .anim-ready { opacity: 1; transform: none; transition: none; }
  .ripple-wave { animation: none; }
  body::after { display: none; }
}
