/* Novatech SDK admin — sidebar layout, dark + light themes. No external fonts / CDN (CSP: style-src 'self'). */

/* ======================================================================= tokens */
:root {
  --bg: #0E1016;
  --bg2: #12151D;
  --card: #171A23;
  --card2: #1E222D;
  --card3: #252A37;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .13);
  --text: #E7EBF3;
  --text2: #B9C2D3;
  --muted: #8892A6;
  --primary: #4C8DFF;
  --primary-d: #3B78E7;
  --primary-soft: rgba(76, 141, 255, .14);
  --primary-text: #8DB5FF;
  --green: #2FB57C;
  --green-soft: rgba(47, 181, 124, .14);
  --green-text: #5FD3A0;
  --red: #E5534B;
  --red-soft: rgba(229, 83, 75, .14);
  --red-text: #FF8F87;
  --warn: #E7A33E;
  --warn-soft: rgba(231, 163, 62, .14);
  --warn-text: #FFC46B;
  --input: #10131A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .18);
  --radius: 12px;
  --radius-s: 8px;
  --side-w: 248px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F4F6FA;
  --bg2: #EDF0F6;
  --card: #FFFFFF;
  --card2: #F5F7FB;
  --card3: #EBEEF5;
  --line: rgba(15, 23, 42, .08);
  --line2: rgba(15, 23, 42, .14);
  --text: #111827;
  --text2: #374151;
  --muted: #6B7385;
  --primary: #2563EB;
  --primary-d: #1D4ED8;
  --primary-soft: rgba(37, 99, 235, .09);
  --primary-text: #1D4ED8;
  --green: #16A34A;
  --green-soft: rgba(22, 163, 74, .1);
  --green-text: #15803D;
  --red: #DC2626;
  --red-soft: rgba(220, 38, 38, .08);
  --red-text: #B91C1C;
  --warn: #D97706;
  --warn-soft: rgba(217, 119, 6, .1);
  --warn-text: #B45309;
  --input: #FFFFFF;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F4F6FA; --bg2: #EDF0F6; --card: #FFFFFF; --card2: #F5F7FB; --card3: #EBEEF5;
    --line: rgba(15, 23, 42, .08); --line2: rgba(15, 23, 42, .14);
    --text: #111827; --text2: #374151; --muted: #6B7385;
    --primary: #2563EB; --primary-d: #1D4ED8; --primary-soft: rgba(37, 99, 235, .09); --primary-text: #1D4ED8;
    --green: #16A34A; --green-soft: rgba(22, 163, 74, .1); --green-text: #15803D;
    --red: #DC2626; --red-soft: rgba(220, 38, 38, .08); --red-text: #B91C1C;
    --warn: #D97706; --warn-soft: rgba(217, 119, 6, .1); --warn-text: #B45309;
    --input: #FFFFFF; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
    color-scheme: light;
  }
}

/* ======================================================================= base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 15px; margin: 0; font-weight: 650; }
h3 { font-size: 13.5px; margin: 0; font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--card3); padding: 1px 6px; border-radius: 5px; color: var(--text2); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; word-break: break-word; }
.center { text-align: center; justify-content: center; }
.warn-text { color: var(--warn-text); }
.lead { font-size: 15px; color: var(--text2); }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
::selection { background: var(--primary-soft); }

/* ======================================================================= shell */
body.app { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 30; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 18px 18px 14px; }
.brand:hover { text-decoration: none; }
.brand-t { display: flex; flex-direction: column; line-height: 1.2; }
.brand-t b { font-size: 14.5px; font-weight: 700; }
.brand-t small { color: var(--muted); font-size: 11.5px; }
.logo {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; font-size: 12.5px; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(135deg, #5B9BFF, #3D6FE0 60%, #6F4FE0); box-shadow: 0 4px 14px rgba(76, 141, 255, .35);
}
.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.side-group { margin-top: 14px; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; opacity: .85; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); color: var(--text2); font-weight: 500; margin-bottom: 2px;
}
.side-nav a .ic { color: var(--muted); }
.side-nav a:hover { background: var(--card2); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--primary-soft); color: var(--primary-text); }
.side-nav a.active .ic { color: var(--primary-text); }
.side-foot { display: flex; align-items: center; gap: 6px; padding: 12px; border-top: 1px solid var(--line); }
.side-foot form { margin: 0; }
.me-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-s); color: var(--text); }
.me-link:hover, .me-link.active { background: var(--card2); text-decoration: none; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--card3); color: var(--text); font-weight: 700; font-size: 13px; flex: none; }
.me-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: 11px; color: var(--muted); }
.side-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) { .topbar { background: var(--bg); } }
.top-title { flex: 1; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs span:last-child { color: var(--text2); }
.crumb-sep { opacity: .5; }
.nav-toggle { display: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-s); border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; padding: 0; flex: none;
}
.icon-btn:hover { background: var(--card2); color: var(--text); border-color: var(--line); }
.icon-btn .ic { width: 17px; height: 17px; }
.ic-sun { display: none; }
:root[data-theme="light"] .ic-sun { display: block; }
:root[data-theme="light"] .ic-moon { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .ic-sun { display: block; } :root:not([data-theme]) .ic-moon { display: none; } }

