:root {
  --bg: #14171a;
  --panel: #1d2126;
  --line: #2e343c;
  --text: #e8ecef;
  --muted: #9aa4ae;
  --accent: #4a9d5f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { display: flex; background: var(--bg); color: var(--text); }
#map { flex: 1; height: 100%; }

#panel {
  width: 330px;
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
h1 { margin: 0 0 4px; font-size: 17px; letter-spacing: .2px; }
.lede { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }

fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 12px; padding: 10px 12px 12px; }
legend { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 0 4px; }
label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0; font-size: 13px; }
.unit { color: var(--muted); margin-left: auto; margin-right: 6px; font-size: 11px; }
input, select {
  width: 84px; padding: 5px 7px; border-radius: 4px;
  border: 1px solid var(--line); background: #12151a; color: var(--text); font: inherit; font-size: 13px;
}
select { width: 150px; }
#savedTests { width: 100%; margin: 4px 0 8px; }
input[type="checkbox"] { width: auto; }
input[type="range"] { width: 110px; padding: 0; background: none; border: none; accent-color: var(--accent); }
output { width: 26px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
label.switch { justify-content: space-between; }
code { font-size: 11px; background: #12151a; padding: 0 3px; border-radius: 3px; }
#auth input { width: 150px; }

.row { display: flex; gap: 8px; margin-bottom: 14px; }
.row.compact { margin-bottom: 0; }
.row.compact button { padding: 7px 6px; font-size: 12.5px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.tool-grid button { min-width: 0; padding: 7px 8px; font-size: 12.5px; }
button {
  flex: 1; padding: 8px 10px; border-radius: 5px; border: 1px solid var(--line);
  background: #262c33; color: var(--text); font: inherit; cursor: pointer;
}
button:hover:not(:disabled) { background: #2f363e; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #57b26d; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.wide { width: 100%; margin-bottom: 10px; }
button.armed { outline: 2px solid var(--accent); }

#status { min-height: 18px; margin: 6px 0 10px; font-size: 12.5px; color: var(--muted); }
#status.error { color: #ff8f7a; }

table.summary { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 12px; }
table.summary.compact { margin-bottom: 8px; }
table.summary td { padding: 3px 0; border-bottom: 1px solid var(--line); }
table.summary td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.summary td.k { color: var(--muted); }

details { font-size: 12.5px; color: var(--muted); }
details.summary-details { margin-bottom: 10px; }
summary { cursor: pointer; padding: 6px 0; }
ul.legend { list-style: none; padding: 0; margin: 6px 0; }
ul.legend li { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
ul.legend i { width: 22px; height: 4px; border-radius: 2px; }
.fine { font-size: 11px; line-height: 1.5; }

.maplibregl-popup-content { background: var(--panel); color: var(--text); font-size: 12px; border-radius: 6px; }
.maplibregl-popup-content table td { padding: 1px 6px 1px 0; }
.maplibregl-popup-tip { border-top-color: var(--panel); border-bottom-color: var(--panel); }
