/* Hotspot map — light map chrome (Noto Serif / Noto Sans TC) */
:root {
  --hm-chrome-bg: #e8eaed;
  --hm-bg: #f4f5f3;
  --hm-surface: #ffffff;
  --hm-surface-raised: #eceef0;
  --hm-border: #d4d8dc;
  --hm-text: #1a1d1f;
  --hm-text-muted: #5a6168;
  --hm-text-subtle: #72797f;
  --hm-primary: #1a1d1f;
  --hm-accent: var(--site-accent, #1565c0);
  --hm-accent-hover: var(--site-accent-hover, #0d47a1);
  --hm-radius: var(--site-radius, 8px);
  --hm-accent-muted: #e8f0fe;
  --hm-link: var(--site-link, #1a73e8);
  --hm-focus: var(--site-accent, #1a73e8);
  --hm-warn-bg: #fef7e0;
  --hm-warn-border: #fdd663;
  --hm-warn-text: #3c4043;
  --hm-touch: 44px;
  --hm-transition: 180ms ease;
  --hm-elevation-panel: 0 4px 16px rgba(26, 29, 31, 0.12);
  --hm-elevation-control: 0 2px 8px rgba(26, 29, 31, 0.14);
  --hm-font-heading: var(--site-font-heading, "Noto Serif TC", serif);
  --hm-font-body: var(--site-font-body, "Noto Sans TC", sans-serif);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--hm-font-body);
  background: var(--hm-bg);
  color: var(--hm-text);
}

h1, h2, .panel-title {
  font-family: var(--hm-font-heading);
}

#layout { display: flex; height: 100%; }

#sidebar {
  width: 340px;
  min-width: 280px;
  max-width: 40vw;
  overflow-y: auto;
  padding: 12px 14px 20px;
  background: var(--hm-surface);
  border-right: 1px solid var(--hm-border);
  -webkit-overflow-scrolling: touch;
}

#map-wrap { flex: 1; position: relative; height: 100%; min-height: 0; }
#map { width: 100%; height: 100%; }

.page-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.35;
  color: var(--hm-text);
  letter-spacing: -0.01em;
}

.page-title .tagline {
  display: block;
  font-weight: 400;
  font-size: 0.82em;
  color: var(--hm-text-muted);
  margin-top: 2px;
}

.sub {
  font-size: 0.74rem;
  color: var(--hm-text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.policy-details {
  margin: 0 0 10px;
  font-size: 0.72rem;
  border: 1px solid var(--hm-warn-border);
  border-radius: var(--hm-radius);
  background: var(--hm-warn-bg);
}

.policy-details summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--hm-warn-text);
  line-height: 1.4;
  list-style-position: outside;
  min-height: var(--hm-touch);
  display: flex;
  align-items: center;
}

.policy-details[open] summary {
  border-bottom: 1px solid var(--hm-warn-border);
}

.policy-details .policy-body {
  padding: 8px 10px 10px;
  color: var(--hm-text-muted);
  line-height: 1.45;
}

.badge {
  display: inline-block;
  background: var(--hm-surface-raised);
  border: 1px solid var(--hm-border);
  border-radius: 6px;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  font-size: 0.75rem;
  color: var(--hm-text);
}

.badge.hi { border-color: #d93025; color: #c5221f; background: #fce8e6; }

.panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--hm-text);
  margin: 14px 0 8px;
}

.ctrl { margin-bottom: 8px; }

.ctrl label.block-label {
  display: block;
  font-size: 0.78rem;
  color: var(--hm-text-muted);
  margin-bottom: 4px;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.presets--primary button {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
}

.presets button {
  font-size: 0.8rem;
  padding: 10px 12px;
  min-height: var(--hm-touch);
  border-radius: var(--hm-radius);
  cursor: pointer;
  background: var(--hm-surface-raised);
  color: var(--hm-text);
  border: 1px solid var(--hm-border);
  transition: border-color var(--hm-transition), background var(--hm-transition), color var(--hm-transition);
}

.presets button:hover { border-color: var(--hm-accent); }
.presets button:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.presets button.active {
  background: var(--hm-accent);
  border-color: var(--hm-accent);
  color: #fff;
  font-weight: 600;
}

.more-filters,
.more-stats {
  margin: 10px 0 0;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-bg);
}

.more-filters > summary,
.more-stats > summary {
  cursor: pointer;
  padding: 10px 12px;
  min-height: var(--hm-touch);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--hm-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.more-filters > summary::-webkit-details-marker,
.more-stats > summary::-webkit-details-marker { display: none; }

.more-filters > summary::after,
.more-stats > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--hm-text-muted);
  border-bottom: 2px solid var(--hm-text-muted);
  transform: rotate(45deg);
  transition: transform var(--hm-transition);
  flex-shrink: 0;
}

.more-filters[open] > summary::after,
.more-stats[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.more-filters__body,
.more-stats__body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--hm-border);
}

.more-filters__body .panel-title,
.more-stats__body .panel-title { margin-top: 10px; }

.map-trust-cue {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--hm-text-muted);
}

.map-summary {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--hm-text);
  text-align: left;
  cursor: pointer;
}

button.map-summary:hover,
button.map-summary:focus-visible {
  color: var(--hm-accent);
}

button.map-summary:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.more-stats-tip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--hm-text-muted);
  background: var(--hm-accent-muted);
  border: 1px solid #d2e3fc;
  border-radius: var(--hm-radius);
}

.more-stats-tip[hidden] {
  display: none !important;
}

.more-stats-tip__dismiss {
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: var(--hm-link);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.more-stats--focus {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.legend-short__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.legend-short__list li {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin: 4px 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--hm-text-muted);
}

.legend-short__list .map-chrome-legend__swatch {
  margin: 3px 4px 0 0;
  flex-shrink: 0;
}

.legend-short__counts {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--hm-text-muted);
}

