* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(800px 400px at 50% -10%, rgba(56, 166, 245, 0.06), transparent 70%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.ok { color: var(--ok); }
.danger { color: var(--danger); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s3) var(--s4);
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(10, 14, 20, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
}
.wordmark span { color: var(--accent); }

.topbar-label {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: var(--s3);
}

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.btn:hover { border-color: var(--accent-dim); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  border-color: var(--accent);
  color: #06121d;
  box-shadow: 0 3px 14px rgba(56, 166, 245, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 22px rgba(56, 166, 245, 0.4); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(240, 86, 78, 0.12); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }

.wrap { max-width: 1080px; margin: 0 auto; padding: var(--s4); }

/* ---- login ---- */

.hero-card {
  max-width: 520px;
  margin: var(--s6) auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s5);
  text-align: center;
}
.hero-card h1 { margin: 0 0 var(--s2); }
.hero-card .lede { color: var(--text-muted); margin: 0 0 var(--s4); }
.hero-card .fine { color: var(--danger); font-size: 13.5px; min-height: 1em; margin-top: var(--s3); }

/* ---- layout ---- */

.admin-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.admin-head h1 { margin: 0; }

.tabs {
  display: flex;
  gap: var(--s1);
  margin: var(--s3) 0 var(--s4);
  border-bottom: 1px solid var(--line);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font: 600 14px var(--font-body);
  padding: 10px 14px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s4);
  margin-bottom: var(--s3);
}
.card h2 { margin: 0 0 var(--s2); font-size: 18px; }

/* ---- overview ---- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.stat { text-align: center; margin-bottom: 0; }
.stat-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.maintenance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}
.maintenance-card p { margin: 0; font-size: 14px; max-width: 560px; }

.switch {
  flex: none;
  width: 58px;
  height: 32px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 160ms ease, background 160ms ease;
}
.switch[aria-checked="true"] { background: rgba(240, 86, 78, 0.25); border-color: var(--danger); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(26px); background: var(--danger); }

/* ---- forms / search ---- */

.form-row { margin-bottom: var(--s3); }
.form-row label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: var(--s1); }

input[type="text"], input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 14px var(--font-body);
  padding: 9px 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-dim); }
textarea { font-family: var(--font-mono); font-size: 12.5px; resize: vertical; }

.search-row { display: flex; gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
.search-row input[type="search"] { flex: 1; }
.search-row select { width: auto; }

/* ---- tables ---- */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table a { color: var(--accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table .mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill-verified { background: var(--ok-soft); color: var(--ok); }
.pill-unverified { background: rgba(147, 161, 184, 0.15); color: var(--text-muted); }
.pill-banned { background: rgba(240, 86, 78, 0.15); color: var(--danger); }

/* ---- worlds ---- */

.world-card .world-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.world-card .world-head h3 { margin: 0; font-size: 16px; }
.world-card .world-meta { color: var(--text-faint); font-size: 12.5px; font-family: var(--font-mono); }
.world-card.revoked { opacity: 0.55; }
.world-card .webhook-row { display: flex; gap: var(--s2); margin-top: var(--s2); }
.world-card .webhook-row input { flex: 1; }

/* ---- analytics ---- */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  padding-top: var(--s2);
}
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 4px; }
.chart .seg { border-radius: 2px 2px 0 0; min-height: 1px; }
.chart .seg-ok { background: var(--ok); }
.chart .seg-warn { background: var(--warn); opacity: 0.7; }
.chart .col[title] { cursor: default; }

.chart-legend { display: flex; gap: var(--s3); margin-top: var(--s2); color: var(--text-muted); font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }

.bars { display: flex; flex-direction: column; gap: var(--s2); }
.bar-row { display: grid; grid-template-columns: 180px 1fr 48px; align-items: center; gap: var(--s2); font-size: 13.5px; }
.bar-row .bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { background: var(--surface-2); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-row .bar-n { text-align: right; font-family: var(--font-mono); color: var(--text-muted); }

/* ---- dialog ---- */

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s4);
  max-width: 560px;
  width: calc(100% - 2 * var(--s4));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h2 { margin-top: 0; }

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3);
  font-size: 13.5px;
}
.notice-warn { background: rgba(240, 180, 41, 0.1); border-color: var(--warn); }

.foot {
  border-top: 1px solid var(--line);
  padding: var(--s4);
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .maintenance-card { flex-direction: column; align-items: flex-start; }
  .bar-row { grid-template-columns: 110px 1fr 40px; }
}
