:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #182026;
  --muted: #5c6b73;
  --border: #d7dee2;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #c2410c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 100vh;
}

.map-panel {
  position: relative;
  min-height: 100vh;
}

#map {
  height: 100%;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: 100vh;
  overflow: auto;
  padding: 28px 24px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(24, 32, 38, 0.08);
  z-index: 2;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

header p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.control-group {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 7px 14px;
}

button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:disabled {
  border-color: var(--border);
  background: #eef2f3;
  color: var(--muted);
  cursor: default;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--text);
  font-weight: 600;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.timeline-group {
  display: grid;
  gap: 10px;
}

.playback-row {
  display: grid;
  gap: 10px;
}

.time-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.legend-bar {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #2563eb, #22c55e, #facc15, #f97316, #dc2626);
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.legend-labels span {
  white-space: nowrap;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

.error {
  color: var(--danger);
}

.noise-heat-canvas {
  pointer-events: none;
}

.sensor-popup {
  display: grid;
  gap: 3px;
  min-width: 150px;
  font-size: 12px;
  line-height: 1.35;
}

.sensor-popup strong {
  font-size: 13px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 62vh auto;
  }

  .map-panel,
  #map {
    min-height: 62vh;
  }

  .sidebar {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(24, 32, 38, 0.08);
  }
}
