:root {
  --bg: #0f1419;
  --panel: rgba(18, 24, 32, 0.92);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #eef2f6;
  --muted: #9aa7b5;
  --accent: #c4a574;
  --accent-soft: rgba(196, 165, 116, 0.18);
  --ok: #7dcea0;
  --err: #e07a7a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", serif;
  color: var(--text);
  background: var(--bg);
}

#map-area {
  width: 100%;
  height: 100%;
  background: #E8E4DC;
}

.initial-data-progress {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 50%;
  width: min(380px, calc(100vw - 32px));
  padding: 11px 13px 9px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(18, 24, 32, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  pointer-events: none;
}

.initial-data-progress[hidden] {
  display: none !important;
}

.initial-data-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.initial-data-progress-head output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.initial-data-progress progress {
  display: block;
  width: 100%;
  height: 6px;
  margin: 8px 0 5px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  accent-color: var(--accent);
}

.initial-data-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.initial-data-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
  transition: width 160ms ease;
}

.initial-data-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.initial-data-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.initial-data-progress.is-error {
  border-color: rgba(224, 122, 122, 0.55);
}

.initial-data-progress.is-error .initial-data-progress-head output {
  color: var(--err);
}

@media (max-width: 600px) {
  .initial-data-progress {
    top: auto;
    bottom: 16px;
    left: 16px;
    width: min(320px, calc(100vw - 104px));
    transform: none;
  }
}

.esri-attribution {
  display: none;
}

.copyright-logo {
  position: absolute;
  bottom: 5px;
  right: 10px;
  width: 28px;
  height: 28px;
  z-index: 2;
  background: url("https://api.hkmapservice.gov.hk/mapapi/landsdlogo.jpg") center / 28px no-repeat;
}

/* 缩放控件右下：抬高以免压住版权与 logo */
.esri-ui-bottom-right {
  bottom: 42px !important;
  right: 12px !important;
}

.map-tool-flyout {
  position: relative;
}

.scale-presets-pop {
  position: absolute;
  top: 0;
  right: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 32, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: 4;
}

.scale-presets-pop[hidden] {
  display: none !important;
}

.scale-presets-pop button {
  min-width: 108px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(18, 24, 32, 0.92);
  color: #e8eef5;
  font-size: 11px;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.scale-presets-pop button:hover {
  background: rgba(32, 42, 54, 0.96);
}

.scale-presets-pop button.is-active {
  border-color: #c4a574;
  color: #c4a574;
}

.shell-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  width: min(320px, calc(100vw - 32px));
  padding: 16px 16px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  transition: transform 0.22s ease, opacity 0.18s ease;
}

.shell-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.shell-panel-brand {
  min-width: 0;
  flex: 1 1 auto;
}

.shell-panel-brand .brand-kicker {
  margin-bottom: 2px;
}

.shell-panel-brand h1 {
  margin-bottom: 0;
}