.map-legend-panel--short {
  padding: 8px 10px;
  margin: 4px 0 8px;
}

.map-legend-panel--short .panel-title {
  margin-bottom: 6px;
}

.dates {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.dates-label {
  font-size: 0.75rem;
  color: var(--hm-text-muted);
  flex-shrink: 0;
}

.dates input[type=date] {
  background: var(--hm-surface);
  color: var(--hm-text);
  border: 1px solid var(--hm-border);
  border-radius: 6px;
  padding: 8px 6px;
  font-size: 0.8rem;
  min-height: var(--hm-touch);
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  margin: 6px 0;
  color: var(--hm-text);
  min-height: var(--hm-touch);
  padding: 6px 0;
  cursor: pointer;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--hm-accent);
  flex-shrink: 0;
}

.toggle-row label {
  flex: 1;
  cursor: pointer;
  color: var(--hm-text);
  line-height: 1.35;
}

.toggle-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.75em;
  font-weight: 400;
  color: var(--hm-text-muted);
  line-height: 1.35;
}

input[type=range] {
  width: 100%;
  accent-color: var(--hm-accent);
}

.range-val { font-size: 0.75rem; color: var(--hm-text-muted); }

.street-search {
  margin: 0 0 12px;
}
.street-search__label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}
.street-search input[type="search"] {
  width: 100%;
  min-height: var(--hm-touch);
  padding: 8px 10px;
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  background: var(--hm-surface-raised);
  color: var(--hm-text);
  font: inherit;
}
.street-search input[type="search"]:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}
.street-search-result {
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
}
.street-search-result[hidden] { display: none; }
.street-search-note {
  margin: 0 0 8px;
  padding: 8px;
  background: #eef4ff;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
}
.street-search-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: #fef7e0;
  border: 1px solid #fdd663;
  color: #3c4043;
}
.street-search-pick-title {
  margin: 0 0 8px;
  font-weight: 600;
}
.street-search-pick {
  margin: 0;
  padding: 0;
  list-style: none;
}
.street-search-result p { margin: 0 0 6px; }
.street-search-result ul {
  margin: 0 0 8px;
  padding-left: 0;
  list-style: none;
}
.dsop-hide-for-overlay {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 8px 12px;
  min-height: var(--hm-touch);
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dsop-hide-for-overlay:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}
.dsop-copy-license {
  font-size: 12px;
  padding: 10px 12px;
  margin-left: 4px;
  min-height: var(--hm-touch);
  min-width: var(--hm-touch);
  cursor: pointer;
  border: 1px solid #8b949e;
  border-radius: 8px;
  background: #f6f8fa;
  color: inherit;
  vertical-align: middle;
}
.dsop-license-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--hm-touch);
  padding: 8px 10px;
  margin: 2px 4px 2px 0;
  border-radius: 8px;
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-raised);
  text-decoration: none;
}
.dsop-license-links a:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}
.dsop-license-line code {
  font-size: 12px;
}
.street-search-result button:not(.dsop-copy-license) {
  width: 100%;
  min-height: var(--hm-touch);
  margin: 0 0 6px;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  background: var(--hm-surface-raised);
  color: var(--hm-text);
  font: inherit;
  cursor: pointer;
}
.street-search-hit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.street-search-hit-row .street-search-hit {
  flex: 1 1 auto;
  min-width: 8rem;
  margin: 0;
  overflow-wrap: anywhere;
}
.street-search-dismiss {
  flex: 0 0 auto;
  min-height: var(--hm-touch);
  min-width: var(--hm-touch);
  padding: 8px 12px;
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  background: var(--hm-surface-raised);
  font: inherit;
  cursor: pointer;
}
.street-search-result--compact {
  max-height: none !important;
  padding: 6px 10px;
}
.street-search-result button:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}
#layout:not(.sidebar-collapsed) .street-search-result--map {
  display: none;
}

.street-search-result--map {
  position: absolute;
  z-index: 1050;
  left: 8px;
  right: 8px;
  top: 58px;
  max-height: min(46vh, 320px);
  overflow: auto;
  margin: 0;
  padding: 8px 10px;
  background: var(--hm-surface);
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
#layout.sidebar-collapsed .street-search--map {
  flex: 1 1 120px;
  min-width: 0;
  margin: 0;
}
#layout.sidebar-collapsed .street-search--map input[type="search"] {
  min-height: 36px;
  background: var(--hm-surface);
}
.hm-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

ol.top {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
}

ol.top li { margin: 6px 0; cursor: pointer; padding: 2px 0; }
ol.top li:hover { color: var(--hm-link); }

.map-legend-panel {
  margin: 4px 0 10px;
  padding: 10px 12px;
  background: var(--hm-surface-raised);
  border-radius: var(--hm-radius);
}

.map-legend-panel .panel-title {
  margin-top: 0;
}

.map-legend-panel__ongoing {
  margin-bottom: 6px;
}

.legend-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--hm-text-muted);
}

.legend-compact > div {
  display: flex;
  align-items: center;
  min-height: 1.5rem;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.note {
  font-size: 0.68rem;
  color: var(--hm-text-subtle);
  margin-top: 12px;
  line-height: 1.45;
}

.scope-note {
  font-size: 0.7rem;
  color: var(--hm-text-muted);
  line-height: 1.45;
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--hm-surface);
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
}

.scope-note a { color: var(--hm-link); }
.scope-note .en {
  display: block;
  margin-top: 4px;
  font-size: 0.66rem;
  color: var(--hm-text-subtle);
}

.site-disclaimer.theme-dark ul,
.site-freshness.theme-dark ul {
  margin: 4px 0 0;
  padding-left: 1.1rem;
}

