:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1b1f27; --muted: #667085; --line: #e3e6eb;
  --accent: #3563e9; --accent-ink: #fff; --ok: #1a7f4b; --warn: #a15c00; --bad: #c0392b;
  --ok-bg: #e6f4ec; --warn-bg: #fdf1dc; --bad-bg: #fbe9e7; --chip: #eef1f5;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --panel: #171b21; --ink: #e6e9ee; --muted: #8b95a5; --line: #2a3039;
    --accent: #6d8dff; --accent-ink: #0b0d10; --ok: #4cc38a; --warn: #f0b35a; --bad: #ff7b6e;
    --ok-bg: #13291f; --warn-bg: #2d2412; --bad-bg: #2e1614; --chip: #222831;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 650; color: var(--ink); font-size: 15px; }
.logo { color: var(--accent); }
#crumb { color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 96px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 12px; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .5; cursor: default; }
button.sm { padding: 3px 8px; font-size: 12px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--chip); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
.tbl-wrap { overflow-x: auto; }
.chlogo { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: var(--chip); }
.card-h { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.result { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--chip); font-size: 13px; }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.groups { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-top: 8px; columns: 2 220px; }
.groups label { display: flex; gap: 6px; align-items: center; padding: 2px 4px; break-inside: avoid; font-size: 13px; }
.groups label .c { color: var(--muted); font-size: 11px; margin-left: auto; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 10px 16px; display: none; z-index: 6; }
.savebar.on { display: block; }
.savebar .inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
#toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; max-width: 90vw; }
#toast.on { opacity: 1; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); width: min(640px, 94vw); padding: 18px; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.pick { max-height: 360px; overflow: auto; margin-top: 10px; }
.pick button { width: 100%; justify-content: space-between; margin-bottom: 4px; text-align: left; }
.install { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.install input { flex: 1; min-width: 240px; font-family: var(--mono); font-size: 12px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.err { color: var(--bad); }
@media (max-width: 600px) { .hide-sm { display: none; } main { padding: 14px 12px 96px; } }