.shell-panel-toggle {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.shell-panel-toggle:hover {
  border-color: rgba(196, 165, 116, 0.5);
  background: var(--accent-soft);
}

.shell-panel.is-collapsed {
  pointer-events: none;
  opacity: 0;
  transform: translateX(calc(-100% - 24px));
}

.shell-panel-expand {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 32, 0.92);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.shell-panel-expand:hover {
  border-color: rgba(196, 165, 116, 0.5);
  background: rgba(196, 165, 116, 0.28);
}

.shell-panel-expand[hidden] {
  display: none !important;
}

.brand-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.shell-panel h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.shell-panel .lede {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.search-box {
  margin: 0 0 14px;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.search-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.search-row input {
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.search-row input::placeholder {
  color: rgba(154, 167, 181, 0.85);
}

.search-btn {
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(196, 165, 116, 0.45);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.search-btn:hover {
  border-color: var(--accent);
}

.search-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.search-results li {
  margin: 0;
  padding: 0;
}

.search-results button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.35;
}

.search-results button:hover,
.search-results button.is-active {
  background: rgba(196, 165, 116, 0.14);
}

.search-results .result-name {
  display: block;
  color: var(--text);
}

.search-results .result-meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.search-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.shell-panel-body > #zone-controls,
.shell-panel-body > #pam-controls,
.shell-panel-body > #swap-controls {
  display: none;
}

.layer-group {
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.layer-group.is-section {
  padding: 6px 4px 8px;
  background: rgba(255, 255, 255, 0.045);
}

.layer-name-zh {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.layer-name-zh .layer-tag {
  flex-shrink: 0;
}

.layer-group-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 2px 6px;
}

.layer-group-head:not(:has(> .layer-toggle)) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.layer-toggle {
  margin: 0;
  accent-color: var(--accent);
}

.layer-pick-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.layer-pick-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.layer-pick-btn.is-pick {
  background: rgba(200, 70, 70, 0.28);
}

.layer-pick-btn:disabled {
  cursor: not-allowed;
}

.layer-fold-btn {
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.layer-fold-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.layer-chevron {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--muted);
  transition: transform 0.15s ease;
}

.layer-group.is-open > .layer-group-head .layer-chevron {
  transform: rotate(90deg);
}

.layer-children {
  margin: 0 4px 4px 12px;
  padding: 4px 0 4px 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.layer-pdf-export {
  display: block;
  box-sizing: border-box;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  min-height: 0;
  text-align: center;
  white-space: nowrap;
}

.layer-pdf-export[hidden] {
  display: none !important;
}

.layer-report-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.layer-report-area-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.3;
}

.layer-report-area-label .layer-name-zh {
  color: var(--text);
}

.layer-report-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.layer-report-row input,
.layer-report-row .layer-pdf-export {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  box-sizing: border-box;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

.layer-report-row input {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.layer-report-row input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.layer-children .zone-controls,
.layer-children .pam-controls,
.layer-children .swap-controls {
  margin: 0;
  padding: 2px 0 4px;
  background: transparent;
}

.layer-children .zone-controls-head {
  justify-content: flex-end;
  margin-bottom: 6px;
}

.layer-children .layer-group.is-nested {
  margin-top: 2px;
  padding: 0;
  background: transparent;
  border: none;
}

.layer-children .layer-group.is-nested.is-disabled {
  opacity: 0.55;
}

.layer-children .layer-group.is-nested.is-disabled .layer-pick-btn {
  cursor: not-allowed;
}

.layer-children .layer-group.is-nested > .layer-group-head {
  padding: 0 2px;
}

.layer-children .layer-group.is-nested > .layer-group-head .layer-fold-btn,
.layer-children .layer-group.is-nested > .layer-group-head .layer-pick-btn {
  padding: 4px 4px;
  font-size: 12px;
}

.layer-children .layer-group.is-nested > .layer-children {
  margin-left: 8px;
  padding-left: 6px;
}

/* 换电站：已落成 / 规划中 / 选址中同一级，叶子行对齐规划中组头 */
#layer-body-choco-swap > .layer-row.is-child {
  padding: 0 2px;
  gap: 8px;
  border: 0;
  border-radius: 0;
  font-size: 12px;
}

#layer-body-choco-swap > .layer-row.is-child > input {
  margin: 0;
  accent-color: var(--accent);
}

#layer-body-choco-swap > .layer-row.is-child.has-icon {
  grid-template-columns: auto minmax(0, 1fr) 28px 22px;
}

#layer-body-choco-swap > .layer-row.is-child .layer-pick-btn {
  padding: 4px;
  font-size: 12px;
}

.layer-charging-note {
  margin: 2px 4px 6px;
  padding: 0 2px;
}

.stt-rate-panel {
  margin: 0 0 4px;
  padding: 2px 2px 3px;
}

.stt-rate-unit {
  margin: 0 0 3px;
  font-size: 9px;
  line-height: 1.2;
  color: var(--muted);
}

.stt-rate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  column-gap: 6px;
  row-gap: 1px;
  font-size: 10px;
  line-height: 1.25;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.stt-rate-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stt-rate-val {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.stt-rate-val.is-masked {
  letter-spacing: 0.12em;
  color: var(--muted);
  filter: blur(3px);
  user-select: none;
}

.stt-rate-input {
  width: 4.4em;
  min-width: 0;
  margin: 0;
  padding: 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  background: rgba(18, 24, 32, 0.85);
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  box-sizing: border-box;
}

.stt-rate-input:focus {
  outline: none;
  border-color: rgba(196, 165, 116, 0.7);
}

.premium-radio-panel {
  display: grid;
  grid-template-columns: auto max-content 1fr;
  column-gap: 8px;
  row-gap: 4px;
  align-items: center;
  margin: 0 0 6px;
  padding: 2px 2px 4px;
  font-size: 12px;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  color: var(--text);
}

.premium-radio-option {
  display: contents;
}

.premium-radio-option input,
.premium-radio-zh,
.premium-radio-en {
  cursor: pointer;
}

.premium-radio-option input {
  margin: 0;
}

.premium-radio-en {
  color: var(--muted, inherit);
}

.layer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  font-size: 13px;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.layer-row.is-child {
  padding: 5px 8px;
  background: transparent;
  font-size: 12px;
}

.layer-row.is-grandchild {
  padding-left: 4px;
  font-size: 11px;
}

.layer-row.is-grandchild .layer-name-en {
  font-size: 9px;
}

.layer-row.has-icon,
.layer-group-head.has-icon {
  grid-template-columns: auto minmax(0, 1fr) 28px;
}

.layer-group-head.has-icon:has(> .layer-fold-btn) {
  grid-template-columns: auto minmax(0, 1fr) 28px auto;
}

.layer-row-icon {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.layer-row.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.layer-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--text);
  line-height: 1.25;
}

.layer-name-en {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}
.layer-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.pam-controls {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.pam-controls.is-disabled {
  opacity: 0.45;
}

.pam-power-legend {
  display: grid;
  gap: 8px;
  margin: 2px 0 10px;
  padding: 0 0 10px;
  list-style: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pam-power-legend-row {
  margin: 0;
}

.pam-power-legend-option {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  cursor: default;
}

.pam-power-legend-option .layer-pick-btn {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding: 2px 4px;
  font-size: 11px;
  color: inherit;
  line-height: 1.45;
}

.pam-power-legend-option input {
  width: 13px;
  height: 13px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.pam-power-legend-option:has(input:disabled) {
  cursor: default;
}

.pam-power-legend-row img {
  display: block;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.pam-power-legend-row strong {
  color: var(--text);
  font-weight: 600;
}

.pam-power-legend-icon-black {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
}

.pam-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.pam-opt input {
  margin: 0;
  accent-color: var(--accent);
}

.pam-scale-note {
  margin: 4px 0 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: #1a1a1a;
  background: #f5e6a3;
  border: 1px solid #c4a035;
}

.swap-controls {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.pam-edit-controls {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pam-edit-hint {
  margin: 4px 0 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #c8d0da;
}

.pam-edit-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pam-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn-primary {
  background: rgba(196, 165, 116, 0.35);
  color: #f5efe4;
  border-color: rgba(196, 165, 116, 0.55);
}

.preset-btn-danger {
  color: #ffb4b4;
  border-color: rgba(220, 80, 80, 0.45);
}

.preset-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pam-edit-form {
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.pam-edit-mode-label {
  margin: 0 0 8px;
  font-size: 11px;
  color: #c8d0da;
}

.pam-edit-mode-label code {
  font-size: 10px;
  color: #f5e6a3;
}

.pam-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text);
}

.pam-edit-field input,
.pam-edit-field select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
}

.pam-edit-field select option {
  color: #111;
  background: #fff;
}

.pam-icon-picker {
  border: 0;
  padding: 0;
  margin: 0 0 8px;
}

.pam-icon-picker legend {
  padding: 0;
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--text);
}

.pam-icon-picker-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pam-icon-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 11px;
  color: var(--text);
}

.pam-icon-option:has(input:checked) {
  border-color: rgba(196, 165, 116, 0.65);
  background: var(--accent-soft);
}

.pam-icon-option input {
  margin: 2px 0 0;
}

.pam-icon-option img {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: block;
  margin-top: 1px;
}

.pam-icon-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pam-icon-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.pam-icon-hint {
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
}

.zone-hint code {
  font-size: 10px;
  color: #c4a574;
}

.zone-controls {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.zone-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.zone-controls-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.zone-presets {
  display: flex;
  gap: 4px;
}

.preset-btn {
  margin: 0;
  padding: 3px 7px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
}

.preset-btn:hover {
  border-color: rgba(196, 165, 116, 0.45);
  color: var(--accent);
}

.control-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

.control-row input[type="range"] {
  width: 100%;
}

.zone-category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  margin-bottom: 6px;
  padding-right: 2px;
}

.zone-cat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 2px 2px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: default;
}

.zone-cat .layer-pick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zone-cat:hover .layer-pick-btn:not(.is-pick):not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.zone-cat.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.zone-cat input {
  margin: 0;
  accent-color: var(--accent);
}

.zone-cat .swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}

.zone-cat .cat-key {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 2.4em;
}

.zone-cat .cat-zh {
  color: var(--text);
}

.zone-hint {
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0.85;
}

.meta-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.disclaimer-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(8, 12, 20, 0.72);
}

.disclaimer-gate[hidden] {
  display: none !important;
}

.disclaimer-card {
  width: min(640px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.disclaimer-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
}

.disclaimer-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.disclaimer-list {
  margin: 0;
  padding-left: 1.35em;
}

.disclaimer-list + .disclaimer-list {
  margin-top: 16px;
}

.disclaimer-list li {
  margin: 0 0 12px;
}

.disclaimer-list li:last-child {
  margin-bottom: 0;
}

.disclaimer-list strong {
  color: var(--text);
  font-weight: 600;
}

.disclaimer-body p {
  margin: 0 0 12px;
}

.disclaimer-body p:last-child {
  margin-bottom: 0;
}

.disclaimer-body strong {
  color: var(--text);
  font-weight: 600;
}

.disclaimer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.disclaimer-actions .preset-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 12px 20px;
  min-height: 40px;
}

.map-tools {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.map-tool-modes {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 16, 22, 0.55);
  backdrop-filter: blur(10px);
}

.map-tool-btn {
  width: 52px;
  min-height: 52px;
  padding: 6px 4px 4px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 32, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  color: #e8eef5;
  backdrop-filter: blur(10px);
  text-decoration: none;
  box-sizing: border-box;
}

a.map-tool-btn:visited {
  color: #e8eef5;
}

.map-tool-btn-action {
  width: 52px;
  margin-top: 2px;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.2);
}

