:root {
  color-scheme: light;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(32, 45, 57, 0.18);
  --text: #18212a;
  --muted: #5c6b73;
  --accent: #24745b;
  --accent-strong: #16543f;
  --danger: #b33a3a;
  --shadow: 0 10px 30px rgba(28, 36, 43, 0.18);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  overflow: hidden;
}

.panel {
  position: absolute;
  z-index: 1000;
  top: 16px;
  left: 16px;
  width: min(360px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

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

.title-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.title-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.other-maps-link {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}

.other-maps-link:hover,
.other-maps-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.metric-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(32, 45, 57, 0.12);
  border-radius: 8px;
  background: rgba(247, 249, 248, 0.9);
}

.metric-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}



.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 42px;
  gap: 8px;
  margin-top: 12px;
}

button {
  height: 36px;
  border: 1px solid rgba(22, 84, 63, 0.28);
  border-radius: 8px;
  background: white;
  color: var(--accent-strong);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #edf7f3;
}

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

.language-selector {
  position: relative;
  min-width: 0;
}

.language-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding: 0;
}

.language-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.language-menu {
  position: absolute;
  z-index: 1002;
  top: calc(100% + 6px);
  right: 0;
  min-width: 124px;
  padding: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.language-menu[hidden] {
  display: none;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.language-option:hover,
.language-option:focus-visible,
.language-option.is-active {
  background: #edf7f3;
  color: var(--accent-strong);
}

.language-option[aria-checked="true"]::after {
  content: "✓";
  margin-left: 14px;
  color: var(--accent-strong);
}


.add-dialog,
.delete-dialog {
  position: absolute;
  z-index: 1001;
  top: 16px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-sizing: border-box;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.add-dialog[hidden],
.delete-dialog[hidden] {
  display: none;
}

.add-form,
.delete-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.add-form-header,
.osm-auth-row,
.submit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-form-header {
  justify-content: space-between;
}

.add-form h2,
.delete-form h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
}

.osm-auth-row {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(32, 45, 57, 0.12);
  border-radius: 8px;
  background: rgba(247, 249, 248, 0.9);
}

.osm-auth-row span,
.add-status {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.osm-auth-row button {
  flex: 0 0 auto;
  width: auto;
  padding: 0 10px;
}

.add-form label,
.add-form fieldset,
.delete-form label {
  min-width: 0;
}

.kind-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid rgba(32, 45, 57, 0.14);
  border-radius: 8px;
}

.kind-options legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kind-options label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
  padding: 0 8px;
  border: 1px solid rgba(22, 84, 63, 0.28);
  border-radius: 8px;
  background: white;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.kind-options label:hover {
  background: #edf7f3;
}

.kind-options label:has(input:checked) {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: white;
}

.kind-options label:has(input:focus-visible) {
  outline: 2px solid rgba(37, 99, 235, 0.85);
  outline-offset: 2px;
}

.kind-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.kind-options span {
  overflow-wrap: anywhere;
}

.add-form label,
.delete-form label {
  display: grid;
  gap: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.add-form input,
.add-form select,
.add-form textarea,
.delete-form textarea {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(32, 45, 57, 0.18);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.add-form input,
.add-form select {
  height: 36px;
  padding: 0 9px;
}

.add-form textarea,
.delete-form textarea {
  resize: vertical;
  padding: 8px 9px;
}

.colour-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
}

.colour-select-preview {
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  border: 1px solid rgba(32, 45, 57, 0.24);
  border-radius: 8px;
  background: white;
}

.coordinate-grid,
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.coordinate-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.coordinate-actions button {
  min-width: 0;
  height: auto;
  min-height: 36px;
  padding: 7px 8px;
  line-height: 1.2;
  white-space: normal;
}

.recycling-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid rgba(32, 45, 57, 0.14);
  border-radius: 8px;
}

.recycling-types legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.recycling-types label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.recycling-types input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.submit-row button {
  flex: 0 0 auto;
  min-width: 128px;
  padding: 0 12px;
}

.delete-submit-button {
  border-color: rgba(179, 58, 58, 0.42);
  background: var(--danger);
  color: white;
}

.delete-submit-button:hover:not(:disabled),
.delete-submit-button:focus-visible {
  background: #932f2f;
  color: white;
}

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

.leaflet-popup-content {
  margin: 12px;
  min-width: 220px;
}

.trash-can-marker,
.recycling-marker,
.clothing-bin-marker,
.coffee-capsule-marker,
.cigarettes-marker,
.combined-marker-inner {
  transition: background-color 120ms ease, box-shadow 120ms ease, padding 120ms ease;
}

.combined-marker {
  background: transparent;
  border: 0;
}

.combined-marker-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 42px;
  height: 34px;
}

.combined-marker-inner img {
  width: 17px;
  height: 17px;
}

.large-scale-markers .trash-can-marker,
.large-scale-markers .recycling-marker,
.large-scale-markers .clothing-bin-marker,
.large-scale-markers .coffee-capsule-marker,
.large-scale-markers .cigarettes-marker,
.large-scale-markers .combined-marker-inner {
  box-sizing: border-box;
  padding: 4px;
  border: 1px solid rgba(22, 84, 63, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 7px rgba(28, 36, 43, 0.25);
}

.large-scale-markers .combined-marker-inner img {
  width: 14px;
  height: 14px;
}

.trash-can-marker.nearby-trash-marker,
.recycling-marker.nearby-trash-marker,
.clothing-bin-marker.nearby-trash-marker,
.coffee-capsule-marker.nearby-trash-marker,
.cigarettes-marker.nearby-trash-marker,
.combined-marker.nearby-trash-marker .combined-marker-inner {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
  filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.85));
}

