:root {
  color-scheme: light;

  --topbar-height: 64px;
  --control-size: 52px;
  --control-gap: 8px;
  --edge-gap: 12px;

  --surface: #ffffff;
  --surface-soft: #f3f6f7;
  --text: #152027;
  --muted: #5b6b74;
  --border: #cbd5da;
  --accent: #006b8f;
  --accent-strong: #004f6a;
  --focus: #ffbf47;
  --shadow: 0 4px 18px rgb(17 39 51 / 20%);
}

* {
  box-sizing: border-box;
}

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

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

button,
select,
input {
  font: inherit;
}

button,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  display: none;
}

.map-header-overlay {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: 10px;
  left: 10px;
  z-index: 860;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 8px;
  background: rgb(255 255 255 / 92%);
  border: 1px solid rgb(137 157 167 / 72%);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.map-header-overlay__title {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.map-header-overlay__title-main,
.map-header-overlay__title-sub {
  display: block;
}

.map-header-overlay__title-sub {
  margin-top: 1px;
  color: #2e7d32;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.05;
}

#haro-select {
  min-width: 0;
  min-height: 42px;
  flex: 1 1 auto;
  padding: 7px 38px 7px 10px;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid #7d8d95;
  border-radius: 7px;
}

#haro-select:disabled {
  color: var(--muted);
  background: #edf1f3;
}

.map-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #dfeaf0;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-attribution {
  max-width: calc(100vw - 18px);
  padding: 2px 5px;
  font-size: 8px;
  line-height: 1.2;
  white-space: nowrap;
}

.leaflet-control-attribution a {
  font-size: 8px;
  font-weight: 400;
}

.leaflet-control-attribution .about-site-link {
  color: #c62828;
}

.leaflet-control-attribution .leaflet-attribution-flag {
  display: inline !important;
  width: 1em;
  height: auto;
  vertical-align: -0.1em;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

.leaflet-popup-content {
  min-width: 180px;
  margin: 14px 16px;
  font-size: 15px;
  line-height: 1.45;
}

.popup-title {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.popup-link {
  display: inline-block;
  padding: 7px 0;
  color: #005f86;
  font-weight: 750;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.popup-note {
  color: var(--muted);
  font-size: 13px;
}

.map-controls {
  position: absolute;
  z-index: 850;
}

.left-controls {
  bottom:
    calc(
      var(--edge-gap)
      + env(safe-area-inset-bottom)
    );
  left: var(--edge-gap);
  display: grid;
  gap: var(--control-gap);
}

.zoom-controls {
  bottom:
    calc(
      var(--edge-gap)
      + env(safe-area-inset-bottom)
    );
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, var(--control-size));
  gap: var(--control-gap);
  transform: translateX(-50%);
}

.organisations-button {
  position: relative;
  inset: auto;
  z-index: auto;
}

.map-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--control-size);
  height: var(--control-size);
  padding: 0;
  color: #10191e;
  background: rgb(255 255 255 / 95%);
  border: 2px solid #b9c5cb;
  border-radius: 13px;
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
}

.map-button:hover {
  background: #f8fbfc;
}

.map-button:active {
  transform: translateY(1px);
}

.map-button:disabled {
  color: #7d8a90;
  background: rgb(235 240 242 / 92%);
  cursor: not-allowed;
  opacity: 0.75;
}

.map-button svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/*
 * Material Icons-former som lokala inline-SVG:er.
 * Ingen ikonfont eller extern bildfil behövs, och 24 x 24-viewBoxen
 * gör symbolerna geometriskt stabila och centrerade i knapparna.
 */
.map-button .material-icon-svg {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
  fill: currentColor;
  stroke: none;
  overflow: visible;
  pointer-events: none;
}

#location-button .location-material-icon {
  width: 30px;
  height: 30px;
}

.button-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  background: #006b8f;
  border: 2px solid #ffffff;
  border-radius: 999px;
}

