:root {
  --bg: #0f1419; --panel: #171d26; --panel2: #1e2631; --line: #2a3441;
  --fg: #d7e0ea; --dim: #8493a5; --accent: #4a9eff; --green: #35c46b;
  --red: #ff5c5c; --amber: #f5a623; --violet: #b57cff;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-size: 17px; font-weight: 700; }
.brand span { color: var(--dim); font-weight: 400; font-size: 13px; margin-left: 6px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.spec { color: var(--violet); font-family: ui-monospace, monospace; font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--red); }

main { display: grid; grid-template-columns: 360px 1fr; gap: 14px; padding: 14px; }
@media (max-width: 820px) { main { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); margin: 18px 0 8px; }
.panel h2:first-child { margin-top: 0; }
.panel h2 small { text-transform: none; letter-spacing: 0; color: var(--dim); font-weight: 400; }

.devices, .recordings { list-style: none; margin: 0; padding: 0; }
.devices li, .recordings li { padding: 8px 10px; background: var(--panel2); border-radius: 7px; margin-bottom: 6px; }
.devices li.empty, .recordings li.empty { color: var(--dim); background: none; padding: 4px 0; }
.devices li { display: flex; align-items: center; gap: 8px; }
.devices .id { font-family: ui-monospace, monospace; font-weight: 600; }
.devices .ver { color: var(--dim); font-size: 12px; margin-left: auto; }

.field { margin: 10px 0; }
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
.row { display: flex; gap: 6px; }
input, textarea, select {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 8px 10px; font: inherit; resize: vertical;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

.btn {
  width: 100%; margin-top: 6px; padding: 9px 12px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--fg); border-radius: 7px; cursor: pointer; font: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; }
.btn.sm { width: auto; padding: 4px 10px; margin: 0; font-size: 12px; }
.row .btn { width: auto; margin-top: 0; white-space: nowrap; }

.recordings li { display: flex; flex-direction: column; gap: 6px; }
.recordings .meta { display: flex; gap: 8px; font-size: 12px; color: var(--dim); }
.recordings .meta .rid { font-family: ui-monospace, monospace; color: var(--fg); }
.recordings audio { width: 100%; height: 32px; }

.logs { display: flex; flex-direction: column; min-height: 60vh; }
.logs-head { display: flex; align-items: center; justify-content: space-between; }
.filters { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--dim); }
.filters label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.log {
  flex: 1; overflow-y: auto; margin-top: 10px; padding: 8px; background: #0b0f14;
  border: 1px solid var(--line); border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12.5px;
}
.line { padding: 3px 6px; border-radius: 5px; display: flex; gap: 8px; align-items: baseline; }
.line:hover { background: #ffffff08; }
.line .t { color: var(--dim); flex-shrink: 0; }
.line .tag { flex-shrink: 0; font-weight: 700; width: 62px; }
.line .dev { color: var(--violet); flex-shrink: 0; }
.line .body { white-space: pre-wrap; word-break: break-all; }
.line.recv .tag { color: var(--green); }
.line.sent .tag { color: var(--accent); }
.line.error .tag { color: var(--red); }
.line.error .body { color: var(--red); }
.line.system .tag { color: var(--amber); }