.combined-marker.nearby-trash-marker .combined-marker-inner {
  border-radius: 999px;
}

.large-scale-markers .trash-can-marker.nearby-trash-marker,
.large-scale-markers .recycling-marker.nearby-trash-marker,
.large-scale-markers .clothing-bin-marker.nearby-trash-marker,
.large-scale-markers .coffee-capsule-marker.nearby-trash-marker,
.large-scale-markers .cigarettes-marker.nearby-trash-marker,
.large-scale-markers .combined-marker.nearby-trash-marker .combined-marker-inner {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18), 0 2px 10px rgba(28, 36, 43, 0.28);
}

.trash-can-marker.add-placement-marker,
.recycling-marker.add-placement-marker,
.clothing-bin-marker.add-placement-marker,
.coffee-capsule-marker.add-placement-marker,
.cigarettes-marker.add-placement-marker,
.combined-marker.add-placement-marker .combined-marker-inner {
  cursor: move;
  outline: 3px solid #2563eb;
  outline-offset: 4px;
  filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.85));
}

.combined-marker.add-placement-marker .combined-marker-inner {
  border-radius: 999px;
}

.large-scale-markers .trash-can-marker.add-placement-marker,
.large-scale-markers .recycling-marker.add-placement-marker,
.large-scale-markers .clothing-bin-marker.add-placement-marker,
.large-scale-markers .coffee-capsule-marker.add-placement-marker,
.large-scale-markers .cigarettes-marker.add-placement-marker,
.large-scale-markers .combined-marker.add-placement-marker .combined-marker-inner {
  border-color: rgba(37, 99, 235, 0.9);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 2px 10px rgba(28, 36, 43, 0.28);
}

.popup h2 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.popup dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px 10px;
  margin: 0 0 10px;
  font-size: 13px;
}

.popup dt {
  color: var(--muted);
  font-weight: 700;
}

.popup dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.colour-values {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}

.colour-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.colour-swatch {
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 1px solid rgba(32, 45, 57, 0.3);
  border-radius: 2px;
  flex: 0 0 auto;
}

.popup-separator {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(32, 45, 57, 0.16);
  margin: 3px 0;
}

.popup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.popup-actions a,
.popup-actions button {
  display: inline-flex;
  align-items: center;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.popup-actions a:hover,
.popup-actions a:focus-visible,
.popup-actions button:hover,
.popup-actions button:focus-visible {
  background: transparent;
  text-decoration: underline;
  outline: none;
}

.popup-actions .popup-edit-button {
  color: #b7791f;
}

.popup-actions .popup-delete-button {
  color: var(--danger);
}

@media (max-width: 640px) {
  .panel {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    padding: 10px;
  }

  .title-row {
    gap: 8px;
  }

  h1 {
    font-size: 16px;
  }


  .controls {
    gap: 6px;
    margin-top: 8px;
  }

  .controls button {
    height: 32px;
    font-size: 13px;
  }

  strong {
    font-size: 20px;
  }

  .add-dialog,
.delete-dialog {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;

    max-height: min(35dvh, calc(100dvh - 16px));
    overflow-y: auto;
    overscroll-behavior: contain;

    border-radius: 10px;
  }

  .add-form,
.delete-form {
    gap: 6px;
    padding: 10px;
  }

  .add-form-header {
    gap: 6px;
  }

  .add-form h2,
.delete-form h2 {
    font-size: 15px;
  }

  .icon-button {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .osm-auth-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 6px 8px;
  }

  .osm-auth-row span,
  .add-status {
    font-size: 12px;
  }

  .osm-auth-row button {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .kind-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 6px 8px 8px;
  }

  .kind-options legend,
  .recycling-types legend {
    font-size: 12px;
  }

  .kind-options label {
    height: 30px;
    padding: 0 5px;
    font-size: 12px;
    line-height: 1.1;
  }

  .coordinate-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .coordinate-actions button {
    min-height: 30px;
    padding: 5px 4px;
    font-size: 11px;
    line-height: 1.15;
  }

  .add-form label,
.delete-form label {
    gap: 3px;
    font-size: 12px;
  }

  .add-form input,
  .add-form select {
    height: 30px;
    padding: 0 7px;
    font-size: 13px;
  }

  .add-form textarea,
.delete-form textarea {
    min-height: 44px;
    max-height: 58px;
    padding: 6px 7px;
    font-size: 13px;
  }

  .colour-select-row {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .colour-select-preview {
    width: 30px;
    height: 30px;
    border-radius: 7px;
  }

  .field-grid {
    gap: 6px;
  }

  .recycling-types {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;

    max-height: 104px;
    overflow-y: auto;

    padding: 6px 8px 8px;
  }

  .recycling-types label {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    min-width: 0;
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .recycling-types input {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
  }

  .submit-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
  }

  .submit-row button {
    min-width: 100px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }
}

/* @media (max-width: 640px) {
  .panel {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    padding: 12px;
  }

  .add-dialog,
.delete-dialog {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: min(72vh, calc(100vh - 20px));
  }

  h1 {
    font-size: 16px;
  }

  strong {
    font-size: 20px;
  }
} */