.info-card {
  position: absolute;
  top: 70px;
  right: 12px;
  z-index: 820;
  width: min(310px, calc(100vw - 24px));
  overflow: hidden;
  background: rgb(255 255 255 / 95%);
  border: 1px solid #bfcbd1;
  border-radius: 13px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.info-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.info-card__header strong {
  display: block;
  font-size: 18px;
  line-height: 1.15;
}

.info-card__id {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.info-card__chevron {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.info-card.is-collapsed .info-card__chevron {
  transform: rotate(180deg);
}

.info-card__details {
  padding: 0 12px 12px;
  border-top: 1px solid #dce4e8;
}

.info-card__details p {
  margin: 9px 0 0;
  font-size: 14px;
  line-height: 1.35;
}

.info-card__welcome p {
  margin-top: 10px;
}

.info-card__welcome a {
  color: #005f86;
  font-weight: 750;
  text-underline-offset: 2px;
}

.info-card__welcome-icon {
  display: inline-block;
  width: 19px;
  height: 19px;
  margin-left: 2px;
  vertical-align: -4px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.info-card__welcome-icon--pointer {
  color: #000000;
  fill: currentColor;
  stroke: none;
}

.info-card__welcome-action {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.info-card__welcome-action > .info-card__welcome-icon,
.info-card__welcome-icons {
  flex: 0 0 auto;
}

.info-card__welcome-action > .info-card__welcome-icon {
  margin-left: 0;
}

.info-card__welcome-icons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 45px;
}

.info-card__welcome-icons .info-card__welcome-icon {
  margin-left: 0;
}

.info-card__welcome-separator {
  line-height: 1;
}

.info-card.is-collapsed .info-card__details {
  display: none;
}

.status-toast {
  position: absolute;
  left: 50%;
  bottom:
    calc(
      var(--control-size)
      + 30px
      + env(safe-area-inset-bottom)
    );
  z-index: 1000;
  width: max-content;
  max-width: calc(100vw - 30px);
  padding: 10px 14px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  background: rgb(20 38 47 / 92%);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.status-toast.is-error {
  background: rgb(139 29 29 / 94%);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #ffffff;
  font-weight: 750;
  background: rgb(239 246 249 / 88%);
}

.loading-overlay p {
  position: absolute;
  left: 50%;
  bottom:
    calc(
      var(--control-size)
      + 30px
      + env(safe-area-inset-bottom)
    );
  width: max-content;
  max-width: calc(100vw - 30px);
  margin: 0;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  background: rgb(163 33 33 / 95%);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 5px solid #b9d0db;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.bottom-sheet {
  width: min(100%, 620px);
  max-width: none;
  max-height: min(82vh, 82dvh);
  padding: 0;
  margin: auto auto 0;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 35px rgb(0 0 0 / 25%);
}

.bottom-sheet[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.bottom-sheet::backdrop {
  background: rgb(4 18 24 / 54%);
  backdrop-filter: blur(2px);
}

.sheet-handle {
  width: 52px;
  height: 5px;
  margin: 9px auto 0;
  background: #b8c4ca;
  border-radius: 999px;
}

.sheet-header {
  padding: 8px 18px 12px;
  border-bottom: 1px solid #dce4e8;
}

.sheet-header h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
}

.sheet-content {
  min-height: 0;
  padding: 8px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-footer {
  padding:
    10px
    14px
    max(12px, env(safe-area-inset-bottom));
  background: #f5f7f8;
  border-top: 1px solid #dce4e8;
}

.close-sheet-button {
  width: 100%;
  min-height: 52px;
  padding: 8px 18px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  background: #ffffff;
  border: 2px solid #aab8bf;
  border-radius: 12px;
  cursor: pointer;
}

.sources-sheet {
  width: min(100%, 680px);
}

.about-sheet {
  width: min(100%, 560px);
}

.about-content {
  display: grid;
  gap: 12px;
  padding: 18px;
  line-height: 1.45;
}

.about-content p {
  margin: 0;
}

.about-content a {
  color: #006b8f;
  font-weight: 700;
}

.about-copyright {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.about-copyright strong {
  font-weight: 800;
}

.about-section-heading {
  margin: 0 0 2px;
  font-size: 1rem;
  line-height: 1.35;
}

.about-related-research {
  display: grid;
  gap: 4px;
}

.about-related-label {
  font-weight: 700;
}

.about-updated {
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid #dce4e8;
}

.sources-content {
  padding: 14px 18px 18px;
}

.sources-intro {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.sources-list {
  display: grid;
  gap: 12px;
  padding-left: 20px;
  margin: 0;
}

.sources-list li {
  padding-left: 2px;
  line-height: 1.45;
}

.sources-list strong {
  color: #17333f;
}

.sources-list a {
  color: #006b8f;
  font-weight: 700;
}

.sources-note {
  margin: 16px 0 0;
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  border-top: 1px solid #dce4e8;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 8px 2px;
  border-bottom: 1px solid #dce4e8;
  cursor: pointer;
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row > span {
  display: grid;
  gap: 2px;
}

.switch-row strong {
  font-size: 18px;
}

.switch-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.switch-row:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.58;
}

.switch-row input {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 31px;
  margin: 0;
  appearance: none;
  background: #77868d;
  border: 2px solid #617078;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

.switch-row input::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  content: "";
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(0 0 0 / 32%);
  transition: transform 140ms ease;
}

.switch-row input:checked {
  background: #007b57;
  border-color: #006445;
}

.switch-row input:checked::before {
  transform: translateX(21px);
}

.switch-row input:disabled {
  cursor: not-allowed;
}

.organisation-list {
  display: grid;
  gap: 10px;
  padding: 4px 0 8px;
}

.organisation-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: #f4f7f8;
  border: 1px solid #d2dde2;
  border-radius: 12px;
}

.organisation-card a {
  width: fit-content;
  color: #005f86;
  font-size: 18px;
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.organisation-card strong {
  font-size: 18px;
}

.organisation-card span {
  color: var(--muted);
  font-size: 14px;
}

.org-pin-wrapper {
  background: transparent;
  border: 0;
}

.org-pin {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  background: #00789f;
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 2px 8px rgb(0 0 0 / 34%);
  transform: rotate(-45deg);
}

.org-pin > span {
  transform: rotate(45deg);
}

.user-location-marker {
  width: 18px;
  height: 18px;
  background: #0879e1;
  border: 4px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgb(8 121 225 / 30%);
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-tooltip.district-label {
  padding: 7px 10px;
  color: #17242b;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  background: rgb(255 255 255 / 92%);
  border: 1px solid rgb(69 86 96 / 46%);
  border-radius: 9px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
}

.leaflet-tooltip.district-label::before {
  display: none;
}

.district-label__content {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.district-label__name {
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.district-label__authority {
  display: block;
  color: #4a5961;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
}

@media (max-width: 390px) {
  :root {
    --control-size: 48px;
    --control-gap: 6px;
    --edge-gap: 8px;
  }

  .map-header-overlay {
    gap: 7px;
    padding: 5px 6px;
  }

  .map-header-overlay__title {
    font-size: clamp(8.5px, 2.55vw, 11px);
    letter-spacing: -0.12px;
  }

  .map-header-overlay__title-sub {
    font-size: clamp(7px, 2.05vw, 9px);
  }

  #haro-select {
    min-height: 40px;
    padding-right: 28px;
    padding-left: 8px;
    font-size: clamp(12px, 3.45vw, 14px);
    letter-spacing: -0.08px;
  }

  .info-card {
    top: 64px;
    right: 8px;
    width: min(280px, calc(100vw - 16px));
  }

  .map-button svg {
    width: 25px;
    height: 25px;
  }

  .map-button .material-icon-svg {
    width: 26px;
    height: 26px;
  }

  #location-button .location-material-icon {
    width: 28px;
    height: 28px;
  }

  .leaflet-tooltip.district-label {
    padding: 5px 7px;
  }

  .district-label__name {
    font-size: 10px;
  }

  .district-label__authority {
    font-size: 9px;
  }
}


@media (max-width: 759px) {
  .info-card.is-welcome .info-card__header strong {
    font-size: 16px;
  }

  .info-card.is-welcome .info-card__details p {
    font-size: 13px;
    line-height: 1.34;
  }

  .map-header-overlay {
    gap: 7px;
    padding: 5px 6px;
  }

  .map-header-overlay__title {
    max-width: none;
    overflow: visible;
    font-size: clamp(8.5px, 2.55vw, 11px);
    letter-spacing: -0.12px;
    text-overflow: clip;
  }

  .map-header-overlay__title-sub {
    font-size: clamp(7px, 2.05vw, 9px);
  }

  #haro-select {
    min-height: 40px;
    padding-right: 28px;
    padding-left: 8px;
    font-size: clamp(12px, 3.45vw, 14px);
    letter-spacing: -0.08px;
  }

  .leaflet-control-attribution {
    max-width: calc(100vw - 12px);
    margin-right: 4px;
    margin-bottom: 0;
    font-size: 8px;
  }

  .sources-content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .sources-list {
    gap: 10px;
    font-size: 14px;
  }
}

@media (min-width: 760px) {
  .leaflet-control-attribution,
  .leaflet-control-attribution a {
    font-size: 10px;
  }


  .map-header-overlay {
    right: auto;
    width: fit-content;
    max-width: calc(100vw - 24px);
  }

  #haro-select {
    width: var(--haro-select-content-width, 320px);
    max-width: min(560px, calc(100vw - 230px));
    flex: 0 0 auto;
  }

  .bottom-sheet {
    margin-bottom: 18px;
    border-radius: 20px;
  }
}

@media (max-width: 430px) {
  .map-header-overlay {
    right: 8px;
    left: 8px;
  }

  .map-header-overlay__title {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  }

  .info-card {
    top: 62px;
  }

  .map-legend {
    top: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Slutlig storlek för vattendistriktens etiketter */
.leaflet-tooltip.district-label {
  padding: 4px 6px;
}

.leaflet-tooltip.district-label
.district-label__name {
  font-size: 9px;
  line-height: 1.05;
}

.leaflet-tooltip.district-label
.district-label__authority {
  font-size: 7px;
  line-height: 1.1;
}

@media (min-width: 760px) {
  .leaflet-tooltip.district-label
  .district-label__name {
    font-size: 10px;
  }

  .leaflet-tooltip.district-label
  .district-label__authority {
    font-size: 8px;
  }
}

/* Kompakt formulär för vattenorganisationsuppgifter */
.editor-sheet {
  width: min(100%, 620px);
  max-height: min(88vh, 88dvh);
}

.editor-sheet[open] {
  grid-template-rows:
    auto
    auto
    minmax(0, 1fr)
    auto;
}

.editor-header {
  padding-bottom: 10px;
}

.editor-header h2 {
  font-size: 21px;
}

.editor-content {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
}

.editor-main-select,
.editor-form input[type="text"],
.editor-form input[type="email"],
.editor-form input[type="url"] {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
  background: #ffffff;
  border: 1px solid #9fafb7;
  border-radius: 9px;
}

.editor-main-select {
  display: block;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding: 0 42px 0 11px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 750;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: auto;
  -webkit-appearance: menulist;
}

.editor-main-select option {
  font-size: 16px;
  font-weight: 500;
}

.editor-form {
  display: grid;
  gap: 9px;
}

.editor-basic-fields {
  display: grid;
  gap: 9px;
  padding: 10px;
  background: #f3f6f7;
  border: 1px solid #cbd6db;
  border-radius: 10px;
}

.editor-basic-fields[hidden] {
  display: none;
}

.editor-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  background: #f3f6f7;
  border: 1px solid #cbd6db;
  border-radius: 10px;
}

.editor-check strong {
  font-size: 14px;
  line-height: 1.25;
}

.editor-switch-row input {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 31px;
  margin: 0;
  appearance: none;
  background: #77868d;
  border: 2px solid #617078;
  border-radius: 999px;
  cursor: pointer;
}

.editor-switch-row input::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  content: "";
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(0 0 0 / 32%);
  transition: transform 140ms ease;
}

.editor-switch-row input:checked {
  background: #007b57;
  border-color: #006445;
}

.editor-switch-row input:checked::before {
  transform: translateX(21px);
}

.editor-more-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.editor-more-actions .secondary-button,
.editor-more-actions .danger-button {
  width: 100%;
  min-height: 46px;
}

.editor-footer {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr);
  gap: 8px;
}

.editor-footer .close-sheet-button {
  min-height: 48px;
  font-size: 17px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 8px 10px;
  font-weight: 800;
  border-radius: 9px;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  border: 2px solid var(--accent-strong);
}

.secondary-button {
  color: var(--text);
  background: #ffffff;
  border: 2px solid #aab8bf;
}

.danger-button {
  color: #ffffff;
  background: #a32121;
  border: 2px solid #791616;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.popup-link--secondary {
  display: block;
  padding-top: 3px;
  padding-bottom: 4px;
  font-size: 13px;
}

.popup-detail {
  margin-top: 6px;
  color: #263238;
  font-size: 13px;
  line-height: 1.35;
}

.organisation-secondary-link {
  font-size: 14px !important;
  font-weight: 700 !important;
}

@media (max-width: 420px) {
  .editor-sheet {
    max-height: 92dvh;
  }

  .editor-header h2 {
    font-size: 19px;
  }

  .editor-content {
    padding: 8px;
  }

  .editor-main-select {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
  }

  .editor-more-actions {
    grid-template-columns: 1fr;
  }
}


.editor-review-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}


/* Läns- och kommunnamn vid inzoomning */
.leaflet-tooltip.county-label,
.leaflet-tooltip.municipality-label {
  max-width: 180px;
  margin: 0;
  padding: 3px 6px;
  overflow: hidden;
  color: #17242b;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  background: rgb(255 255 255 / 82%);
  border: 1px solid rgb(69 86 96 / 30%);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 14%);
}

.leaflet-tooltip.county-label::before,
.leaflet-tooltip.municipality-label::before {
  display: none;
}

.leaflet-tooltip.county-label {
  font-size: 11px;
  font-weight: 800;
}

.leaflet-tooltip.municipality-label {
  font-size: 10px;
  font-weight: 700;
  background: rgb(255 255 255 / 76%);
}

@media (max-width: 500px) {
  .leaflet-tooltip.county-label {
    max-width: 135px;
    padding: 2px 4px;
    font-size: 10px;
  }

  .leaflet-tooltip.municipality-label {
    max-width: 120px;
    padding: 2px 4px;
    font-size: 9px;
  }
}


/* Ekologisk klassning: lagerreglage och teckenförklaring */
.layer-setting-group {
  border-bottom: 1px solid #dce4e8;
}

.layer-setting-group .switch-row {
  border-bottom: 0;
}

.basemap-selector {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 2px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.basemap-selector select {
  width: 100%;
  min-height: 42px;
  padding: 8px 34px 8px 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #aebcc3;
  border-radius: 8px;
}

.basemap-selector select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.layer-opacity-control {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr) 52px;
  align-items: center;
  gap: 10px;
  padding: 0 2px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.layer-opacity-control input[type="range"] {
  width: 100%;
  accent-color: #007b57;
  cursor: pointer;
}

.layer-opacity-control input[type="range"]:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.layer-opacity-control output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.map-legend {
  position: absolute;
  top: 70px;
  left: 12px;
  z-index: 815;
  width: min(245px, calc(100vw - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  color: var(--text);
  background: rgb(255 255 255 / 96%);
  border: 1px solid #bfcbd1;
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.map-legend summary {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}

.map-legend[open] summary {
  border-bottom: 1px solid #dce4e8;
}

.map-legend__content {
  padding: 7px 8px 8px;
}

.legend-heading {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.legend-comparison {
  display: grid;
  gap: 4px;
}

.legend-comparison__row {
  display: grid;
  grid-template-columns: 19px 19px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 19px;
  font-size: 11px;
  line-height: 1.12;
}

.legend-swatch {
  width: 18px;
  height: 15px;
  box-sizing: border-box;
  background-color: #d4d9dc;
  border: 1px solid rgb(43 56 63 / 45%);
  border-radius: 1px;
}

.legend-swatch.status-high {
  background-color: #5ca4ff;
}

.legend-swatch.status-good {
  background-color: #5ca68d;
}

.legend-swatch.status-moderate {
  background-color: #ffff5c;
}

.legend-swatch.status-poor {
  background-color: #ffc95c;
}

.legend-swatch.status-bad {
  background-color: #ff5c5c;
}

.legend-swatch.is-potential {
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent 3px,
    rgb(190 190 190 / 90%) 3px,
    rgb(190 190 190 / 90%) 5px
  );
}

@media (max-width: 520px) {
  .map-legend {
    width: min(222px, calc(100vw - 20px));
    top: 64px;
    left: 10px;
  }

  .map-legend:not([open]) {
    width: auto;
    max-width: calc(100vw - 20px);
  }

  .map-legend summary {
    padding: 7px 9px;
    font-size: 12px;
  }

  .map-legend__content {
    padding: 6px 7px 7px;
  }

  .legend-heading,
  .legend-comparison__row {
    font-size: 10.5px;
  }
}


/*
  Kartografisk balans v31
  ----------------------
  Baskartan bär orienteringen. Vektorlagren får en tydlig men
  skalberoende hierarki: vattendistrikt, HARO, län och kommun.
*/

.leaflet-tooltip.district-label {
  padding: 4px 7px;
  background: rgb(255 255 255 / 88%);
  border-color: rgb(61 78 87 / 34%);
  border-radius: 7px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 14%);
  backdrop-filter: blur(2px);
}

/* Nationell översikt: distriktsnamnen får mest visuell tyngd. */
#map[data-zoom-band="national"]
.leaflet-tooltip.district-label
.district-label__name {
  font-size: 12px;
  line-height: 1.08;
}

#map[data-zoom-band="national"]
.leaflet-tooltip.district-label
.district-label__authority {
  font-size: 10px;
  line-height: 1.1;
}

/* Regional nivå: något mindre etiketter för att frigöra kartbilden. */
#map[data-zoom-band="regional"]
.leaflet-tooltip.district-label
.district-label__name {
  font-size: 11px;
  line-height: 1.06;
}

#map[data-zoom-band="regional"]
.leaflet-tooltip.district-label
.district-label__authority {
  font-size: 9px;
  line-height: 1.08;
}

.leaflet-tooltip.county-label,
.leaflet-tooltip.municipality-label {
  color: #223139;
  background: rgb(255 255 255 / 76%);
  border-color: rgb(69 86 96 / 25%);
  box-shadow: 0 1px 3px rgb(0 0 0 / 11%);
  backdrop-filter: blur(1.5px);
}

#map[data-zoom-band="regional"]
.leaflet-tooltip.county-label {
  padding: 3px 6px;
  font-size: 11.5px;
  font-weight: 780;
}

#map[data-zoom-band="local"]
.leaflet-tooltip.county-label {
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 760;
}

#map[data-zoom-band="local"]
.leaflet-tooltip.municipality-label {
  padding: 2px 5px;
  font-size: 9.5px;
  font-weight: 680;
  background: rgb(255 255 255 / 68%);
}

/* Högre baskarteopacitet utan att göra reglaget mindre användbart. */
#basemap-opacity {
  accent-color: #006f8f;
}

/* Mobil: bibehåll läsbarhet utan att etiketterna tar över kartan. */
@media (max-width: 759px) {
  .leaflet-tooltip.district-label {
    padding: 3px 5px;
    border-radius: 6px;
  }

  #map[data-zoom-band="national"]
  .leaflet-tooltip.district-label
  .district-label__name {
    font-size: 10px;
  }

  #map[data-zoom-band="national"]
  .leaflet-tooltip.district-label
  .district-label__authority {
    font-size: 8px;
  }

  #map[data-zoom-band="regional"]
  .leaflet-tooltip.district-label
  .district-label__name {
    font-size: 9px;
  }

  #map[data-zoom-band="regional"]
  .leaflet-tooltip.district-label
  .district-label__authority {
    font-size: 7px;
  }

  #map[data-zoom-band="regional"]
  .leaflet-tooltip.county-label,
  #map[data-zoom-band="local"]
  .leaflet-tooltip.county-label {
    max-width: 132px;
    padding: 2px 4px;
    font-size: 10px;
  }

  #map[data-zoom-band="local"]
  .leaflet-tooltip.municipality-label {
    max-width: 116px;
    padding: 2px 4px;
    font-size: 9px;
  }
}
