.map-main { max-width: 1650px; margin: auto; }
.map-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 4px 16px; }
.map-header h1 { font-size: clamp(1.2rem, 2.3vw, 1.7rem); }
.map-header p, .map-note { color: var(--muted); font-size: .875rem; margin: 7px 0 0; line-height: 1.5; }
.map-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(245px, 295px); border: 1px solid #476d59; }
.map-stage { position: relative; min-width: 0; height: clamp(440px, 71dvh, 880px); }
#hq-map { height: 100%; background: #0b110f; }
.map-stage > p { position: absolute; inset: 12px; pointer-events: none; }
.company-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: clamp(440px, 71dvh, 880px); border-left: 1px solid #476d59; background: #171d19; padding: 14px; }
.company-panel label { color: var(--mint); font-weight: 700; }
.company-panel input, .map-header button { background: #101512; color: #edf0ed; border: 1px solid #567062; padding: 8px; font: inherit; font-size: .875rem; }
.company-panel input { margin-top: 8px; width: 100%; }
.match-count { color: var(--muted); font-size: .8125rem; }
#company-list { overflow: auto; list-style: none; padding: 0; margin: 0; }
#company-list button { width: 100%; text-align: left; display: grid; gap: 4px; padding: 10px 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: #edf0ed; font: inherit; font-size: .875rem; }
#company-list button span { color: var(--muted); font-size: .8125rem; }
#company-list button:hover, #company-list button[aria-pressed=true] { color: var(--mint); background: #24362c; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
.map-note { padding-bottom: 12px; }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-tooltip { background: #17221c; color: #edf0ed; border: 1px solid #557b66; }
.leaflet-popup-content p { margin: 4px 0; }
.leaflet-popup-content a { color: var(--mint); }
.leaflet-tooltip-top:before { border-top-color: #557b66; }
.hq-pin { display: grid; place-items: center; background: #18271f; border: 1px solid #8ee6b3; box-shadow: 0 0 12px #79e5ab50; border-radius: 9px; color: #cbfadd; font-weight: 800; }
.hq-pin img { grid-area: 1 / 1; background: #eff5ef; border-radius: 5px; width: 22px; height: 22px; }
.hq-pin span { grid-area: 1 / 1; font-size: 10px; }
.hq-group { border-radius: 50%; background: #254733; font-size: 14px; }
.hq-card { min-width: 148px; }
.hq-card strong { display: block; font-size: .95rem; }
.hq-card span { color: var(--mint); }
@media(max-width: 690px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-stage { height: 54dvh; min-height: 340px; }
  .company-panel { height: 245px; border-left: 0; border-top: 1px solid #476d59; }
}
#hq-map .leaflet-tile-pane { filter: grayscale(1) invert(.9) hue-rotate(135deg) saturate(1.8) brightness(.82); }
.hq-pin > div { display: grid; place-items: center; }
.hq-pin img[hidden], .hq-pin span[hidden] { display: none; }
.hq-company-group button { display: block; width: 100%; padding: 6px; border: 0; border-bottom: 1px solid #476d59; background: #17221c; color: #edf0ed; text-align: left; font: inherit; }
.hq-company-group button:hover { color: var(--mint); background: #254733; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-filters { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 8px; margin-top: 10px; }
.map-filters select { min-width: 0; font-size: .8125rem; }
#company-list { min-height: 0; flex: 1; scrollbar-gutter: stable; }
#directory-detail:empty { display: none; }
#directory-detail { margin-top: 10px; padding: 8px; border: 1px solid #476d59; }
@media(max-width: 690px) { .company-panel { height: 350px; } }
@media (max-width: 690px) {
  .map-header { flex-wrap: wrap; gap: 8px; padding-block: 10px; }
  .map-stage { height: clamp(270px, 50svh, 450px); min-height: 0; }
  .company-panel { height: auto; padding: 10px; }
  #company-list { flex: none; max-height: 36svh; }
}
@media (max-width: 690px) and (pointer: coarse) {
  .map-header button, .map-filters select, .company-panel input, #company-list button { min-height: 44px; }
  .company-panel input, .map-filters select { font-size: 1rem; }
  #hq-map .leaflet-control-zoom a { width: 42px; height: 42px; line-height: 42px; }
  .map-note .desktop-guide { display: none; }
  .touch-guide { display: inline; }
  #pan-map[aria-pressed="true"] { color: var(--mint); background: #254733; }
}
