html,
body {
  height: 100%;
}

body.plant-doctor-page {
  margin: 0;
  color: #1f2d2a;
  background:
    radial-gradient(circle at top left, rgba(229, 239, 226, 0.92), transparent 24%),
    radial-gradient(circle at top right, rgba(237, 242, 247, 0.88), transparent 28%),
    linear-gradient(180deg, #f4f6f2 0%, #edf3ef 52%, #edf2f6 100%);
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.pd-shell {
  width: min(1280px, calc(100% - 20px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.pd-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: calc(100dvh - 96px);
  align-items: stretch;
}

.pd-map-card,
.pd-side-card,
.pd-footer-note {
  border: 1px solid rgba(97, 120, 103, 0.15);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 42px rgba(31, 45, 42, 0.08);
  backdrop-filter: blur(10px);
}

.pd-map-card {
  position: relative;
  overflow: hidden;
  min-height: calc(100dvh - 108px);
}

.pd-map {
  width: 100%;
  height: 100%;
  min-height: calc(100dvh - 108px);
}

.pd-loading-mask {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(235, 240, 235, 0.68);
}

.pd-loading-mask.is-hidden {
  display: none;
}

.pd-loading-box {
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 28px rgba(31, 45, 42, 0.12);
  font-weight: 700;
  color: #2a4337;
}

.pd-floating-panel {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 1000;
  min-width: 188px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(103, 124, 106, 0.16);
  box-shadow: 0 10px 28px rgba(31, 45, 42, 0.14);
  backdrop-filter: blur(10px);
}

.pd-panel-title,
.pd-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #617667;
}

.pd-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pd-filter-btn,
.pd-reset-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.pd-filter-btn {
  background: #e8efe7;
  color: #305040;
}

.pd-filter-btn.is-active {
  background: linear-gradient(135deg, #315f42, #5e855e);
  color: #fff;
}

.pd-reset-btn {
  margin-top: 10px;
  width: 100%;
  background: rgba(241, 244, 242, 0.9);
  color: #3d524a;
}

.pd-legend {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pd-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(97, 120, 103, 0.15);
  box-shadow: 0 10px 24px rgba(31, 45, 42, 0.1);
  font-size: 13px;
  font-weight: 700;
}

.pd-legend-chip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.pd-legend-chip.active::before {
  background: #2e8a57;
}

.pd-legend-chip.pending::before {
  background: #e19534;
}

.pd-side-panel {
  display: grid;
  gap: 16px;
  grid-template-rows: auto auto 1fr;
}

.pd-side-card {
  padding: 18px;
}

.pd-side-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.pd-summary,
.pd-updated,
.pd-empty-state,
.pd-selection-county,
.pd-detail-list dt,
.pd-note-list {
  color: #52635b;
}

.pd-summary {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.8;
}

.pd-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.pd-stat {
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f3f7f2, #ebf1ed);
}

.pd-stat-label {
  display: block;
  font-size: 12px;
  color: #65786f;
}

.pd-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  color: #27453b;
}

.pd-empty-state {
  font-size: 14px;
  line-height: 1.8;
}

.pd-selection-card h2 {
  margin: 0;
  font-size: 22px;
}

.pd-selection-county {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.pd-detail-list {
  margin: 14px 0 0;
  display: grid;
  gap: 12px;
}

.pd-detail-list div {
  padding-top: 10px;
  border-top: 1px solid #e3e9e4;
}

.pd-detail-list dt {
  font-size: 12px;
  margin-bottom: 4px;
}

.pd-detail-list dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #21332c;
  font-weight: 700;
}

.pd-note-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  font-size: 14px;
}

.pd-updated {
  margin: 14px 0 0;
  font-size: 12px;
}

.pd-footer-note {
  margin-top: 16px;
  padding: 18px 20px;
}

.pd-footer-note h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.pd-footer-note p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #52635b;
}

.pd-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 6px 12px rgba(26, 36, 31, 0.25);
}

.pd-marker.active {
  background: #2e8a57;
}

.pd-marker.pending {
  background: #e19534;
}

.pd-popup {
  min-width: 220px;
  line-height: 1.7;
}

.pd-popup h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.pd-popup p {
  margin: 0;
  color: #4d6157;
  font-size: 13px;
}

.pd-popup .status {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pd-popup .status.active {
  background: #dbeedb;
  color: #21633f;
}

.pd-popup .status.pending {
  background: #f7e3c7;
  color: #9a5e0e;
}

@media (max-width: 980px) {
  .pd-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .pd-map-card,
  .pd-map {
    min-height: clamp(360px, calc(100dvh - 170px), 680px);
  }

  .pd-side-panel {
    grid-template-rows: auto;
  }
}

@media (max-width: 640px) {
  .pd-shell {
    width: min(100% - 10px, 100%);
    padding-top: 10px;
  }

  .pd-map-card,
  .pd-side-card,
  .pd-footer-note {
    border-radius: 18px;
  }

  .pd-map-card,
  .pd-map {
    min-height: clamp(320px, calc(100dvh - 150px), 520px);
  }

  .pd-legend {
    left: 12px;
    top: 12px;
    right: 12px;
  }

  .pd-floating-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    min-width: 0;
  }

  .pd-side-card h1 {
    font-size: 24px;
  }
}
