:root {
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(16, 185, 129, 0.09), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 55%),
    #020617;
  background-attachment: fixed;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(90px);
  opacity: 0.18;
}

.orb-emerald {
  width: 34rem;
  height: 34rem;
  left: -12rem;
  top: -14rem;
  background: #10b981;
}

.orb-sky {
  width: 28rem;
  height: 28rem;
  right: -10rem;
  top: 8rem;
  background: #0ea5e9;
  opacity: 0.12;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.logo-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1.1rem;
  color: #6ee7b7;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.2), rgba(2, 6, 23, 0.7));
  border: 1px solid rgba(52, 211, 153, 0.25);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 16px 40px -16px rgba(16, 185, 129, 0.55);
}

.logo-badge::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 1.35rem;
  border: 1px solid rgba(52, 211, 153, 0.12);
  animation: breathe 3.5s ease-in-out infinite;
}

.logo-badge-sm {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.8rem;
}

.logo-badge-sm::after {
  inset: -3px;
  border-radius: 0.95rem;
}

.glass {
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.82), rgba(2, 6, 23, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.input-field {
  width: 100%;
  border-radius: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(2, 6, 23, 0.55);
  padding: 0.7rem 0.9rem;
  color: #e2e8f0;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input-field:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.input-field:focus {
  border-color: rgba(52, 211, 153, 0.65);
  background: rgba(2, 6, 23, 0.85);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.13);
}

.input-field::placeholder {
  color: #475569;
}

textarea.input-field {
  line-height: 1.55;
}

select.input-field {
  cursor: pointer;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.8rem;
  padding: 0.65rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.1;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  color: #022c22;
  background: linear-gradient(180deg, #34d399, #10b981);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 10px 24px -12px rgba(16, 185, 129, 0.9);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #6ee7b7, #10b981);
  transform: translateY(-1px);
}

.btn-secondary {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  color: #fff1f2;
  background: rgba(244, 63, 94, 0.9);
  border-color: rgba(251, 113, 133, 0.35);
}

.btn-danger:hover {
  background: #f43f5e;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: translateY(0) scale(0.985);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.75rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.12s ease;
  cursor: pointer;
}

.icon-btn:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

.icon-btn:active {
  transform: scale(0.96);
}

.summary-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.72), rgba(2, 6, 23, 0.45));
  padding: 1rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.summary-card::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -40px;
  bottom: -55px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.06);
  filter: blur(12px);
}

.summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.monitor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow: hidden;
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.75), rgba(2, 6, 23, 0.55));
  padding: 1rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.035) inset,
    0 20px 40px -32px rgba(0, 0, 0, 0.9);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: card-in 0.28s ease both;
}

.monitor-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 50px -30px rgba(0, 0, 0, 0.95);
}

.monitor-card[data-status="down"] {
  border-color: rgba(244, 63, 94, 0.22);
  background:
    radial-gradient(500px 120px at 100% 0%, rgba(244, 63, 94, 0.09), transparent 70%),
    linear-gradient(165deg, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.6));
}

.monitor-card[data-status="paused"] {
  border-color: rgba(245, 158, 11, 0.16);
}

.status-dot {
  position: relative;
  display: inline-flex;
  width: 0.6rem;
  height: 0.6rem;
  flex: 0 0 auto;
  border-radius: 9999px;
}

.status-dot.up {
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1), 0 0 12px rgba(52, 211, 153, 0.55);
}

.status-dot.down {
  background: #fb7185;
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.1), 0 0 12px rgba(251, 113, 133, 0.55);
}

.status-dot.unknown {
  background: #64748b;
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.1);
}

.status-dot.paused {
  background: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.09);
}

.status-dot.down::after,
.status-dot.up::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid currentColor;
  opacity: 0.22;
  animation: ping-soft 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-dot.paused::after {
  animation: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 0.22rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-up {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(52, 211, 153, 0.22);
}

.badge-down {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(251, 113, 133, 0.25);
}

.badge-unknown {
  color: #cbd5e1;
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(148, 163, 184, 0.16);
}

.badge-paused {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

.metric-label {
  font-size: 0.6875rem;
  color: #64748b;
  letter-spacing: 0.01em;
}

.metric-value {
  margin-top: 0.12rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.sparkline {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 0.65rem;
}

.spark-bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.12);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.spark-bar:hover {
  transform: scaleY(1.35);
  filter: brightness(1.2);
}

.spark-bar.ok {
  background: rgba(52, 211, 153, 0.72);
}

.spark-bar.fail {
  background: rgba(251, 113, 133, 0.82);
}

.skeleton-card {
  height: 245px;
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(
      100deg,
      rgba(255, 255, 255, 0.02) 20%,
      rgba(255, 255, 255, 0.055) 38%,
      rgba(255, 255, 255, 0.02) 56%
    ),
    rgba(15, 23, 42, 0.4);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.18s ease both;
}

.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% - 2rem);
  max-width: 36rem;
  max-height: calc(100dvh - 2rem);
  transform: translate(-50%, -50%);
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: linear-gradient(165deg, #0f172a, #070d1d);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#formError,
.toast p {
  white-space: pre-line;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: min(100%, 24rem);
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.96);
  padding: 0.75rem 0.9rem;
  font-size: 0.8125rem;
  color: #e2e8f0;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  animation: toast-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast.hide {
  animation: toast-out 0.2s ease forwards;
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.25);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.3);
}

.toast.info {
  border-color: rgba(56, 189, 248, 0.25);
}

details > summary::-webkit-details-marker {
  display: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 9999px;
  border: 3px solid #020617;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.03);
  }
}

@keyframes ping-soft {
  0% {
    transform: scale(0.85);
    opacity: 0.4;
  }
  75%,
  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

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

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

@media (max-width: 640px) {
  .orb-emerald {
    left: -18rem;
  }

  .modal-panel {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
