:root {
  --bg: #0f1419;
  --bg-elev: #171e26;
  --bg-soft: #1c2530;
  --line: #2a3542;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #2dd4a8;
  --accent-dim: rgba(45, 212, 168, 0.14);
  --warn: #f5a524;
  --danger: #f07178;
  --ok: #2dd4a8;
  --unknown: #6b7c8f;
  --radius: 12px;
  --font: "Segoe UI", "PT Root UI", "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(45, 212, 168, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(80, 140, 255, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #042219;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-soft); filter: none; }
.btn-danger {
  background: transparent;
  border-color: rgba(240, 113, 120, .45);
  color: var(--danger);
}
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: rgba(45, 212, 168, .55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field textarea { min-height: 140px; resize: vertical; font-family: var(--mono); font-size: 13px; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(28, 37, 48, .95), rgba(23, 30, 38, .98));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 28px;
}
.brand-mark {
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.brand h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.error {
  background: rgba(240, 113, 120, .12);
  border: 1px solid rgba(240, 113, 120, .35);
  color: #ffb4b8;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}

/* App shell */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(15, 20, 25, .82);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
}
.topbar .brand-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.topbar .brand-inline strong { font-size: 18px; }
.topbar .brand-inline span { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-pill {
  color: var(--muted);
  font-size: 13px;
  margin-right: 4px;
}

.layout {
  width: min(1200px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: grid;
  gap: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.03em; }
.stat.ok .value { color: var(--ok); }
.stat.fail .value { color: var(--danger); }
.stat.unknown .value { color: var(--warn); }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-h h2 { margin: 0; font-size: 16px; font-weight: 650; }
.panel-b { padding: 16px 18px; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.meta-row strong { color: var(--text); font-weight: 600; }

.site-list { display: grid; gap: 10px; }
.site-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.site-row:hover { border-color: rgba(45, 212, 168, .4); background: #212b36; }
.site-row h3 { margin: 0 0 4px; font-size: 15px; }
.site-row .url { color: var(--muted); font-size: 13px; font-family: var(--mono); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-ok { color: var(--ok); border-color: rgba(45,212,168,.35); background: rgba(45,212,168,.08); }
.badge-fail { color: var(--danger); border-color: rgba(240,113,120,.35); background: rgba(240,113,120,.08); }
.badge-off { color: var(--unknown); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.path { font-family: var(--mono); font-size: 13px; word-break: break-all; }
td.muted { color: var(--muted); font-size: 13px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, .62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  width: min(560px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.modal.wide { width: min(720px, 100%); }
.modal-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-b { padding: 18px; }
.modal-f {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 18px;
}

.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) {
  .field-grid { grid-template-columns: 1fr; }
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 8px;
  font-size: 14px;
  cursor: pointer;
}
.check-row input { margin-top: 2px; }
.muted { color: var(--muted); }
code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}
.hidden { display: none !important; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #1a2330;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  z-index: 100;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  max-width: min(360px, calc(100vw - 36px));
}

@media (max-width: 800px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .site-row { grid-template-columns: 1fr; }
  .badges { justify-content: flex-start; }
  .topbar { padding: 12px 14px; }
  .layout { width: calc(100% - 24px); }
}
