:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --muted: #64748B;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --success-bg: #F0FDF4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}
.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.active { background: #EFF6FF; color: var(--primary); }

/* ── Layout ──────────────────────────────────────────── */
.container { max-width: 1040px; margin: 0 auto; padding: 28px 20px 64px; }
.page-title { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; max-width: 640px; }

/* ── Card ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 24px; }

/* ── Forms ───────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 13px; margin-top: 6px; }
.input, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .35); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-danger-ghost { background: #fff; border-color: #FCA5A5; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-success { background: var(--success-bg); color: #15803D; border: 1px solid #BBF7D0; }
.alert-error { background: var(--danger-bg); color: #B91C1C; border: 1px solid #FECACA; }

/* ── Table ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge-new { background: #EFF6FF; color: #1D4ED8; }
.badge-new::before { background: #2563EB; }
.badge-blocked { background: var(--danger-bg); color: #B91C1C; }
.badge-blocked::before { background: #DC2626; }
.badge-weak { background: #FEF3C7; color: #92400E; }
.badge-weak::before { background: #D97706; }
.tag-yes { color: #15803D; font-weight: 600; }

/* ── Empty state ─────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ── Centered (login / blocked) ──────────────────────── */
.center-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.center-card { width: 100%; max-width: 380px; }
.center-card .card-body { padding: 28px; }
.center-title { font-size: 20px; font-weight: 600; margin: 0 0 20px; text-align: center; }

/* ── Splash ──────────────────────────────────────────── */
.splash {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media (max-width: 560px) {
  .topbar-inner, .container { padding-left: 16px; padding-right: 16px; }
}
