:root {
  --bg: #0f0d17;
  --panel: #18151f;
  --panel-2: #211d2b;
  --line: #2e2939;
  --text: #ece9f3;
  --muted: #9a93ab;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
small, .muted { color: var(--muted); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

.topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .brand { font-weight: 700; font-size: 1.05rem; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.topbar .brand::before { content: "♪"; color: var(--accent); font-size: 1.3rem; }
.topbar nav { display: flex; gap: 1rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); text-decoration: none; }
.badge { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.badge.sa { background: #3b2a63; color: #d8c8ff; border-color: #55408a; }
.badge.ok { color: var(--ok); border-color: #1f5b47; }
.badge.bad { color: var(--bad); border-color: #6b2b2b; }
.badge.warn { color: var(--warn); border-color: #6b5420; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; min-width: 0; }
.stat .n { font-size: 1.6rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }

.flash { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: #0f2a22; border-color: #1f5b47; color: #b7f5dc; }
.flash.err { background: #2c1414; border-color: #6b2b2b; color: #ffd0d0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .45rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
td.num { width: 1%; white-space: nowrap; color: var(--muted); }
td.actions { width: 1%; white-space: nowrap; text-align: right; }
.ellipsis { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

form.inline { display: inline; margin: 0; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=number], input[type=search], select, input[type=file] {
  width: 100%; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: .45rem; color: var(--text); font-size: .95rem; }
.fields { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

button, .btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #7c4dee; }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button.sm { padding: .25rem .55rem; font-size: .85rem; }

.np { display: flex; gap: 1rem; align-items: center; }
.np img { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.np .art-fallback { width: 84px; height: 84px; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; font-size: 2rem; color: var(--accent); flex: none; }
.np .title { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .5s linear; }
.meter { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); }

.guild-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--panel-2); object-fit: cover; flex: none; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.auth { max-width: 380px; margin: 9vh auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .topbar nav { margin-left: 0; }
  .np img, .np .art-fallback { width: 64px; height: 64px; }
  .ellipsis { max-width: 160px; }
}