#ongoing-dsat-stats {
  font-size: 0.74rem;
  line-height: 1.5;
  margin: 0 0 8px;
  padding: 8px 10px;
  background: var(--hm-surface-raised);
  border: 1px solid var(--hm-border);
  border-left: 3px solid var(--hm-accent);
  border-radius: var(--hm-radius);
  color: var(--hm-text-muted);
}

#ongoing-dsat-stats .stat-line { margin: 2px 0; }
#ongoing-dsat-stats strong { color: var(--hm-text); }
#ongoing-dsat-stats details { margin-top: 6px; font-size: 0.7rem; }
#ongoing-dsat-stats summary { cursor: pointer; color: var(--hm-link); }
#ongoing-dsat-stats ul { margin: 4px 0 0; padding-left: 1.1rem; }

.leaflet-container .leaflet-popup {
  margin-bottom: 12px;
}

.leaflet-popup-content-wrapper {
  max-height: min(72vh, 520px);
}

.leaflet-popup-content {
  color: #1a1a1a;
  font-size: 13px;
  min-width: 220px;
  max-width: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.leaflet-popup-content a { color: var(--hm-link); }
.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-meta { color: #555; margin-bottom: 6px; }
.popup-list { margin: 4px 0 0; padding-left: 1.1rem; max-height: 220px; overflow-y: auto; }
.popup-list--history { max-height: 160px; }
@media (max-width: 720px) {
  .popup-list { max-height: 280px; }
  .popup-list--history { max-height: 200px; }
}
.popup-notice-meta {
  margin: 4px 0 2px;
  padding: 4px 6px;
  background: #f6f7f8;
  border-radius: 4px;
  font-size: 12px;
  color: #444;
  line-height: 1.35;
}
.popup-notice-meta-row { margin: 2px 0; }
.popup-notice-meta-label { color: #333; }
.popup-notice-meta-value { color: #555; }
.popup-history-fold {
  margin: 4px 0 0;
  font-size: 12px;
}
.popup-history-fold summary {
  cursor: pointer;
  color: #5f6368;
  user-select: none;
  padding: 4px 0;
}
.leaflet-pane path.hm-segment-ambient-hit {
  cursor: pointer;
}
.leaflet-pane path.hm-segment-highlight-hit {
  cursor: pointer;
}
.popup-traffic-summary {
  font-size: 12px;
  background: #fff8eb;
  border: 1px solid #e6c200;
  padding: 4px 6px;
  border-radius: 4px;
  margin-top: 4px;
}
.popup-traffic-measure {
  display: inline-block;
  font-size: 12px;
  color: #9a6700;
  margin-top: 2px;
}
.popup-traffic-segments {
  margin: 2px 0 0;
  padding-left: 1.1rem;
  font-size: 12px;
  color: #5f6368;
  line-height: 1.45;
}
.popup-traffic-segments-more {
  list-style: none;
  margin-left: -1.1rem;
  color: #80868b;
}
.popup-traffic-seg--today {
  font-weight: 600;
  color: #1a1a1a;
  background: #e8f4fd;
  border: 1px solid #c6daf5;
  border-radius: 4px;
  padding: 3px 6px;
  margin: 3px 0;
  list-style: none;
  margin-left: -1.1rem;
  padding-left: calc(1.1rem + 6px);
  line-height: 1.4;
}
.popup-traffic-today-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #1a73e8;
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.popup-traffic-future-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #1a5f2a;
  background: #d4edda;
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
}
.popup-traffic-past-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #5f6368;
  background: #e8eaed;
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
}
.popup-traffic-seg--muted {
  color: #9aa0a6;
}
.popup-traffic-seg--muted.popup-traffic-seg--clickable {
  color: #5f6368;
}
.popup-traffic-seg--clickable {
  cursor: pointer;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 4px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(26, 115, 232, 0.15);
}
.popup-traffic-seg--loading {
  cursor: progress;
}
.popup-traffic-seg--loading::after {
  content: '標示中…';
  margin-left: 6px;
  color: #d93025;
  font-weight: 600;
  font-size: 11px;
}
.popup-traffic-seg--clickable:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}
.popup-traffic-seg--active {
  box-shadow: inset 0 0 0 2px #d93025;
}

.hm-segment-return {
  position: absolute;
  z-index: 900;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 16px);
  margin: 0;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--hm-border);
  border-radius: 999px;
  background: var(--hm-surface);
  box-shadow: var(--hm-elevation-panel);
  transform: translateX(-50%);
  pointer-events: auto;
}

.hm-segment-return[hidden] {
  display: none;
}

.hm-segment-return__text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hm-text);
  white-space: nowrap;
}

.hm-segment-return button {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hm-segment-return__back {
  border: none;
  background: var(--hm-accent);
  color: #fff;
}

.hm-segment-return__clear {
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-raised);
  color: var(--hm-text);
}

.hm-segment-return button:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .hm-segment-return button {
    min-height: var(--hm-touch);
  }
}

/* Pin → segment dashed leaders (ambient on load; stronger on 路段 selection) */
.leaflet-pane path.hm-segment-leader {
  pointer-events: none;
}

.leaflet-pane path.hm-segment-leader--ambient {
  filter: none;
}

.leaflet-pane path.hm-segment-ambient {
  cursor: pointer;
}

.hm-ambient-segment-card-wrap {
  position: absolute;
  z-index: 1000;
  max-width: min(340px, calc(100% - 24px));
  max-height: min(52vh, 420px);
  overflow: auto;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(60, 64, 67, 0.28);
  padding: 10px 12px 12px;
  transform: translateX(-50%);
  -webkit-overflow-scrolling: touch;
}

.hm-ambient-segment-card-wrap[hidden] {
  display: none !important;
}

