:root {
  --bg: #08100d;
  --surface: #101a16;
  --surface-2: #17231e;
  --border: #293831;
  --text: #f1f7f3;
  --muted: #8fa49a;
  --accent: #65f3ad;
  --accent-dark: #173d2c;
  --amber: #f4bc55;
  --red: #ff716e;
  --blue: #85b7ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% -10%, rgba(101, 243, 173, 0.13), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(133, 183, 255, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -0.055em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; }
.muted { color: var(--muted); font-size: 0.86rem; }
.hidden { display: none !important; }

.connection-state {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.82rem;
}
.connection-state.live { color: var(--accent); border-color: rgba(101, 243, 173, 0.45); background: rgba(101, 243, 173, 0.07); }

.login-card, .panel {
  background: rgba(16, 26, 22, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.login-card { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 42px; max-width: 900px; margin: 10vh auto 0; }
.login-card h2, .panel h2, .dialog-card h2 { margin: 6px 0 8px; letter-spacing: -0.035em; }
.login-card p:not(.eyebrow) { color: var(--muted); max-width: 42ch; line-height: 1.6; }
.login-form { display: flex; flex-direction: column; justify-content: center; gap: 16px; }

label { display: grid; gap: 7px; color: #cad8d1; font-size: 0.86rem; font-weight: 650; }
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b1410;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(101, 243, 173, 0.1); }

.button {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  padding: 11px 15px;
  transition: transform 120ms ease, background 120ms ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #06120c; background: var(--accent); }
.button.subtle { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.form-error { min-height: 1.2em; margin: 0; color: var(--red); font-size: 0.85rem; }
.form-note { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.summary-card::after { content: ""; position: absolute; inset: auto -20px -42px auto; width: 100px; height: 100px; border-radius: 50%; opacity: 0.15; background: currentColor; }
.summary-card span { display: block; color: var(--muted); font-size: 0.82rem; }
.summary-card strong { display: block; margin-top: 8px; font-size: 2rem; }
.summary-card.total { color: var(--blue); }
.summary-card.online { color: var(--accent); }
.summary-card.degraded { color: var(--amber); }
.summary-card.unreachable { color: var(--red); }

.panel { margin-top: 18px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.panel-header h2 { font-size: 1.25rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th { padding: 13px 18px; text-align: left; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(255,255,255,0.015); }
td { padding: 16px 18px; border-top: 1px solid rgba(41, 56, 49, 0.7); color: #dbe6e0; font-size: 0.88rem; }
.router-name { display: grid; gap: 4px; }
.router-name strong { color: var(--text); }
.router-name span { color: var(--muted); font-size: 0.76rem; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 10px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status-pill.online { color: var(--accent); background: rgba(101,243,173,.08); }
.status-pill.degraded { color: var(--amber); background: rgba(244,188,85,.08); }
.status-pill.unreachable { color: var(--red); background: rgba(255,113,110,.08); }
.status-pill.pending { color: var(--muted); background: rgba(143,164,154,.08); }
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 54px; color: var(--muted); }
.empty-state strong { color: var(--text); }

.event-list { display: grid; }
.event { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 14px; padding: 15px 24px; border-top: 1px solid rgba(41,56,49,.7); }
.event:first-child { border-top: 0; }
.event-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.event-dot.online { background: var(--accent); }
.event-dot.degraded { background: var(--amber); }
.event-dot.unreachable { background: var(--red); }
.event-title { font-size: .88rem; }
.event-meta { color: var(--muted); font-size: .75rem; margin-top: 3px; }

dialog { width: min(640px, calc(100% - 28px)); border: 0; padding: 0; border-radius: 18px; background: transparent; color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-card { display: grid; gap: 17px; padding: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.icon-button { border: 0; border-radius: 8px; background: var(--surface-2); color: var(--muted); width: 36px; height: 36px; cursor: pointer; font-size: 1.4rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.installer-card { width: min(900px, calc(100vw - 30px)); }
#installer-dialog { width: min(920px, calc(100% - 28px)); max-width: none; }
.warning-box { color: var(--amber); background: rgba(244,188,85,.08); border: 1px solid rgba(244,188,85,.24); padding: 12px 14px; border-radius: 10px; font-size: .86rem; }
pre { max-height: 50vh; overflow: auto; margin: 0; padding: 18px; border-radius: 12px; background: #050a08; border: 1px solid var(--border); color: #bcefd2; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 1180px); padding-top: 20px; }
  .login-card { grid-template-columns: 1fr; gap: 22px; padding: 26px; margin-top: 5vh; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .event { grid-template-columns: 10px 1fr; }
  .event time { grid-column: 2; }
}
