:root {
  --bg: #0f172a;
  --panel: #111827;
  --line: #243041;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --ok: #22c55e;
  --warn: #f59e0b;
  --down: #ef4444;
  --accent: #38bdf8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}
button, input, select {
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 28px; }
.topbar p, .muted { margin: 6px 0 0 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.pill {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
}
.pill-button { background: transparent; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 18px 24px;
}
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.card { padding: 18px; }
.card .k { color: var(--muted); font-size: 14px; }
.card .v { margin-top: 8px; font-size: 28px; font-weight: 700; }
.layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  padding: 0 24px 18px 24px;
}
.panel {
  padding: 18px;
  margin: 0 24px 18px 24px;
}
.layout .panel, .admin-grid .panel { margin: 0; }
.inner-panel { padding: 16px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.section-head.compact { align-items: center; }
.legend, .actions-row, .admin-auth {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
}
.dot.base-online { background: #ef4444; }
.dot.base-offline { background: #b91c1c; }
.dot.rover-online { background: #2563eb; }
.dot.rover-stale { background: #93c5fd; }
#map {
  height: 520px;
  border-radius: 14px;
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-wrap { overflow-x: auto; }
th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); }
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
  margin-bottom: 4px;
}
.badge.ok { background: rgba(34,197,94,.16); color: #86efac; }
.badge.warn { background: rgba(245,158,11,.16); color: #fcd34d; }
.badge.down { background: rgba(239,68,68,.16); color: #fca5a5; }
.custom-marker div {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 2px rgba(0,0,0,.25);
}
.custom-marker.base-online div { background: #ef4444; }
.custom-marker.base-offline div { background: #b91c1c; }
.custom-marker.rover-online div { background: #2563eb; }
.custom-marker.rover-stale div { background: #93c5fd; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  max-height: 360px;
  overflow: auto;
}
.admin-panel.hidden { display: none; }
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.form-grid input, .form-grid select { width: 100%; }
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.checkbox input { width: auto; }
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.service-card {
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.service-card .k { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.service-card .v { font-size: 18px; font-weight: 700; word-break: break-word; }
.service-card .v.small { font-size: 14px; font-weight: 500; }
.service-note { grid-column: 1 / -1; }
code { color: #93c5fd; }
@media (max-width: 1100px) {
  .layout, .admin-grid, .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
