:root {
  --bg: #0f1216;
  --panel: #171c22;
  --panel2: #1f2630;
  --line: #2a333f;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3ba55d;
  --danger: #d9534f;
  --warn: #d9a441;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 16px; margin: 0; letter-spacing: .5px; }
.spacer { flex: 1; }
.pill {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel2); color: var(--muted);
}
.pill.ok { color: var(--accent); }
.pill.bad { color: var(--danger); }
main { flex: 1; display: flex; min-height: 0; }
aside {
  width: 300px; min-width: 300px; border-right: 1px solid var(--line);
  background: var(--panel); display: flex; flex-direction: column; min-height: 0;
}
.aside-head { display: flex; align-items: center; padding: 12px; }
.aside-head h2 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 0; flex: 1; }
#device-list { overflow-y: auto; }
.device {
  padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer;
}
.device:hover, .device.active { background: var(--panel2); }
.device .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.online { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.offline { background: #555; }
.device .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
section#stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#map { flex: 1; min-height: 220px; background: #0b0e12; }
#panel { height: 45%; border-top: 1px solid var(--line); display: flex; min-height: 0; }
#detail { flex: 1; padding: 14px; overflow-y: auto; }
#detail.empty { color: var(--muted); }
#gallery-wrap { width: 340px; min-width: 340px; border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; }
#gallery-wrap h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
#gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
#gallery img, #gallery video { width: 100%; border-radius: 6px; border: 1px solid var(--line); }
#gallery a { color: var(--accent); font-size: 12px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; margin-bottom: 14px; }
.kv .k { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
button {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
button:hover { border-color: #3d4a5a; }
button.primary { background: var(--accent); border-color: var(--accent); color: #08110b; font-weight: 600; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.small { padding: 4px 9px; font-size: 12px; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-size: 13px; width: 100%;
}
.cmdlist { margin-top: 16px; }
.cmd { display: flex; gap: 8px; font-size: 12px; padding: 5px 0; border-top: 1px solid var(--line); }
.cmd .type { width: 70px; font-weight: 600; }
.cmd .st { color: var(--muted); }
.st.done { color: var(--accent); }
.st.failed { color: var(--danger); }
.st.pending, .st.delivered { color: var(--warn); }
