:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --ink: #16232e;
  --muted: #5d6d7c;
  --line: #d9e1e8;
  --accent: #0c6b62;
  --accent-ink: #ffffff;
  --accent-soft: #e5f4f2;
  --ok: #0e7a43;
  --ok-soft: #e5f6ec;
  --warn: #8a5a00;
  --warn-soft: #fff4d8;
  --bad: #a61b22;
  --bad-soft: #fdecea;
  --info: #1554b0;
  --shadow: 0 10px 30px rgba(22, 35, 46, 0.08);
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { display: block; font-size: 15px; letter-spacing: 0.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent); color: white; font-weight: 700; font-size: 12px;
  letter-spacing: 0.04em;
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 400px at 10% -10%, #d7efe9 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid; gap: 14px;
}
.login-card h1 { margin: 8px 0 0; font-size: 28px; }
.lead { margin: 0; color: var(--muted); }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.field input, .field select, .search, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 10px 12px;
  font-weight: 500;
}
.field input:focus, .field select:focus, .search:focus, .select:focus {
  outline: 2px solid #b7ddd7;
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 8px 12px;
  font-weight: 600;
}
.btn:hover { border-color: #b7c6d1; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #0a5c54; }
.btn.danger { background: var(--bad); color: white; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 9px; font-size: 13px; }
.login-card .btn.primary { padding: 11px 14px; margin-top: 4px; }

.app { min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.top-right { display: flex; align-items: center; gap: 12px; }
.view { width: min(1180px, calc(100% - 32px)); margin: 22px auto 48px; display: grid; gap: 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px;
  background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.muted { color: var(--muted); font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-family: Consolas, "Segoe UI", monospace; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat b { display: block; font-size: 26px; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.good b { color: var(--ok); }
.stat.bad b { color: var(--bad); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.search { max-width: 320px; }
.select { max-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 10px; font-weight: 600; font-size: 13px;
}
.chip.on { background: var(--accent-soft); border-color: #b7ddd7; color: var(--accent); }

.table-wrap { overflow: auto; }
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: middle; }
th button {
  background: none; border: 0; padding: 0; font-weight: 700; color: var(--muted);
}
th button.on { color: var(--ink); }
tr[data-act="open"] { cursor: pointer; }
tr[data-act="open"]:hover { background: #f6fbfa; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--bad); margin-right: 6px; }
.dot.on { background: var(--ok); }
.rx-good { color: var(--ok); font-weight: 700; }
.rx-mid { color: var(--warn); font-weight: 700; }
.rx-bad { color: var(--bad); font-weight: 700; }
.rx-na { color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.empty { padding: 28px 8px; color: var(--muted); text-align: center; }

.banner {
  border-radius: 10px; padding: 10px 12px; background: var(--accent-soft); color: var(--ink);
  overflow-wrap: anywhere;
}
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: #e8f0fc; color: #163e75; }

.hero { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hero h1 { margin: 0 0 4px; font-size: 26px; word-break: break-all; }
.meta { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.section-head h2 { margin: 0; font-size: 16px; }

.wifi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.wifi-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: grid; gap: 6px;
}
.wifi-card header { display: flex; justify-content: space-between; align-items: center; }
.kvs { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 14px; }
.kvs span { color: var(--muted); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkline { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 14px; }
.note { margin: 0; color: var(--muted); font-size: 13px; }
pre.secret {
  margin: 8px 0 0; white-space: pre-wrap; word-break: break-word;
  background: #f6f8fa; border-radius: 8px; padding: 10px; font-size: 13px;
}

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; }
.modal-back { position: absolute; inset: 0; background: rgba(16, 27, 36, 0.45); }
.modal-card {
  position: relative; width: min(480px, 100%);
  background: white; border-radius: 14px; padding: 18px;
  box-shadow: var(--shadow); display: grid; gap: 12px;
}
.modal-card h3 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast {
  width: min(360px, calc(100vw - 32px));
  background: #173042; color: white; border-radius: 10px; padding: 10px 12px;
  box-shadow: var(--shadow);
}
.toast.ok { background: #0e5c40; }
.toast.bad { background: #8d1d24; }

.legend { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

@media (max-width: 860px) {
  .stats, .split { grid-template-columns: 1fr 1fr; }
  .top { padding: 12px; }
  .view { width: min(100% - 20px, 1180px); }
}
@media (max-width: 640px) {
  .stats, .split { grid-template-columns: 1fr; }
  .search, .select { max-width: none; }
  .top { align-items: flex-start; }
  .top-right { flex-wrap: wrap; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
