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

#map {
  width: 100%;
  height: 100%;
  font-family: "Sarabun", sans-serif;
}

/* Leaflet control ต้องอยู่เหนือ tile แต่ไม่ควรทับ panel ฝั่งขวา */
.leaflet-control {
  z-index: 800;
}

.leaflet-draw-control {
  display: none;
}

.leaflet-editing-icon {
  width: 12px !important;
  height: 12px !important;
  margin-left: -7px !important;
  margin-top: -7px !important;
  box-sizing: border-box;
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.95), 0 2px 8px rgba(15, 23, 42, 0.45);
}

/* Layer control ซ้ายบนวางห่างจาก zoom control เล็กน้อย */
.leaflet-left .leaflet-control-layers {
  margin-left: 10px;
  margin-top: 10px;
}

.leaflet-control-layers-expanded {
  max-width: min(280px, calc(100vw - 24px));
  max-height: 60vh;
  overflow-y: auto;
}

.mobile-layer-drawer-header,
.mobile-layer-drawer-scrim {
  display: none;
}

.location-panel,
.result-panel {
  /* Panel หลักลอยทับแผนที่ แต่ยังต่ำกว่า popup ที่ต้องเห็นชัด */
  position: fixed;
  right: 16px;
  z-index: 1000;
  width: min(390px, calc(100vw - 32px));
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d6d9de;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.location-panel {
  top: 16px;
  display: flex;
  flex-direction: column;
}

.app-sidebar .location-panel:not(.is-open):not(.is-mobile-open) {
  display: none;
}

body > .mobile-location-launcher:not([hidden]) {
  position: fixed;
  right: 16px;
  bottom: 42px;
  z-index: 950;
}

.result-panel {
  top: 294px;
  bottom: 16px;
  display: none;
}

.result-panel.is-open {
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.panel-header h2 {
  margin: 0;
  color: #111827;
  font-size: 18px;
  font-weight: 700;
}

.mobile-location-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid #0f766e;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
}

.mobile-location-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #0f766e;
  color: #ffffff;
  line-height: 1;
}

.mobile-point-actions {
  display: none;
}

.mobile-point-confirm {
  display: none;
  min-width: 182px;
  min-height: 52px;
  padding: 13px 22px;
  cursor: pointer;
  border: 1px solid #0d9488;
  border-radius: 999px;
  background: #0f766e;
  color: #ffffff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.32);
}

.mobile-line-summary-button {
  min-width: 0;
  white-space: normal;
}

.mobile-line-summary-button[aria-busy="true"] {
  cursor: wait;
}

.mobile-line-summary-status {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
}

.mobile-line-summary-status.is-success {
  color: #166534;
}

.mobile-line-summary-status.is-error {
  color: #b91c1c;
}

.location-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-content {
  overflow: auto;
  padding: 14px 16px 20px;
}

.location-status,
.location-instruction {
  margin: 0 0 10px;
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
}

.location-instruction {
  color: #6b7280;
}

.location-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.location-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.location-actions.has-line-summary {
  grid-template-columns: 1fr;
}

.line-summary-button {
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.line-summary-status {
  margin: 10px 0 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.45;
}

.line-summary-status.is-success {
  color: #166534;
}

.line-summary-status.is-error {
  color: #b91c1c;
}

.result-section {
  padding: 12px 0;
  border-bottom: 1px solid #eef0f3;
}

.result-section:last-child {
  border-bottom: 0;
}

.result-section h3,
.map-popup h3 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 16px;
}

