:root {
  --bg: #161a22;
  --sidebar: #12151c;
  --panel: #1c212b;
  --panel-hover: #232935;
  --line: #2a303c;
  --line-strong: #363d4b;
  --text: #e8eaef;
  --text-2: #c3c8d2;
  --muted: #8b93a3;
  --gold: #e3b341;
  --gold-hover: #ecc35f;
  --gold-soft: rgba(227, 179, 65, .14);
  --gold-ink: #1d1605;
  --good: #4cc38a;
  --bad: #f2706a;
  --font: "Instrument Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.logo { width: 28px; height: 28px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono, code { font-family: var(--mono); font-size: 12.5px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: transparent; color: var(--text);
  font: 600 13px/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s;
}
.btn:hover { background: var(--panel-hover); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-primary:hover { background: var(--gold-hover); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn-sm .i { width: 14px; height: 14px; }
.btn:disabled, .icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { color: var(--bad); border-color: rgba(242, 112, 106, .45); }
.btn-danger:hover { background: rgba(242, 112, 106, .1); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #2a0b09; }
.btn-danger-solid:hover { background: #f58a85; }
.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-hover); color: var(--text); }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-underline-offset: 3px; }
.link:hover { color: var(--gold); }

/* Sidebar */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.15; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px 0;
  background: var(--sidebar); border-right: 1px solid var(--line);
}
.sidebar > .brand { padding: 0 8px; }
.actions { display: grid; gap: 8px; }
.nav-heading { margin-bottom: 4px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.nav-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 2px; }
.nav-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-list a:hover { background: var(--panel); color: var(--text); }
.nav-list a[aria-current="page"] { background: var(--panel-hover); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--gold); }
.nav-list .i { color: var(--muted); }
.nav-list a[aria-current="page"] .i { color: var(--gold); }
.nav-list .ext { width: 13px; height: 13px; }
.nav-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: var(--gold-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.on { background: var(--good); }

.account-wrap { margin-top: auto; padding: 10px 0; border-top: 1px solid var(--line); }
.account {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.account:hover { background: var(--panel); }
.avatar { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--panel-hover); font-weight: 700; color: var(--gold); }
.account-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.verified { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--good); }
.verified .i { width: 14px; height: 14px; }

/* Account menu (popover) */
.menu {
  position: fixed; inset: auto auto 72px 14px; margin: 0; width: 236px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--panel); color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
.menu-item {
  width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 9px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--text);
  font: 500 14px/1.35 var(--font); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--panel-hover); }
.menu-item .i { margin-top: 1px; color: var(--muted); }
.menu-item small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
.menu-item small.mono { font-family: var(--mono); }
.menu-item.danger, .menu-item.danger .i { color: var(--bad); }

.topbar, .backdrop { display: none; }