.hm-ambient-segment-card__close {
  position: sticky;
  top: 0;
  float: right;
  margin: -2px -4px 4px 8px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #5f6368;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.hm-ambient-segment-card__close:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.hm-ambient-segment-card__meta {
  font-size: 11px;
  color: #5f6368;
}

.hm-ambient-segment-card__list {
  margin-top: 6px;
}

@media (max-width: 720px) {
  .hm-ambient-segment-card-wrap {
    max-height: min(46vh, 360px);
  }

  .hm-ambient-segment-card__close {
    min-height: var(--hm-touch);
    min-width: var(--hm-touch);
  }
}

.map-chrome-legend__swatch--line {
  height: 4px;
  width: 18px;
  border-radius: 2px;
  vertical-align: middle;
}

.popup-traffic-other-wrap {
  list-style: none;
  margin-left: -1.1rem;
  margin-top: 4px;
}
.popup-traffic-other summary {
  cursor: pointer;
  color: #5f6368;
  font-size: 11px;
  user-select: none;
}
.popup-traffic-segments--nested {
  margin-top: 4px;
  padding-left: 1rem;
}
.popup-traffic-segments-other-streets {
  list-style: none;
  margin: 6px 0 2px;
}
.popup-traffic-segments-other-label {
  color: #5f6368;
  font-size: 11px;
  font-weight: 600;
}
.redig { margin-top: 6px; padding: 4px 6px; background: #fff3cd; border-radius: 4px; font-size: 12px; }

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.share-row button {
  flex: 1 1 auto;
  min-height: var(--hm-touch);
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--hm-radius);
  cursor: pointer;
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-raised);
  color: var(--hm-text);
  transition: background var(--hm-transition), border-color var(--hm-transition);
}

.share-row--compact {
  margin: 4px 0 2px;
  gap: 12px;
}

.share-row button.share-text {
  flex: 0 0 auto;
  min-height: auto;
  padding: 4px 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--hm-link);
  font-weight: 500;
  font-size: 0.8rem;
}

.share-row button.share-text:hover {
  border: none;
  text-decoration: underline;
}

.share-row button:hover { border-color: var(--hm-accent); }
.share-row button:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.share-row button.primary {
  background: var(--hm-accent);
  border-color: var(--hm-accent);
  color: #fff;
}

.share-row button.primary:hover { background: var(--hm-accent-hover); }

#share-copy-feedback {
  font-size: 0.82rem;
  font-weight: 600;
  color: #188038;
  width: 100%;
  margin: 6px 0 0;
  padding: 8px 10px;
  display: none;
  background: #e6f4ea;
  border: 1px solid #34a853;
  border-radius: 8px;
}

.map-sticky-bar {
  display: none;
}

#layout.sidebar-collapsed .map-sticky-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 910;
  padding: 8px 12px;
  background: var(--hm-surface);
  border-bottom: 1px solid var(--hm-border);
}

#layout.sidebar-collapsed .map-sticky-bar__text {
  min-width: 0;
  flex: 1 1 auto;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

#layout.sidebar-collapsed .map-sticky-bar__text:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

#layout.sidebar-collapsed .map-sticky-bar__title {
  display: block;
  font-family: var(--hm-font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

#layout.sidebar-collapsed .map-sticky-bar__title::after {
  content: " · 更多";
  font-family: var(--hm-font-body);
  font-size: 0.78em;
  font-weight: 600;
  color: var(--hm-link);
}

#layout.sidebar-collapsed .map-sticky-bar__meta {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--hm-text-muted);
  line-height: 1.35;
  white-space: normal;
}

#layout.sidebar-collapsed .map-sticky-bar__meta .map-trust-cue {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 500;
}

#layout.sidebar-collapsed .map-sticky-bar__meta .map-trust-cue::after {
  content: " · ";
}

#layout.sidebar-collapsed .sidebar-toggle {
  position: static;
  flex: 0 0 auto;
}

.map-chrome-legend {
  position: absolute;
  left: 10px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 880;
  max-width: min(260px, calc(100% - 20px));
  padding: 8px 10px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--hm-text-muted);
  background: var(--hm-surface);
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  pointer-events: none;
}

.map-chrome-legend .legend-short__list {
  margin-top: 4px;
}

.map-chrome-legend .legend-short__list li {
  font-size: 0.72rem;
}

.map-chrome-legend__title {
  font-weight: 600;
  color: var(--hm-text);
  margin-right: 6px;
}

.map-chrome-legend__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 2px 0 6px;
}

.map-chrome-legend__grad {
  display: inline-block;
  width: 48px;
  height: 8px;
  border-radius: 4px;
  vertical-align: middle;
  margin: 0 4px;
  background: linear-gradient(90deg, #1a9850, #fee08b, #d73027);
}

.map-chrome-legend__heat {
  color: #e37400;
}

.map-chrome-legend__pin-note {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px solid var(--hm-border);
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--hm-text-subtle);
}

.popup-mega-streets {
  font-size: 12px;
  margin-top: 4px;
}

.popup-pin-note {
  margin-top: 2px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #888;
}

.ongoing-figures {
  margin: 6px 0 8px;
  padding: 8px 10px;
  font-size: 0.72rem;
  line-height: 1.45;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-surface-raised);
}

.ongoing-figures__row {
  margin: 4px 0;
}

.ongoing-figures__row strong {
  color: var(--hm-text);
}

.hm-fold--meta {
  margin: 12px 0 10px;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-surface-raised);
}

.hm-fold--meta > summary {
  cursor: pointer;
  padding: 10px 12px;
  min-height: var(--hm-touch);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--hm-link);
}

.hm-fold--meta .site-disclaimer.theme-dark {
  margin: 0;
  border: none;
  border-radius: 0;
  font-size: 0.8125rem;
}

