:root {
  color: #172026;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f4f7f5;
}

.portal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 76px;
  box-sizing: border-box;
  padding: 0 28px;
  isolation: isolate;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  background:
    radial-gradient(circle at 68% -120%, rgb(31 179 117 / 34%), transparent 48%),
    linear-gradient(112deg, #043d2b 0%, #075c40 52%, #034734 100%);
  box-shadow: 0 5px 24px rgb(2 37 25 / 25%);
}

.project-tabs,
.portal-user {
  display: flex;
  align-items: center;
}

.project-tabs {
  gap: 5px;
  padding: 5px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 13px;
  background: rgb(0 38 25 / 20%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%);
}

.project-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0 18px;
  border-radius: 9px;
  color: rgb(255 255 255 / 82%);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .01em;
  text-align: center;
  text-decoration: none;
  transition: background 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.project-tab:hover { background: rgb(255 255 255 / 9%); color: #fff; }
.project-tab--active {
  border: 1px solid rgb(255 255 255 / 22%);
  background: linear-gradient(135deg, #18a36d, #0d7d54);
  color: #fff;
  box-shadow: 0 5px 16px rgb(0 31 20 / 30%), inset 0 1px 0 rgb(255 255 255 / 15%);
  transform: translateY(-1px);
}

.project-tab--active::after {
  position: absolute;
  right: 18%;
  bottom: -7px;
  left: 18%;
  height: 2px;
  border-radius: 999px;
  background: #f2c451;
  box-shadow: 0 0 8px rgb(242 196 81 / 55%);
  content: "";
}

.context-nav {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 28px;
  border-top: 1px solid rgb(255 255 255 / 7%);
  border-bottom: 1px solid #03402d;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 2%), transparent 35%),
    #064e38;
  box-shadow: 0 4px 14px rgb(3 43 29 / 16%);
}

.context-nav__links {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 9px;
}

.context-nav__link {
  padding: 7px 11px;
  border-radius: 7px;
  color: rgb(255 255 255 / 70%);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.context-nav__link:hover {
  background: rgb(255 255 255 / 7%);
  color: #fff;
}

.context-nav__link--active {
  background: rgb(242 196 81 / 13%);
  color: #f6ce64;
}

.portal-user {
  justify-content: flex-end;
  gap: 12px;
  color: rgb(255 255 255 / 78%);
  font-size: 14px;
}

.portal-user form { margin: 0; }
.portal-user button {
  border: 0;
  background: transparent;
  color: #f3cc61;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.project-home {
  width: min(900px, calc(100% - 40px));
  margin: 72px auto;
}

.project-home__eyebrow {
  margin: 0 0 6px;
  color: #0b6b48;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.project-home h1 { margin: 0; color: #103d2d; font-size: 44px; }
.project-home > p:not(.project-home__eyebrow) { color: #5c6964; font-size: 18px; }

.project-empty {
  display: grid;
  gap: 8px;
  margin-top: 36px;
  padding: 28px;
  border: 1px solid #d5e2da;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(23 32 38 / 7%);
}

.project-empty strong { color: #164c38; font-size: 18px; }
.project-empty span { color: #65716d; line-height: 1.5; }

.project-back-link {
  justify-self: start;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 7px;
  background: #0f6b5b;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.project-back-link:hover {
  background: #0b584b;
}

.gbff-map-page {
  height: 100vh;
  overflow: hidden;
}

.gbff-map-shell {
  position: relative;
  height: calc(100vh - 122px);
  min-height: 420px;
}

.gbff-map {
  width: 100%;
  height: 100%;
  background: #dce8e2;
}

.gbff-map-card {
  position: absolute;
  top: 132px;
  right: 10px;
  z-index: 700;
  width: min(330px, calc(100vw - 36px));
  max-height: calc(100% - 144px);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 15px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 14px 38px rgb(16 53 38 / 20%);
  backdrop-filter: blur(12px);
  scrollbar-color: #9bb9ae transparent;
  scrollbar-width: thin;
}

.gbff-map-card::-webkit-scrollbar {
  width: 7px;
}

.gbff-map-card::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #9bb9ae;
}

.gbff-map-card::-webkit-scrollbar-track {
  background: transparent;
}

.gbff-map-card__eyebrow {
  margin-bottom: 5px;
  color: #13724f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.gbff-map-card h1 {
  margin: 0;
  color: #123f30;
  font-size: 26px;
  line-height: 1.15;
}

.gbff-map-card > p {
  margin: 7px 0 18px;
  color: #68746f;
  font-size: 13px;
}

.gbff-layer-list {
  display: grid;
  gap: 6px;
  padding-top: 15px;
  border-top: 1px solid #e3e9e5;
}

.gbff-layer-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #fff;
}

.gbff-layer-group.is-active {
  border-color: #b9d7cf;
  background: #f8fcfb;
}

.gbff-layer-group__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gbff-layer-group__title {
  margin: 0;
  color: #52645c;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.gbff-layer-group__items {
  display: none;
  gap: 6px;
}

.gbff-layer-group.is-expanded .gbff-layer-group__items {
  display: grid;
}

.gbff-layer-item {
  padding: 8px 9px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #f6f9f7;
  transition: border-color 140ms ease, background 140ms ease;
}

.gbff-layer-item:has(input:checked) {
  border-color: #b9d7cf;
  background: #f1f8f6;
}

.gbff-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #263d34;
  font-size: 13px;
  cursor: pointer;
  font-weight: 700;
}

.gbff-checkbox-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0f6b5b;
  cursor: pointer;
}

.gbff-legend {
  display: grid;
  margin-top: 5px;
  padding-left: 23px;
  color: #52645c;
  font-size: 12px;
}

.gbff-legend[hidden],
.gbff-legend > span[hidden] {
  display: none;
}

.gbff-legend > span {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.gbff-legend--elevation {
  padding-right: 8px;
}

.gbff-elevation-classes {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  color: #475569;
  font-size: 11px;
  line-height: 1.2;
}

.gbff-elevation-classes span {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.gbff-elevation-classes i {
  flex: 0 0 16px;
  width: 16px;
  height: 11px;
  border: 1px solid rgb(15 23 42 / 22%);
  border-radius: 2px;
  box-shadow: none;
}

.gbff-legend--aspect {
  padding-right: 8px;
}

.gbff-aspect-classes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 6px;
  color: #475569;
  font-size: 11px;
  line-height: 1.2;
}

.gbff-aspect-classes span {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.gbff-aspect-classes i {
  flex: 0 0 16px;
  width: 16px;
  height: 11px;
  border: 1px solid rgb(15 23 42 / 22%);
  border-radius: 2px;
}

.gbff-legend i {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: var(--category-border-width, 1px) solid var(--category-border, #fff);
  border-radius: 3px;
  background: var(--category-color);
  box-shadow: 0 1px 3px rgb(17 24 39 / 20%);
}

.gbff-kba-agricultural-overlay {
  filter:
    drop-shadow(0 0 1px rgb(255 255 255 / 100%))
    drop-shadow(0 1px 1px rgb(15 23 42 / 55%));
  stroke-linejoin: round;
  stroke-linecap: round;
}

.gbff-legend .gbff-legend__kba-agriculture-1km {
  background:
    repeating-linear-gradient(
      135deg,
      #788b3b 0 4px,
      #a8b86d 4px 6px
    );
}

.gbff-legend .gbff-legend__kba-agriculture-2km {
  background: #b75a36;
}

.gbff-legend .gbff-legend__island {
  border: 2px solid #e5b83f;
  background: transparent;
}

.gbff-legend .gbff-legend__watershed {
  height: 0;
  border: 0;
  border-top: 2px dashed #d1d5db;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.gbff-legend .gbff-legend__neighborhood {
  height: 0;
  border: 0;
  border-top: 2px dashed #ef7d32;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.gbff-legend .gbff-legend__municipality {
  height: 0;
  border: 0;
  border-top: 3px solid #ffe066;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.gbff-legend .gbff-legend__road {
  height: 0;
  border: 0;
  border-top: 3px dashed #c4c9d1;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.gbff-legend .gbff-legend__place {
  flex-basis: 12px;
  width: 12px;
  height: 12px;
  margin: 0 2px 3px 1px;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #1976d2;
  box-shadow: -1px 2px 4px rgb(31 41 55 / 40%);
  transform: rotate(-45deg);
}

.gbff-legend .gbff-legend__place::after {
  display: block;
  width: 3px;
  height: 3px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.gbff-legend .gbff-legend__diagnostic-place {
  flex-basis: 12px;
  width: 12px;
  height: 12px;
  margin: 0 2px 3px 1px;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #7c3aed;
  box-shadow: -1px 2px 4px rgb(31 41 55 / 40%);
  transform: rotate(-45deg);
}

.gbff-legend .gbff-legend__diagnostic-place::after {
  display: block;
  width: 3px;
  height: 3px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.gbff-legend .gbff-legend__boundary-place {
  flex-basis: 12px;
  width: 12px;
  height: 12px;
  margin: 0 2px 3px 1px;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #f97316;
  box-shadow: -1px 2px 4px rgb(31 41 55 / 40%);
  transform: rotate(-45deg);
}

.gbff-legend .gbff-legend__boundary-place::after {
  display: block;
  width: 3px;
  height: 3px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.gbff-map .gbff-diagnostic-place-label {
  max-width: 120px;
  padding: 3px 7px 3px 6px;
  border: 1px solid rgb(203 213 225 / 95%);
  border-bottom: 3px solid #7c3aed;
  border-radius: 5px;
  background: rgb(255 255 255 / 94%);
  color: #263442;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  box-shadow: 0 2px 6px rgb(15 23 42 / 22%);
}

.gbff-map .leaflet-tooltip-top.gbff-diagnostic-place-label::before {
  border-top-color: #7c3aed;
}

.gbff-map .gbff-boundary-place-label {
  border-bottom-color: #f97316;
}

.gbff-map .leaflet-tooltip-top.gbff-boundary-place-label::before {
  border-top-color: #f97316;
}

.gbff-diagnostic-marker-wrapper {
  border: 0;
  background: transparent;
}

.gbff-diagnostic-marker {
  position: absolute;
  top: 2px;
  left: 1px;
  width: 12px;
  height: 12px;
  box-sizing: content-box;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #7c3aed;
  box-shadow: -2px 3px 6px rgb(31 41 55 / 45%);
  transform: rotate(-45deg);
}

.gbff-diagnostic-marker::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgb(255 255 255 / 90%);
  content: "";
}

.gbff-boundary-marker {
  background: #f97316;
}

.gbff-place-marker-wrapper {
  border: 0;
  background: transparent;
}

.gbff-place-marker {
  position: absolute;
  top: 2px;
  left: 1px;
  width: 12px;
  height: 12px;
  box-sizing: content-box;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #1976d2;
  box-shadow: -2px 3px 5px rgb(31 41 55 / 35%);
  transform: rotate(-45deg);
}

.gbff-map-card .gbff-map-status {
  margin: 14px 0 0;
  color: #63726b;
  font-size: 11px;
}

.gbff-map-status--error { color: #a33a32 !important; }

.gbff-home-control {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: #155c43;
  box-shadow: 0 1px 5px rgb(0 0 0 / 32%);
  cursor: pointer;
  font-size: 21px;
  font-weight: 800;
}

.gbff-home-control:hover { background: #f1f6f3; }

.gbff-map-tooltip {
  border: 1px solid #cbd9d2;
  color: #174a37;
  font-weight: 800;
  box-shadow: 0 5px 14px rgb(22 57 43 / 15%);
}

@media (max-width: 700px) {
  .portal-header { grid-template-columns: auto 1fr auto; height: 64px; padding: 0 12px; }
  .portal-user { display: none; }
  .project-tabs { justify-content: center; gap: 2px; padding: 3px; }
  .project-tab { min-width: 62px; min-height: 36px; padding: 0 8px; font-size: 12px; }
  .project-tab:first-child { display: none; }
  .project-tab--active::after { bottom: -5px; }
  .context-nav { min-height: 40px; padding: 0 12px; }
  .gbff-map-shell { height: calc(100vh - 120px); min-height: 0; }
  .gbff-map-card {
    top: 124px;
    right: 10px;
    width: min(290px, calc(100vw - 72px));
    max-height: calc(100% - 134px);
    padding: 14px;
  }
  .gbff-map-card h1 { font-size: 21px; }
  .gbff-map-card > p { margin-bottom: 12px; }
}
