:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --border: #e3e6eb;
  --accent: #2563eb; --accent-text: #fff; --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
  --code: #eef1f5;
  --t-events: #2563eb; --t-commands: #c2410c; --t-state: #15803d; --t-status: #7c3aed;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --card: #1b1f27; --text: #e6e8ec; --muted: #9aa3b2; --border: #2c323d;
    --accent: #3b82f6; --code: #252b35;
    --t-events: #60a5fa; --t-commands: #fb923c; --t-state: #4ade80; --t-status: #a78bfa;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 24px 16px 48px; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 1200px; margin-inline: auto;
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
header { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
header p { margin: 2px 0 0; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--border); font-size: 13px; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok i { background: var(--ok); } .pill.bad i { background: var(--bad); } .pill.warn i { background: var(--warn); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; }
main .card { margin: 0; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 10px; }
.grow { flex: 1 1 180px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
label.radio { flex-direction: row; align-items: center; gap: 5px; color: var(--text); }
input:not([type=radio]) { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); min-width: 0; }
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
button.small { padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
#names { list-style: none; padding: 0; margin: 8px 0 0; }
#names li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
#names li .id { color: var(--muted); font-size: 12px; width: 32px; }
#names li .name { flex: 1; overflow-wrap: anywhere; }
#names li.flash { animation: flash 1.2s; }
@keyframes flash { from { background: color-mix(in srgb, var(--ok) 25%, transparent); } to { background: transparent; } }
#log { list-style: none; padding: 0; margin: 0; max-height: 520px; overflow-y: auto;
  font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
#log li { padding: 6px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: auto auto 1fr; gap: 0 8px; }
#log .time { color: var(--muted); }
#log .topic { font-weight: 600; }
#log .payload { grid-column: 1 / -1; overflow-wrap: anywhere; white-space: pre-wrap; }
#log .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
#log .t-events { color: var(--t-events); } #log .t-commands { color: var(--t-commands); }
#log .t-state { color: var(--t-state); } #log .t-status { color: var(--t-status); }
#empty[hidden], #via-row[hidden] { display: none; }