.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 28px 64px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.page-h-t { min-width: 0; }
.page-sub { margin: 6px 0 0; color: var(--muted); max-width: 820px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ======================================================================= cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; min-width: 0; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 14px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 16px 20px 0; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.cols2 > .card, .cols2 > div > .card:last-child { margin-bottom: 0; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.cols3 > .card { margin: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-auto > .card { margin: 0; }

/* ======================================================================= stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin: 0 0 18px; }
.stat {
  position: relative; display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text);
  min-width: 0; box-shadow: var(--shadow);
}
a.stat:hover { text-decoration: none; border-color: var(--line2); transform: translateY(-1px); }
a.stat { transition: transform .15s ease, border-color .15s ease; }
.stat.wide { grid-column: span 2; }
.stat-ic { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-text); }
.stat-k { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-ic + .stat-k { padding-right: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.chips .chip { margin: 0; }
.stat-v { font-size: 26px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-v.small-v { font-size: 16px; line-height: 1.5; font-weight: 600; }
.stat-s { color: var(--muted); font-size: 11.5px; }
.stat.danger { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: var(--red-soft); }
.stat.danger .stat-v { color: var(--red-text); }
.rev { white-space: nowrap; }
.sep { color: var(--muted); }

/* ======================================================================= forms */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--input); border: 1px solid var(--line2); border-radius: var(--radius-s); padding: 8px 11px;
  min-height: 38px; max-width: 100%; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line2)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
summary:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; accent-color: var(--primary); padding: 0; box-shadow: none; }
input[type=file] { padding: 6px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }

