:root {
  color-scheme: light dark;
  --bg: #0f1417;
  --panel: #171d22;
  --banner-bg: #0a1420;
  --border: #2a3238;
  --text: #e7edf0;
  --muted: #93a1a8;
  --accent: #4fb3ff;
  --fail: #e0555f;
  --changed: #f2a93b;
}

* { box-sizing: border-box; }

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.app-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  flex: 0 0 auto;
  background: var(--banner-bg);
  border-bottom: 3px solid var(--accent);
}

.app-banner-brand {
  display: flex;
  align-items: center;
}

.banner-logo {
  height: 26px;
  width: auto;
  display: block;
}

.banner-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 0.9rem;
}

.app-banner-title {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.banner-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 0.45rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

.banner-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.banner-btn:disabled {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.15);
  cursor: not-allowed;
}

.banner-btn:disabled:hover {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(79, 179, 255, 0.06);
}

.dropzone .hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.file-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.file-list li {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

.actions {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

button {
  background: var(--accent);
  color: #06202f;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  border-color: var(--muted);
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.controls-row select {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}

#map {
  flex: 1 1 auto;
  width: 100%;
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
}

.leaflet-popup-tip {
  background: var(--panel);
}

.popup-table {
  font-size: 0.85rem;
  border-collapse: collapse;
}

.popup-table td {
  padding: 1px 6px 1px 0;
  vertical-align: top;
}

.popup-table td:first-child {
  color: var(--muted);
  white-space: nowrap;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.changed { background: rgba(242, 169, 59, 0.18); color: var(--changed); }
.badge.unchanged { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

.leaflet-div-icon.kind-icon {
  background: transparent;
  border: none;
}

.leaflet-div-icon.site-icon {
  background: transparent;
  border: none;
  filter: drop-shadow(0 0 4px #FFCB00) drop-shadow(0 0 8px #FFCB00) drop-shadow(0 0 14px #FFCB00);
}

.map-legend {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
}

.legend-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 2px 0;
}

.legend-row svg {
  flex-shrink: 0;
}

.leaflet-tooltip.roaming-label {
  background: var(--panel);
  border: 1px solid var(--changed);
  color: var(--text);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  box-shadow: none;
}

.leaflet-tooltip-top.roaming-label::before {
  border-top-color: var(--changed);
}

.roaming-label-kind {
  font-weight: 700;
  color: var(--changed);
  margin-right: 2px;
}
