:root {
  --ink: #1e2442;
  --ink-rgb: 30, 36, 66;
  --muted: #6f789c;
  --content-max-width: 1060px;
  --layout-gap: 20px;
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(239, 244, 255, 0.84) 100%);
  --panel-muted: linear-gradient(180deg, rgba(241, 245, 255, 0.92) 0%, rgba(232, 238, 255, 0.84) 100%);
  --stroke: rgba(72, 84, 141, 0.14);
  --accent: #5c68f6;
  --accent-deep: #3947ac;
  --sun: #8e79f6;
  --coral: #d95c84;
  --olive: #5ea496;
  --shadow: 0 22px 54px rgba(33, 42, 83, 0.16);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --page-background:
    radial-gradient(1180px 860px at 8% 10%, rgba(186, 168, 255, 0.52) 0%, rgba(186, 168, 255, 0) 60%),
    radial-gradient(980px 760px at 92% 10%, rgba(170, 201, 255, 0.58) 0%, rgba(170, 201, 255, 0) 58%),
    linear-gradient(180deg, #eef2ff 0%, #e6ebff 54%, #e2e8fb 100%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page-background);
  background-color: #e7ecff;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  overscroll-behavior-y: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 104, 246, 0.38) rgba(255, 255, 255, 0.18);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

html::-webkit-scrollbar {
  width: 12px;
}

html::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.16);
}

html::-webkit-scrollbar-thumb {
  background: rgba(92, 104, 246, 0.34);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

html::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 104, 246, 0.46);
  border: 3px solid transparent;
  background-clip: content-box;
}

html::-webkit-scrollbar-corner {
  background: transparent;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding:
    calc(40px + var(--safe-top))
    calc(24px + var(--safe-right))
    calc(72px + var(--safe-bottom))
    calc(24px + var(--safe-left));
  position: relative;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  z-index: 2;
}

.lang-switch .toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(72, 84, 141, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 16px rgba(33, 42, 83, 0.06);
}

.lang-switch .toggle-btn {
  min-width: 38px;
  min-height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #65748f;
  font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.lang-switch .toggle-btn:hover {
  color: var(--ink);
  background: rgba(76, 95, 232, 0.08);
}

.lang-switch .toggle-btn:focus-visible {
  outline: 2px solid rgba(92, 104, 246, 0.45);
  outline-offset: 2px;
}

.lang-switch .toggle-btn.is-active {
  background: linear-gradient(135deg, #5664ef, #404eb3 88%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(63, 76, 160, 0.2);
}

p {
  margin: 0;
  color: var(--muted);
  max-width: 700px;
  line-height: 1.6;
}

.status {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(33, 42, 83, 0.06);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(var(--ink-rgb), 0.36);
  transition: background 0.3s ease;
}

.status[data-tone="pending"] {
  background: rgba(142, 121, 246, 0.14);
  color: #5642af;
  border-color: rgba(142, 121, 246, 0.28);
}

.status[data-tone="pending"]::before {
  background: var(--sun);
  animation: pulse 1.4s ease-in-out infinite;
}

.status[data-tone="success"] {
  background: rgba(94, 164, 150, 0.14);
  color: #2f6d63;
  border-color: rgba(94, 164, 150, 0.28);
}

.status[data-tone="success"]::before {
  background: var(--olive);
}

.status[data-tone="error"] {
  background: rgba(217, 92, 132, 0.14);
  color: #873352;
  border-color: rgba(217, 92, 132, 0.28);
}

.status[data-tone="error"]::before {
  background: var(--coral);
}

.status.is-hidden {
  display: none;
}

.panel-status {
  margin-top: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "map"
    "data"
    "chart";
  gap: var(--layout-gap);
  align-items: stretch;
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border-radius: 24px;
  padding: 24px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  animation: liftIn 0.75s ease both;
  animation-delay: var(--delay, 0s);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(92, 104, 246, 0.54), rgba(185, 200, 255, 0.34), rgba(185, 200, 255, 0));
  pointer-events: none;
}

.panel--location {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(237, 243, 255, 0.88) 100%);
  border: 1px solid rgba(92, 104, 246, 0.1);
  box-shadow:
    0 22px 54px rgba(33, 42, 83, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.panel--location::before {
  height: 3px;
  background: linear-gradient(90deg, rgba(92, 104, 246, 0.6), rgba(142, 121, 246, 0.4), rgba(185, 200, 255, 0.2), rgba(185, 200, 255, 0));
}

#panel-map {
  grid-area: map;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  width: min(100%, var(--content-max-width));
  justify-self: center;
  min-height: clamp(400px, 52vh, 560px);
}

#panel-data {
  grid-area: data;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  width: min(100%, var(--content-max-width));
  justify-self: center;
}

#panel-chart {
  grid-area: chart;
  width: min(100%, var(--content-max-width));
  justify-self: center;
}

#panel-map .panel-header {
  justify-items: center;
  text-align: center;
}

.panel-header {
  display: grid;
  gap: 4px;
}

.panel-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(92, 104, 246, 0.18);
  background: rgba(92, 104, 246, 0.08);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.panel-title:hover {
  background: rgba(92, 104, 246, 0.12);
  border-color: rgba(92, 104, 246, 0.24);
}

.panel-body {
  min-height: 0;
}

