:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6978;
  --line: #d5dde7;
  --panel: #f7f9fc;
  --paper: #ffffff;
  --header: #21313c;
  --accent: #0f7b72;
  --accent-2: #b85f1d;
  --danger: #a33131;
  --shadow: 0 16px 36px rgba(22, 34, 48, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  background: var(--header);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.menu-toggle {
  display: none;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  padding: 0;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #b7c6d1;
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 750;
}

h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.header-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-stats span {
  min-width: 88px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
  color: #e7edf2;
}

.header-stats strong {
  display: block;
  font-size: 20px;
  color: #fff;
}

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

.side-panel {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.panel-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.visit-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
button {
  min-height: 40px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid #c6d0dc;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.subtle-button {
  min-height: 32px;
  border: 1px solid #c6d0dc;
  background: #fff;
  color: var(--ink);
}

.status-line {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.match-choices {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.match-choices[hidden] {
  display: none;
}

.match-choice-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.match-choice {
  display: grid;
  gap: 3px;
  min-height: 0;
  border: 1px solid #c6d0dc;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.match-choice span {
  font-weight: 750;
}

.match-choice small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.coverage-list,
.user-list {
  display: grid;
  gap: 8px;
}

.visit-row,
.user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.visit-row button {
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  color: var(--danger);
  border: 1px solid #e0b4b4;
}

.visit-meta,
.user-meta {
  color: var(--muted);
  font-size: 12px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.map-panel {
  min-width: 0;
  position: relative;
  background: #101924;
}

#map {
  position: absolute;
  inset: 0;
}

.maplibregl-popup-content {
  border-radius: 6px;
  box-shadow: var(--shadow);
}

@media (max-width: 780px) {
  .app-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .menu-toggle {
    display: flex;
  }

  .header-stats {
    grid-column: 1 / -1;
  }

  .app-shell {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  body.menu-collapsed .side-panel {
    display: none;
  }

  .side-panel {
    max-height: none;
    border-right: 0;
  }

  .map-panel {
    min-height: 64vh;
  }
}
