:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --text: #1e1f24;
  --muted: #5d6070;
  --border: #e3e5ec;
  --accent: #5865f2;
  --accent-text: #ffffff;
  --ok: #1f9d55;
  --error: #d93b3b;
  --quote: #f0f1f7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111216;
    --surface: #1b1c22;
    --text: #ecedf1;
    --muted: #9ea1b0;
    --border: #2b2d36;
    --accent: #6d78f7;
    --quote: #23252d;
    --ok: #3ccf7d;
    --error: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.06);
}
.avatar { border-radius: 50%; display: block; margin: 0 auto 12px; }
.card > .badge {
  width: 64px; height: 64px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 28px; font-weight: 700;
  background: var(--quote); color: var(--accent);
}
.tone-ok .badge { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tone-error .badge { background: color-mix(in srgb, var(--error) 15%, transparent); color: var(--error); }
h1 { font-size: 1.35rem; margin: 0 0 8px; overflow-wrap: anywhere; }
.msg { color: var(--muted); margin: 0 0 16px; }
.tone-ok h1 { color: var(--ok); }
.tone-error h1 { color: var(--error); }
.custom {
  margin: 0 0 16px; padding: 12px 14px; text-align: left;
  background: var(--quote); border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.who { font-size: 0.9rem; color: var(--muted); margin: 0 0 16px; overflow-wrap: anywhere; }
.btn {
  width: 100%; padding: 12px 16px;
  border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 12px 0 0; min-height: 1.3em; }
.foot { text-align: center; font-size: 0.8rem; color: var(--muted); padding: 16px; }

/* ------------------------------------------------------------------ dashboard */
.btn { display: inline-block; text-align: center; text-decoration: none; }
.card .btn { margin-top: 4px; }
body.dash { display: block; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; }
.me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.me img { border-radius: 50%; }
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.me form { margin: 0; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; }
.dash-main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.dash-main h1 { font-size: 1.5rem; margin: 0; }
.dash-main h2 { font-size: 1.1rem; margin: 0 0 12px; }
.dash-main section { margin-top: 28px; }
.muted { color: var(--muted); }
a { color: var(--accent); }

.guilds { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.guilds a {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.guilds a:hover, .guilds a:focus-visible { border-color: var(--accent); }
.guilds img, .guild-head img { border-radius: 12px; flex: none; }
.gicon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--quote); color: var(--accent); font-weight: 700;
}
.guild-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; min-width: 0; }
.guild-head h1 { overflow-wrap: anywhere; }
.guild-head .gicon { width: 48px; height: 48px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.flash { padding: 10px 14px; border-radius: 10px; margin: 0 0 16px; }
.flash-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.flash-error { background: color-mix(in srgb, var(--error) 14%, transparent); color: var(--error); }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.tile-v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--muted); font-size: 0.85rem; }
.tile.warn .tile-v { color: var(--error); }