.panel-body--map {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(250px, 320px);
  gap: 18px;
  min-height: 0;
  align-items: stretch;
}

.map-card {
  position: relative;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(27, 43, 50, 0.08);
  background: var(--panel-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  display: grid;
  gap: 0;
}

/* ── Map search bar ── */

.map-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 44px;
  border-radius: 14px 14px 0 0;
  border-bottom: 1px solid rgba(72, 84, 141, 0.08);
  background: rgba(255, 255, 255, 0.8);
  transition: background 0.2s ease;
}

.map-search-bar:focus-within {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(92, 104, 246, 0.2);
}

.map-search-icon {
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.6;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.map-search-bar:focus-within .map-search-icon {
  opacity: 1;
  color: var(--accent);
}

.map-search-bar input[type="text"] {
  flex: 1;
  min-height: 0 !important;
  height: 100%;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  box-shadow: none !important;
}

.map-search-bar input[type="text"]:focus {
  outline: none;
  border: none !important;
  box-shadow: none !important;
}

.map-search-bar input[type="text"]::placeholder {
  color: var(--muted);
  opacity: 0.55;
  font-weight: 400;
}

.search-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(92, 104, 246, 0.15);
  border-top-color: var(--accent);
  animation: overlaySpinnerRotate 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Search dropdown ── */

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 900;
  display: grid;
  gap: 2px;
  padding: 6px;
  margin-top: 2px;
  border-radius: 14px;
  border: 1px solid rgba(72, 84, 141, 0.1);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow:
    0 12px 40px rgba(30, 36, 66, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  max-height: 260px;
  overflow-y: auto;
  animation: dropdownSlideIn 0.2s ease both;
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--ink);
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: none !important;
}

.search-dropdown-item:hover {
  background: rgba(92, 104, 246, 0.06) !important;
  border-color: rgba(92, 104, 246, 0.1) !important;
}

.search-dropdown-item:active {
  background: rgba(92, 104, 246, 0.1) !important;
}

.search-result-icon {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.5;
}

.search-result-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.search-result-primary {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-secondary {
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map {
  height: 100%;
  min-height: clamp(300px, 40vh, 440px);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  border-top: none;
}

.section-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(27, 43, 50, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 255, 0.9) 100%);
  box-shadow:
    0 16px 30px rgba(33, 42, 83, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.section-card:hover {
  border-color: rgba(92, 104, 246, 0.14);
  box-shadow:
    0 20px 40px rgba(33, 42, 83, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.section-card--date {
  align-content: start;
}

/* ── Section card label ── */

.section-card-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(72, 84, 141, 0.06);
}

.section-card-label svg {
  opacity: 0.8;
  flex-shrink: 0;
}

.form-grid--vertical {
  grid-template-columns: 1fr;
}

.leaflet-control-attribution {
  display: none !important;
}

.coords-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(245, 247, 252, 0.96);
  border: 1px solid rgba(72, 84, 141, 0.1);
  white-space: nowrap;
}

.coords-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coords-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  flex-shrink: 0;
  line-height: 1;
  cursor: default;
  user-select: none;
}

.coords-label-icon {
  opacity: 0.55;
  flex-shrink: 0;
}

.coords-sep {
  width: 1px;
  height: 28px;
  background: rgba(72, 84, 141, 0.14);
  flex-shrink: 0;
}

.coords-input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(72, 84, 141, 0.16);
  border-radius: 10px;
  background: rgba(245, 247, 252, 0.96);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.coords-input-group:hover {
  border-color: rgba(72, 84, 141, 0.26);
}

.coords-input-group:focus-within {
  border-color: rgba(92, 104, 246, 0.45);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(92, 104, 246, 0.14);
}

.coords-bar input[type="text"] {
  width: 70px;
  height: 32px;
  min-height: 32px !important;
  padding: 0 6px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: none !important;
  cursor: text;
}

.coords-bar input[type="text"]:focus {
  outline: none;
  background: transparent !important;
  box-shadow: none !important;
}

.coords-step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  min-height: 32px !important;
  min-width: 28px;
  padding: 0 !important;
  margin: 0;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--accent-deep) !important;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: none !important;
  transition: background 0.12s ease, color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.coords-step-btn:first-child {
  border-right: 1px solid rgba(72, 84, 141, 0.12) !important;
}

.coords-step-btn:last-child {
  border-left: 1px solid rgba(72, 84, 141, 0.12) !important;
}

.coords-step-btn:hover {
  background: rgba(92, 104, 246, 0.1) !important;
  color: var(--accent) !important;
}

.coords-step-btn:active {
  background: rgba(92, 104, 246, 0.18) !important;
  color: var(--accent) !important;
}

.coords-step-btn:focus-visible {
  outline: 2px solid rgba(92, 104, 246, 0.4);
  outline-offset: -2px;
}

.search-dropdown-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 0.86rem;
  color: var(--muted);
  text-align: left;
  line-height: 1.4;
}

.search-dropdown--error .search-dropdown-message {
  color: #b14545;
}

.search-dropdown--searching .search-dropdown-message {
  color: var(--accent-deep);
  opacity: 0.8;
}

.map-search-bar.is-searching .map-search-icon {
  opacity: 1;
  color: var(--accent);
  animation: searchPulse 1s ease-in-out infinite;
}

@keyframes searchPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

