:root {
  color-scheme: dark;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  --bg: #0a0f17;
  --text: #e7eefb;
  --muted: #93a2bc;
  --panel: #121a26;
  --panel-border: #223249;
  --panel-shadow: rgba(2, 7, 16, 0.5);
  --sidebar-bg: linear-gradient(180deg, #0f1622 0%, #0a1019 100%);
  --sidebar-border: #1b2a3d;
  --coords-bg: #162235;
  --button-bg: #2f6de1;
  --button-bg-hover: #3f7df0;
  --button-text: #f5f9ff;
  --button-ghost: #8ab4ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 18% 12%, #18283f 0%, #111b2a 34%, #090f17 100%);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
  gap: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  box-shadow: inset -8px 0 24px rgba(0, 0, 0, 0.2);
}

.heading {
  padding: 4px 0 2px;
}

.sidebar h1 {
  font-size: 24px;
  letter-spacing: 0.01em;
  margin: 0 0 6px 0;
}

.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 20px var(--panel-shadow);
}

.connection {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid transparent;
  font-weight: 600;
}

.status-ok {
  background: rgba(56, 152, 72, 0.2);
  color: #9ee6a8;
  border-color: rgba(56, 152, 72, 0.32);
}

.status-warn {
  background: rgba(242, 185, 88, 0.2);
  color: #ffd88a;
  border-color: rgba(242, 185, 88, 0.32);
}

.status-bad {
  background: rgba(214, 67, 67, 0.2);
  color: #ffb3b3;
  border-color: rgba(214, 67, 67, 0.3);
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8ea0bf;
  margin-bottom: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  min-width: 96px;
}

.pill.ok {
  background: rgba(56, 152, 72, 0.2);
  color: #9ee6a8;
}

.pill.warn {
  background: rgba(242, 185, 88, 0.2);
  color: #ffd88a;
}

.pill.low {
  background: rgba(214, 67, 67, 0.2);
  color: #ffb3b3;
}

.status {
  font-size: 14px;
  margin-bottom: 6px;
}

.last-seen {
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.35;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  background: rgba(74, 133, 220, 0.1);
  border-radius: 9px;
}

.coords {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 13px;
  background: var(--coords-bg);
  border-radius: 8px;
  padding: 6px 8px;
}

.meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.camera-image {
  display: block;
  width: 100%;
  min-height: 160px;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(74, 133, 220, 0.15);
}

.camera-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.camera-tile {
  background: rgba(74, 133, 220, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px;
}

.camera-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.button {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease;
}

.button:hover {
  background: var(--button-bg-hover);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--button-ghost);
  color: var(--button-ghost);
}

.select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.watermark {
  margin-top: auto;
  padding-top: 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

#map {
  min-height: 100vh;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  #map {
    min-height: 62vh;
  }

  .camera-grid {
    grid-template-columns: 1fr;
  }
}