.map-tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.map-tool-btn[hidden],
#tool-db-export[hidden] {
  display: none !important;
}

body:not([data-auth-role="super"]) #tool-db-export {
  display: none !important;
}

.tech-support-pop {
  position: absolute;
  top: 0;
  right: calc(100% + 8px);
  width: 220px;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 32, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  color: #e8eef5;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  text-align: left;
  z-index: 4;
}

.tech-support-pop[hidden] {
  display: none !important;
}

.db-export-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  margin: 0 0 8px;
}

.db-export-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #e8eef5;
  cursor: pointer;
}

.db-export-row input {
  margin: 0;
}

.tech-support-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.tech-support-product {
  margin: 0 0 6px;
  font-size: 12px;
  color: #c8d0da;
}

.tech-support-email {
  margin: 0 0 10px;
  font-size: 12px;
  color: #c4a574;
  word-break: break-all;
  user-select: text;
}

.tech-support-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tech-support-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: #c8d0da;
}

.tech-support-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 12, 18, 0.85);
  color: #e8eef5;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
}

.tech-support-send {
  width: 100%;
  min-height: 32px;
}

.tech-support-status {
  margin: 0;
  font-size: 11px;
  color: #9ad0a8;
}

.tech-support-status.is-error {
  color: #ff8f8f;
}