button,
input,
select {
  touch-action: manipulation;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(27, 43, 50, 0.16);
  background: rgba(255, 255, 255, 0.96);
  font-size: 0.95rem;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field-stack {
  gap: 8px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover {
  border-color: rgba(27, 43, 50, 0.24);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  outline: none;
  border-color: rgba(92, 104, 246, 0.48);
  box-shadow: 0 0 0 4px rgba(92, 104, 246, 0.12);
  background: #fff;
}

input:not([type="checkbox"]):not([type="radio"]):disabled,
select:disabled {
  cursor: not-allowed;
  color: rgba(27, 43, 50, 0.48);
  background: rgba(244, 247, 247, 0.92);
  border-color: rgba(27, 43, 50, 0.1);
  box-shadow: none;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

.input-field {
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.input-field input::-webkit-outer-spin-button,
.input-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

.gdd-field .input-field input {
  text-align: right;
  padding-right: 52px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

/* ── Date range group ── */

.date-range-group {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}

.date-range-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  color: var(--muted);
  opacity: 0.4;
  padding-top: 20px;
}

/* ── Period and GDD group ── */

.period-gdd-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.date-field input[type="date"] {
  text-align: left;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.chip-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button.chip-action {
  width: auto;
  min-height: 0;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(72, 84, 141, 0.14);
  background: rgba(243, 246, 255, 0.96);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.79rem;
  box-shadow: none;
}

button.chip-action:hover {
  border-color: rgba(92, 104, 246, 0.24);
  background: rgba(237, 241, 255, 1);
  box-shadow: none;
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  max-height: clamp(260px, 38vh, 400px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 104, 246, 0.26) transparent;
}

.chips::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.chips::-webkit-scrollbar-thumb {
  background: rgba(92, 104, 246, 0.26);
  border-radius: 999px;
}

.chips::-webkit-scrollbar-track {
  background: transparent;
}

.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(27, 43, 50, 0.1);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.chip span {
  flex: 1;
  min-width: 0;
}

.chip:hover {
  border-color: rgba(27, 43, 50, 0.2);
  background: rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

.chip:has(input:checked),
.chip.is-checked {
  border-color: rgba(92, 104, 246, 0.28);
  background: linear-gradient(180deg, rgba(242, 244, 255, 0.98) 0%, rgba(234, 239, 255, 0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 12px 22px rgba(66, 79, 154, 0.1);
}

.chip:has(input:checked):hover,
.chip.is-checked:hover {
  border-color: rgba(92, 104, 246, 0.4);
  background: linear-gradient(180deg, rgba(244, 246, 255, 1) 0%, rgba(237, 241, 255, 0.98) 100%);
}

.chip input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1.5px solid rgba(27, 43, 50, 0.2);
  background: rgba(255, 255, 255, 0.98);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.chip input::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 0.16s ease;
}

.chip input:hover {
  border-color: rgba(92, 104, 246, 0.36);
}

.chip input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(92, 104, 246, 0.12);
}

.chip input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.chip input:checked::after {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}

.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

button:not(.toggle-btn):not(.chip-action):not(.button-secondary):not(.coords-step-btn):not(.utility-action):not(.install-guide__close) {
  margin: 0;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, #5e6df6, #404eb6 88%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.96rem;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(66, 79, 154, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

button:not(.toggle-btn):not(.chip-action):not(.button-secondary):not(.coords-step-btn):not(.utility-action):not(.install-guide__close):hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 34px rgba(66, 79, 154, 0.28);
  filter: brightness(1.02);
}

button:not(.toggle-btn):not(.chip-action):not(.button-secondary):not(.coords-step-btn):not(.utility-action):not(.install-guide__close):disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
  filter: none;
}

.action-row {
  display: flex;
  gap: 12px;
  align-self: end;
}

.action-row button {
  flex: 1;
}

button.button-secondary {
  margin: 0;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(92, 104, 246, 0.18);
  background: linear-gradient(135deg, rgba(236, 240, 255, 0.96) 0%, rgba(244, 247, 255, 0.92) 100%);
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.96rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(92, 104, 246, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button.button-secondary svg {
  flex-shrink: 0;
  opacity: 0.7;
}

button.button-secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(92, 104, 246, 0.32);
  background: linear-gradient(135deg, rgba(228, 234, 255, 0.98) 0%, rgba(238, 242, 255, 0.96) 100%);
  box-shadow: 0 8px 20px rgba(92, 104, 246, 0.12);
}

button.button-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.chart-panel {
  display: grid;
  gap: 20px;
}

.chart-block {
  display: grid;
  gap: 10px;
}

.chart-grid {
  display: grid;
  gap: 16px;
}

.chart-item {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(27, 43, 50, 0.07);
  background: #fff;
  box-shadow: 0 2px 12px rgba(33, 42, 83, 0.06);
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chart-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.chart-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  opacity: 0.8;
}

.chart-actions {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.chart-actions button {
  width: auto;
  min-height: 0;
  padding: 9px 14px;
  font-size: 0.84rem;
  gap: 4px;
}

.chart-actions button svg {
  width: 13px;
  height: 13px;
}

.chart-wrap {
  position: relative;
  height: 340px;
  border-radius: 10px;
  background: #fafbfe;
  overflow: hidden;
}

.chart-notes {
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 3px solid rgba(75, 93, 156, 0.2);
  background: rgba(248, 249, 253, 0.9);
  font-size: 0.78rem;
  color: #5a6577;
  line-height: 1.6;
}

.chart-notes-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: #3d4a5c;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.chart-notes-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 5px;
}

.chart-notes-list li::marker {
  color: rgba(75, 93, 156, 0.35);
}

.note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.leaflet-container {
  font-family: inherit;
  background: #e4eafe;
}

.leaflet-container .leaflet-tile {
  outline: 1px solid transparent;
}

/* ── Loading overlay ── */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(30, 36, 66, 0.16);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.loading-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.loading-card {
  display: grid;
  gap: 22px;
  justify-items: center;
  padding: 44px 52px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(239, 244, 255, 0.88) 100%);
  box-shadow:
    0 32px 80px rgba(33, 42, 83, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  max-width: min(88vw, 380px);
  text-align: center;
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.35s ease;
}

.loading-overlay.is-active .loading-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.loading-indicator {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(92, 104, 246, 0.12);
  border-top-color: var(--accent);
  animation: overlaySpinnerRotate 0.85s linear infinite;
}

.loading-icon {
  position: absolute;
  width: 30px;
  height: 30px;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.loading-icon--success { color: #2f8a6d; }
.loading-icon--error   { color: #c04060; }

/* State: pending — spinner visible, icons hidden */
.loading-overlay[data-state="pending"] .loading-spinner { display: block; }
.loading-overlay[data-state="pending"] .loading-icon   { display: none; }

/* State: success — spinner hidden, checkmark visible */
.loading-overlay[data-state="success"] .loading-spinner,
.loading-overlay[data-state="error"]   .loading-spinner {
  display: none;
}

.loading-overlay[data-state="success"] .loading-icon--success,
.loading-overlay[data-state="error"]   .loading-icon--error {
  opacity: 1;
  transform: scale(1);
}

.loading-text {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.55;
  max-width: 300px;
}

@keyframes overlaySpinnerRotate {
  to { transform: rotate(360deg); }
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

@media (max-width: 1080px) {
  #panel-map {
    min-height: auto;
    width: 100%;
  }

  #panel-data,
  #panel-chart {
    width: 100%;
    justify-self: stretch;
  }

  .panel-body--map {
    grid-template-columns: 1fr;
  }

  .map {
    min-height: clamp(260px, 42vh, 380px);
  }

  .chips {
    max-height: none;
  }

  .section-card--date {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .shell {
    padding:
      calc(24px + var(--safe-top))
      calc(14px + var(--safe-right))
      calc(48px + var(--safe-bottom))
      calc(14px + var(--safe-left));
  }

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .map {
    min-height: clamp(240px, 38vh, 340px);
  }

  .map-search-bar {
    border-radius: 12px 12px 0 0;
    height: 42px;
  }

  .coords-bar {
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .coords-label {
    font-size: 0.58rem;
  }

  .coords-label > span {
    display: none;
  }

  .coords-label {
    gap: 0;
  }

  .coords-bar input[type="text"] {
    width: 64px;
    height: 30px;
    font-size: 0.82rem;
  }

  .coords-step-btn {
    width: 26px;
    height: 30px;
    font-size: 0.95rem;
  }

  .coords-sep {
    height: 22px;
  }

  .date-range-group {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .date-range-connector {
    display: none;
  }

  .period-gdd-group {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .section-card {
    padding: 16px;
    border-radius: 18px;
  }

  .chips {
    grid-template-columns: 1fr;
  }

  .action-row {
    flex-direction: column;
  }

  .chart-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-actions {
    justify-content: flex-start;
  }

  .chart-wrap {
    height: 260px;
  }

  .loading-card {
    padding: 36px 28px;
  }
}

/* ── Extra-small mobile (320px-390px) ── */

@media (max-width: 420px) {
  .shell {
    padding:
      calc(20px + var(--safe-top))
      calc(10px + var(--safe-right))
      calc(40px + var(--safe-bottom))
      calc(10px + var(--safe-left));
  }

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .panel-title {
    font-size: 0.72rem;
    padding: 7px 12px;
  }

  .map {
    min-height: 220px;
  }

  .map-card {
    padding: 6px;
    border-radius: 16px;
  }

  .map-search-bar {
    height: 40px;
    padding: 0 10px;
    border-radius: 10px 10px 0 0;
  }

  .coords-bar {
    gap: 4px;
    padding: 6px;
    border-radius: 10px;
  }

  .coords-bar input[type="text"] {
    width: 58px;
    height: 28px;
    font-size: 0.78rem;
  }

  .coords-step-btn {
    width: 24px;
    height: 28px;
    font-size: 0.9rem;
  }

  .coords-sep {
    height: 20px;
  }

  .section-card {
    padding: 14px;
    border-radius: 16px;
  }

  .period-gdd-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .field-label {
    font-size: 0.78rem;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.92rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]),
  select {
    font-size: 16px;
  }
}

/* Premium workspace overrides */

:root {
  --ink: #142033;
  --ink-rgb: 20, 32, 51;
  --muted: #61708a;
  --accent: #4c5fe8;
  --accent-deep: #3647b7;
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(249, 251, 255, 0.92) 100%);
  --panel-muted: linear-gradient(180deg, rgba(252, 253, 255, 0.96) 0%, rgba(244, 247, 252, 0.94) 100%);
  --stroke: rgba(72, 92, 138, 0.12);
  --shadow: 0 22px 48px rgba(17, 27, 54, 0.08), 0 8px 20px rgba(17, 27, 54, 0.04);
  --page-background:
    radial-gradient(880px 520px at 0% 0%, rgba(104, 121, 241, 0.1) 0%, rgba(104, 121, 241, 0) 62%),
    radial-gradient(920px 640px at 100% 0%, rgba(117, 152, 226, 0.12) 0%, rgba(117, 152, 226, 0) 58%),
    linear-gradient(180deg, #f3f6fb 0%, #eef2f8 52%, #edf1f7 100%);
}

html,
body {
  background: var(--page-background);
  background-color: #edf2f8;
}

body {
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
}

.shell {
  max-width: 1360px;
  padding:
    calc(28px + var(--safe-top))
    calc(24px + var(--safe-right))
    calc(44px + var(--safe-bottom))
    calc(24px + var(--safe-left));
}

.app-shell {
  position: relative;
  display: grid;
  gap: 24px;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 12px 0 auto auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 95, 232, 0.08) 0%, rgba(76, 95, 232, 0) 72%);
  pointer-events: none;
  filter: blur(2px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-meta {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.topbar-name {
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #1a2750;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.panel {
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(70, 88, 142, 0.12);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::before {
  height: 1px;
  background: linear-gradient(90deg, rgba(76, 95, 232, 0.18), rgba(76, 95, 232, 0.02) 72%);
}

.panel--location,
.panel--control,
#panel-chart {
  border-color: rgba(70, 88, 142, 0.11);
}

.panel--location {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.94) 100%);
  box-shadow: var(--shadow);
}

.panel--location::before,
.panel--control::before,
#panel-chart::before {
  height: 1px;
  background: linear-gradient(90deg, rgba(76, 95, 232, 0.18), rgba(76, 95, 232, 0.02) 72%);
}

#panel-map {
  width: 100%;
  min-height: 720px;
  justify-self: stretch;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 22px;
}

#panel-data {
  width: 100%;
  justify-self: stretch;
  min-height: 720px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
}

#panel-chart {
  width: 100%;
}

.panel-header,
#panel-map .panel-header {
  justify-items: start;
  text-align: left;
}

.panel-heading {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.panel-title,
.panel-title:hover {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: none;
}

.panel-subtitle {
  margin: 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.panel-body--map {
  display: block;
  min-height: 0;
}

.map-card {
  min-height: 100%;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(71, 90, 138, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(246, 249, 255, 0.92) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 14px 30px rgba(20, 32, 51, 0.06);
  overflow: hidden;
}

.map {
  min-height: 600px;
  border: 1px solid rgba(71, 90, 138, 0.1);
  border-top: none;
  border-radius: 0 0 18px 18px;
  background: #dfe7f3;
}

.leaflet-container {
  font-family: "Inter", "Segoe UI", sans-serif;
}

.leaflet-control-attribution {
  display: block !important;
  margin: 0 14px 14px 0 !important;
  padding: 6px 8px !important;
  border-radius: 10px;
  border: 1px solid rgba(71, 90, 138, 0.12);
  background: rgba(255, 255, 255, 0.92) !important;
  color: #5c6880 !important;
  box-shadow: 0 8px 18px rgba(20, 32, 51, 0.08);
}

.leaflet-control-attribution a {
  color: #4254d1 !important;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 16px 28px rgba(20, 32, 51, 0.12) !important;
}

.leaflet-touch .leaflet-bar,
.leaflet-touch .leaflet-control-layers {
  border: 1px solid rgba(71, 90, 138, 0.12);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  overflow: hidden;
}

.leaflet-touch .leaflet-bar a {
  width: 42px;
  height: 42px;
  line-height: 40px;
  border-bottom-color: rgba(71, 90, 138, 0.1);
  color: var(--ink);
  background: transparent;
}

.leaflet-touch .leaflet-bar a:hover {
  background: rgba(76, 95, 232, 0.06);
  color: var(--accent-deep);
}

.control-stack {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  height: 100%;
  min-height: 0;
}

.section-card {
  gap: 16px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(71, 90, 138, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 255, 0.94) 100%);
  box-shadow: 0 14px 28px rgba(20, 32, 51, 0.05);
}

.section-card:hover {
  border-color: rgba(76, 95, 232, 0.16);
  box-shadow: 0 16px 30px rgba(20, 32, 51, 0.06);
}

.section-card--date {
  background: linear-gradient(180deg, rgba(252, 253, 255, 0.98) 0%, rgba(244, 247, 255, 0.95) 100%);
}

.section-card--metrics {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.section-card-head {
  display: grid;
  gap: 8px;
}

.section-card-label {
  gap: 8px;
  padding: 0;
  border: none;
  color: #5f6f8d;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.section-card-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

label {
  color: #4b5a74;
}

.field-stack {
  gap: 10px;
}

.field-label {
  color: #36435d;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(71, 90, 138, 0.16);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover {
  border-color: rgba(71, 90, 138, 0.24);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  border-color: rgba(76, 95, 232, 0.42);
  box-shadow:
    0 0 0 4px rgba(76, 95, 232, 0.11),
    0 10px 20px rgba(76, 95, 232, 0.06);
  background: #fff;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, #77839b 50%),
    linear-gradient(135deg, #77839b 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
}

.input-unit {
  right: 16px;
  color: #6c7892;
  font-family: "Manrope", "Inter", sans-serif;
}

.gdd-field .input-field input {
  padding-right: 54px;
}

.date-range-group {
  grid-template-columns: 1fr 28px 1fr;
  gap: 12px;
}

.date-range-connector {
  height: 48px;
  padding-top: 24px;
  color: #7e8aa2;
  opacity: 0.75;
}

.period-gdd-group {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chip-actions {
  gap: 10px;
}

button.chip-action {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(71, 90, 138, 0.12);
  background: rgba(245, 247, 252, 0.98);
  color: #33415d;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

button.chip-action:hover {
  border-color: rgba(76, 95, 232, 0.18);
  background: rgba(238, 242, 251, 1);
}

.chips {
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.chip {
  gap: 12px;
  min-height: 52px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(71, 90, 138, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 253, 0.98) 100%);
  font-size: 0.88rem;
  line-height: 1.45;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chip:hover {
  transform: none;
  border-color: rgba(71, 90, 138, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 255, 1) 100%);
}

.chip:has(input:checked),
.chip.is-checked {
  border-color: rgba(76, 95, 232, 0.22);
  background: linear-gradient(180deg, rgba(242, 245, 255, 0.98) 0%, rgba(236, 241, 255, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.chip input {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border-width: 1.5px;
}

.chip input:focus-visible {
  box-shadow: 0 0 0 4px rgba(76, 95, 232, 0.12);
}

.control-footer {
  display: grid;
  gap: 12px;
  align-self: end;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#fetch-btn,
button.button-secondary {
  min-height: 50px;
  border-radius: 16px;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#fetch-btn {
  border: 1px solid rgba(62, 79, 194, 0.18);
  background: linear-gradient(180deg, #4f62eb 0%, #4254d1 100%);
  box-shadow: 0 16px 24px rgba(66, 84, 209, 0.22);
}

#fetch-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(66, 84, 209, 0.26);
}

button.button-secondary {
  border: 1px solid rgba(71, 90, 138, 0.12);
  background: rgba(255, 255, 255, 0.98);
  color: #31405d;
  box-shadow: 0 10px 18px rgba(20, 32, 51, 0.06);
}

button.button-secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(76, 95, 232, 0.18);
  background: rgba(248, 250, 255, 1);
  box-shadow: 0 14px 22px rgba(20, 32, 51, 0.08);
}

.status {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  border-color: rgba(71, 90, 138, 0.12);
  background: rgba(246, 248, 252, 0.96);
  box-shadow: none;
  font-size: 0.87rem;
}

.panel-status {
  margin-top: 0;
}

.chart-panel {
  gap: 18px;
}

.chart-title {
  font-family: "Manrope", "Inter", sans-serif;
}

.chart-subtitle,
.note {
  color: var(--muted);
}

.map-marker-icon {
  background: transparent;
  border: none;
}

.map-marker {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.map-marker::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4f62eb 0%, #3d4fc4 100%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 10px 18px rgba(61, 79, 196, 0.26),
    0 0 0 6px rgba(79, 98, 235, 0.16);
}

.map-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

@media (max-width: 1180px) {
  #panel-map,
  #panel-data {
    min-height: auto;
  }

  .map {
    min-height: 480px;
  }

  .control-stack {
    grid-template-rows: auto auto auto;
  }

  .section-card--metrics .chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .shell {
    padding:
      calc(20px + var(--safe-top))
      calc(16px + var(--safe-right))
      calc(36px + var(--safe-bottom))
      calc(16px + var(--safe-left));
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .map {
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  .panel {
    padding: 20px;
    border-radius: 24px;
  }

  .map-card {
    padding: 10px;
    border-radius: 20px;
  }

  .map {
    min-height: 360px;
  }

  .date-range-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .date-range-connector {
    display: none;
  }

  .period-gdd-group,
  .action-row {
    grid-template-columns: 1fr;
  }

  .section-card--metrics .chips {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell {
    padding:
      calc(16px + var(--safe-top))
      calc(12px + var(--safe-right))
      calc(28px + var(--safe-bottom))
      calc(12px + var(--safe-left));
  }

  .topbar-actions {
    gap: 10px;
  }

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .panel-subtitle,
  .section-card-caption {
    font-size: 0.84rem;
  }

  .map-search-bar {
    height: 48px;
    padding: 0 14px;
  }

  .map {
    min-height: 300px;
  }
}

/* Context alignment overrides */

:root {
  --ink: #1e2442;
  --ink-rgb: 30, 36, 66;
  --muted: #6f789c;
  --content-max-width: 1040px;
  --layout-gap: 20px;
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(239, 244, 255, 0.84) 100%);
  --panel-muted: linear-gradient(180deg, rgba(241, 245, 255, 0.92) 0%, rgba(232, 238, 255, 0.84) 100%);
  --stroke: rgba(72, 84, 141, 0.14);
  --accent: #5c68f6;
  --accent-deep: #3947ac;
  --sun: #8e79f6;
  --coral: #d95c84;
  --olive: #5ea496;
  --shadow: 0 22px 54px rgba(33, 42, 83, 0.16);
  --page-background:
    radial-gradient(1180px 860px at 8% 10%, rgba(186, 168, 255, 0.52) 0%, rgba(186, 168, 255, 0) 60%),
    radial-gradient(980px 760px at 92% 10%, rgba(170, 201, 255, 0.58) 0%, rgba(170, 201, 255, 0) 58%),
    linear-gradient(180deg, #eef2ff 0%, #e6ebff 54%, #e2e8fb 100%);
}

body {
  font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 2000;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
  box-shadow: 0 12px 26px rgba(33, 42, 83, 0.12);
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  max-width: 1160px;
  padding:
    calc(36px + var(--safe-top))
    calc(24px + var(--safe-right))
    calc(64px + var(--safe-bottom))
    calc(24px + var(--safe-left));
}

.app-shell {
  gap: 18px;
}

.app-shell::before {
  display: none;
}

#panel-map,
#panel-data,
#panel-chart {
  width: min(100%, var(--content-max-width));
  justify-self: center;
}

.topbar {
  width: min(100%, var(--content-max-width));
  margin-inline: auto;
  gap: 12px;
}

.topbar-name {
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.topbar-actions {
  gap: 10px;
}

.panel {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel::before,
.panel--location::before,
.panel--control::before,
#panel-chart::before {
  height: 3px;
  background: linear-gradient(90deg, rgba(92, 104, 246, 0.54), rgba(185, 200, 255, 0.34), rgba(185, 200, 255, 0));
}

.panel--location {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(237, 243, 255, 0.88) 100%);
  border: 1px solid rgba(92, 104, 246, 0.1);
  box-shadow:
    0 22px 54px rgba(33, 42, 83, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.panel--location::before {
  background: linear-gradient(90deg, rgba(92, 104, 246, 0.6), rgba(142, 121, 246, 0.4), rgba(185, 200, 255, 0.2), rgba(185, 200, 255, 0));
}

#panel-map {
  min-height: clamp(400px, 52vh, 560px);
}

#panel-data {
  min-height: auto;
}

.panel-heading {
  gap: 8px;
}

.panel-title,
.panel-title:hover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(92, 104, 246, 0.18);
  background: rgba(92, 104, 246, 0.08);
  color: var(--accent-deep);
  font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: none;
}

.panel-subtitle {
  max-width: 42ch;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--muted);
}

.map-card {
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(27, 43, 50, 0.08);
  background: var(--panel-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.map {
  min-height: clamp(300px, 40vh, 440px);
  border-radius: 0 0 16px 16px;
  border: 1px solid var(--stroke);
  border-top: none;
}

.leaflet-control-attribution {
  display: none !important;
}

.section-card {
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(27, 43, 50, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 245, 255, 0.9) 100%);
  box-shadow:
    0 16px 30px rgba(33, 42, 83, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.section-card--date {
  gap: 18px;
}

.section-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.section-card-caption {
  font-size: 0.8rem;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
}

.section-card--date .field-label {
  color: #33415d;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
}

.section-card--date input:not([type="checkbox"]):not([type="radio"]),
.section-card--date select {
  min-height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(72, 84, 141, 0.16);
  background: rgba(255, 255, 255, 0.98);
  color: #24314d;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 1px 0 rgba(255, 255, 255, 0.7);
}

.section-card--date input:not([type="checkbox"]):not([type="radio"]):hover,
.section-card--date select:hover {
  border-color: rgba(72, 84, 141, 0.24);
}

.section-card--date input:not([type="checkbox"]):not([type="radio"]):focus,
.section-card--date select:focus {
  border-color: rgba(92, 104, 246, 0.4);
  box-shadow:
    0 0 0 4px rgba(92, 104, 246, 0.1),
    0 10px 18px rgba(63, 76, 160, 0.08);
}

.date-range-group {
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
}

.date-range-connector {
  height: 44px;
  padding-top: 20px;
  opacity: 0.4;
}

.chips {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  min-height: 0;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.84rem;
}

.chip input {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.input-field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 50px;
}

.input-glyph {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5c6bdd;
  opacity: 0.85;
}

.input-field--date input {
  padding-right: 48px !important;
}

.input-field--date input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.input-field--select select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none !important;
  padding-right: 46px !important;
  cursor: pointer;
}

.input-field--select .input-glyph {
  right: 18px;
}

.section-card--date .input-field:hover .input-glyph,
.section-card--date .input-field:focus-within .input-glyph {
  color: #4f5ddd;
}

.input-field--number input {
  appearance: textfield;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.input-field--number input::-webkit-outer-spin-button,
.input-field--number input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gdd-field .input-field input {
  text-align: left;
  font-variant-numeric: tabular-nums;
  padding-right: 54px !important;
}

.date-field input[type="date"],
.gdd-field .input-field input,
.input-field--select select {
  letter-spacing: 0.01em;
}

.date-range-group {
  gap: 12px;
}

.date-range-connector {
  height: 50px;
  padding-top: 22px;
  color: #6774cc;
  opacity: 1;
}

.date-range-connector svg {
  width: 20px;
  height: 20px;
}

.section-card--date .section-card-label svg,
.section-card--date .date-range-connector svg,
.input-glyph svg {
  display: block;
}

.period-gdd-group {
  gap: 14px;
}

.action-row {
  display: flex;
  gap: 12px;
}

.action-row button {
  flex: 1;
}

#fetch-btn,
button.button-secondary {
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
}

#fetch-btn {
  background: linear-gradient(135deg, #5e6df6, #404eb6 88%);
}

.status {
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(33, 42, 83, 0.06);
}

.map-marker::before {
  box-shadow: 0 10px 20px rgba(63, 76, 160, 0.24);
}


@media (max-width: 767px) {
  .shell {
    padding:
      calc(24px + var(--safe-top))
      calc(14px + var(--safe-right))
      calc(48px + var(--safe-bottom))
      calc(14px + var(--safe-left));
  }

  .panel {
    padding: 16px;
  }

  .chips {
    grid-template-columns: 1fr;
  }

  .date-range-group {
    grid-template-columns: 1fr;
  }

  .date-range-connector {
    display: none;
  }

  .action-row {
    flex-direction: column;
  }

}

@media (max-width: 420px) {
  .panel {
    padding: 16px;
    border-radius: 20px;
  }
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-brand-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(70, 88, 142, 0.12);
  background: #fff;
  box-shadow: 0 10px 22px rgba(20, 32, 51, 0.08);
}

.topbar-brand-icon img,
.topbar-brand-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.topbar-brand-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.topbar-caption {
  margin: 0;
  font-size: 0.88rem;
  color: #66739b;
  max-width: 38ch;
  line-height: 1.35;
}

.topbar-actions {
  gap: 12px;
}

button.utility-action {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(72, 84, 141, 0.14);
  background: rgba(255, 255, 255, 0.85);
  color: #4352bd;
  box-shadow: 0 6px 16px rgba(33, 42, 83, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

button.utility-action:hover {
  transform: translateY(-1px);
  border-color: rgba(92, 104, 246, 0.32);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 20px rgba(33, 42, 83, 0.10);
}

button.utility-action:focus-visible,
button.install-guide__close:focus-visible {
  outline: 3px solid rgba(92, 104, 246, 0.32);
  outline-offset: 2px;
}

button.utility-action[hidden] {
  display: none !important;
}

.utility-action__icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.utility-action__icon svg,
.install-guide__close svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.utility-action--manual {
  color: #236c84;
}

button.utility-action--manual:hover {
  border-color: rgba(46, 127, 154, 0.32);
}

.install-guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(23, 31, 62, 0.34);
  backdrop-filter: blur(8px);
}

.install-guide {
  position: fixed;
  top: max(20px, calc(var(--safe-top) + 14px));
  right: max(16px, calc(var(--safe-right) + 16px));
  z-index: 1201;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(72, 84, 141, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(239, 244, 255, 0.94) 100%);
  box-shadow: 0 28px 56px rgba(20, 28, 60, 0.22);
}

.install-guide__header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
}

.install-guide__eyebrow {
  grid-column: 1 / 2;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5c6aa2;
}

.install-guide__title {
  margin: 0;
  grid-column: 1 / 2;
  font-size: 1.25rem;
  line-height: 1.2;
  color: #18214a;
}

button.install-guide__close {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(72, 84, 141, 0.12);
  background: rgba(244, 247, 255, 0.92);
  color: #4f5c90;
  box-shadow: none;
}

button.install-guide__close:hover {
  transform: none;
  background: rgba(236, 241, 255, 0.98);
  border-color: rgba(92, 104, 246, 0.22);
  box-shadow: none;
}

.install-guide__summary {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.65;
  color: #53607f;
}

.install-guide__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.install-guide__step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(72, 84, 141, 0.1);
  background: rgba(255, 255, 255, 0.74);
}

.install-guide__step-badge {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(92, 104, 246, 0.12);
  color: #4352bd;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.install-guide__step-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #213054;
}

@media (max-width: 767px) {
  .topbar {
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
    width: 100%;
  }

  .topbar-caption {
    display: none;
  }

  .install-guide {
    top: auto;
    right: 16px;
    left: 16px;
    bottom: max(12px, calc(var(--safe-bottom) + 12px));
    width: auto;
    max-height: min(72vh, 560px);
    overflow-y: auto;
  }
}

@media (max-width: 540px) {
  .topbar-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .topbar-brand-icon img,
  .topbar-brand-icon svg {
    width: 100%;
    height: 100%;
  }

  .topbar-name {
    font-size: 1.15rem;
  }
}

@media (prefers-contrast: more) {
  button.utility-action,
  button.install-guide__close,
  .chip,
  .panel,
  .section-card {
    border-color: rgba(27, 43, 50, 0.32);
  }

  .status {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  .install-guide-backdrop {
    background: rgba(0, 0, 0, 0.55);
  }

  button.utility-action,
  button.install-guide__close,
  .chip,
  .panel,
  .section-card,
  .status {
    forced-color-adjust: auto;
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body.install-guide-open {
  overflow: hidden;
}

.chart-actions button,
button.chip-action {
  min-height: 44px;
}

.install-guide[data-mode="ios-manual"] {
  border-top: 4px solid #1f7a7b;
}

.install-guide[data-mode="mac-manual"] {
  border-top: 4px solid #4352bd;
}

.install-guide[data-mode="firefox-android-manual"] {
  border-top: 4px solid #b55b19;
}

.install-guide__summary {
  color: #32415f;
  font-weight: 600;
}

.install-guide__step {
  min-height: 68px;
}

.install-guide__step-badge {
  width: 32px;
  height: 32px;
  font-size: 0.88rem;
}

@media (max-width: 540px) {
  .topbar-actions {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
}