.filters {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 16px; box-shadow: var(--shadow);
}
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 140px; }
.filters label.grow { flex: 1 1 280px; }
.filters label.check { flex-direction: row; align-items: center; gap: 7px; min-width: 0; padding-bottom: 10px; color: var(--text2); }
.filter-actions { display: flex; gap: 8px; }
.more-filters { flex-basis: 100%; }
.more-filters > summary { display: inline-flex; }
.more-body { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin-top: 12px; }
.more-body label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); min-width: 140px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stack.compact { gap: 9px; min-width: 240px; }
.row-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.row-form label.grow { flex: 1 1 220px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: 13.5px; color: #fff; background: var(--primary);
  border: 1px solid transparent; border-radius: var(--radius-s); padding: 8px 15px; min-height: 38px; cursor: pointer; white-space: nowrap; list-style: none;
  transition: background .15s ease, border-color .15s ease, transform .05s ease; box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.btn:hover { background: var(--primary-d); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }
.btn.ghost { background: transparent; border-color: var(--line2); color: var(--text); box-shadow: none; }
.btn.ghost:hover { background: var(--card2); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 85%, #000); }
.btn.danger.ghost { background: transparent; color: var(--red-text); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.btn.danger.ghost:hover { background: var(--red-soft); }
.btn.warn { background: #B7791F; }
.btn.small { min-height: 30px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
summary.btn::-webkit-details-marker { display: none; }
summary.btn::marker { content: ""; }

/* ======================================================================= tabs (game page) */
.tabset { min-width: 0; }
.tabs {
  display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 0 20px; scrollbar-width: thin;
  position: sticky; top: 56px; z-index: 10; background: var(--bg); padding-top: 4px;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-weight: 550; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0;
}
.tab .ic { width: 16px; height: 16px; }
.tab:hover { color: var(--text); background: var(--card2); text-decoration: none; }
.tab.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tab-dot.red { background: var(--red); }
.tab-dot.green { background: var(--green); }
.panel-title { display: none; }
.js .tab-panel { display: none; }
.js .tab-panel.active { display: block; animation: fade .18s ease; }
html:not(.js) .panel-title { display: block; font-size: 18px; margin: 28px 0 14px; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ======================================================================= settings blocks */
.cfg { border: 0; margin: 0; padding: 0; min-width: 0; }
.cfg-section { border-top: 1px solid var(--line); padding: 18px 0 8px; }
.cfg-section:first-child { border-top: 0; padding-top: 0; }
.cfg-section h3 { font-size: 14px; font-weight: 650; margin: 0 0 4px; }
.cfg-section h3 + .cfg-grid, .cfg-section h3 + .kv { margin-top: 12px; }
.cfg-desc { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; align-items: end; }
.cfg-grid.two { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.cfg-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; min-width: 0; }
.cfg-grid label.full { grid-column: 1 / -1; }
.cfg-grid label.check {
  flex-direction: row; align-items: center; gap: 10px; color: var(--text); min-height: 42px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--card2); font-weight: 500; cursor: pointer;
}
.cfg-grid label.check:hover { border-color: var(--line2); }
.cfg-grid input:not([type=checkbox]), .cfg-grid select, .cfg-grid textarea { width: 100%; }
.cfg-grid .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.lbl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.key { font-family: var(--mono); font-size: 11px; color: var(--muted); opacity: .8; font-weight: 400; }
.cfg-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.cfg-warn { margin: 10px 0 0; font-size: 12.5px; color: var(--warn-text); }
.cfg-danger { margin: 10px 0 0; font-size: 12.5px; color: var(--red-text); font-weight: 600; }
.cfg-actions {
  border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.cfg[disabled] input, .cfg[disabled] select, .cfg[disabled] textarea { opacity: .7; }
.secret-field { display: flex; gap: 8px; align-items: center; }
.secret-field input { flex: 1; min-width: 0; }
.secret-field .check-mini { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 400; }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-s); border: 1px solid var(--line2); background: var(--card2); margin: 0 0 14px; font-size: 13px; color: var(--text2); }
.note > .ic { margin-top: 1px; width: 17px; height: 17px; }
.note > div { min-width: 0; overflow-wrap: anywhere; }
.note p { margin: 0 0 4px; }
.note p:last-child { margin: 0; }
.note.info { border-color: color-mix(in srgb, var(--primary) 35%, transparent); background: var(--primary-soft); }
.note.info > .ic { color: var(--primary-text); }
.note.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.note.warn > .ic { color: var(--warn-text); }
.note.danger { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.note.danger > .ic { color: var(--red-text); }
.note.ok { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.note.ok > .ic { color: var(--green-text); }

.copyable { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; }
.copyable > span { overflow-wrap: anywhere; }
.copyable .icon-btn { width: 28px; height: 28px; }
.copyable .icon-btn .ic { width: 15px; height: 15px; }
.icon-btn.copied { color: var(--green-text); }

.uri-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.uri-list li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-s); flex-wrap: wrap; }
.uri-list .uri-k { font-size: 12px; color: var(--muted); min-width: 120px; }

.secret-box { padding: 14px; border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent); border-radius: var(--radius-s); background: var(--warn-soft); margin-bottom: 14px; }
.secret-box .mono { font-size: 14px; letter-spacing: .02em; }

.provider { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.provider-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--card3); color: var(--text); flex: none; font-weight: 800; font-size: 15px; }
.provider-ic.g { background: rgba(66, 133, 244, .15); color: #6EA8FF; }
.provider-ic.f { background: rgba(24, 119, 242, .15); color: #5C9DFF; }
.provider-ic.a { background: var(--card3); }
.provider-ic.p { background: rgba(52, 168, 83, .15); color: #4FC77A; }
.provider-t { flex: 1; min-width: 0; }
.provider-t h3 { margin: 0; }
.provider-t p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* ======================================================================= actions */
.actions .action-form { margin: 0 0 10px; }
.action-body { margin-top: 10px; padding: 14px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-s); display: flex; flex-direction: column; gap: 10px; }
.action-body label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.inline-edit { display: inline-block; vertical-align: top; }
.inline-edit[open] { display: block; margin-top: 10px; }
.inline-edit[open] > form { padding: 14px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-s); }
.danger-zone { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.danger-zone .card-h h2 { color: var(--red-text); }
.dz-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dz-row:first-of-type { border-top: 0; padding-top: 0; }
.dz-row p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; max-width: 640px; }
.dz-row form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }

/* ======================================================================= tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-s); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; padding: 10px 12px;
  border-bottom: 1px solid var(--line2); white-space: nowrap; background: var(--card);
}
.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--card2); }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.wrap-any { min-width: 240px; }
.grid td.small { min-width: 140px; }
.grid td.empty { text-align: center; color: var(--muted); padding: 34px; }
.grid tr.row-danger td { background: var(--red-soft); }
.grid tr.row-off td { opacity: .6; }
.grid td.act { text-align: right; white-space: nowrap; }
.cell-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-main b { font-weight: 600; color: var(--text); }
.cell-main span { color: var(--muted); font-size: 12px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.pager .muted { margin-right: auto; }

/* ======================================================================= badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; line-height: 1.5; }
.badge.green { background: var(--green-soft); color: var(--green-text); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.badge.red { background: var(--red-soft); color: var(--red-text); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.badge.blue { background: var(--primary-soft); color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.grey { background: var(--card3); color: var(--muted); border-color: var(--line); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 6px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); margin: 1px 0; }
.chip.on { color: var(--green-text); border-color: color-mix(in srgb, var(--green) 35%, transparent); background: var(--green-soft); }

/* ======================================================================= key/value */
.kv { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 0; margin: 0; }
.kv dt { color: var(--muted); padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kv dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
pre.extra, pre.secret { margin: 0; white-space: pre-wrap; word-break: break-word; background: var(--input); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; font-size: 12.5px; font-family: var(--mono); }
pre.secret { font-size: 15px; letter-spacing: 1px; }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 12px; }

/* ======================================================================= health checks */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks .ck { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none; margin-top: 1px; }
.checks .ck .ic { width: 14px; height: 14px; }
.checks .ck.ok { background: var(--green-soft); color: var(--green-text); }
.checks .ck.warn { background: var(--warn-soft); color: var(--warn-text); }
.checks .ck.bad { background: var(--red-soft); color: var(--red-text); }
.checks .ck-t { flex: 1; min-width: 0; }
.checks .ck-t b { font-weight: 600; }
.checks .ck-t p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }

/* ======================================================================= game cards (list) */
.game-head { display: flex; align-items: center; gap: 14px; }
.game-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--primary-soft); color: var(--primary-text); flex: none; font-weight: 800; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .ic { width: 38px; height: 38px; color: var(--muted); margin-bottom: 8px; }
.empty-state h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ======================================================================= timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line2); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); }
.timeline li.ok::before { background: var(--green); }
.timeline li.bad::before { background: var(--red); }
.timeline li.warn::before { background: var(--warn); }
.timeline li.muted::before { background: var(--muted); }
.timeline .t { display: block; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.timeline .d { overflow-wrap: anywhere; }

/* ======================================================================= flash */
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius-s); margin: 0 0 16px; border: 1px solid var(--line2);
  background: var(--card2); overflow-wrap: anywhere; box-shadow: var(--shadow);
}
.flash > .ic { margin-top: 1px; }
.flash.ok { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-soft); }
.flash.ok > .ic { color: var(--green-text); }
.flash.error { border-color: color-mix(in srgb, var(--red) 50%, transparent); background: var(--red-soft); }
.flash.error > .ic { color: var(--red-text); }