.map-login-pop {
  position: absolute;
  bottom: 0;
  top: auto;
  right: calc(100% + 8px);
  width: 200px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 24, 32, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  color: #e8eef5;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  text-align: left;
  z-index: 4;
}

.map-login-pop[hidden] {
  display: none !important;
}

.map-login-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.map-login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-login-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: #c8d0da;
}

.map-login-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 12, 18, 0.85);
  color: #e8eef5;
  font-size: 12px;
}

.map-login-error {
  margin: 0;
  font-size: 11px;
  color: #ff8f8f;
}

.map-login-user-label {
  margin: 0 0 8px;
  font-size: 12px;
  color: #c8d0da;
  word-break: break-all;
}

.map-login-submit {
  width: 100%;
  min-height: 32px;
  margin-top: 2px;
}

.map-tool-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.map-tool-caption {
  font-size: 10px;
  line-height: 1.1;
  color: #c8d0da;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.map-tool-btn img {
  display: block;
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(0.92);
}

.map-tool-btn:hover {
  border-color: rgba(196, 165, 116, 0.5);
}

.map-tool-btn.is-active {
  border-color: rgba(196, 165, 116, 0.7);
  background: rgba(196, 165, 116, 0.28);
}

.map-tool-btn.is-active .map-tool-caption {
  color: #f5efe4;
}

