* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0f1419;
  color: #e6edf3;
  display: flex;
  flex-direction: column;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: #161b22; border-bottom: 1px solid #30363d;
}
header h1 { font-size: 18px; margin: 0; }
main { flex: 1; display: flex; min-height: 0; }
aside {
  width: 340px; max-width: 45vw; overflow-y: auto; padding: 12px;
  background: #161b22; border-right: 1px solid #30363d;
}
#map { flex: 1; }
.aside-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
h2 { font-size: 15px; margin: 0; }
h3 { margin-top: 0; }

button, select, input {
  font: inherit; color: inherit; background: #21262d; border: 1px solid #30363d;
  border-radius: 6px; padding: 6px 10px;
}
button { cursor: pointer; }
button:hover { background: #2d333b; }
button.primary { background: #238636; border-color: #2ea043; color: #fff; }
button.primary:hover { background: #2ea043; }
button.danger { color: #ff7b72; }
label { display: block; font-size: 13px; color: #8b949e; margin-bottom: 10px; }
label input, label select { display: block; width: 100%; margin-top: 4px; color: #e6edf3; }

#list { list-style: none; margin: 0; padding: 0; }
#list li {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
}
#list li:hover { background: #1c2128; }
#list li.selected { background: #1f2a37; border-color: #1f6feb; }
#list .name { font-weight: 600; }
#list .sub { font-size: 12px; color: #8b949e; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #6e7681; flex: none; }
.dot.online { background: #3fb950; }
.dot.sos { background: #f85149; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

#details { margin-top: 14px; padding-top: 12px; border-top: 1px solid #30363d; }
#info h3 { margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 14px; }
.kv span:nth-child(odd) { color: #8b949e; }
.row { margin-top: 12px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.sos-banner {
  background: #5c1d1d; border: 1px solid #f85149; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 10px; font-size: 14px;
}
.sos-banner button { margin-top: 6px; }
.muted { color: #8b949e; font-size: 13px; }
.error { color: #ff7b72; min-height: 1.2em; }
a { color: #58a6ff; }

dialog {
  background: #161b22; color: #e6edf3; border: 1px solid #30363d;
  border-radius: 10px; padding: 18px; width: min(520px, 92vw);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
pre {
  background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
  padding: 10px; overflow-x: auto; user-select: all; font-size: 13px;
}
code { background: #0d1117; padding: 1px 4px; border-radius: 4px; }

.login-body { align-items: center; justify-content: center; }
.login-card {
  width: min(340px, 90vw); background: #161b22; border: 1px solid #30363d;
  border-radius: 10px; padding: 24px;
}
.login-card h1 { margin-top: 0; font-size: 20px; }
.login-card button { width: 100%; margin-top: 4px; }

@media (max-width: 700px) {
  main { flex-direction: column-reverse; }
  aside { width: 100%; max-width: none; max-height: 45vh; border-right: none; border-top: 1px solid #30363d; }
  #map { min-height: 200px; }
}