.parcel-result-card {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.parcel-result-card:last-child {
  margin-bottom: 0;
}

.parcel-result-card-title,
.parcel-result-card > h3,
.parcel-crop-result.parcel-result-card > h3 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.parcel-result-card-body,
.parcel-hazard-card-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.result-list,
.popup-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.result-field {
  display: grid;
  grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
  gap: 10px;
}

.result-label,
.result-value {
  min-width: 0;
  margin: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.result-label {
  color: #6b7280;
  font-weight: 700;
}

.result-value {
  font-weight: 400;
}

.coordinate-map-link {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 0;
  color: #0f766e;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.coordinate-map-link:hover,
.coordinate-map-link:active {
  color: #115e59;
}

.coordinate-map-link:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.result-message,
.popup-message {
  margin: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.parcel-suitability-section {
  display: grid;
  gap: 16px;
}

.parcel-crop-result {
  display: grid;
  gap: 10px;
}

.parcel-suitability-section .parcel-crop-result + .parcel-crop-result {
  padding-top: 14px;
  border-top: 1px solid #eef0f3;
}

.parcel-crop-result__title {
  margin: 0;
  color: #111827;
  font-size: 16px;
}

.parcel-crop-result__primary,
.parcel-crop-result__distribution {
  display: grid;
  gap: 8px;
}

.parcel-crop-result__summary-label,
.parcel-crop-result__distribution-title {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.45;
}

.parcel-crop-result__primary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.parcel-crop-result__primary-label,
.parcel-crop-result__primary-percent,
.parcel-crop-result__primary-metrics,
.parcel-crop-result__distribution-class,
.parcel-crop-result__distribution-metrics,
.parcel-suitability-source {
  min-width: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.5;
}

.parcel-crop-result__primary-label {
  font-weight: 700;
  color: #111827;
}

.parcel-crop-result__primary-percent {
  color: #4b5563;
  font-weight: 700;
}

.parcel-crop-result__distribution-list {
  display: grid;
  gap: 8px;
}

.parcel-crop-result__distribution-item {
  display: grid;
  gap: 2px;
}

.parcel-crop-result__distribution-class {
  font-weight: 600;
  color: #111827;
}

.parcel-suitability-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.parcel-suitability-badge.status-s1 {
  background: #15803d;
  color: #ffffff;
}

.parcel-suitability-badge.status-s2 {
  background: #ca8a04;
  color: #111827;
}

.parcel-suitability-badge.status-s3 {
  background: #ea580c;
  color: #ffffff;
}

.parcel-suitability-badge.status-n {
  background: #dc2626;
  color: #ffffff;
}

.parcel-suitability-badge.status-no-coverage {
  background: #94a3b8;
  color: #ffffff;
}

.parcel-suitability-source {
  padding-top: 4px;
  color: #6b7280;
  font-size: 13px;
}

.suitability-summary-card {
  /* Card สรุปด้านบนบอกผลจากชั้นข้อมูล Potential ก่อนเปิดดูรายละเอียด */
  display: grid;
  gap: 14px;
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid #d6d9de;
  border-radius: 8px;
  background: #ffffff;
}

.suitability-card-header {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.suitability-grade {
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.suitability-label {
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.status-not-evaluated {
  background: #f8fafc;
}

.status-not-evaluated .suitability-grade {
  background: #e5e7eb;
  color: #374151;
}

.status-s1 {
  background: #f0fdf4;
}

.status-s1 .suitability-grade {
  background: #15803d;
  color: #ffffff;
}

.status-s2 {
  background: #fefce8;
}

.status-s2 .suitability-grade {
  background: #ca8a04;
  color: #111827;
}

.status-s3 {
  background: #fff7ed;
}

.status-s3 .suitability-grade {
  background: #ea580c;
  color: #ffffff;
}

.status-n {
  background: #fef2f2;
}

.status-n .suitability-grade {
  background: #dc2626;
  color: #ffffff;
}

.status-no-coverage {
  background: #f8fafc;
}

.status-no-coverage .suitability-grade {
  background: #94a3b8;
  color: #ffffff;
}

.suitability-card-body {
  display: grid;
  gap: 14px;
  padding: 0 16px;
}

.summary-card-group {
  display: grid;
  gap: 8px;
}

.parcel-hazard-subcard {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

.parcel-hazard-tambon {
  min-width: 0;
}

.parcel-hazard-tambon h5 {
  margin: 0;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.summary-card-group h4 {
  margin: 0;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}

.summary-card-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.summary-card-row {
  display: grid;
  grid-template-columns: minmax(112px, 40%) minmax(0, 1fr);
  gap: 10px;
}

.summary-card-label,
.summary-card-value {
  min-width: 0;
  margin: 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.summary-card-label {
  color: #6b7280;
  font-weight: 700;
}

.summary-card-value {
  font-weight: 400;
}

.summary-card-message {
  margin: 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
}

.suitability-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 16px 14px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.suitability-status-pill {
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.summary-coordinate {
  color: #4b5563;
  font-size: 12px;
  line-height: 1.4;
}

.map-popup {
  min-width: 220px;
}

.map-popup .result-field {
  grid-template-columns: 90px 1fr;
}

.hazard-popup p {
  margin: 4px 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.45;
}

.hazard-popup-note {
  color: #6b7280 !important;
}

.hazard-legend[hidden] {
  display: none !important;
}

.hazard-legend {
  display: grid;
  gap: 10px;
  max-width: min(260px, calc(100vw - 32px));
  max-height: min(46dvh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d6d9de;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  color: #111827;
  font: 13px/1.4 "Sarabun", sans-serif;
}

.hazard-legend-content {
  display: grid;
  gap: 10px;
}

.hazard-legend-sections {
  display: grid;
  gap: 10px;
}

.hazard-legend-sheet-header,
.hazard-legend-tabs {
  display: none;
}

.hazard-legend-mobile-toggle {
  display: none;
}

.hazard-legend-section {
  display: grid;
  gap: 6px;
}

.hazard-legend-section + .hazard-legend-section {
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.hazard-legend h4 {
  margin: 0;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
}

.hazard-legend-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.hazard-legend-swatch {
  width: 18px;
  height: 14px;
  border: 1px solid rgba(15, 23, 42, 0.28);
  border-radius: 3px;
}

.hazard-legend-note {
  margin: 2px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.45;
}

.saved-parcel-selection-status[hidden] {
  display: none;
}

.saved-parcel-selection-status {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 950;
  display: flex;
  box-sizing: border-box;
  max-width: min(260px, calc(100% - 32px));
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  font: 600 13px/1.3 "Sarabun", sans-serif;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.saved-parcel-selection-spinner {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid #99f6e4;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: saved-parcel-selection-spin 0.8s linear infinite;
}

.saved-parcel-selection-retry {
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #0f766e;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}

@keyframes saved-parcel-selection-spin {
  to { transform: rotate(360deg); }
}

.point-popup-result-button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #0f766e;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.point-popup-result-button:hover,
.point-popup-result-button:active {
  border-color: #115e59;
  background: #115e59;
}

.parcel-draw-control {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d6d9de;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.parcel-draw-control .panel-button {
  min-height: 38px;
}

.mobile-parcel-draw-hud {
  display: none;
}

.temporary-parcel-panel[hidden],
.result-panel[hidden] {
  display: none !important;
}

.temporary-parcel-panel {
  position: absolute;
  top: 0;
  left: calc(100% + 10px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100vw - 190px));
  max-height: min(60dvh, 560px);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d6d9de;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.temporary-parcel-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.temporary-parcel-panel-header h2 {
  margin: 0;
  color: #111827;
  font-size: 17px;
  font-weight: 700;
}

.temporary-parcel-panel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 18px;
  -webkit-overflow-scrolling: touch;
}

.temporary-parcel-panel > .parcel-note {
  flex: 0 0 auto;
  padding: 0 12px 12px;
}

.parcel-section {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.parcel-section h3 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 15px;
}

.parcel-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow-x: hidden;
}

.parcel-list.temporary-parcel-panel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parcel-empty,
.parcel-note {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.45;
}

.parcel-item {
  display: block;
  flex: 0 0 auto;
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 66px;
  height: auto;
  margin: 0;
  overflow: visible;
  box-sizing: border-box;
  border: 1px solid #d6d9de;
  border-radius: 8px;
  background: #f8fafc;
}

.parcel-item.is-selected {
  border-color: #0f766e;
  box-shadow: inset 0 0 0 1px #0f766e;
  background: #f0fdfa;
}

.parcel-item-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  height: auto;
  box-sizing: border-box;
  padding: 10px 12px;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.parcel-item-title {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 4px;
  overflow: hidden;
}

.parcel-item-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.parcel-item-name {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parcel-item-index {
  flex: 0 0 auto;
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.parcel-item-status {
  min-width: 0;
  overflow: hidden;
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.parcel-item-chevron {
  flex: 0 0 auto;
  color: #0f766e;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.parcel-item-actions {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(40px, auto);
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 0 12px 12px;
  box-sizing: border-box;
}

.parcel-item-actions[hidden] {
  display: none !important;
}

.parcel-action {
  cursor: pointer;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
}

.parcel-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
}

.parcel-modal {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 18px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
}

.parcel-modal h3 {
  margin: 0 0 12px;
  color: #111827;
  font-size: 18px;
}

.parcel-modal label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 14px;
}

.parcel-name-help {
  color: #64748b;
  font-size: 12px;
}

.parcel-modal input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
}

.parcel-modal-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: #b91c1c;
  font-size: 13px;
}

.parcel-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.parcel-popup-title {
  margin: 0 0 8px;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
}

.parcel-popup-details-button {
  cursor: pointer;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #0f766e;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.parcel-popup-details-button:hover {
  border-color: #115e59;
  background: #115e59;
}

.parcel-popup-details-button:focus-visible {
  outline: 3px solid #99f6e4;
  outline-offset: 2px;
}

@media (max-width: 700px) {
  /* มือถือ: แสดง panel เป็นการ์ดลอยเหนือแผนที่ ไม่จองพื้นที่ด้านล่าง */
  .location-panel,
  .result-panel {
    width: min(430px, calc(100vw - 32px));
    max-height: 70dvh;
    border-radius: 10px;
  }

  .location-panel {
    z-index: 1001;
    max-height: 70dvh;
  }

  .result-panel {
    max-height: 82dvh;
  }

  .result-panel.is-open {
    z-index: 1002;
  }

  .location-panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .location-panel .panel-header {
    min-height: 52px;
    box-sizing: border-box;
    padding: 8px 12px;
  }

  .location-panel .panel-header h2 {
    min-width: 0;
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .location-panel .panel-content,
  .result-panel .panel-content {
    min-height: 0;
    overflow-y: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .panel-close {
    min-width: 56px;
    min-height: 44px;
  }

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

  button.mobile-location-launcher {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-color: rgba(15, 118, 110, 0.28);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.16);
  }

  .mobile-location-launcher .mobile-location-launcher-icon {
    width: 24px;
    height: 24px;
    background: transparent;
    color: #0f766e;
    font-size: 20px;
  }

  .mobile-location-launcher-text {
    display: none;
  }

  .location-actions .mobile-location-launcher {
    justify-self: start;
  }

  body > .mobile-location-launcher:not([hidden]) {
    position: fixed;
    top: auto;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(42px + env(safe-area-inset-bottom));
    z-index: 950;
    display: inline-flex;
    pointer-events: auto;
  }

  .mobile-point-actions:not([hidden]) {
    position: fixed;
    left: 50%;
    bottom: calc(clamp(72px, 10dvh, 118px) + env(safe-area-inset-bottom));
    z-index: 950;
    display: grid;
    width: min(260px, calc(100vw - 32px));
    gap: 10px;
    transform: translateX(-50%);
    pointer-events: auto;
  }

  .mobile-point-actions .mobile-point-confirm:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .parcel-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1400;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }

  .parcel-modal {
    position: fixed;
    top: auto;
    right: calc(12px + env(safe-area-inset-right));
    bottom: 0;
    left: calc(12px + env(safe-area-inset-left));
    z-index: 1410;
    box-sizing: border-box;
    width: auto;
    max-height: min(78dvh, calc(100dvh - 24px));
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
    transform: none;
    overscroll-behavior: contain;
  }

  .parcel-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .temporary-parcel-panel {
    position: fixed;
    top: auto;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: calc(12px + env(safe-area-inset-left));
    width: auto;
    max-width: none;
    max-height: min(58dvh, 470px);
    border-radius: 10px;
  }

  .temporary-parcel-panel-header {
    padding: 10px 12px;
  }

  .temporary-parcel-panel-list {
    padding: 10px 10px 18px;
  }

  .parcel-item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .parcel-action {
    min-height: 42px;
    padding-right: 8px;
    padding-left: 8px;
    white-space: normal;
  }

  .summary-card-row {
    grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
    gap: 8px;
  }

  .suitability-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Desktop/mobile sidebar override */
.app-sidebar {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.app-sidebar .location-panel,
.app-sidebar .result-panel {
  position: static;
  right: auto;
  left: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  pointer-events: auto;
}

.app-sidebar .location-panel {
  flex: 0 0 auto;
}

.app-sidebar .result-panel {
  flex: 1 1 auto;
  min-height: 0;
}

.app-sidebar .panel-content {
  min-height: 0;
}

@media (max-width: 700px) {
  .app-sidebar {
    inset: 0;
    width: auto;
    gap: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
  }

  .app-sidebar .location-panel,
  .app-sidebar .result-panel {
    position: fixed;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(430px, calc(100vw - 32px));
    transform: translateX(-50%);
    pointer-events: auto;
  }

  .app-sidebar .location-panel {
    top: calc(96px + env(safe-area-inset-top));
    display: none;
  }

  .app-sidebar .location-panel.is-mobile-open {
    display: flex;
  }

  .app-sidebar .result-panel {
    top: calc(72px + env(safe-area-inset-top));
    display: none;
    width: min(520px, calc(100vw - 24px));
  }

  .app-sidebar .result-panel.is-open {
    display: flex;
  }
}

.crop-suitability-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.crop-suitability-summary {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid #d6d9de;
  border-radius: 8px;
}

.crop-suitability-summary-title {
  margin: 0;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.crop-suitability-summary-grade {
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.crop-suitability-summary-label {
  margin: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.5;
}

.crop-suitability-summary.status-not-evaluated {
  background: #f8fafc;
}

.crop-suitability-summary.status-not-evaluated .crop-suitability-summary-grade {
  background: #e5e7eb;
  color: #374151;
}

.crop-suitability-summary.status-s1 {
  background: #f0fdf4;
}

.crop-suitability-summary.status-s1 .crop-suitability-summary-grade {
  background: #15803d;
  color: #ffffff;
}

.crop-suitability-summary.status-s2 {
  background: #fefce8;
}

.crop-suitability-summary.status-s2 .crop-suitability-summary-grade {
  background: #ca8a04;
  color: #111827;
}

.crop-suitability-summary.status-s3 {
  background: #fff7ed;
}

.crop-suitability-summary.status-s3 .crop-suitability-summary-grade {
  background: #ea580c;
  color: #ffffff;
}

.crop-suitability-summary.status-n {
  background: #fef2f2;
}

.crop-suitability-summary.status-n .crop-suitability-summary-grade {
  background: #dc2626;
  color: #ffffff;
}

.crop-suitability-summary.status-no-coverage {
  background: #f8fafc;
}

.crop-suitability-summary.status-no-coverage .crop-suitability-summary-grade {
  background: #94a3b8;
  color: #ffffff;
}

.parcel-draw-button.is-active {
  border-color: #9f1239;
  background: #be123c;
  color: #ffffff;
}

.parcel-draw-button.is-active:hover,
.parcel-draw-button.is-active:active {
  border-color: #881337;
  background: #9f1239;
}

.parcel-draw-button:focus-visible,
.parcel-item-header:focus-visible,
.parcel-popup-details-button:focus-visible,
.point-popup-result-button:focus-visible,
.panel-button:focus-visible,
.panel-close:focus-visible,
.mobile-location-launcher:focus-visible,
.mobile-point-confirm:focus-visible {
  outline: 3px solid #99f6e4;
  outline-offset: 2px;
}

@media (min-width: 1100px) {
  .app-sidebar {
    top: 20px;
    right: 20px;
    bottom: 20px;
    display: grid;
    grid-template-columns: minmax(430px, 500px) minmax(320px, 380px);
    grid-template-areas: "result location";
    gap: 14px;
    align-items: start;
    width: fit-content;
    max-width: calc(100vw - 40px);
  }

  .app-sidebar:not(.has-result-panel) {
    grid-template-columns: minmax(320px, 380px);
    grid-template-areas: "location";
  }

  .app-sidebar .result-panel {
    grid-area: result;
    grid-row: 1;
    max-height: calc(100vh - 40px);
    min-height: 0;
    overflow: hidden;
  }

  .app-sidebar .location-panel {
    grid-area: location;
    grid-row: 1;
    max-height: calc(100vh - 40px);
  }

  .app-sidebar:not(.has-result-panel) .location-panel {
    grid-area: location;
    grid-row: 1;
  }

  .app-sidebar .panel-content {
    overflow-y: auto;
  }
}

@media (max-width: 1099px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 32px));
    gap: 12px;
  }
}

@media (max-width: 820px) {
  .crop-suitability-summary-grid {
    grid-template-columns: 1fr;
  }
}

.parcel-details-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.parcel-details-fields > * {
  min-width: 0;
}

.parcel-modal select,
.parcel-modal textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
}

.parcel-modal textarea {
  min-height: 76px;
  resize: vertical;
}

.parcel-save-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0 0 16px;
}

.parcel-save-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.parcel-upload-diagnostic {
  border-top: 1px solid #cbd5e1;
  padding: 10px 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.parcel-upload-diagnostic h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.parcel-upload-steps p,
.parcel-upload-failure {
  margin: 2px 0;
}

.parcel-upload-failure {
  white-space: pre-line;
  color: #9f1239;
}

.parcel-photo-picker h4 {
  margin: 16px 0 8px;
  font-size: 15px;
}

.parcel-photo-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.parcel-modal input.parcel-photo-file-input {
  display: none;
}

.parcel-photo-strip {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin-top: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 2px 2px 8px;
}

.parcel-photo-section .parcel-photo-strip {
  margin-top: 0;
}

.parcel-photo-item {
  position: relative;
  flex: 0 0 120px;
  width: 120px;
  height: 90px;
  border-radius: 6px;
  object-fit: cover;
  overflow: hidden;
}

.parcel-photo-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.parcel-photo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
}

.parcel-photo-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #cbd5e1;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: parcel-photo-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .parcel-photo-spinner { animation-duration: 2s; }
}

.parcel-photo-open {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.parcel-photo-open:focus-visible {
  outline: 3px solid #0d9488;
}

.parcel-photo-viewer[hidden] {
  display: none;
}

.parcel-photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.96);
}

.parcel-photo-viewer img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.parcel-photo-viewer-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  font-size: 24px;
  cursor: pointer;
}

.parcel-photo-viewer-close:focus-visible {
  outline: 3px solid #0d9488;
}

.parcel-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.93);
  color: #dc2626;
}

.parcel-photo-remove:focus-visible {
  outline: 3px solid #fecaca;
}

.parcel-photo-count,
.parcel-photo-empty {
  margin: 4px 0;
  color: #475569;
  font-size: 13px;
}

.parcel-photo-load-error {
  flex: 0 0 120px;
  margin: 0;
  color: #b91c1c;
  font-size: 13px;
}

.mobile-temporary-parcels-button {
  display: none;
  min-height: 48px;
  padding: 11px 16px;
  cursor: pointer;
  border: 1px solid #0f766e;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
}

.result-panel .panel-header h2 {
  flex: 1 1 auto;
  min-width: 0;
}

button.panel-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #0f766e;
  font-size: 21px;
}

button.panel-icon-action:hover:not(:disabled) {
  background: rgba(15, 118, 110, 0.08);
  color: #115e59;
}

button.panel-icon-action:active:not(:disabled) {
  background: rgba(15, 118, 110, 0.14);
}

button.panel-icon-action:focus-visible {
  outline: 3px solid #99f6e4;
  outline-offset: 2px;
}

button.panel-icon-action.panel-close-icon {
  color: #dc2626;
}

button.panel-icon-action.panel-close-icon:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

button.panel-icon-action.panel-close-icon:active:not(:disabled) {
  background: rgba(220, 38, 38, 0.14);
}

button.panel-icon-action.panel-close-icon:focus-visible {
  outline-color: #fecaca;
}

button.panel-icon-action[hidden] {
  display: none;
}

.parcel-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.36);
}

.parcel-sheet {
  display: flex;
  flex-direction: column;
  width: min(430px, calc(100vw - 24px));
  max-height: min(78dvh, 720px);
  overflow: hidden;
  border: 1px solid #d6d9de;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.26);
}

.parcel-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.parcel-sheet-header h2 {
  margin: 0;
  color: #111827;
  font-size: 17px;
  font-weight: 700;
}

.parcel-sheet-body {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

#my-parcels-sheet .parcel-sheet-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

#my-parcels-status {
  flex: 0 0 auto;
}

.my-parcels-search-row {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  margin-bottom: 10px;
}

.my-parcels-search {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
}

.my-parcels-search-clear {
  flex: 0 0 44px;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.my-parcels-search-clear[hidden] {
  display: none;
}

#my-parcels-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.parcel-sheet-body.parcel-form-body {
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 0;
}

.parcel-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.parcel-form-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

.saved-photo-edit {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.saved-photo-edit-heading {
  display: flex;
  justify-content: space-between;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.saved-photo-edit-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.saved-photo-edit-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
}

.saved-photo-edit-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-photo-edit-item.is-marked-for-delete img { opacity: .35; }

.saved-photo-edit-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  padding: 2px 5px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
}

.saved-photo-edit-action {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #ffffff;
  font-size: 17px;
  text-shadow: 0 1px 3px #0f172a, 0 0 5px #0f172a;
  cursor: pointer;
}

.saved-photo-edit-action:focus-visible { outline: 2px solid #0f766e; }

.saved-photo-edit-placeholder,
.saved-photo-edit-message {
  color: #475569;
  font-size: 12px;
}

.parcel-modal-error.is-progress {
  color: #374151;
}

.parcel-confirm-message {
  margin: 0;
  color: #374151;
  line-height: 1.5;
}

.parcel-confirm-destructive {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
}

.parcel-confirm-destructive:hover,
.parcel-confirm-destructive:focus-visible {
  background: #991b1b;
  border-color: #991b1b;
}

.map-action-notice {
  position: fixed;
  top: calc(68px + env(safe-area-inset-top));
  left: 50%;
  z-index: 1450;
  box-sizing: border-box;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 6px;
  background: #155e46;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  line-height: 1.45;
  transform: translateX(-50%);
}

.map-action-notice[hidden] {
  display: none;
}

.saved-photo-edit-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  height: 100%;
  padding: 4px;
  text-align: center;
}

.saved-photo-edit-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: #475569;
  font-size: 12px;
}

.saved-photo-edit-loading[hidden] { display: none; }

.saved-photo-edit-placeholder.is-error { color: #b42318; }

.saved-photo-edit-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: saved-photo-edit-spin .8s linear infinite;
}

@keyframes saved-photo-edit-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .saved-photo-edit-spinner { animation: none; }
}

.parcel-form-footer {
  flex: 0 0 auto;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #e5e7eb;
}

.parcel-form-footer .parcel-sheet-status:not([hidden]) {
  margin-bottom: 8px;
}

.parcel-form-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.parcel-form-field input,
.parcel-form-field select,
.parcel-form-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 15px;
}

.parcel-sheet-status {
  margin: 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.45;
}

.parcel-sheet-status.is-error {
  color: #b91c1c;
}

.parcel-sheet-status.is-success {
  color: #166534;
  font-weight: 700;
}

.parcel-sheet-status.is-warning {
  color: #92400e;
  font-weight: 700;
}

.parcel-sheet-actions,
.saved-parcel-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.saved-parcel-card {
  display: block;
  overflow: hidden;
  border: 1px solid #d6d9de;
  border-radius: 8px;
  background: #f8fafc;
}

.saved-parcel-card.is-expanded {
  border-color: #0f766e;
  box-shadow: inset 0 0 0 1px #0f766e;
  background: #f0fdfa;
}

.saved-parcel-card.is-focused {
  outline: 2px solid #0f766e;
  outline-offset: -2px;
}

.saved-parcel-card + .saved-parcel-card {
  margin-top: 10px;
}

.saved-parcel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  box-sizing: border-box;
  padding: 10px 12px;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.saved-parcel-title {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 4px;
  overflow: hidden;
}

.saved-parcel-name,
.saved-parcel-summary,
.saved-parcel-date,
.saved-parcel-chevron {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.saved-parcel-name {
  overflow: hidden;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-parcel-summary,
.saved-parcel-date {
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.saved-parcel-actions {
  padding: 0 12px 12px;
}

.saved-parcel-actions[hidden] {
  display: none;
}

.saved-parcel-chevron {
  flex: 0 0 auto;
  color: #0f766e;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.parcel-action.full-width {
  grid-column: 1 / -1;
}

.parcel-action.danger,
.panel-button.danger {
  border-color: #dc2626;
  background: #dc2626;
  color: #ffffff;
}

@media (max-width: 700px) {
  .mobile-temporary-parcels-button:not([hidden]) {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: calc(12px + env(safe-area-inset-left));
    z-index: 940;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .parcel-sheet-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .leaflet-control-layers:not(.is-mobile-drawer-open).leaflet-control-layers-expanded {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .leaflet-control-layers:not(.is-mobile-drawer-open).leaflet-control-layers-expanded
    .leaflet-control-layers-toggle {
    display: block;
  }

  .leaflet-control-layers:not(.is-mobile-drawer-open).leaflet-control-layers-expanded
    .leaflet-control-layers-list {
    display: none;
  }

  .mobile-layer-drawer-scrim:not([hidden]) {
    position: fixed;
    top: 0;
    right: 0;
    bottom: var(--mobile-layer-drawer-bottom, calc(96px + env(safe-area-inset-bottom)));
    left: min(310px, calc(100vw - 56px));
    z-index: 990;
    display: block;
    background: rgba(15, 23, 42, 0.34);
  }

  .leaflet-control-layers.is-mobile-drawer-open {
    position: fixed;
    top: calc(84px + env(safe-area-inset-top));
    right: auto;
    bottom: var(--mobile-layer-drawer-bottom, calc(96px + env(safe-area-inset-bottom)));
    left: 0;
    z-index: 1010;
    box-sizing: border-box;
    width: min(310px, calc(100vw - 56px));
    max-width: none;
    max-height: none;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0 14px 14px 0;
    background: #ffffff;
    box-shadow: 12px 0 30px rgba(15, 23, 42, 0.28);
  }

  .leaflet-control-layers.is-mobile-drawer-open .leaflet-control-layers-toggle {
    display: none;
  }

  .leaflet-control-layers.is-mobile-drawer-open .leaflet-control-layers-list {
    box-sizing: border-box;
    display: block;
    height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0 14px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .leaflet-control-layers.is-mobile-drawer-open .leaflet-control-layers-separator {
    margin: 10px 0;
  }

  .leaflet-control-layers.is-mobile-drawer-open label {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 38px;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: rgba(15, 118, 110, 0.14);
  }

  .leaflet-control-layers.is-mobile-drawer-open label > span {
    display: flex;
    width: 100%;
    min-height: inherit;
    align-items: center;
  }

  .leaflet-control-layers.is-mobile-drawer-open .leaflet-control-layers-selector {
    position: relative;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin: 0 9px 0 0;
    pointer-events: auto;
    cursor: pointer;
    accent-color: #0f766e;
    touch-action: manipulation;
  }

  .mobile-layer-drawer-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -14px 8px;
    padding: 8px 10px 8px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
  }

  .mobile-layer-drawer-header h2 {
    margin: 0;
    color: #111827;
    font-size: 17px;
    font-weight: 700;
  }

  .mobile-layer-drawer-close {
    min-width: 56px;
    min-height: 44px;
    cursor: pointer;
    border: 0;
    border-radius: 8px;
    background: #dc2626;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
  }

  .mobile-layer-drawer-open .mobile-location-launcher,
  .mobile-layer-drawer-open .mobile-temporary-parcels-button,
  .mobile-layer-drawer-open .parcel-draw-control,
  .mobile-layer-drawer-open .hazard-legend {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .hazard-legend {
    position: relative;
    bottom: auto;
    margin-top: env(safe-area-inset-top);
    display: block;
    max-width: min(260px, calc(100vw - 32px));
    max-height: none;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .hazard-legend-mobile-toggle {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 9px 13px;
    cursor: pointer;
    border: 1px solid #d6d9de;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.97);
    color: #0f172a;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
  }

  .hazard-legend-content {
    display: none;
  }

  .hazard-legend.is-mobile-expanded .hazard-legend-content {
    position: fixed;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom));
    z-index: 950;
    display: flex;
    box-sizing: border-box;
    width: min(420px, calc(100vw - 24px));
    max-height: min(43dvh, 390px);
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #d6d9de;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
    transform: translateX(-50%);
  }

  .hazard-legend-sheet-header {
    display: flex;
    min-height: 48px;
    flex: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 14px;
    border-bottom: 1px solid #e5e7eb;
  }

  .hazard-legend-sheet-header h3 {
    margin: 0;
    font-size: 15px;
  }

  .hazard-legend-sheet-close {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #b91c1c;
    font: inherit;
    font-size: 18px;
    cursor: pointer;
  }

  .hazard-legend-tabs:not([hidden]) {
    display: flex;
    flex: none;
    border-bottom: 1px solid #e5e7eb;
  }

  .hazard-legend-tab {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 0;
    padding: 8px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: #ffffff;
    color: #475569;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .hazard-legend-tab[aria-selected="true"] {
    border-bottom-color: #0f766e;
    color: #0f172a;
  }

  .hazard-legend-sections {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 14px 14px;
  }

  .hazard-legend-section:not(.is-selected) {
    display: none;
  }

  .hazard-legend-sheet-close:focus-visible,
  .hazard-legend-tab:focus-visible,
  .hazard-legend-mobile-toggle:focus-visible {
    outline: 3px solid #0f766e;
    outline-offset: -3px;
  }

  .mobile-parcel-draw-hud:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: block;
    pointer-events: none;
  }

  .mobile-parcel-draw-hint {
    position: absolute;
    top: calc(82px + env(safe-area-inset-top));
    left: 50%;
    box-sizing: border-box;
    width: max-content;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 9px 13px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    transform: translateX(-50%);
  }

  .mobile-parcel-drawing .map-action-notice {
    top: calc(152px + env(safe-area-inset-top));
  }

  .mobile-parcel-draw-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    border: 3px solid #ffffff;
    border-radius: 999px;
    box-shadow: 0 0 0 3px #0f766e, 0 4px 14px rgba(15, 23, 42, 0.4);
    transform: translate(-50%, -50%);
  }

  .mobile-parcel-draw-reticle::before,
  .mobile-parcel-draw-reticle::after {
    position: absolute;
    content: "";
    background: #0f766e;
  }

  .mobile-parcel-draw-reticle::before {
    top: 50%;
    left: 50%;
    width: 2px;
    height: 48px;
    transform: translate(-50%, -50%);
  }

  .mobile-parcel-draw-reticle::after {
    top: 50%;
    left: 50%;
    width: 48px;
    height: 2px;
    transform: translate(-50%, -50%);
  }

  .mobile-parcel-draw-cancel {
    position: absolute;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(88px + env(safe-area-inset-bottom));
    min-height: 42px;
    padding: 8px 13px;
    pointer-events: auto;
    cursor: pointer;
    border: 0;
    border-radius: 10px;
    background: #be123c;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24);
  }

  .mobile-parcel-draw-actions {
    position: absolute;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: calc(12px + env(safe-area-inset-left));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
    pointer-events: auto;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.3);
  }

  .mobile-parcel-draw-action {
    min-width: 0;
    min-height: 52px;
    padding: 8px 6px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    background: #ffffff;
    color: #334155;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
  }

  .mobile-parcel-draw-add {
    border-color: #0f766e;
    background: #0f766e;
    color: #ffffff;
  }

  .mobile-parcel-draw-finish:not(:disabled) {
    border-color: #15803d;
    color: #166534;
  }

  .mobile-parcel-draw-action:disabled {
    cursor: not-allowed;
    border-color: #e2e8f0;
    background: #e5e7eb;
    color: #64748b;
  }

  .mobile-parcel-drawing .leaflet-control-layers,
  .mobile-parcel-drawing .hazard-legend,
  .mobile-parcel-drawing .mobile-location-launcher,
  .mobile-parcel-drawing .mobile-point-actions,
  .mobile-parcel-drawing .mobile-temporary-parcels-button,
  .mobile-parcel-drawing .parcel-draw-control,
  .mobile-parcel-drawing .leaflet-draw-tooltip {
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

.mobile-temporary-parcels-button:focus-visible,
.mobile-parcel-save-button:focus-visible,
.parcel-sheet .panel-button:focus-visible,
.parcel-form-field input:focus-visible,
.parcel-form-field select:focus-visible,
.parcel-form-field textarea:focus-visible {
  outline: 3px solid #99f6e4;
  outline-offset: 2px;
}
