@font-face {
  font-family: 'Open Sans';
  src: url('fonts/opensans.woff2') format('woff2-variations');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

/* County Control dashboard. Black and white like the rest of pcdev.info; the only
   colour is meaning (ok / warning / danger). No inline styles anywhere: the page runs
   under a CSP that forbids them. */
:root {
  --bg: #121213; --bg-2: #0f0f10; --surface: #0f0f10; --surface-2: #17171a; --surface-3: #1e1e20;
  --line: #1c1d1e; --line-strong: #2a2a2d;
  --ink: #d1d0d2; --muted: #a9a8ab; --muted-2: #82848c;
  --ok: #4ade80; --ok-bg: rgba(74,222,128,.12);
  --warn: #fbbf24; --warn-bg: rgba(251,191,36,.12);
  --bad: #f87171; --bad-bg: rgba(248,113,113,.12);
  --radius: 16px; --radius-sm: 12px; --radius-input: 16px; --radius-btn: 14px;
  --ease: cubic-bezier(.16,1,.3,1);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 32px rgba(0,0,0,.35);
  --red: #d01418; --red-hi: #ee3237; --red-soft: rgba(208,20,24,.14); --red-line: rgba(238,50,55,.38);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #f1f1f4; --surface-3: #e8e8ec;
    --line: rgba(0,0,0,.09); --line-strong: rgba(0,0,0,.22);
    --ink: #131316; --muted: #63636b; --muted-2: #8c8c94;
    --ok: #15803d; --ok-bg: rgba(21,128,61,.1);
    --warn: #b45309; --warn-bg: rgba(180,83,9,.1);
    --bad: #b91c1c; --bad-bg: rgba(185,28,28,.09);
    --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
    --red-hi: #c8121a; --red-soft: rgba(208,20,24,.10); --red-line: rgba(208,20,24,.35);
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh;
  font: 0.9375rem/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 20% -8%, var(--red-soft), transparent 70%);
}
@media (prefers-color-scheme: light) { body::before { display: none; } }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--red); color: #fff; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; text-align: center; }

#app { position: relative; z-index: 1; min-height: 100vh; }
.boot { display: grid; place-items: center; min-height: 100vh; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--red-hi); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; text-decoration: none;
  font-weight: 600; font-size: 0.875rem; white-space: nowrap; transition: background .18s, transform .18s var(--ease), border-color .18s, opacity .18s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn.primary:hover { background: var(--red-hi); border-color: var(--red-hi); }
.btn.danger { color: var(--bad); border-color: var(--bad-bg); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.btn.ghost { border-color: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); font-size: 0.8125rem; }
.link:hover { color: var(--ink); }

