:root {
  --bg: #f6f7f9; --card: #fff; --fg: #1b1f24; --muted: #69707a; --line: #e3e6ea;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --code: #0f1419; --codefg: #d8dee4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1116; --card: #161b22; --fg: #e6e9ed; --muted: #8b949e; --line: #2a313b;
    --accent: #4c8dff; --code: #0a0d12; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.brand { font-size: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip { font-size: 12px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 8px 16px 40px; }
h2 { font-size: 15px; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.narrow { max-width: 340px; margin: 60px auto; padding: 16px; }
.narrow h2 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
.grp td { background: var(--bg); font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--bad); }
.mono, code, pre, textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; }
button.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
button.danger { background: transparent; color: var(--bad); border-color: var(--line); }
button:disabled { opacity: .5; cursor: default; }
button + button { margin-left: 4px; }
.linkbtn { background: none; border: 0; color: var(--fg); padding: 0; font-weight: 600; }
.linkbtn:hover { color: var(--accent); }
input, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); width: 100%; }
form > * + * { margin-top: 8px; }
dialog { width: min(980px, calc(100vw - 16px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.dhead h2 { margin: 0; }
nav { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 10px; }
nav button.on { color: var(--fg); border-bottom-color: var(--accent); }
#d-body { padding: 14px 16px 18px; }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.bar label { display: flex; gap: 4px; align-items: center; color: var(--muted); font-size: 13px; }
.bar input[type=checkbox] { width: auto; }
pre.log { background: var(--code); color: var(--codefg); padding: 10px; border-radius: 6px; margin: 0;
  height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-all; }
textarea { height: 50vh; resize: vertical; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; }
dt { color: var(--muted); } dd { margin: 0; word-break: break-all; }
.drow { display: grid; grid-template-columns: 1fr 120px 90px auto; gap: 6px; margin-bottom: 6px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg);
  padding: 8px 14px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .drow { grid-template-columns: 1fr 1fr; }
  td.actions button { padding: 4px 7px; }
}
