:root {
  --bg-dark: #061a2b;
  --bg-mid: #0d2844;
  --panel: rgba(15, 35, 55, 0.76);
  --panel-border: rgba(148, 197, 255, 0.28);
  --card: rgba(10, 24, 38, 0.72);
  --card-strong: rgba(6, 20, 32, 0.88);
  --primary: #60a5fa;
  --primary-strong: #2563eb;
  --primary-soft: rgba(96, 165, 250, 0.18);
  --text: #e5f3ff;
  --muted: #b7d8f7;
  --success-bg: rgba(34, 197, 94, 0.18);
  --success-text: #bbf7d0;
  --error-text: #fecaca;
  --shadow: rgba(2, 12, 24, 0.42);
}

* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, rgba(6, 26, 43, 0.95), rgba(11, 44, 72, 0.9));
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(96, 165, 250, 0.06), rgba(96, 165, 250, 0.06)),
    radial-gradient(circle at 15% 20%, rgba(96, 165, 250, 0.15), transparent 30%),
    radial-gradient(circle at 75% 25%, rgba(147, 197, 253, 0.12), transparent 25%),
    repeating-linear-gradient(
      90deg,
      rgba(96, 165, 250, 0.04) 0,
      rgba(96, 165, 250, 0.04) 2px,
      transparent 2px,
      transparent 42px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(96, 165, 250, 0.03) 0,
      rgba(96, 165, 250, 0.03) 2px,
      transparent 2px,
      transparent 34px
    );
  filter: blur(1.5px);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800" viewBox="0 0 1200 800"><g fill="none" stroke="rgba(148,197,255,0.14)" stroke-width="1.6"><path d="M0 170 L220 170 L260 120 L420 120 L470 180 L670 180 L720 120 L1060 120 L1100 160 L1200 160"/><path d="M0 360 L180 360 L220 320 L390 320 L440 360 L620 360 L660 320 L860 320 L920 360 L1200 360"/><path d="M0 560 L250 560 L300 610 L520 610 L560 560 L780 560 L840 610 L1200 610"/><path d="M150 0 L150 800"/><path d="M430 0 L430 800"/><path d="M760 0 L760 800"/><path d="M1040 0 L1040 800"/></g><g fill="rgba(148,197,255,0.09)"><rect x="100" y="130" width="110" height="58" rx="4"/><rect x="505" y="130" width="120" height="70" rx="4"/><rect x="845" y="100" width="150" height="58" rx="4"/><rect x="150" y="290" width="180" height="56" rx="4"/><rect x="570" y="290" width="165" height="66" rx="4"/><rect x="870" y="280" width="180" height="52" rx="4"/><rect x="100" y="500" width="150" height="60" rx="4"/><rect x="620" y="500" width="150" height="62" rx="4"/><rect x="950" y="500" width="120" height="58" rx="4"/></g></svg>');
  background-size: cover;
  filter: blur(2px) saturate(0.8);
  opacity: 0.9;
}

#loginView, #appView {
  position: relative;
  z-index: 1;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(2rem, 3vw, 2.5rem);
  letter-spacing: 0.04em;
}

.card {
  background: linear-gradient(180deg, rgba(18, 40, 62, 0.82), rgba(11, 23, 34, 0.72));
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 45px var(--shadow);
  backdrop-filter: blur(10px);
}

.environment-switch {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.env-option {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(11, 29, 44, 0.72);
  border: 1px solid rgba(147, 197, 253, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
}

.env-option input {
  min-width: auto;
  width: 16px;
  height: 16px;
  accent-color: var(--primary-strong);
}

.env-option span {
  font-weight: 700;
}

.env-option small {
  display: block;
  color: var(--muted);
}

.message-panel {
  margin-top: 12px;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(13, 26, 39, 0.62);
  border: 1px solid rgba(148, 197, 255, 0.18);
}

.message-panel.success {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.12);
}

.message-panel.error {
  border-color: rgba(254, 202, 202, 0.35);
  background: rgba(127, 29, 29, 0.18);
}

.system-status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 31, 49, 0.9), rgba(12, 24, 38, 0.78));
  border: 1px solid rgba(133, 196, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(96, 165, 250, 0.18), 0 0 26px rgba(59, 130, 246, 0.18);
  overflow: hidden;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.system-status.busy {
  background: linear-gradient(135deg, rgba(81, 18, 18, 0.9), rgba(38, 18, 18, 0.82));
  border-color: rgba(252, 165, 165, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(248, 113, 113, 0.2), 0 0 30px rgba(239, 68, 68, 0.2);
}

.system-status::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: radial-gradient(circle at center, rgba(96, 165, 250, 0.18), transparent 42%);
  animation: pulseGlow 2.8s ease-in-out infinite;
}

.system-status__icon {
  position: relative;
  width: 72px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(74, 137, 255, 0.18), rgba(15, 35, 55, 0.6));
  border: 1px solid rgba(148, 197, 255, 0.2);
  overflow: hidden;
  z-index: 1;
}