/* ---------- sign in / server list ---------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.hero { text-align: center; max-width: 440px; animation: rise .6s var(--ease) both; }
.logo { width: 84px; height: 84px; margin: 0 auto 20px; display: block; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hero h1 { font-size: clamp(1.75rem, 6vw, 2.375rem); margin: 0 0 10px; letter-spacing: -.02em; line-height: 1.1; }
.hero p { color: var(--muted); margin: 0 0 26px; }
.hero .fine { font-size: 0.8125rem; margin: 18px 0 0; color: var(--muted-2); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 80px; }
.topline { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; }
.brand .logo { width: 34px; height: 34px; margin: 0; }
.grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.875rem; }
.h1 { font-size: 1.625rem; margin: 0 0 6px; letter-spacing: -.02em; }
.sub { color: var(--muted); margin: 0 0 24px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gcard {
  display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; transition: border-color .2s, transform .25s var(--ease), background .2s;
  animation: rise .5s var(--ease) both;
}
.gcard:hover { border-color: var(--line-strong); background: var(--surface-2); transform: translateY(-2px); }
.gcard .meta { min-width: 0; flex: 1; }
.gcard .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .state { font-size: 0.8125rem; color: var(--muted); }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.av { width: 44px; height: 44px; border-radius: 12px; flex: none; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--muted); overflow: hidden; }
.av img { width: 100%; height: 100%; display: block; object-fit: cover; }
.av.round { border-radius: 50%; }
.av.sm { width: 30px; height: 30px; font-size: 0.75rem; border-radius: 9px; }
.av.sm.round { border-radius: 50%; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; text-decoration: none; margin-bottom: 14px; }
.switch:hover { background: var(--surface-2); }
.switch .t { min-width: 0; flex: 1; }
.switch .n { font-weight: 650; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch .s { font-size: 0.75rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 550; font-size: 0.875rem; border: 0; background: none; width: 100%; text-align: left; transition: background .15s, color .15s; }
.nav:hover { background: var(--surface-2); color: var(--ink); }
.nav[aria-current="page"] { background: var(--surface-3); color: var(--ink); box-shadow: inset 2px 0 0 var(--red-hi); }
.nav .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: auto; }
.nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side .sep { height: 1px; background: var(--line); margin: 10px 4px; }
.side .foot { margin-top: auto; padding-top: 12px; }
.main { padding: 30px clamp(16px, 4vw, 44px) 120px; max-width: 980px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 1.625rem; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); max-width: 62ch; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); font-size: 0.875rem; }
.banner.warn { background: var(--warn-bg); border-color: transparent; }
.banner.bad { background: var(--bad-bg); border-color: transparent; }

/* ---------- cards ---------- */
.card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); animation: rise .45s var(--ease) both; }
.card > h2 { margin: 0 0 4px; font-size: 1rem; letter-spacing: -.01em; }
.card > .hint { color: var(--muted); font-size: 0.84375rem; margin: 0 0 16px; }
.card > h2 + :not(.hint) { margin-top: 14px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px; animation: rise .45s var(--ease) both; }
.tile .k { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tile .v { font-size: 1.625rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.tile .d { font-size: 0.8125rem; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 650; background: var(--surface-3); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }

.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.check:first-of-type { border-top: 0; }
.check .box { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 1.5px solid var(--line-strong); }
.check.done .box { background: var(--ok); border-color: var(--ok); color: #06210f; }
.check .box svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.check .txt { flex: 1; min-width: 0; }
.check .lab { font-weight: 600; font-size: 0.875rem; }
.check .det { font-size: 0.8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--red-hi); border-radius: inherit; width: var(--w, 0%); transition: width .6s var(--ease); }
.bar.ok > i { background: var(--ok); }
.progress-line { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.progress-line .bar { flex: 1; }
.progress-line span { font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
.field { padding: 16px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.field:first-of-type { border-top: 0; padding-top: 4px; }
.field.row { grid-template-columns: minmax(0, 1fr) minmax(190px, 260px); align-items: center; gap: 16px; }
.field .lab { font-weight: 600; font-size: 0.875rem; }
.field .help { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }
.field .err { font-size: 0.8125rem; color: var(--bad); }
.field.changed .lab::after { content: "edited"; margin-left: 8px; font-size: 0.6875rem; font-weight: 650; color: var(--warn); background: var(--warn-bg); padding: 1px 8px; border-radius: 99px; }
.inp, .sel, .txt-a {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--bg-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus, .sel:focus, .txt-a:focus { border-color: var(--red-hi); box-shadow: 0 0 0 3px var(--surface-3); }
.txt-a { min-height: 96px; resize: vertical; line-height: 1.5; }
.sel { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.sel option, .sel optgroup { background: var(--surface); color: var(--ink); }
.suffix { position: relative; }
.suffix .inp { padding-right: 62px; }
.suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 0.8125rem; color: var(--muted); pointer-events: none; }
.toggle { width: 46px; height: 26px; border-radius: 99px; border: 0; background: var(--surface-3); position: relative; padding: 0; transition: background .2s; justify-self: end; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .2s; }
.toggle[aria-checked="true"] { background: var(--red); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); background: #fff; }
.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--surface-3); justify-self: end; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 99px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--red); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: none; border-radius: 99px; padding: 2px 10px; font-size: 0.75rem; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.chip:hover { color: var(--ink); background: var(--surface-2); }
.preview { font-size: 0.84375rem; padding: 10px 12px; border-radius: 3px var(--radius-sm) var(--radius-sm) 3px; min-height: 40px; background: var(--bg-2); border-left: 3px solid var(--line-strong); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.preview b { color: var(--ink); }
.count { font-size: 0.75rem; color: var(--muted-2); text-align: right; font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 8px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline .sel { flex: 1; min-width: 180px; }

.ttype { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--bg-2); display: grid; gap: 10px; }
.ttype .two { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.ttype .head { display: flex; align-items: center; gap: 10px; }
.ttype .head .inp { flex: 1; font-weight: 600; }

/* ---------- save bar ---------- */
.savebar { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 20px; border-radius: 999px; background: var(--surface-3); color: var(--ink); border: 1px solid var(--red-line); box-shadow: 0 16px 48px rgba(0,0,0,.5), 0 0 40px var(--red-soft); transition: transform .4s var(--ease); max-width: calc(100vw - 24px); }
.savebar.show { transform: translate(-50%, 0); }
.savebar .btn { border-color: transparent; }
.savebar .btn.ghost { color: var(--ink); }
.savebar .btn.ghost:hover { background: var(--surface-2); }
.savebar span { font-weight: 600; font-size: 0.875rem; }

/* ---------- tables and lists ---------- */
.tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tools .inp, .tools .sel { flex: 1; min-width: 160px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tbl th { text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .rs { color: var(--muted); max-width: 320px; overflow-wrap: anywhere; }
.scroll-x { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.rowline { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rowline:first-child { border-top: 0; }
.rowline .who { flex: 1; min-width: 0; }
.rowline .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowline .who small { color: var(--muted); font-size: 0.8125rem; }
.rank { width: 22px; text-align: center; color: var(--muted-2); font-variant-numeric: tabular-nums; font-size: 0.8125rem; }
.rowline .bar { width: 120px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 650; background: var(--surface-3); color: var(--muted); }
.tag.ban { background: var(--bad-bg); color: var(--bad); }
.tag.kick, .tag.warn, .tag.timeout, .tag.softban { background: var(--warn-bg); color: var(--warn); }
.tag.unban, .tag.untimeout { background: var(--ok-bg); color: var(--ok); }
.more { text-align: center; padding-top: 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- confirm dialog (ccConfirm in app.js; the browser's confirm box is never used) ---------- */
.ccdlg { width: min(420px, calc(100vw - 32px)); margin: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.ccdlg::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.ccdlg h2 { margin: 0; padding: 20px 20px 0; font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
.ccdlg p { margin: 0; padding: 8px 20px 0; color: var(--muted); line-height: 1.55; }
.ccdlg .ft { display: flex; justify-content: flex-end; gap: 8px; padding: 20px; }
.btn.ccbad { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ccbad:hover { background: var(--red-hi); border-color: var(--red-hi); }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 40; right: 16px; top: 16px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 0.875rem; animation: rise .35s var(--ease) both; }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.bad { border-left: 3px solid var(--bad); }
.toast b { display: block; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 6px; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .switch { width: auto; flex: none; margin: 0 6px 0 0; }
  .switch .t { display: none; }
  .nav { width: auto; flex: none; white-space: nowrap; }
  .nav svg { display: none; }
  .side .sep, .side .foot { display: none; }
  .main { padding-top: 22px; }
  .field.row { grid-template-columns: 1fr; gap: 8px; }
  .toggle, .seg { justify-self: start; }
  .ttype .two { grid-template-columns: 1fr; }
  .rowline .bar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.h1 + .grid + .h1, .grid + .h1 { margin-top: 32px; }
.still *, .still *::before, .still *::after { animation: none !important; }
.check.opt .box { border-style: dashed; }

/* ---------- type-to-search picker ---------- */
.combo { position: relative; width: 100%; }
.combo-in { width: 100%; min-height: 40px; padding: 8px 58px 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--bg-2); outline: none; transition: border-color .15s, box-shadow .15s; }
.combo-in:focus { border-color: var(--red-hi); box-shadow: 0 0 0 3px var(--surface-3); }
.combo-in::placeholder { color: var(--muted); }
.combo-x { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--muted); font-size: 0.9375rem; line-height: 1; padding: 0; }
.combo-x:hover { color: var(--ink); }
.combo-x[hidden] { display: none; }
.combo-caret { position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.combo-list { position: absolute; left: auto; right: 0; width: max(100%, min(340px, calc(100vw - 32px))); top: calc(100% + 6px); z-index: 30; max-height: 280px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 18px 48px rgba(0,0,0,.5); padding: 6px; overscroll-behavior: contain; }
.combo-group { padding: 8px 10px 4px; font-size: 0.6875rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.combo-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 0.875rem; }
.combo-opt.active { background: var(--surface-3); }
.combo-opt[aria-selected="true"] .combo-label { font-weight: 650; }
.combo-opt.none { color: var(--muted); }
.combo-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-hint { font-size: 0.75rem; color: var(--muted-2); }
.combo-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 0.84375rem; }
.swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #99aab5); flex: none; }
.combo.multi { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px; padding: 5px 58px 5px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2); transition: border-color .15s, box-shadow .15s; }
.combo.multi:focus-within { border-color: var(--red-hi); box-shadow: 0 0 0 3px var(--surface-3); }
.combo.multi .combo-in { flex: 1; width: auto; min-width: 120px; min-height: 30px; padding: 4px; border: 0; box-shadow: none; background: none; }
.combo-tags { display: contents; }
.tag-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 99px; background: var(--surface-3); font-size: 0.8125rem; }
.tag-x { border: 0; background: none; color: var(--muted); width: 18px; height: 18px; border-radius: 50%; padding: 0; font-size: 0.875rem; line-height: 1; }
.tag-x:hover { color: var(--ink); background: var(--surface-2); }
.inline .combo, .tools .combo { flex: 1; min-width: 180px; }

/* ---------- permissions ---------- */
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 380px) auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.perm-row:first-child { border-top: 0; }
.perm-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.perm-info .muted { font-size: 0.84375rem; }
@media (max-width: 860px) { .perm-row { grid-template-columns: 1fr; gap: 10px; } .perm-row .btn { justify-self: start; } }

/* ---------- server picker ---------- */
.servers { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.scard { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, var(--surface), var(--bg-2)); text-decoration: none; overflow: hidden; transition: border-color .2s, transform .3s var(--ease), box-shadow .3s; animation: rise .5s var(--ease) both; }
.scard::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line-strong); transition: background .2s; }
.scard:hover { border-color: var(--red-line); transform: translateY(-3px); box-shadow: 0 18px 40px -20px rgba(208,20,24,.45); }
.scard:hover::after, .scard.live::after { background: var(--red-hi); }
.scard .top { display: flex; align-items: center; gap: 14px; }
.scard .top .av { width: 52px; height: 52px; border-radius: 14px; font-size: 1rem; }
.scard .nm { min-width: 0; flex: 1; }
.scard .nm b { display: block; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard .nm span { font-size: 0.8125rem; color: var(--muted); }
.scard .facts { display: flex; flex-wrap: wrap; gap: 8px; }
.scard .setup { display: flex; align-items: center; gap: 10px; font-size: 0.78125rem; color: var(--muted); }
.scard .setup .bar { flex: 1; height: 6px; }
.add-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 420px); gap: 20px; align-items: center; }
.add-card h2 { margin: 0 0 4px; }
.add-card .hint { margin: 0; }
@media (max-width: 760px) { .add-card { grid-template-columns: 1fr; } .servers { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.125rem; letter-spacing: -.01em; }
.section-title span { color: var(--muted); font-size: 0.84375rem; }

.scard .top { min-width: 0; }
.scard .top .pill { flex: none; }
.scard .setup span { flex: none; white-space: nowrap; }
.scard .setup .bar { min-width: 0; }
.servers > * { min-width: 0; }

.nav-beta { margin-left: auto; font: 700 0.59375rem/1 ui-monospace, Menlo, monospace; letter-spacing: .12em; color: #fff; background: var(--red); padding: 3px 5px; border-radius: 4px; }
.check .btn.primary { flex: none; }
.row-gap-inline { display: flex; gap: 8px; align-items: center; flex: none; }

.check.dim { opacity: .55; }
.card .link { margin-top: 10px; }

/* departments */
.dept-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dept-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--bg-2); color: inherit; font: inherit; cursor: pointer; }
.dept-row.static { cursor: default; }
.dept-row:hover:not(.static) { border-color: rgba(255,255,255,.22); }
.dept-row.on { border-color: var(--accent, #d01018); }
.dept-row.off { opacity: .55; }
.dept-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dept-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dept-main b { font-weight: 600; }
.dept-main small { color: var(--ink-3); font-size: 0.75rem; }
.dept-count { color: var(--ink-2); font-size: 0.75rem; white-space: nowrap; }
.dpill { font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.dpill.d-police { color: #8ab4ff; border-color: rgba(138,180,255,.35); }
.dpill.d-fire { color: #ff9b7a; border-color: rgba(255,155,122,.35); }
.dpill.d-dispatch { color: #ffd479; border-color: rgba(255,212,121,.35); }
.dpill.d-transportation { color: #9ee6a8; border-color: rgba(158,230,168,.35); }
.dpill.d-off { color: var(--ink-3); }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.dept-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.75rem; color: var(--ink-2); }
.dept-field input[type="color"] { height: 38px; padding: 4px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.btn.small { padding: 5px 10px; font-size: 0.75rem; }
.btn.danger { color: #ff7a7a; border-color: rgba(255,122,122,.35); }
@media (max-width: 640px) {
  .dept-row { flex-wrap: wrap; }
  .dept-count { width: 100%; }
}

/* home: welcome + grouped server list */
.home { max-width: 980px; }
.home-hero { margin: 26px 0 30px; display: flex; flex-wrap: wrap; gap: 20px;
  align-items: flex-end; justify-content: space-between; }
.home-hello h1 { font-size: 1.875rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.home-hello p { margin: 0; color: var(--ink-2); }
.home-stats { display: flex; gap: 10px; }
.hstat { min-width: 104px; padding: 10px 14px; border: 1px solid var(--rule);
  border-radius: 12px; background: var(--bg-2); display: flex; flex-direction: column; gap: 2px; }
.hstat b { font-size: 1.25rem; font-weight: 600; line-height: 1.1; }
.hstat span { font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.hstat.warn b { color: #ffc46b; }

.sgroup { margin: 0 0 26px; }
.sgroup-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 10px; }
.sgroup-head h2 { font-size: 0.8125rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-2); margin: 0; }
.sgroup-head span { font-size: 0.75rem; color: var(--ink-3); }
.srows { display: flex; flex-direction: column; gap: 6px; }

.srow { display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--bg-2);
  color: inherit; text-decoration: none; transition: border-color .12s, background .12s; }
.srow:hover { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.03); }
.srow img, .srow .fallback { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.srow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.srow-main b { font-weight: 600; font-size: 0.875rem; }
.srow-main small { color: var(--ink-3); font-size: 0.75rem; }
.srow-live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem;
  color: #7bd88f; white-space: nowrap; }
.srow-live i { width: 7px; height: 7px; border-radius: 50%; background: #7bd88f; }
.srow-right { display: flex; align-items: center; gap: 16px; flex: none; }
.srow-setup { display: flex; align-items: center; gap: 8px; }
.srow-setup span { font-size: 0.6875rem; color: var(--ink-3); white-space: nowrap; }
.srow-bar { width: 72px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.srow-bar i { display: block; height: 100%; width: var(--w, 0%); border-radius: 99px;
  background: var(--ink-2); transition: width .5s ease; }
.srow-ok { font-size: 0.6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.srow-go { font-size: 0.75rem; color: var(--ink-2); white-space: nowrap; }
.srow:hover .srow-go { color: var(--ink); }
.add-row { padding: 14px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg-2); }

@media (max-width: 720px) {
  .home-hero { flex-direction: column; align-items: stretch; }
  .home-stats { flex-wrap: wrap; }
  .hstat { flex: 1; min-width: 92px; }
  .srow { flex-wrap: wrap; }
  .srow-right { width: 100%; justify-content: space-between; }
}

/* ----------------------------------------------------------------------------
   Anchor-style surface treatment. Measured off anchr.gg's live dashboard: cards
   share the page background and are told apart by a hairline only, inputs sit
   DARKER than the page rather than lighter, and the radii are larger than we had
   (12 card / 16 input / 14 button). Open Sans is self-hosted so the strict CSP
   only had to gain font-src 'self'.
   ---------------------------------------------------------------------------- */
body, .wrap, .cad { font-family: 'Open Sans', system-ui, -apple-system, sans-serif; }
body { font-size: 1rem; }
h1, .h1 { font-weight: 700; letter-spacing: -.025em; }
h2 { font-weight: 600; letter-spacing: -.01em; }
.card, .sgroup .srow, .add-row, .hstat, .dept-row {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.inp, input[type="text"], input[type="search"], input[type="number"], input[type="color"], select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  min-height: 40px;
  font-size: 0.875rem;
  padding: 8px 12px;
}
.inp:focus, select:focus, textarea:focus { border-color: var(--line-strong); outline: none; }
.btn { border-radius: var(--radius-btn); font-size: 0.875rem; font-weight: 500; }
.btn.ghost, .btn.sm { background: rgba(255,255,255,.04); border-color: transparent; }
.btn.ghost:hover, .btn.sm:hover { background: rgba(255,255,255,.07); }
.hint, .sub, p { font-size: 0.875rem; line-height: 20px; }
label, .dept-field > span { font-size: 0.875rem; font-weight: 500; color: #c5c6c9; }

/* ----------------------------------------------------------------------------
   Anchor card anatomy, measured off their live DOM. The correction that mattered:
   cards are DARKER than the page (#0f0f10 on #121213), carry a soft drop shadow,
   and use a 16px radius. Their titles are 16px/600 with an 18px muted icon.
   ---------------------------------------------------------------------------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 10px -4px rgba(0,0,0,.22);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card > h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 600; letter-spacing: -.01em;
  color: var(--ink); margin: 0 0 6px;
}
.card > h3 { font-size: 0.875rem; font-weight: 600; color: var(--ink); margin: 20px 0 8px; }
.card > .hint { margin: 0 0 14px; }

/* departments: one card, inline form, tight empty state */
.dept-card .dept-head { margin-bottom: 4px; }
.dept-new { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.dept-new-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.dnf { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.dnf.grow { flex: 1 1 240px; }
.dnf > span { font-size: 0.75rem; font-weight: 500; color: var(--muted-2); }
.dnf .inp { width: 100%; }
.dept-new-go { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit;
  font-size: 0.8125rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--ink); }
.btn.primary { background: rgba(255,255,255,.08); border: 1px solid var(--line-strong); color: var(--ink); }
.btn.primary:hover { background: rgba(255,255,255,.12); }
.dept-list:empty { display: none; }
.dept-card .hint:last-child { margin-bottom: 0; }

/* rows inside a card sit on the card, so they need to lift off it */
.dept-row, .srow, .add-row, .hstat { background: #141416; border-color: var(--line); }

/* card titles lead with a muted 18px glyph, as Anchor's do */
.card > h2 > svg { width: 18px; height: 18px; flex: none; color: var(--muted-2); stroke-width: 2; }
.card > h2 > span { min-width: 0; }

/* card title icon. icon() sets no size, so anything outside a styled context
   rendered at natural size and solid black. */
.ctitle { display: flex; align-items: center; gap: 10px; }
.ctitle-ico { width: 18px; height: 18px; flex: none;
  fill: none; stroke: var(--muted-2); stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }

/* A department's badge: the linked Discord server's icon, ringed in that department's
   own colour so a roster of agencies is scannable at a glance instead of a column of
   identical dots. Falls back to .dept-dot when nothing is linked. */
.dept-badge { --dept: var(--line-2); width: 28px; height: 28px; border-radius: 8px;
  object-fit: cover; flex: none; background: var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--dept) 55%, transparent); }
.dept-badge.big { width: 40px; height: 40px; border-radius: 10px; }
.dept-head { display: flex; align-items: center; gap: 12px; }
.dept-head h2 { margin: 0; }

/* Department CAD permissions (Departments page). */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 28px; margin: 14px 0 6px; }
.perm-group h4 { margin: 0 0 8px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.perm-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.perm-row input { margin-top: 3px; accent-color: var(--red); flex: none; width: 16px; height: 16px; }
.perm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-text b { font-weight: 600; color: var(--ink); font-size: .875rem; }
.perm-text small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.perm-calls { display: grid; gap: 10px; margin: 12px 0; max-width: 640px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-chips[hidden] { display: none; }
.perm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .8rem; color: var(--ink); cursor: pointer; }
.perm-chip input { accent-color: var(--red); }
.perm-chip:has(input:checked) { border-color: var(--red-line); background: var(--red-soft); }

.perm-chips.roles { max-height: 260px; overflow-y: auto; padding: 2px; }
.perm-chip[hidden] { display: none; }
.hint.warn { color: var(--warn); }
