:root {
  color-scheme: dark;
  --bg: #07101c;
  --panel: rgba(13, 26, 43, 0.78);
  --panel-solid: #0d1a2b;
  --line: rgba(142, 174, 207, 0.18);
  --text: #edf6ff;
  --muted: #91a6bc;
  --up: #49e3a3;
  --degraded: #ffc65b;
  --down: #ff6b79;
  --unknown: #8395aa;
  --accent: #76b7ff;
  --accent-strong: #3c93f2;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(39, 105, 173, 0.18), transparent 35%),
    radial-gradient(circle at 90% 5%, rgba(44, 193, 154, 0.12), transparent 30%),
    var(--bg);
}

button, input { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  pointer-events: none;
}
.ambient-one { top: -12rem; left: -8rem; background: #4e9fff; }
.ambient-two { right: -9rem; bottom: -13rem; background: #35d7a4; }

#app { position: relative; z-index: 1; }
.loading-shell, .auth-shell {
  min-height: 100vh;
  display: grid;
  place-content: center;
  padding: 24px;
}

.spinner {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 12px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-card {
  width: min(440px, calc(100vw - 32px));
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(10, 22, 38, 0.9);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(20px);
}

.brand-mark {
  display: inline-grid;
  place-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 13px;
  color: #06111c;
  font-weight: 900;
  background: linear-gradient(135deg, #9bd1ff, #48e1ab);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.55rem, 4vw, 2rem); letter-spacing: -0.03em; }
h2 { margin-bottom: 4px; font-size: 1rem; }
h3 { margin-bottom: 8px; font-size: 0.92rem; }
.muted { color: var(--muted); }
.caption { color: var(--muted); font-size: 0.78rem; }

.field { display: grid; gap: 7px; margin: 18px 0; }
.field label { color: #b6c8d9; font-size: 0.82rem; font-weight: 650; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(5, 13, 24, 0.7);
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 151, 239, 0.14); }

.button-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #07111d;
  font-weight: 750;
  background: linear-gradient(135deg, #8bc5ff, #50dda9);
}
.button:hover { filter: brightness(1.08); }
.button:disabled { cursor: wait; opacity: 0.58; }
.button.secondary { color: var(--text); border-color: var(--line); background: rgba(255, 255, 255, 0.04); }
.button.danger { color: #ffdbe0; border-color: rgba(255, 107, 121, 0.32); background: rgba(255, 107, 121, 0.08); }
.button.small { min-height: 34px; padding: 0 11px; font-size: 0.78rem; }
.button.full { width: 100%; justify-content: center; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 0.76rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.error-box { margin: 14px 0; padding: 11px 13px; border: 1px solid rgba(255,107,121,.3); border-radius: 10px; color: #ffc0c7; background: rgba(255,107,121,.08); }
.hidden { display: none !important; }

.dashboard { width: min(1440px, 100%); margin: 0 auto; padding: 30px clamp(18px, 4vw, 54px) 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
.topbar-title { display: flex; align-items: center; gap: 13px; }
.topbar .brand-mark { width: 38px; height: 38px; margin: 0; border-radius: 11px; }
.topbar h1 { margin: 0; font-size: 1.25rem; }
.topbar p { margin: 3px 0 0; font-size: 0.76rem; }

.overall {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(110deg, rgba(26, 51, 77, 0.72), rgba(9, 25, 40, 0.7));
}
.overall-copy { display: flex; align-items: center; gap: 14px; }
.pulse { width: 15px; height: 15px; border-radius: 50%; box-shadow: 0 0 0 7px color-mix(in srgb, currentColor 12%, transparent); }
.status-up { color: var(--up); }
.status-degraded { color: var(--degraded); }
.status-down { color: var(--down); }
.status-unknown { color: var(--unknown); }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin: 30px 0 13px; }
.section-head h2 { font-size: 1.05rem; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.guest-panel { margin-top: 14px; }
.guest-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 750;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}
.guest-panel[open] .guest-summary { margin-bottom: 14px; }
.guest-grid .card { background: rgba(13, 26, 43, 0.56); }
.card {
  grid-column: span 4;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.11);
  backdrop-filter: blur(12px);
}
.card.wide { grid-column: span 6; }
.card.full { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 15px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; background: rgba(255,255,255,.05); }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.check-list { display: grid; gap: 10px; }
.check-row { display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 12px; align-items: start; padding-top: 10px; border-top: 1px solid var(--line); }
.check-row:first-child { border-top: 0; padding-top: 0; }
.check-name { font-size: 0.82rem; font-weight: 680; overflow-wrap: anywhere; }
.check-summary { margin-top: 4px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.metrics { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.metric { padding: 4px 7px; border-radius: 7px; color: #b9c9da; font-size: 0.66rem; background: rgba(255, 255, 255, 0.045); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.035); }
.stat strong { display: block; margin-top: 4px; font-size: 1.05rem; }
.progress { height: 7px; margin-top: 11px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.07); }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--up)); }
.progress.danger span { background: linear-gradient(90deg, var(--degraded), var(--down)); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 650; }
td.wrap { white-space: normal; }
.empty { padding: 30px 10px; color: var(--muted); text-align: center; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 5; max-width: min(400px, calc(100vw - 36px)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 11px; opacity: 0; transform: translateY(8px); pointer-events: none; background: #14263a; box-shadow: 0 14px 40px rgba(0,0,0,.32); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

dialog { width: min(460px, calc(100vw - 30px)); padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 20px; background: var(--panel-solid); box-shadow: 0 30px 100px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(1,6,12,.72); backdrop-filter: blur(4px); }
.dialog-body { padding: 24px; }

@media (max-width: 900px) {
  .card, .card.wide { grid-column: span 6; }
}
@media (max-width: 620px) {
  .dashboard { padding-inline: 14px; }
  .topbar, .overall { align-items: flex-start; }
  .topbar { flex-direction: column; }
  .overall { flex-direction: column; }
  .card, .card.wide { grid-column: 1 / -1; }
  .auth-card { padding: 24px 20px; }
  .stat-row { grid-template-columns: 1fr; }
  .guest-summary { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
