:root {
  color-scheme: dark;
  --bg: #0f1518;
  --panel: #172024;
  --line: #2f3d42;
  --text: #eff4ef;
  --muted: #a8b5ae;
  --green: #8ed980;
  --orange: #f5b253;
}

* {
  box-sizing: border-box;
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #11191d;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  margin-top: 18px;
  margin-bottom: 10px;
  font-size: 14px;
}

.toolbar p,
.panel p,
dt {
  color: var(--muted);
}

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

button {
  border: 1px solid #5f776a;
  border-radius: 6px;
  padding: 9px 12px;
  background: #203028;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover {
  background: #2a3d33;
}

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

.map-shell {
  min-width: 0;
  padding: 14px;
}

#map {
  width: 100%;
  height: calc(100vh - 102px);
  min-height: 520px;
  border: 1px solid var(--line);
  background: #15242e;
}

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

.legend {
  display: grid;
  gap: 8px;
  margin: 14px 0 4px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.legend i {
  width: 18px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 3px;
}

.legend .completed {
  background: rgba(142, 217, 128, 0.72);
}

.legend .in-progress {
  background: rgba(245, 178, 83, 0.74);
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.graticule-layer {
  pointer-events: none;
}

.tile-grid-label {
  pointer-events: none;
  text-align: center;
}

.tile-grid-label span,
.tile-grid-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(15, 21, 24, 0.72);
  color: #fff7d6;
  font-size: 11px;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.tile-grid-label small {
  display: inline-block;
  margin-top: 2px;
  color: #c9d6cf;
  font-size: 10px;
}

.leaflet-control-attribution {
  background: rgba(15, 21, 24, 0.76);
  color: rgba(239, 244, 239, 0.84);
}

.leaflet-control-attribution a {
  color: #d7c68a;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #172024;
  color: var(--text);
}

@media (max-width: 820px) {
  .toolbar,
  .layout {
    display: block;
  }

  .actions {
    margin-top: 12px;
  }

  #map {
    height: 68vh;
    min-height: 420px;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