.sidebar-toggle {
  position: absolute;
  z-index: 900;
  top: 10px;
  right: 10px;
  min-height: var(--hm-touch);
  min-width: var(--hm-touch);
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--hm-radius);
  cursor: pointer;
  border: 1px solid var(--hm-border);
  background: var(--hm-surface);
  color: var(--hm-text);
  box-shadow: var(--hm-elevation-control);
}

.sidebar-toggle:hover { border-color: var(--hm-accent); }
.sidebar-toggle:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.sidebar-sheet-header {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 950;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(32, 33, 36, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hm-fold {
  margin: 0 0 10px;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-warn-bg);
}

.hm-fold > summary {
  cursor: pointer;
  padding: 10px 12px;
  min-height: var(--hm-touch);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--hm-warn-text);
  line-height: 1.35;
  list-style: none;
  display: flex;
  align-items: center;
}

.hm-fold > summary::-webkit-details-marker { display: none; }

.hm-fold[open] > summary {
  border-bottom: 1px solid var(--hm-border);
}

.hm-fold--disclaimer .site-disclaimer.theme-dark {
  margin: 0;
  border: none;
  border-radius: 0;
  font-size: 0.8125rem;
}

#layout.sidebar-collapsed #sidebar { display: none; }
#layout.sidebar-collapsed #map-wrap { flex: 1; width: 100%; height: 100%; min-height: 100%; }

/* Before JS applies session/desktop state, keep desktop sidebar visible while HTML defaults collapsed for mobile. */
@media (min-width: 721px) {
  #layout:not(.hm-sidebar-ready).sidebar-collapsed #sidebar {
    display: block;
  }

  #layout:not(.hm-sidebar-ready).sidebar-collapsed #map-wrap {
    width: 100%;
    min-width: 0;
  }
}

@media (min-width: 721px) {
  #layout {
    display: block;
    position: relative;
    background: var(--hm-chrome-bg);
  }

  #map-wrap {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    border-radius: 0;
  }

  #sidebar {
    position: absolute;
    z-index: 920;
    left: 12px;
    top: 12px;
    bottom: 12px;
    width: min(360px, 38vw);
    min-width: 280px;
    max-width: none;
    border-right: none;
    border-radius: 12px;
    border: 1px solid var(--hm-border);
    box-shadow: var(--hm-elevation-panel);
  }

  #layout.sidebar-collapsed #sidebar {
    display: none;
  }

  .sidebar-sheet-header {
    display: none !important;
  }

}