.problems { margin: 0; padding-left: 20px; color: var(--error); }
.problems li { margin: 4px 0; }
.ok-line { color: var(--ok); margin: 0; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.filter label { white-space: nowrap; }
.filter input { flex: 0 1 15rem; min-width: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.8rem; white-space: nowrap; }
/* Wide lists scroll sideways on small screens instead of crushing short columns into one-word lines. */
table.list { min-width: 1100px; }
table.list td { min-width: 0; }
table.list .small { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.details { min-width: 220px; overflow-wrap: anywhere; }
.details .k { color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--quote); white-space: nowrap; font-size: 0.8rem; }
.b-alt, .b-ban { background: color-mix(in srgb, var(--error) 16%, transparent); color: var(--error); }
.b-success, .b-manual { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
table.kv th { width: 34%; color: var(--muted); font-weight: 500; }

form.settings fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 8px 16px 16px; margin: 0 0 16px; background: var(--surface); }
form.settings legend { font-weight: 600; padding: 0 6px; }
.field { display: grid; gap: 6px; margin-top: 14px; }
.field-boolean { grid-template-columns: auto 1fr; align-items: center; }
.field-boolean label { order: 2; }
.field-boolean input { order: 1; width: 18px; height: 18px; }
.field-boolean .field-error { order: 3; grid-column: 1 / -1; }
.field label { font-weight: 500; }
select, input[type="number"], input[type="text"], input:not([type]), input[inputmode], textarea {
  width: 100%; max-width: 520px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
textarea { resize: vertical; }
.filter select { width: auto; }
.has-error select, .has-error input, .has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); margin: 0; font-size: 0.85rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.actions form { margin: 0; }
.actions .btn, .settings .btn { width: auto; padding: 10px 18px; }
.btn-small { width: auto; padding: 7px 12px; font-size: 0.9rem; }
.lookup { display: grid; gap: 6px; max-width: 560px; }
.lookup .row { display: flex; gap: 8px; }
.lookup .btn { width: auto; }
.member { margin-top: 20px; }
.member-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.member-head img { border-radius: 50%; }
.member-head h2 { margin: 0; }

/* ---- platform panel (/admin) ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.err-line { color: var(--error); }
.reason-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.reason-form input { flex: 1 1 200px; min-width: 0; }
.btn-danger { background: var(--error); border-color: var(--error); }
.danger-zone { margin: 20px 0; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--error) 45%, var(--border)); border-radius: 12px; }
.danger-zone h2 { margin-top: 0; }
.danger-zone h3 { font-size: 0.95rem; margin: 14px 0 6px; }
code.details { font-size: 0.8rem; word-break: break-all; }

/* ---- verify page bot check ---- */
.challenge { min-height: 0; margin: 4px 0 12px; display: flex; justify-content: center; color: var(--muted); font-size: 0.9rem; }
.challenge:empty { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chips a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: inherit; font-size: 0.9rem; }
.chips a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.small { font-size: 0.8rem; }

/* admin: one-server view */
.crumbs { margin: 0 0 6px; font-size: 0.9rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.server-title { margin-bottom: 12px; overflow-wrap: anywhere; }
.server-title .small { font-weight: 400; font-size: 0.85rem; }

/* full-width admin pages */
.dash-main.full { max-width: none; padding-left: clamp(16px, 3vw, 40px); padding-right: clamp(16px, 3vw, 40px); }

/* admin: one-user profile */
.profile-head { display: flex; gap: 16px; align-items: center; margin: 4px 0 14px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; flex: none; background: var(--surface); }
.profile-id { min-width: 0; }
.profile-id h1 { margin: 0 0 2px; }
.profile-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tab-n { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--quote); font-size: 0.75rem; font-weight: 600; text-align: center; color: var(--muted); }
.b-vpn, .b-mobile, .b-kick { background: color-mix(in srgb, #e6a23c 18%, transparent); color: #b7791f; }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); margin-top: 16px; }
.split > * > section:first-child, .split > section { margin-top: 0; }
@media (min-width: 1100px) {
  .split { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
  .split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.split-side table.kv th { width: 52%; }

/* ------------------------------------------------------------------ Arix Alerts */
.plat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.plat-twitch { background: color-mix(in srgb, #9146ff 18%, transparent); color: #9146ff; }
.plat-kick { background: color-mix(in srgb, #53fc18 22%, transparent); color: #2f9a0c; }
.plat-youtube { background: color-mix(in srgb, #ff0000 14%, transparent); color: #e00000; }
@media (prefers-color-scheme: dark) { .plat-kick { color: #53fc18; } .plat-youtube { color: #ff5c5c; } .plat-twitch { color: #b38bff; } }
.streamer { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.streamer img, .streamer .ph { width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--quote); }
.streamer b { display: block; }
.live { display: inline-flex; align-items: center; gap: 5px; color: var(--error); font-weight: 600; font-size: 0.8rem; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.off { color: var(--muted); font-size: 0.8rem; }
.paused { color: #b7791f; font-size: 0.8rem; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.add-form { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 16px; }
.add-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.add-grid .wide { grid-column: 1 / -1; }
.stream-title { max-width: 360px; overflow-wrap: anywhere; }
code { background: var(--quote); padding: 1px 5px; border-radius: 5px; font-size: 0.85em; }
.card.solo { margin: 40px auto; }
