:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e3e6eb;
  --accent: #2f6fed; --accent-text: #fff; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #171a21; --text: #e6e8ec; --muted: #9aa1ad; --line: #2a2f3a;
    --accent: #5b8cff; --accent-text: #0b0d12; --ok: #22c55e; --warn: #f59e0b; --bad: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .2px; }
nav { display: flex; gap: 4px; flex: 1; }
nav button { background: none; border: 0; color: var(--muted); padding: 6px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
nav button.active { color: var(--text); background: var(--bg); }
.who { display: flex; gap: 10px; align-items: center; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
h2:first-child { margin-top: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.small { font-size: 12px; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 7px; padding: 6px 11px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: none; }
button:disabled { opacity: .5; cursor: progress; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; min-width: 0; }
textarea { width: 100%; font-family: var(--mono); font-size: 12px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
label > input, label > select { color: var(--text); font-size: 14px; }
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-items: end; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.hot > i { background: var(--warn); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num { font-variant-numeric: tabular-nums; }
.inst h3 { margin: 0; font-size: 15px; }
.inst .actions { margin-top: 12px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 18px; width: min(900px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.45); }
#term { height: 60vh; background: #000; border-radius: 6px; padding: 4px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; max-width: calc(100vw - 32px); z-index: 50; }
#toast.err { background: var(--bad); color: #fff; }
.login { max-width: 360px; margin: 12vh auto; }
.login .panel { display: grid; gap: 12px; }
.secret { font-family: var(--mono); background: var(--bg); padding: 10px; border-radius: 6px; word-break: break-all; user-select: all; }
pre.log { max-height: 50vh; overflow: auto; background: var(--bg); padding: 10px; border-radius: 6px; font-size: 11.5px; }
.table-wrap { overflow-x: auto; }
@media (max-width: 600px) { .stats { grid-template-columns: 1fr 1fr; } header { gap: 10px; } }
a.btn { text-decoration: none; display: inline-block; line-height: 1.45; }
a { color: var(--accent); }
#fm-crumbs { gap: 4px; margin-bottom: 8px; }
#fm-crumbs a { text-decoration: none; }
#fm-list td a { text-decoration: none; color: var(--text); }
#fm-list td a:hover { color: var(--accent); }