@media (max-width: 720px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.hm-sidebar-open { overflow: hidden; }

  #layout {
    --hm-mobile-map-bar-height: 68px;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  #map-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
  }

  #map {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }

  body.hm-sidebar-open .map-sticky-bar {
    z-index: 1010;
  }

  .map-sticky-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 910;
    padding: 8px 10px 8px 12px;
    background: var(--hm-surface);
    border-bottom: 1px solid var(--hm-border);
  }

  /* Collapsed-desktop rule is position:absolute and outranks the block above.
     On a phone the bar stays in the column so the map starts below it. */
  #layout.sidebar-collapsed .map-sticky-bar {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
  }

  .leaflet-popup-content .popup-traffic-seg--clickable {
    min-height: var(--hm-touch);
    margin: 0 0 8px;
    padding: 10px 12px;
    position: relative;
    z-index: 2;
    color: #202124;
    background: #fff;
    border: 1px solid #dadce0;
    border-left: 3px solid #1a73e8;
  }

  .leaflet-popup-content .popup-traffic-seg--muted.popup-traffic-seg--clickable {
    color: #202124;
  }

  .leaflet-popup-content .popup-traffic-seg--today.popup-traffic-seg--clickable {
    background: #e8f4fd;
    border-color: #c6daf5;
    border-left-color: #1a73e8;
  }

  .leaflet-popup-content .popup-traffic-seg--active {
    background: #fdecea;
    border-left-color: #d93025;
  }

  .leaflet-popup-content.leaflet-popup-scrolled {
    -webkit-overflow-scrolling: touch;
  }

  /* Leaflet's stylesheet loads after this file, so the id is required to win. */
  #map.leaflet-container a.leaflet-popup-close-button {
    width: 44px;
    height: 44px;
    font-size: 22px;
    line-height: 44px;
    padding: 0;
  }

  #map .leaflet-popup-content {
    margin-right: 48px;
  }

  .map-sticky-bar__text {
    min-width: 0;
    flex: 1 1 auto;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
  }

  .map-sticky-bar__text:focus-visible {
    outline: 2px solid var(--hm-focus);
    outline-offset: 2px;
    border-radius: 4px;
  }

  .map-sticky-bar__title {
    display: block;
    font-family: var(--hm-font-heading);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--hm-text);
  }

  .map-sticky-bar__title::after {
    content: " · 更多";
    font-family: var(--hm-font-body);
    font-size: 0.78em;
    font-weight: 600;
    color: var(--hm-link);
  }

  .map-sticky-bar__meta {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--hm-text-muted);
    line-height: 1.35;
    white-space: normal;
  }

  .map-sticky-bar__meta .map-trust-cue {
    display: inline;
    margin: 0;
    font-size: inherit;
    font-weight: 500;
  }

  .map-sticky-bar__meta .map-trust-cue::after {
    content: " · ";
  }

  .sidebar-toggle {
    position: static;
    flex: 0 0 auto;
    min-height: var(--hm-touch);
    min-width: auto;
    padding: 10px 16px;
    font-size: 1rem;
    box-shadow: none;
    background: var(--hm-surface-raised);
  }

  #layout:not(.sidebar-collapsed) .sidebar-backdrop {
    display: block;
    z-index: 990;
    top: calc(var(--hm-mobile-map-bar-height) + env(safe-area-inset-top, 0px));
  }

  .sidebar-sheet-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 3;
    margin: -10px -12px 8px;
    padding: 8px 12px 6px;
    min-height: 0;
    background: var(--hm-surface);
    border-bottom: 1px solid var(--hm-border);
  }

  .sidebar-sheet-header__handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--hm-border);
  }

  .sidebar-sheet-header__title {
    font-family: var(--hm-font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hm-text-muted);
    min-width: 0;
  }

  #sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 1000;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(
      48vh,
      calc(100dvh - var(--hm-mobile-map-bar-height) - env(safe-area-inset-top, 0px) - 16px)
    );
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: none;
    padding: 10px 12px max(16px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 16px rgba(60, 64, 67, 0.28);
    border-radius: var(--hm-radius) var(--hm-radius) 0 0;
  }

  #layout.sidebar-collapsed #sidebar {
    display: none;
  }

  #sidebar .page-title,
  #sidebar .page-title .tagline,
  #sidebar .map-summary,
  #sidebar .time-range-label,
  #sidebar .street-search--sidebar {
    display: none;
  }

  #sidebar .sub {
    font-size: 1rem;
    line-height: 1.45;
  }

  #sidebar .panel-title {
    font-size: 0.875rem;
    color: var(--hm-text-muted);
    margin-top: 14px;
  }

  #sidebar .presets button,
  #sidebar .more-filters > summary,
  #sidebar .more-stats > summary,
  #sidebar .share-row button:not(.share-text),
  #sidebar .policy-details summary,
  #sidebar .hm-fold--meta > summary {
    font-size: 1rem;
    min-height: var(--hm-touch);
    padding: 12px 14px;
  }

  #sidebar .share-row button.share-text {
    min-height: auto;
    padding: 4px 0;
    font-size: 0.875rem;
  }

  #sidebar .toggle-row {
    font-size: 1rem;
    min-height: var(--hm-touch);
    padding: 6px 0;
  }

  #sidebar .toggle-row input {
    width: 22px;
    height: 22px;
  }

  #sidebar .ctrl label.block-label,
  #sidebar .range-val,
  #sidebar ol.top,
  #sidebar .legend-compact {
    font-size: 1rem;
  }

  #sidebar .dates input[type=date] {
    font-size: 1rem;
    flex: 1 1 8rem;
  }

  #sidebar #site-nav .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 0 8px;
    padding: 4px 0 8px;
    gap: 4px 8px;
    font-size: 1rem;
    border-bottom-color: var(--hm-border);
  }

  #sidebar #site-nav .site-nav::-webkit-scrollbar {
    display: none;
  }

  #sidebar #site-nav .site-nav a {
    min-height: var(--hm-touch);
    padding: 8px 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #sidebar #site-nav .nav-sep {
    flex-shrink: 0;
  }

  #sidebar .site-freshness.theme-dark {
    font-size: 0.875rem;
    padding: 8px 10px;
    margin: 8px 0;
  }

  #sidebar .site-freshness.theme-dark ul {
    margin-top: 4px;
  }

  #sidebar .site-freshness.theme-dark li {
    margin: 4px 0;
  }

  #sidebar .policy-details {
    font-size: 0.875rem;
  }

  #sidebar .note {
    font-size: 0.8125rem;
    color: var(--hm-text-muted);
  }

  #sidebar .badge {
    font-size: 0.875rem;
  }

  .map-status-banner {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    pointer-events: auto;
  }

  #layout.sidebar-collapsed #map-wrap {
    flex: 1;
    min-height: 0;
    height: auto;
  }
}

@media (max-width: 430px) {
  .map-sticky-bar {
    padding: 6px 8px 6px 10px;
    gap: 8px;
  }

  .map-sticky-bar__title {
    font-size: 0.9375rem;
  }

  .map-sticky-bar__meta {
    font-size: 0.75rem;
  }

  .sidebar-toggle {
    padding: 10px 12px;
    font-size: 0.9375rem;
  }

  #layout {
    --hm-mobile-map-bar-height: 76px;
  }

  #sidebar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar-sheet-header {
    margin-left: -10px;
    margin-right: -10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .presets--primary button {
    flex: 1 1 100%;
  }

  #layout.sidebar-collapsed .street-search-result--map {
    top: calc(var(--hm-mobile-map-bar-height) + 54px);
    left: 58px;
    right: 8px;
  }
}

/* Leaflet — Google-like map controls */
.leaflet-control-zoom,
.leaflet-bar {
  border: none !important;
  box-shadow: var(--hm-elevation-control) !important;
  border-radius: 2px !important;
  overflow: hidden;
}

.leaflet-control-zoom a,
.leaflet-bar a {
  background: var(--hm-surface) !important;
  color: var(--hm-text-muted) !important;
  border-bottom: 1px solid var(--hm-border) !important;
  width: var(--hm-touch) !important;
  height: var(--hm-touch) !important;
  line-height: var(--hm-touch) !important;
  font-size: 18px !important;
}

.leaflet-control-zoom a:hover,
.leaflet-bar a:hover {
  background: var(--hm-surface-raised) !important;
  color: var(--hm-text) !important;
}

.leaflet-control-zoom-in { border-radius: 2px 2px 0 0 !important; }
.leaflet-control-zoom-out { border-bottom: none !important; }

.leaflet-control-attribution {
  background: color-mix(in srgb, var(--hm-surface) 88%, transparent) !important;
  color: var(--hm-text-subtle) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 2px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--hm-link) !important;
}

.hm-map-control.leaflet-bar a.hm-locate-btn {
  border-bottom: none !important;
  font-size: 20px !important;
  line-height: 38px !important;
}

.hm-locate-btn--active {
  color: var(--hm-accent) !important;
}

