:root {
  --bg: #0f1115; --panel: #171a21; --line: #2a2f3a; --text: #e8eaf0; --muted: #9aa3b2;
  --accent: #5b8cff; --danger: #ff5d5d; --ok: #3ecf8e; --radius: 10px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f7f9; --panel: #fff; --line: #e1e4ea; --text: #161a22; --muted: #5d6676; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
#nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; align-items: center; }
#nav a { color: var(--muted); text-decoration: none; padding: .35rem .7rem; border-radius: 6px; }
#nav a:hover, #nav a.active { color: var(--text); background: var(--line); }
#nav .spacer { flex: 1; }
main { width: 100%; max-width: 980px; margin: 2rem auto; padding: 0 1.5rem; flex: 1; }
.foot { text-align: center; color: var(--muted); padding: 1.5rem; font-size: .9rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
label { display: block; font-size: .9rem; margin: .8rem 0 .3rem; color: var(--muted); }
input, select, textarea { width: 100%; padding: .6rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 220px; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
input[type=checkbox], input[type=radio] { width: auto; }
button, .btn { margin-top: .9rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { margin: 0; padding: .3rem .6rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.tabs { display: flex; gap: .4rem; margin: 1rem 0; flex-wrap: wrap; }
.tabs button, .tabs a { margin: 0; background: transparent; color: var(--muted); border: 1px solid var(--line); padding: .4rem .9rem; border-radius: 8px; text-decoration: none; }
.tabs .active { color: var(--text); border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
td select { min-width: 140px; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 160px; }
.pill { display: inline-block; font-size: .78rem; padding: .1rem .5rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.grid { overflow-x: auto; }
.grid td, .grid th { text-align: center; }
.grid td:first-child, .grid th:first-child { text-align: left; }
#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); padding: .7rem 1.1rem; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
#toast.err { border-color: var(--danger); color: var(--danger); }
.page-content img { max-width: 100%; }