.measure-panel {
  width: min(220px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 24, 32, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
}

.measure-hint {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.measure-result {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.35;
}

.measure-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 140px;
  overflow: auto;
}

.measure-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.measure-list-idx {
  color: var(--muted);
  flex: 0 0 auto;
}

.measure-list-dist {
  flex: 1 1 auto;
  color: var(--text);
}

.measure-list-del {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #ffb4b4;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.measure-list-del:hover {
  background: rgba(220, 80, 80, 0.2);
}

.lot-select-list {
  list-style: none;
  margin: 0 8px 6px 28px;
  padding: 0;
  max-height: 132px;
  overflow: auto;
}

.lot-select-hint {
  margin: 0 8px 2px 28px;
}

.lot-select-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lot-select-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lot-pop-del {
  margin: 0 2px;
}

.shell-panel {
  max-height: calc(100vh - 32px);
  overflow: auto;
}

/* PAM 弹窗内容 */
.esri-popup__main-container {
  font-family: "Avenir Next", "PingFang SC", "Noto Sans TC", sans-serif;
}

.swap-pop-status,
.swap-pop-note {
  margin: 0 0 8px;
}

.swap-pop-kind {
  display: flex;
  align-items: center;
  margin: 0 0 8px;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.swap-pop-kind select {
  width: 180px;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  font-size: inherit;
  font-family: inherit;
}

.swap-pop-id {
  margin: 0;
  font-size: 11px;
}

.record-pop-note {
  margin: 0 0 8px;
  font-size: 12px;
}

.record-pop-msg-label {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  color: #4a5560;
}

.record-pop-msg {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  margin: 4px 0 0;
  padding: 6px 8px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: #1c2430;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
}

.record-pop-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.record-pop-save {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #c4c9d1;
  background: #f4f6f8;
  color: #1c2430;
  cursor: pointer;
  font-size: 13px;
  pointer-events: auto;
}

.record-pop-save:hover {
  background: #e8ecf0;
}

.record-pop-hint {
  margin: 0;
  font-size: 11px;
  opacity: 0.75;
}

.record-pop-del {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #b31830;
  background: #e31c3d;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  pointer-events: auto;
}

.record-pop-del:hover {
  background: #c41834;
}

.pam-pop {
  min-width: 220px;
  max-width: 300px;
  color: #1c2430;
  line-height: 1.35;
}

.pam-pop-hero {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(145deg, #f7f1e6 0%, #efe4d2 100%);
  border: 1px solid rgba(160, 120, 60, 0.22);
}

.pam-pop-metric {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pam-pop-metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #6b4a1e;
  line-height: 1;
}

.pam-pop-metric-unit {
  font-size: 12px;
  color: #8a7048;
  font-weight: 600;
}

.pam-pop-metric-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: #5c5348;
}

.pam-pop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 0 0 10px;
}

.pam-pop-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pam-pop-label {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b949e;
}

.pam-pop-value {
  font-size: 12px;
  color: #1c2430;
  font-weight: 600;
  word-break: break-word;
}

.pam-pop-mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  font-weight: 500;
  font-size: 11px;
  line-height: 1.45;
}

.pam-pop-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  color: #66707a;
}

.pam-pop-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f6f8;
  font-size: 11px;
  color: #4a5560;
}

.pam-pop-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid #e6eaee;
  font-size: 10px;
  color: #8b949e;
}

.pam-pop-foot a {
  color: #8a6230;
  text-decoration: none;
}

.pam-pop-foot a:hover {
  text-decoration: underline;
}

.map-pet {
  position: absolute;
  right: 72px;
  bottom: 56px;
  z-index: 4;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  width: 64px;
  height: 64px;
  touch-action: none;
  user-select: none;
}
.map-pet.is-dragging {
  cursor: grabbing;
}
.map-pet img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.28));
}
.map-pet-bubble {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -4px);
  padding: 4px 8px;
  border-radius: 10px;
  background: #fff;
  color: #1a1a1a;
  font-size: 12px;
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.map-pet[data-mood="idle"] img {
  animation: map-pet-breathe 2.6s ease-in-out infinite;
}
.map-pet[data-mood="hop"] img {
  animation: map-pet-hop 0.55s ease;
}
.map-pet[data-mood="spin"] img {
  animation: map-pet-spin 0.7s ease;
}
.map-pet[data-mood="wave"] img {
  animation: map-pet-wave 0.65s ease;
}
.map-pet[data-mood="sleep"] img {
  animation: map-pet-sleep 2.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.28)) grayscale(0.35);
}
@keyframes map-pet-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes map-pet-hop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-22px) scale(1.05); }
  70% { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes map-pet-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes map-pet-wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-18deg); }
  50% { transform: rotate(16deg); }
  75% { transform: rotate(-10deg); }
}
@keyframes map-pet-sleep {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(-12deg); }
}