/* Main */
main { padding: 28px 40px 48px; min-width: 0; }
.page-title { margin-bottom: 28px; font-size: 22px; font-weight: 650; letter-spacing: -.015em; }
.page-title:focus { outline: none; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.section-title { margin-bottom: 14px; font-size: 15px; font-weight: 600; }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card { padding: 18px; }
.card.empty { display: grid; justify-items: start; gap: 14px; max-width: 520px; color: var(--muted); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* Subscription card */
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sub-head h3 { min-width: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-head a { text-decoration: none; }
.sub-head a:hover { text-decoration: underline; text-underline-offset: 3px; }
.sub-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 18px; font-size: 12px; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.status.on { color: var(--good); }
.status.on::before { background: var(--good); }

.meter { margin-bottom: 16px; }
.meter-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.meter-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.meter-label .i { color: var(--muted); width: 15px; height: 15px; }
.meter-value { color: var(--muted); }
.meter-value strong { color: var(--text); font-weight: 650; }
.meter-track { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter-track span { display: block; height: 100%; border-radius: 4px; background: var(--gold); }

/* Chart */
.chart-box { position: relative; height: 110px; margin-right: 26px; touch-action: pan-y; }
.chart-box svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-box .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-box .base { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-box .area { fill: var(--gold-soft); }
.chart-box .line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-box.tall { height: 240px; margin-right: 46px; }
.y-tick { position: absolute; left: calc(100% + 6px); transform: translateY(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.x-ticks { position: relative; height: 16px; margin: 6px 26px 0 0; font-size: 11px; color: var(--muted); }
.chart-box.tall + .x-ticks { margin-right: 46px; }
.x-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.x-ticks span:first-child { transform: none; }
.x-ticks span:last-child { transform: translateX(-100%); }
.cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .5; pointer-events: none; }
.pt { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--panel); pointer-events: none; }
.tip {
  position: absolute; top: 0; z-index: 1; transform: translateX(10px);
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  background: var(--panel-hover); border: 1px solid var(--line-strong); box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  font-size: 12px; color: var(--text-2);
}
.tip.flip { transform: translateX(calc(-100% - 10px)); }
.tip strong { color: var(--text); font-size: 13px; }
.tip span { display: block; color: var(--muted); }

/* Side panels */
.side { display: grid; gap: 20px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); max-width: 75ch; }
.panel-body { padding: 16px 18px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.count { font-size: 12px; font-weight: 600; color: var(--gold); }
.empty-note { padding: 32px 18px; text-align: center; color: var(--muted); }
.empty-note strong { display: block; margin-bottom: 4px; color: var(--text); }
.ann { padding: 16px 18px; }
.ann + .ann { border-top: 1px solid var(--line); }
.ann h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.ann p { color: var(--text-2); max-width: 65ch; }
time { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list:focus { outline: none; }
.notif { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 14px 12px 14px 18px; }
.notif + .notif { border-top: 1px solid var(--line); }
.notif > div { flex: 1; min-width: 0; }
.notif p { color: var(--text-2); }
.notif.unread p { color: var(--text); font-weight: 600; }
.notif.unread::before { content: ""; position: absolute; left: 7px; top: 22px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

/* Tables (billing) */
.table-wrap { position: relative; overflow-x: auto; } /* relative: keeps absolutely positioned .sr-only text inside the scroll box */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { padding: 10px 18px; text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 12px 18px; color: var(--text-2); white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
td.strong { color: var(--text); font-weight: 600; }
.num { text-align: right; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.pill.good { background: rgba(76, 195, 138, .14); color: var(--good); }
.pill.bad { background: rgba(242, 112, 106, .14); color: var(--bad); }
.pill.neutral { background: var(--panel-hover); color: var(--muted); }

/* Changelog */
.releases { max-width: 780px; }
.release { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.release:first-child { padding-top: 0; border-top: 0; }
.release h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.release time { margin-top: 2px; }
.release ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; color: var(--text-2); }
.release li::marker { color: var(--muted); }

/* Preferences dialog */
.modal {
  width: min(580px, calc(100% - 32px)); padding: 0;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--panel); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
}
.modal::backdrop { background: rgba(6, 8, 12, .65); }
.modal form { display: flex; flex-direction: column; max-height: min(780px, calc(100vh - 48px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 4px 22px; }
.modal-head h2 { font-size: 17px; font-weight: 650; }
.modal-body { overflow-y: auto; padding: 8px 22px 16px; }
.modal-body > p + p { margin-top: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.form-error { margin: 0 22px 12px; color: var(--bad); font-size: 13px; }
.field { display: grid; gap: 6px; margin: 4px 0 14px; }
.field label, .field-label { font-weight: 500; }
.field .select, .field .seg { justify-self: start; }
.input { width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.input::placeholder { color: var(--muted); }
.textarea { height: auto; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.hint { margin-top: 8px; font-size: 13px; color: var(--muted); }
.field .hint { margin-top: 0; }
.pref-section { padding: 16px 0; }
.pref-section + .pref-section { border-top: 1px solid var(--line); }
.pref-section h3 { margin-bottom: 8px; font-size: 14px; font-weight: 650; }
.pref-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 0; }
.pref-row + .pref-row { border-top: 1px solid var(--line); }
.pref-row > div:first-child { flex: 1 1 220px; }
.pref-title { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.pref-desc { margin-top: 2px; font-size: 12.5px; color: var(--muted); max-width: 42ch; }
.id-box { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.id-box code { flex: 1; }
.chip { padding: 1px 7px; border-radius: 5px; background: var(--panel-hover); color: var(--muted); font-size: 12px; font-weight: 600; }
.select { height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }

.seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.seg span:hover { color: var(--text); }
.seg input:checked + span { background: var(--gold-soft); color: var(--gold); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.seg input:disabled + span { opacity: .5; cursor: not-allowed; }
.seg .i { width: 12px; height: 12px; margin-left: 5px; vertical-align: -1px; }

/* Server pages */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text-2); font-weight: 500; }
.page-title.server-title { margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; box-shadow: inset 0 -1px 0 var(--line); }
.tabs a { flex: none; padding: 10px 12px; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--gold); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; color: inherit; text-decoration: none; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.link-card:hover { border-color: var(--line-strong); background: var(--panel-hover); }
.link-card > .i { position: absolute; top: 16px; right: 16px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: 20px; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
[aria-pressed="true"] .live-dot { background: var(--good); }
.search { margin-bottom: 4px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .search { width: 260px; max-width: 100%; margin: 0; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; }
.activity li + li { border-top: 1px solid var(--line); }
.activity p { display: flex; align-items: center; gap: 8px; }
.activity p.muted { font-size: 12.5px; }
.activity-meta { flex: none; display: grid; justify-items: end; font-size: 12px; }
.activity-meta time { margin: 0; }

/* Statistics (admin) */
.section-title { margin-top: 12px; font-size: 16px; font-weight: 650; }
.stack > .stats, .stack > .grid-2.even { margin-block: 0; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.delta { color: var(--muted); font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.heat { display: grid; grid-template-columns: 32px repeat(24, minmax(0, 1fr)); gap: 2px; }
.heat-cell { height: 22px; border-radius: 3px; background: var(--line); }
.heat-cell.l1 { background: color-mix(in srgb, var(--gold) 25%, var(--panel)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--gold) 48%, var(--panel)); }
.heat-cell.l3 { background: color-mix(in srgb, var(--gold) 72%, var(--panel)); }
.heat-cell.l4 { background: var(--gold); }
.heat-day, .heat-hour { font-size: 11px; color: var(--muted); white-space: nowrap; }
.heat-day { align-self: center; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.heat-legend .heat-cell { width: 14px; height: 14px; }
.heat-legend .l0 { margin-left: 4px; }
.heat-legend .l4 { margin-right: 4px; }
.meter-track.usage { width: 100%; max-width: 160px; margin: 6px 0 0 auto; }
@media (max-width: 600px) { .heat-cell { height: 14px; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); overflow: hidden; border-radius: 0 0 11px 11px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; box-shadow: -1px -1px 0 var(--line); }
.cell-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sub-title { margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.sub-title.inset { margin: 0; padding: 14px 18px 0; border-top: 1px solid var(--line); }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.chip { margin-left: 2px; }

.kv { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); margin: 0; }
.kv dt, .kv dd { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); }
.kv dt:first-of-type, .kv dd:first-of-type { border-top: 0; }
.kv dt { color: var(--muted); }
.kv dd.strong { font-weight: 600; }

.token-count { font-size: 13px; color: var(--text-2); }
.token-count strong { margin-left: 6px; color: var(--text); }
.pending { padding: 40px 24px; text-align: center; }
.pending h2 { margin-bottom: 8px; font-size: 17px; font-weight: 650; }
.pending p { max-width: 56ch; margin-inline: auto; color: var(--text-2); }
.pending .hint { color: var(--muted); }
.pending .btn { margin-top: 20px; }
.notice { margin-bottom: 16px; padding: 12px 16px; border: 1px solid rgba(227, 179, 65, .4); border-radius: 10px; background: var(--gold-soft); color: var(--text-2); }
.notice.bad { border-color: rgba(242, 112, 106, .45); background: rgba(242, 112, 106, .1); }
.notice strong { color: var(--text); }
.shared-meta { margin: -8px 0 16px; }
.server-settings .panel-body { max-width: 640px; }
.server-settings .field .select { justify-self: stretch; }

/* New server wizard */
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0 0 32px; padding: 0; list-style: none; }
.stepper button {
  width: 100%; display: grid; gap: 2px; padding: 12px 0 0;
  border: 0; border-top: 2px solid var(--line); background: none; color: var(--muted); font: inherit; text-align: left; cursor: pointer;
}
.stepper button:disabled { cursor: default; }
.stepper span { font-size: 12.5px; }
.stepper strong { font-weight: 600; }
.stepper .done button { border-top-color: rgba(227, 179, 65, .45); color: var(--text-2); }
.stepper .done button:hover { color: var(--text); }
.stepper .current button { border-top-color: var(--gold); color: var(--text); }
.stepper .current span { color: var(--gold); }
.wizard { max-width: 620px; margin: 0 auto; }
.wizard h2 { font-size: 17px; font-weight: 650; }
.wizard h2:focus { outline: none; }
.lead { margin: 4px 0 24px; color: var(--text-2); }
.wizard .input, .wizard .select { width: 100%; height: 38px; }
.wizard .field .select { justify-self: stretch; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.field-set { min-width: 0; margin: 0 0 4px; padding: 0; border: 0; }
.field-set legend { padding: 0; font-weight: 500; }
.field-set > .hint { margin: 2px 0 8px; }
.wizard-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.wizard-foot > [data-step] { margin-right: auto; }

.multi { position: relative; }
.multi summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 0 12px; list-style: none; cursor: pointer; }
.multi summary::-webkit-details-marker { display: none; }
.multi summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi summary .i { color: var(--muted); }
.multi[open] summary .i { transform: rotate(180deg); }
.multi-panel {
  position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; padding: 8px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.multi-list { display: grid; max-height: 240px; margin-top: 8px; overflow-y: auto; }
.multi-list label { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.multi-list label:hover { background: var(--panel-hover); }
.multi-list input { margin: 0; accent-color: var(--gold); }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 14px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; top: 12px; left: 12px; opacity: 0; }
.choice-body { display: grid; gap: 2px; height: 100%; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--text-2); font-size: 13px; }
.choice-body strong { color: var(--text); font-size: 14px; }
.choice-body .i { width: 18px; height: 18px; margin-bottom: 6px; color: var(--muted); }
.choice:hover .choice-body { border-color: var(--muted); }
.choice input:checked + .choice-body { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.choice input:checked + .choice-body .i { color: var(--gold); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--gold); outline-offset: 2px; }

.dns { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.dns-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 48px; padding: 8px 8px 8px 14px; }
.dns-row + .dns-row { border-top: 1px solid var(--line); }
.dns-row code { color: var(--text); word-break: break-all; }
.dns-row .hint { margin-top: 2px; font-size: 12px; }
.verify-status { display: flex; align-items: center; gap: 6px; min-height: 22px; margin-top: 14px; color: var(--muted); }
.verify-status.ok { color: var(--good); font-weight: 600; }

.review-block { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.review-block header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.review-block h3 { font-size: 14px; font-weight: 600; }

/* Admin panel */
.account.static { cursor: default; }
.account.static:hover { background: none; }
.cell-sub { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
.stats + .grid-2 { margin-top: 0; }
.admin-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cell-actions.start { justify-content: flex-start; margin-top: 12px; }
.modal-sub { margin-top: 18px; }
.input.narrow { width: 140px; }
.input[type="file"] { height: auto; padding: 5px; }
.input::file-selector-button { height: 26px; margin-right: 12px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel-hover); color: var(--text); font: 600 12.5px var(--font); cursor: pointer; }
.release-tag { margin-top: 8px; }
.release-file { margin-top: 14px; }
.release-file .muted { margin-left: 4px; font-size: 12.5px; }
.release .release-files { gap: 6px; margin-top: 14px; padding: 0; list-style: none; }
.release-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.release-files .muted { font-size: 12.5px; }
.branch-name { min-width: 64px; font-weight: 600; color: var(--text); }
.release-branches { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.branch-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 4px 12px; padding: 8px 0; }
.branch-row + .branch-row { border-top: 1px solid var(--line); }
.branch-row label:first-child { font-weight: 500; }
.branch-row .hint { grid-column: 2; margin: 0; }
.check.inline { display: inline-flex; margin-left: 8px; padding: 0; }
td.wrap { min-width: 220px; white-space: normal; }
.id-box .btn-sm { flex: none; }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.detail-head .page-title { margin-bottom: 6px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.form-foot {
  position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line);
}
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.check input { margin: 0; accent-color: var(--gold); }
.limit-row { display: grid; grid-template-columns: minmax(0, 1fr) 170px 130px; align-items: center; gap: 12px; padding: 6px 0; }
.limit-row + .limit-row { border-top: 1px solid var(--line); }
.limit-row .input:disabled { opacity: .45; }
@media (max-width: 600px) {
  .limit-row { grid-template-columns: minmax(0, 1fr) 96px; }
  .limit-row .check { grid-column: 2; }
}

.switch {
  appearance: none; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 11px; cursor: pointer;
  background: radial-gradient(circle at 11px 50%, var(--text) 7px, transparent 7.5px), var(--line-strong);
}
.switch:checked { background: radial-gradient(circle at 27px 50%, var(--gold-ink) 7px, transparent 7.5px), var(--gold); }

/* Tickets */
.thread { margin: 0; padding: 4px 18px; list-style: none; }
.msg { padding: 14px 0; }
.msg + .msg { border-top: 1px solid var(--line); }
.msg header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; }
.msg header time { margin: 0 0 0 auto; }
.msg.staff header strong { color: var(--gold); }
.msg.internal { margin-inline: -18px; padding-inline: 18px; background: var(--gold-soft); }
.msg p { max-width: 75ch; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.reply { display: grid; gap: 8px; padding: 16px 18px; border-top: 1px solid var(--line); }
.reply > label:first-child, .reply-head label { font-weight: 500; }
.reply-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.msg.system { padding: 8px 0; text-align: center; }
.msg.system p { margin: 0 auto; font-size: 12.5px; color: var(--muted); }
.msg.system time { margin-top: 2px; }
.msg-files { display: grid; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; }
.msg-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.msg-files .muted { font-size: 12px; }
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 16px 18px; border-top: 1px solid var(--line); color: var(--text-2); }
.rating .cell-actions.start { margin-top: 0; }
.stack > .notice { margin-bottom: 0; }
.items { display: grid; margin: 0; padding: 0 18px; list-style: none; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; }
.item + .item { border-top: 1px solid var(--line); }
.item-text { display: grid; flex: 1 1 260px; min-width: 0; }
.item-text .muted { font-size: 12.5px; overflow-wrap: anywhere; }
.item .cell-actions { flex-wrap: wrap; }
.item-picker { display: grid; gap: 2px; max-height: 240px; overflow-y: auto; margin-top: 6px; }
.item-picker .check { align-items: flex-start; padding: 6px 4px; border-radius: 6px; }
.item-picker .check:hover { background: var(--panel-hover); }
.item-picker .muted { font-size: 12.5px; }
.inset-hint { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); }
.ticket-context .kv { grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); }
.link-btn { padding: 0; border: 0; background: none; font: inherit; text-decoration: underline; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; inset: auto auto 24px 50%; transform: translateX(-50%); margin: 0;
  padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel-hover); color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}

/* Sign-in page */
body.auth { grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 32px 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); text-align: center; }
.auth-logo { width: 40px; height: 40px; margin-bottom: 16px; }
.auth-card h1 { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.auth-card .lead { margin: 8px 0 24px; }
.auth-card .hint { margin-top: 16px; font-size: 12px; }
.auth-card .hint a { color: var(--text-2); }
.auth-error { margin-bottom: 16px; padding: 10px 12px; border-radius: 8px; background: rgba(242, 112, 106, .12); color: var(--bad); font-size: 13px; text-align: left; }
.btn-discord { width: 100%; height: 42px; background: #5865f2; border-color: #5865f2; color: #fff; font-size: 14px; }
.btn-discord:hover { background: #4752c4; }

/* Narrow screens */
@media (max-width: 1240px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
  .grid-2, .grid-2.even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  body { display: block; }
  .topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--sidebar); border-bottom: 1px solid var(--line);
  }
  .sidebar {
    position: fixed; z-index: 30; left: 0; top: 0; width: min(280px, 85vw);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility .2s;
  }
  .nav-open .sidebar { transform: none; visibility: visible; }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5); }
  main { padding: 20px 16px 40px; }
  .page-title { margin-bottom: 20px; }
  .sub-grid { grid-template-columns: minmax(0, 1fr); }
  .release { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .modal-head, .modal-body, .modal-foot { padding-inline: 16px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .stepper { gap: 8px; margin-bottom: 24px; }
  .stepper strong { font-size: 12px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dd { padding-top: 0; border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
