:root {
  --bg: #0b1120;
  --surface: #131c31;
  --surface-2: #1c2742;
  --border: #263554;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-h: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; }
hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-left, .topbar-right, .brand-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 12px var(--primary); }

.tabs {
  display: flex; gap: 4px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  background: transparent; border: none; color: var(--muted); padding: 12px 16px; cursor: pointer;
  font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); }
.badge-num { background: var(--surface-2); padding: 1px 7px; border-radius: 999px; font-size: 12px; margin-left: 4px; }

.container { max-width: 1240px; margin: 0 auto; padding: 20px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 0 0 6px; font-size: 14px; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }
.grow { flex: 1 1 160px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
input[type="text"], input[type="password"], input[type="url"], input[type="search"], input[type="time"], select, textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 8px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; margin-top: 8px; }

.checks-row { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.chk { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13.5px; margin-bottom: 6px; }
.chk input { margin-top: 3px; width: auto; }
.danger-chk { background: rgba(217,119,6,.12); border: 1px solid rgba(217,119,6,.35); padding: 10px; border-radius: 8px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 9px 15px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-h); }
.btn.danger { background: rgba(220,38,38,.2); border-color: rgba(220,38,38,.55); color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.full { width: 100%; }

.pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; background: var(--surface-2);
}
.pill.ok { background: rgba(22,163,74,.2); color: #86efac; border: 1px solid rgba(22,163,74,.4); }
.pill.warn { background: rgba(217,119,6,.2); color: #fde68a; border: 1px solid rgba(217,119,6,.4); }
.pill.err { background: rgba(220,38,38,.2); color: #fecaca; border: 1px solid rgba(220,38,38,.4); }

.alert { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 13px; }
.alert.error { background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.4); color: #fecaca; }
.alert.warn { background: rgba(217,119,6,.15); border: 1px solid rgba(217,119,6,.4); color: #fde68a; }
.alert.ok { background: rgba(22,163,74,.15); border: 1px solid rgba(22,163,74,.4); color: #bbf7d0; }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 50; max-width: 420px;
  background: var(--surface-2); border: 1px solid var(--border); padding: 12px 16px;
  border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.45); font-weight: 500;
}

.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 4px; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tbl a { color: #60a5fa; text-decoration: none; }
.tbl a:hover { text-decoration: underline; }

.code-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow-x: auto; font-size: 12.5px; margin: 8px 0 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all;
}
.check-status { font-size: 12.5px; margin-bottom: 10px; }
.preview-items { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.preview-items td, .preview-items th { padding: 6px; border-bottom: 1px solid var(--border); }
.preview-items th { color: var(--muted); text-align: left; font-size: 12px; }
