/* Unity Admin Center — no external assets, CSP-friendly (no inline styles). */
:root {
  --bg: #0b0e14; --bg2: #10141c; --panel: #151a24; --panel2: #1b2130; --line: #252c3b; --line2: #303a4e;
  --text: #e6e9f0; --muted: #8b95a8; --faint: #5d6679;
  --accent: #6c8cff; --accent2: #38d6c9; --accent-ink: #0b0e14;
  --ok: #3fbf7f; --warn: #f5a524; --bad: #ef5b5b;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa; --bg2: #eef1f6; --panel: #ffffff; --panel2: #f6f8fb; --line: #e2e6ee; --line2: #d3d9e4;
    --text: #141925; --muted: #5d6679; --faint: #8b95a8; --accent: #4563e8; --accent2: #0fa89b; --accent-ink: #fff;
    --shadow: 0 1px 2px rgba(20,25,37,.06), 0 6px 18px rgba(20,25,37,.06); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: .05em .4em; white-space: nowrap; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.ic { width: 18px; height: 18px; fill: currentColor; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; background: var(--bg2); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .14em; text-transform: uppercase; }
.brand small { display: block; color: var(--muted); font-size: .75rem; margin-top: -2px; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px rgba(108,140,255,.35); }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 520; }
.nav:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav.on { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.me b { display: block; font-size: .9rem; }
.me small { color: var(--muted); text-transform: capitalize; }
.main { padding: 26px 32px 60px; max-width: 1180px; width: 100%; min-width: 0; }
.main.wide { max-width: 1480px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards & layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.split > .card { margin-bottom: 0; }
.split + .card, .split + section { margin-top: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 640px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row4 { display: grid; grid-template-columns: 2fr 1fr 1fr 90px; gap: 12px; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.fine { color: var(--faint); font-size: .8rem; margin: 6px 0 0; }
.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
.subtle { background: var(--panel2); border: 1px dashed var(--line2); border-radius: var(--radius-sm); padding: 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.danger-zone { margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--line2); }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line2); border-radius: var(--radius); }
.empty p { margin: 0 0 14px; }

/* ---------- forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 560; font-size: .9rem; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.18); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; flex: none; }
input[type=color] { padding: 3px; height: 40px; cursor: pointer; }
input[type=search] { min-width: 220px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.pad-top { padding-top: 28px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; width: fit-content; }
.seg label { flex-direction: row; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 520; }
.seg label:has(input:checked) { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line2); }
.code-input { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .3em; text-align: center; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { opacity: .75; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: .9rem;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #8a6cff); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(108,140,255,.3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(239,91,91,.45); }
.btn.danger:hover { background: rgba(239,91,91,.1); }
.danger-text { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px; }
.btn.steam { background: #171a21; color: #fff; border-color: #2a475e; }
.btn.steam:hover { background: #1b2838; }
.btn[disabled] { opacity: .6; cursor: progress; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }
.toggle { font: inherit; font-size: .8rem; font-weight: 650; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line2); background: var(--bg2); color: var(--muted); cursor: pointer; }
.toggle.on { color: var(--ok); border-color: rgba(63,191,127,.5); background: rgba(63,191,127,.1); }

/* ---------- pills & badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; margin: 2px 4px 2px 0; }
.pill.ok { color: var(--ok); border-color: rgba(63,191,127,.4); background: rgba(63,191,127,.1); }
.pill.warn { color: var(--warn); border-color: rgba(245,165,36,.4); background: rgba(245,165,36,.1); }
.pill.bad { color: var(--bad); border-color: rgba(239,91,91,.4); background: rgba(239,91,91,.1); }
.pill.role { color: var(--text); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); }
.pill.role small { color: var(--muted); font-weight: 500; }
.pill .exp { color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); display: inline-block; flex: none; }
.dot.lg { width: 12px; height: 12px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 750; letter-spacing: .03em; padding: 2px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; }
.game-cs2 { background: rgba(245,165,36,.15); color: #f5b74a; }
.game-cs16 { background: rgba(160,170,120,.18); color: #c4cc8f; }
.game-tf2 { background: rgba(207,106,50,.18); color: #e58a55; }
.game-css { background: rgba(108,140,255,.16); color: #8ea6ff; }
.game-rust { background: rgba(206,66,43,.18); color: #f0745c; }
.game-minecraft { background: rgba(98,180,72,.18); color: #7fcf5f; }
.count { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); font-size: .8rem; }

/* ---------- tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); }
a.tile:hover { border-color: var(--line2); text-decoration: none; }
.tile span { color: var(--muted); font-size: .85rem; font-weight: 560; }
.tile b { font-size: 1.9rem; line-height: 1.1; font-weight: 750; letter-spacing: -.02em; }
.tile small { color: var(--muted); }
.tile small.bad { color: var(--bad); }
.tile.attention { border-color: rgba(245,165,36,.5); background: linear-gradient(180deg, rgba(245,165,36,.08), transparent 70%), var(--panel); }
.tile form { margin-top: 4px; }

/* ---------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; }
.list th, .list td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; background: var(--panel2); }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
.list.compact th, .list.compact td { padding: 7px 12px; }
.is-disabled td { opacity: .55; }
.is-bad td:nth-child(3) code { color: var(--bad); }
.audit .details { max-width: 420px; overflow-wrap: anywhere; white-space: normal; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text); }
.who small { display: block; color: var(--muted); }
.av { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex: none; }
.av.ph { display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); font-weight: 700; }

/* role matrix */
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; vertical-align: middle; }
.matrix thead th { background: var(--panel2); position: sticky; top: 0; z-index: 1; min-width: 118px; }
.matrix thead th small { display: block; color: var(--muted); font-weight: 400; font-size: .72rem; }
.matrix tbody th { text-align: left; font-weight: 600; min-width: 210px; background: var(--panel); }
.matrix tbody th small { display: block; color: var(--muted); font-weight: 400; font-size: .76rem; }
.matrix td:last-child, .matrix th:last-child { border-right: 0; }
.matrix .gtoggle, .matrix .rowtoggle { flex-direction: row; align-items: center; gap: 8px; justify-content: center; }
.matrix .rowtoggle { justify-content: flex-start; }
.matrix .cell { flex-direction: row; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: 500; }
.matrix .cell code { font-size: .74rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.matrix td.na { color: var(--faint); }
.matrix .col-off { opacity: .35; }
.matrix .extra-row input { font-family: var(--mono); font-size: .8rem; padding: 6px 8px; min-width: 110px; }
.matrix .result-row td { background: var(--panel2); }
.matrix .result-row code { white-space: normal; overflow-wrap: anywhere; display: inline-block; max-width: 170px; max-height: 120px; overflow-y: auto; text-align: left; }
.help { margin-top: 14px; color: var(--muted); font-size: .88rem; }
.help summary { cursor: pointer; color: var(--text); font-weight: 600; }
.help ul { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* role cards */
.role-card { display: flex; flex-direction: column; gap: 10px; color: var(--text); border-top: 3px solid var(--c, var(--accent)); margin: 0; }
.role-card:hover { text-decoration: none; border-color: var(--line2); border-top-color: var(--c, var(--accent)); }
.role-card p { margin: 0; font-size: .88rem; }
.role-head { display: flex; align-items: center; gap: 10px; }
.role-head h3 { flex: 1; font-size: 1.05rem; }
.lvl { font-size: .75rem; font-weight: 700; color: var(--muted); background: var(--panel2); border: 1px solid var(--line2); padding: 1px 8px; border-radius: 99px; }
.meta { display: flex; gap: 14px; color: var(--muted); font-size: .82rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .76rem; padding: 3px 8px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); }
.chip code { border: 0; background: none; padding: 0; color: var(--muted); }

/* lists */
.assign { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.assign li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel2); }
.assign li.is-expired { opacity: .5; }
.assign form { margin: 0; }
.srv, .plainlist, .feed { list-style: none; padding: 0; margin: 0; }
.srv li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.srv li:last-child, .plainlist li:last-child, .feed li:last-child { border-bottom: 0; }
.srv li a { color: var(--text); }
.plainlist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.feed li { display: grid; grid-template-columns: 76px auto auto 1fr; gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .86rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.ids { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); margin-top: -4px; }
.onboarding ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

/* diff */
.diff { margin: 0; padding: 12px 0; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius-sm); font: .82rem/1.55 var(--mono); overflow-x: auto; max-height: 640px; }
.diff span { display: block; padding: 0 14px; white-space: pre; }
.dadd { background: rgba(63,191,127,.12); color: #7fe0ae; }
.ddel { background: rgba(239,91,91,.12); color: #ff9a9a; }
.dgap { color: var(--faint); font-style: italic; }
@media (prefers-color-scheme: light) { .dadd { color: #137a47; } .ddel { color: #b42323; } }

/* flash */
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-size: .92rem; overflow-wrap: anywhere; }
.flash.ok { background: rgba(63,191,127,.1); border-color: rgba(63,191,127,.35); }
.flash.error { background: rgba(239,91,91,.1); border-color: rgba(239,91,91,.4); }
.flash.warn { background: rgba(245,165,36,.1); border-color: rgba(245,165,36,.4); }
.flash div + div { margin-top: 4px; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* ---------- auth screens */
.auth-bg { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(108,140,255,.18), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(56,214,201,.14), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 410px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.auth-card h2 { font-size: 1.2rem; }
.auth-card p { margin: 0; color: var(--muted); }
.brand.big { padding: 0 0 6px; justify-content: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: .8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line2); }
.center { text-align: center; }
.qr-wrap { display: grid; place-items: center; }
.qr { width: 220px; height: 220px; border-radius: 10px; }
.secret { display: block; margin-top: 8px; padding: 10px; text-align: center; font-size: .95rem; letter-spacing: .08em; white-space: normal; word-break: break-all; }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.codes { columns: 2; padding-left: 22px; margin: 0; font-family: var(--mono); }
.codes li { padding: 3px 0; }

/* ---------- responsive */
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  #admins-table th:nth-child(2), #admins-table td:nth-child(2) { display: none; }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 100%; }
  .toolbar form.inline { flex: 1 1 100%; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 4px; }
  .brand { padding: 4px 10px 4px 4px; }
  .nav span { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .me { display: none; }
  .main { padding: 18px 16px 48px; }
  .split, .row3, .row4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .assign li { grid-template-columns: 1fr auto; }
  .feed li { grid-template-columns: 1fr; gap: 0; }
}
