:root {
  --bg: #0b1020;
  --panel: #131a30;
  --panel-2: #1a2342;
  --line: #263056;
  --text: #e8ecf8;
  --muted: #8d97b8;
  --accent: #38bdf8;
  --accent-2: #8b5cf6;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5fb; --panel: #ffffff; --panel-2: #eef1fa; --line: #dde2f1;
    --text: #151b33; --muted: #5f6a8c; --accent: #0284c7; --accent-2: #6d28d9;
    --good: #059669; --warn: #b45309; --bad: #dc2626;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Myanmar", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 12px; padding: 28px; }
.logo-lg { width: 64px; height: 64px; }
label { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
input, select, textarea { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.btn.good { background: var(--good); color: #052; border: 0; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }

/* layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.wordmark { font-weight: 900; letter-spacing: 3px; font-size: 16px; line-height: 1.1; }
.sub { color: var(--muted); font-size: 12px; letter-spacing: .02em; }
h1.wordmark { font-size: 26px; margin: 0; text-align: center; }
.login-card .sub { text-align: center; margin-top: -8px; }
.login-card .logo-lg { justify-self: center; }
#nav { display: grid; gap: 4px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
#nav a:hover { background: var(--panel-2); color: var(--text); }
#nav a.on { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent-2) 22%, transparent)); color: var(--text); }
.ico { width: 18px; text-align: center; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; }
.main { padding: 24px; max-width: 1200px; width: 100%; min-width: 0; }
.badge { background: var(--warn); color: #231a00; border-radius: 20px; padding: 0 7px; font-size: 11px; margin-left: auto; }
.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); border: 1px solid var(--warn); color: var(--text); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }

.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat .num { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 16px; }
canvas { width: 100%; height: 190px; display: block; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11.5px; padding: 8px 10px; white-space: nowrap; font-weight: 600; }
td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; border: 1px solid currentColor; }
.pill.active { color: var(--good); } .pill.pending { color: var(--warn); }
.pill.banned { color: var(--bad); } .pill.expired, .pill.limited { color: var(--muted); }
.pill.wl { color: var(--accent); }
.bar { height: 6px; border-radius: 6px; background: var(--panel-2); overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar > i.hot { background: var(--bad); }

/* detail */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.log { max-height: 280px; overflow: auto; }
.log div { padding: 6px 0; border-top: 1px solid var(--line); }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(5, 8, 20, .66); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal .card { width: min(460px, 100%); display: grid; gap: 12px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; z-index: 30; max-width: calc(100vw - 32px); }
.toast.bad { border-color: var(--bad); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  #nav { grid-auto-flow: column; overflow-x: auto; }
  .side-foot { margin: 0 0 0 auto; grid-auto-flow: column; align-items: center; }
  .main { padding: 14px; }
  .grid2, .detail { grid-template-columns: 1fr; }
  .brand span { display: none; }
}

tr.sel td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.bar.big { height: 9px; margin-top: 6px; }
.meter { display: block; }
.logbox { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 0; max-height: 300px; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
a.btn { text-decoration: none; display: inline-block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { flex: none; }

/* content pages */
.stack{display:grid;gap:10px}
.sponsor{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.sponsor .grow{flex:1;min-width:160px}
.logo-box{width:72px;height:72px;border-radius:14px;background:var(--panel-2);border:1px solid var(--line);display:grid;place-items:center;overflow:hidden;flex:none}
.logo-box img{max-width:100%;max-height:100%;object-fit:contain}
.clip{max-width:46ch;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.form-grid{display:grid;gap:14px;max-width:640px}
.form-grid small{display:block;margin-top:4px}
.pill.sev-emergency{background:#5c1b24;color:#ff9aa6}
.pill.sev-warning{background:#5a4514;color:#ffd479}
.pill.sev-info{background:#17375a;color:#8fd0ff}