.signal-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #9ae6b4, #34d399);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.14), 0 0 18px rgba(52, 211, 153, 0.45);
  animation: dotPulse 1.8s ease-in-out infinite;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.system-status.busy .signal-dot {
  background: linear-gradient(135deg, #fca5a5, #ef4444);
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.14), 0 0 18px rgba(239, 68, 68, 0.55);
}

.signal-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0), rgba(96, 165, 250, 0.9), rgba(96, 165, 250, 0));
  opacity: 0.9;
  animation: linePulse 2.2s ease-in-out infinite;
  transition: background 0.25s ease, opacity 0.25s ease;
}

.system-status.busy .signal-line {
  background: linear-gradient(90deg, rgba(254, 202, 202, 0), rgba(248, 113, 113, 0.9), rgba(254, 202, 202, 0));
}

.signal-line--1 {
  width: 38px;
  top: 15px;
}

.signal-line--2 {
  width: 52px;
  top: 24px;
  animation-delay: 0.2s;
}

.signal-line--3 {
  width: 60px;
  top: 33px;
  animation-delay: 0.4s;
}

.system-status__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.system-status__content strong {
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.system-status.busy .system-status__content strong {
  color: #fecaca;
}

.system-status__content span {
  color: var(--muted);
  font-size: 0.8rem;
}

.system-status.busy .system-status__content span {
  color: #fca5a5;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

input, button {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s ease;
}

input {
  min-width: 220px;
  background: rgba(10, 27, 40, 0.7);
  border: 1px solid rgba(147, 197, 253, 0.34);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

input::placeholder { color: rgba(183, 216, 247, 0.7); }
input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

button {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.28);
}

button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }

button.secondary {
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  border: 1px solid rgba(147, 197, 253, 0.28);
  box-shadow: none;
}

.badge {
  display: inline-block;
  background: var(--primary-soft);
  color: #dbeafe;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: rgba(10, 24, 38, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 197, 255, 0.16);
  vertical-align: top;
}

th {
  background: rgba(18, 43, 66, 0.9);
  color: #dfeefe;
  letter-spacing: 0.02em;
}

td { color: var(--text); }

.env-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.env-badge--staging {
  background: rgba(56, 189, 248, 0.15);
  color: #dbeafe;
  border: 1px solid rgba(125, 211, 252, 0.4);
}

.env-badge--production {
  background: rgba(34, 197, 94, 0.15);
  color: #dcfce7;
  border: 1px solid rgba(134, 239, 172, 0.4);
}

.status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.active {
  background: var(--success-bg);
  color: var(--success-text);
}

.muted {
  color: var(--muted);
}

pre { white-space: pre-wrap; word-break: break-all; margin: 0; }
.error { color: var(--error-text); }
.success { color: var(--success-text); }

a {
  color: #7dd3fc;
  text-decoration: none;
}

a:hover { text-decoration: underline; }

#appView {
  max-width: 1200px;
  margin: 32px auto 48px;
  padding: 0 24px;
}

#loginView {
  max-width: 420px;
  margin: 100px auto;
  padding: 0 18px;
}

#loginView .card {
  padding: 28px 24px;
}

#loginView h1 {
  font-size: 2rem;
}

@keyframes pulseGlow {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes dotPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.14), 0 0 18px rgba(52, 211, 153, 0.45);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.25);
    box-shadow: 0 0 0 10px rgba(52, 211, 153, 0.1), 0 0 24px rgba(52, 211, 153, 0.6);
  }
}

@keyframes linePulse {
  0%, 100% {
    opacity: 0.35;
    filter: blur(0);
  }
  50% {
    opacity: 1;
    filter: blur(0.3px);
  }
}