.hm-locate-btn--error {
  color: #d93025 !important;
}

.leaflet-div-icon.hm-user-loc-marker {
  background: transparent !important;
  border: none !important;
}

.hm-user-loc-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 3px;
  background: #1a73e8;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .presets button,
  .share-row button,
  .more-filters > summary::after,
  .more-stats > summary::after {
    transition: none;
  }
}


/* Notice kind chips (疏通排水 vs 掘路) */
.popup-kind-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: middle;
}
.popup-kind-chip--drain {
  background: #e7f5ff;
  color: #1864ab;
  border: 1px solid #74c0fc;
}

/* P2 docked pin data card — outside Leaflet panes so position:fixed works */
.hm-pin-data-card {
  position: absolute;
  z-index: 940;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid var(--hm-border);
  box-shadow: var(--hm-elevation-panel);
  overflow: hidden;
  pointer-events: auto;
}

.hm-pin-data-card[hidden] {
  display: none !important;
}

.hm-pin-card__handle {
  display: none;
  flex: 0 0 auto;
  height: 18px;
  cursor: ns-resize;
  touch-action: none;
}

.hm-pin-card__handle::after {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: #dadce0;
}

.hm-pin-data-card__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 12px;
}

.hm-pin-data-card--side {
  top: 64px;
  right: 12px;
  bottom: auto;
  width: 340px;
  max-width: min(360px, calc(100% - 24px));
  height: auto;
  max-height: calc(100dvh - 76px);
  border-radius: 12px;
}

.hm-pin-data-card--sheet {
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: var(--hm-pin-sheet-vh, 42vh);
  max-height: 70vh;
  border-radius: 16px 16px 0 0;
  border-bottom: none;
}

.hm-pin-data-card--sheet .hm-pin-card__handle {
  display: block;
}

.hm-pin-card {
  font-size: 13px;
  line-height: 1.45;
}

.hm-pin-card__top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.hm-pin-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.hm-pin-card__street {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.hm-pin-card__chip {
  flex: 0 0 auto;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #dadce0;
  background: #f1f3f4;
  color: #202124;
  white-space: nowrap;
}

.hm-pin-card__chip--ongoing {
  background: #e6f4ea;
  border-color: #81c995;
  color: #137333;
}

.hm-pin-card__chip--gap {
  background: #e8f0fe;
  border-color: #8eb6ff;
  color: #1d4ed8;
}

.hm-pin-card__chip--drain {
  background: #e7f5ff;
  border-color: #74c0fc;
  color: #1864ab;
}

.hm-pin-card__chip--done {
  background: #f1f3f4;
  border-color: #dadce0;
  color: #5f6368;
}

.hm-pin-card__chip--missing_geo {
  background: #fef7e0;
  border-color: #fdd663;
  color: #3c4043;
}

.ungeocoded-badge {
  position: absolute;
  top: 58px;
  right: 10px;
  z-index: 1060;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--hm-warn-border);
  border-radius: 999px;
  background: var(--hm-warn-bg);
  color: var(--hm-warn-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--hm-elevation-control);
}
.ungeocoded-badge[hidden] { display: none; }
.ungeocoded-badge:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

.ungeocoded-list {
  position: absolute;
  z-index: 1055;
  left: 8px;
  right: 8px;
  top: 100px;
  max-height: min(46vh, 320px);
  overflow: auto;
  margin: 0;
  padding: 8px 10px;
  background: var(--hm-surface);
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.8rem;
  line-height: 1.45;
}
.ungeocoded-list[hidden] { display: none; }
.ungeocoded-list__title {
  margin: 0 0 6px;
  font-weight: 700;
}
.ungeocoded-list__note {
  margin: 0 0 8px;
  color: var(--hm-text-muted);
}
.ungeocoded-list__items {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}
.ungeocoded-list__items button {
  width: 100%;
  min-height: var(--hm-touch);
  margin: 0 0 6px;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--hm-border);
  border-radius: 8px;
  background: var(--hm-surface-raised);
  color: var(--hm-text);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ungeocoded-list__summary {
  font-size: 0.72rem;
  color: var(--hm-text-muted);
}

.hm-pin-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hm-pin-card__hide,
.hm-pin-card__close,
.hm-pin-card__report,
.dsop-hide-for-overlay {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.hm-pin-card__hide,
.hm-pin-card__report,
.dsop-hide-for-overlay {
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-raised);
  color: var(--hm-text);
}

.hm-pin-card__close {
  border: none;
  background: #202124;
  color: #fff;
}

.hm-pin-card__conclusion {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 650;
  color: #202124;
}

