:root {
  --bg: #eef2ee;
  --panel: #ffffff;
  --ink: #17201c;
  --muted: #5e6b66;
  --line: #d6ded9;
  --accent: #2f6f5e;
  --accent-dark: #204f43;
  --danger: #b94235;
  --warn: #c57b1f;
  --blue: #2e6f9f;
  --shadow: 0 16px 42px rgba(16, 31, 27, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  color: var(--accent-dark);
  background: #dceee8;
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100vh;
  padding: 18px;
  overflow-y: auto;
  background: #f8faf8;
  border-right: 1px solid var(--line);
  z-index: 10;
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 8px;
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #38a169;
  box-shadow: 0 0 0 5px rgba(56, 161, 105, 0.12);
}

.panel {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 36, 31, 0.06);
}

.panel.grow {
  flex: 1;
  min-height: 260px;
}

.panel h2,
.section-title h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

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

.toggle-row,
.button-row,
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-row {
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.button-row {
  justify-content: flex-end;
}

.button-row.compact button {
  padding: 8px 11px;
}

.coord-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.coord-list div {
  display: grid;
  gap: 3px;
}

.coord-list dt {
  color: var(--muted);
  font-size: 12px;
}

.coord-list dd {
  margin: 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.section-title {
  justify-content: space-between;
}

.icon-button {
  padding: 7px 10px;
  color: var(--accent-dark);
  background: #dceee8;
  font-size: 12px;
}

.search-box {
  margin-bottom: 12px;
}

.points-list {
  display: grid;
  gap: 10px;
}

.layers-list {
  display: grid;
  gap: 8px;
}

.layer-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
}

.layer-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
}

.layer-item input {
  width: auto;
}

.mini {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.danger-text {
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(185, 66, 53, 0.25);
}

.point-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.point-head,
.point-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.point-head {
  justify-content: space-between;
}

.point-title {
  margin: 0;
  font-size: 15px;
}

.point-meta,
.point-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.point-actions {
  flex-wrap: wrap;
}

.point-actions button {
  padding: 7px 9px;
  font-size: 12px;
}

.type-pill {
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
}

.type-pill.danger {
  background: var(--danger);
}

.type-pill.target {
  background: var(--warn);
}

.type-pill.supply {
  background: var(--accent);
}

.zone-pill {
  min-width: 48px;
  text-align: center;
}

.zone-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.zone-tools button {
  padding: 8px 10px;
}

.zone-tools span {
  color: var(--muted);
  font-size: 13px;
}

.map-area {
  position: relative;
  min-width: 0;
}

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

.topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.route-summary,
.map-hint {
  border: 1px solid rgba(214, 222, 217, 0.9);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.route-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.route-summary strong {
  color: var(--ink);
}

.map-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  z-index: 500;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 13px;
}

.grid-label {
  color: #1e3a34;
  font: 600 11px/1.2 Consolas, "Courier New", monospace;
  text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
  pointer-events: none;
}

.marker-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  font-size: 14px;
  font-weight: 700;
}

.marker-icon.danger {
  background: var(--danger);
}

.marker-icon.target {
  background: var(--warn);
}

.marker-icon.supply {
  background: var(--accent);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  #map {
    height: 70vh;
    min-height: 520px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding: 12px;
  }

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

  .topbar {
    left: 10px;
    right: 10px;
  }

  .route-summary {
    flex-wrap: wrap;
  }

  .map-hint {
    left: 10px;
    right: 10px;
    transform: none;
    text-align: center;
  }
}