/* ======================================================================= login */
body.bare { display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: center; padding: 24px 16px; position: relative; overflow-x: hidden; }
.bare-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 500px at 15% -10%, rgba(76, 141, 255, .18), transparent 60%), radial-gradient(700px 500px at 110% 110%, rgba(111, 79, 224, .16), transparent 60%);
}
.bare-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.bare-card .brand { justify-content: center; padding: 0 0 22px; }
.bare-card h1 { text-align: center; font-size: 30px; }
.bare-card .stack { gap: 14px; }
.bare-card .btn.block { min-height: 42px; margin-top: 4px; }
.bare-foot { margin: 18px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ======================================================================= responsive */
@media (max-width: 1180px) {
  .cols2, .cols3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .side { transform: translateX(-100%); box-shadow: none; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  body.nav-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; }
  .main { margin-left: 0; }
  .nav-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .wrap { padding: 18px 16px 56px; }
}
@media (max-width: 760px) {
  .stat.wide { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-v { font-size: 21px; }
  .filters label, .filters label.grow, .more-body label { flex: 1 1 calc(50% - 14px); min-width: 0; }
  .filters label select, .filters label input:not([type=checkbox]), .more-body label select, .more-body label input { width: 100%; }
  .filters label.check { flex-basis: 100%; padding-bottom: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  h1 { font-size: 20px; }
  .card { padding: 14px; }
  .cfg-grid, .cfg-grid.two { grid-template-columns: minmax(0, 1fr); }
  .tabs { top: 56px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .filters label.grow { flex-basis: 100%; }
  .page-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