.hm-pin-card__lists {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hm-pin-card__group {
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fff;
}

.hm-pin-card__group:not([open]) {
  background: #f8f9fa;
}

.hm-pin-card__group > summary {
  cursor: pointer;
  padding: 8px 10px;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hm-pin-card__group > summary::-webkit-details-marker { display: none; }

.hm-pin-card__group-label {
  flex: 1 1 auto;
  min-width: 0;
}

.hm-pin-card__group-count {
  flex: 0 0 auto;
  min-width: 1.4em;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef0f2;
  color: #5f6368;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.hm-pin-card__group > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 2px solid #80868b;
  border-bottom: 2px solid #80868b;
  transform: rotate(45deg);
}

.hm-pin-card__group[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.hm-pin-card__group-body {
  padding: 0 10px 10px;
}

.hm-pin-card .popup-list,
.hm-pin-card .popup-list--history {
  max-height: none;
}

.hm-pin-card .popup-list > li {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f4;
}

.hm-pin-card .popup-list > li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hm-pin-card__legend {
  margin: 10px 0 6px;
  font-size: 11px;
  color: #5f6368;
}

.hm-pin-card__explain {
  margin: 0;
  font-size: 12px;
  color: #5f6368;
}

.hm-pin-card__explain > summary {
  cursor: pointer;
  padding: 6px 0;
}

.hm-pin-card__explain ul {
  margin: 0;
  padding-left: 1.1rem;
}

.hm-pin-card--gap .hm-pin-card__top {
  border-left: 3px solid #1d4ed8;
  padding-left: 8px;
}

.hm-pin-card--drain .hm-pin-card__top {
  border-left: 3px solid #4dabf7;
  padding-left: 8px;
}

.hm-pin-card--notice .hm-pin-card__top {
  border-left: 3px solid #ca8a04;
  padding-left: 8px;
}

.hm-pin-card--ambient .hm-pin-card__top,
.hm-ambient-segment-card.hm-pin-card--ambient .popup-title {
  border-left: 3px solid #e57373;
  padding-left: 8px;
}

.leaflet-popup.hm-pin-card-leaflet-hidden,
.leaflet-popup.hm-pin-card-leaflet .leaflet-popup-content-wrapper {
  /* Balloon is a content host only; the docked card is the visible UI. */
}

.leaflet-popup.hm-pin-card-leaflet-hidden {
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
}

@media (max-width: 720px) {
  #layout.hm-pin-card-open .leaflet-bottom.leaflet-right {
    bottom: calc(var(--hm-pin-sheet-vh, 42vh) + 8px);
  }

  .hm-pin-card__hide,
  .hm-pin-card__close,
  .hm-pin-card__report,
  .dsop-hide-for-overlay {
    min-height: var(--hm-touch);
  }

  .hm-segment-return--peek {
    bottom: 12px;
    top: auto;
  }

  .hm-ambient-segment-card-wrap.hm-pin-data-card--sheet {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
  }
}

.hm-feedback-fab {
  position: absolute;
  right: 12px;
  bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  z-index: 930;
  min-height: var(--hm-touch);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--hm-border);
  background: var(--hm-surface);
  color: var(--hm-text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--hm-elevation-control);
}

.hm-feedback-fab:hover { border-color: var(--hm-accent); }
.hm-feedback-fab:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
}

#layout.hm-feedback-open .hm-feedback-fab {
  visibility: hidden;
}

.hm-feedback-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1010;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(32, 33, 36, 0.45);
  cursor: pointer;
}

.hm-feedback-backdrop[hidden] { display: none !important; }

.hm-feedback-sheet {
  position: fixed;
  z-index: 1020;
  display: flex;
  flex-direction: column;
  background: var(--hm-surface);
  color: var(--hm-text);
  border: 1px solid var(--hm-border);
  box-shadow: var(--hm-elevation-panel);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.hm-feedback-sheet[hidden] { display: none !important; }

.hm-feedback-sheet__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 12px 6px;
  background: var(--hm-surface);
  border-bottom: 1px solid var(--hm-border);
}

.hm-feedback-sheet__handle {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--hm-border);
  flex: 0 0 100%;
}

.hm-feedback-sheet__title {
  font-family: var(--hm-font-heading);
  font-size: 0.95rem;
  font-weight: 700;
}

.hm-feedback-sheet__close {
  margin-left: auto;
  min-height: var(--hm-touch);
  padding: 8px 12px;
  border: none;
  border-radius: 999px;
  background: #202124;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hm-feedback-sheet__hint,
.hm-feedback-context,
.hm-feedback-status,
.hm-feedback-recent__note {
  margin: 8px 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--hm-text-muted);
}

.hm-feedback-context {
  color: var(--hm-text);
  font-weight: 600;
}

.hm-feedback-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 8px;
}

.hm-feedback-categories {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hm-feedback-categories legend {
  width: 100%;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.hm-feedback-categories label {
  min-height: var(--hm-touch);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--hm-border);
  border-radius: 999px;
  background: var(--hm-surface-raised);
}

.hm-feedback-field {
  font-size: 0.85rem;
  font-weight: 600;
}

.hm-feedback-form textarea,
.hm-feedback-form input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--hm-touch);
  padding: 10px 12px;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  font: inherit;
  color: var(--hm-text);
  background: #fff;
}

.hm-feedback-form textarea { min-height: 96px; resize: vertical; }

.hm-feedback-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.hm-feedback-submit {
  min-height: var(--hm-touch);
  margin-top: 4px;
  border: none;
  border-radius: 999px;
  background: var(--hm-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.hm-feedback-submit:disabled { opacity: 0.6; cursor: progress; }

.hm-feedback-recent {
  padding: 0 12px max(16px, env(safe-area-inset-bottom, 0px));
}

.hm-feedback-recent__title {
  margin: 4px 0;
  font-size: 0.9rem;
}

.hm-feedback-recent__list {
  margin: 0;
  padding-left: 1.1rem;
}

.hm-feedback-recent__cat {
  font-weight: 700;
}

@media (max-width: 720px) {
  .hm-feedback-backdrop:not([hidden]) { display: block; }

  .hm-feedback-fab {
    /* Sit above the bottom-right locate + zoom stack. */
    bottom: calc(168px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
  }

  .hm-feedback-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: min(
      78vh,
      calc(100dvh - var(--hm-mobile-map-bar-height, 68px) - env(safe-area-inset-top, 0px) - 16px)
    );
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }

  #layout.hm-pin-card-open .hm-feedback-fab {
    bottom: calc(var(--hm-pin-sheet-vh, 42vh) + 168px);
  }
}

@media (min-width: 721px) {
  .hm-feedback-sheet {
    right: 12px;
    bottom: 72px;
    left: auto;
    top: auto;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, calc(100dvh - 96px));
    border-radius: 12px;
  }

  .hm-feedback-sheet__handle { display: none; }
}

