:root {
  --bg: #f4f5f7; --panel: #fff; --fg: #1d2330; --mute: #6b7280; --line: #e3e6ea;
  --acc: #2563eb; --ok: #16a34a; --alarm: #dc2626; --warn: #d97706;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1218; --panel: #171b23; --fg: #e6e8ec; --mute: #9aa1ad; --line: #2a303b; --acc: #60a5fa; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand b { font-size: 16px; margin-right: 10px; }
.brand span { color: var(--mute); font-size: 12px; }
.hstat { display: flex; align-items: center; gap: 10px; }
.tag { padding: 1px 8px; border-radius: 10px; background: var(--line); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--alarm); display: inline-block; }
.dot.on { background: var(--ok); }
.dot.wait { background: var(--warn); }
button { font: inherit; padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--acc); }
button.primary { background: var(--acc); color: #fff; border-color: var(--acc); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.on { background: var(--acc); color: #fff; border-color: var(--acc); }
main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 12px; padding: 12px 16px; }
@media (max-width: 900px) { main { grid-template-columns: minmax(0, 1fr); } }
.mapbox, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-width: 0; }
.mapbox { position: relative; }
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.hint { color: var(--mute); font-size: 12px; }
#map { width: 100%; display: block; background: #cdcdcd; border-radius: 4px; touch-action: none; cursor: crosshair; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--mute); margin-top: 6px; }
.lg { display: inline-block; width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; border-radius: 2px; }
.lg.robot { background: var(--acc); border-radius: 50%; } .lg.scan { background: #f43f5e; }
.lg.plan { background: #22c55e; height: 3px; vertical-align: 2px; } .lg.ok { background: var(--ok); } .lg.alarm { background: var(--alarm); }
.teleop { position: absolute; right: 18px; bottom: 44px; display: grid; grid-template-columns: repeat(3, 40px); gap: 4px; }
.teleop[hidden] { display: none; }
.teleop button { padding: 6px 0; opacity: .9; }
.teleop button:first-child, .teleop button:last-child { grid-column: 2; }
aside { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
h3 { margin: 0 0 8px; font-size: 14px; }
h3 small { color: var(--mute); font-weight: normal; margin-left: 6px; }
#cam { width: 100%; aspect-ratio: 4 / 3; background: #222; border-radius: 4px; display: block; object-fit: contain; }
.sub { color: var(--mute); font-size: 12px; margin-top: 6px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl.small { font-size: 12px; }
.tbl td.wrap { white-space: normal; word-break: break-all; }
.tbl tr.cur { background: color-mix(in srgb, var(--acc) 12%, transparent); }
.st-OK { color: var(--ok); font-weight: 600; } .st-ALARM { color: var(--alarm); font-weight: 600; }
.st-UNKNOWN, .st-UNREACHED { color: var(--warn); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chips span { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--line); }
details summary { cursor: pointer; color: var(--mute); margin-top: 4px; }
.log { font-size: 12px; color: var(--mute); min-height: 18px; }
.log .error { color: var(--alarm); } .log .warn { color: var(--warn); }
