.map-panel{min-height:0;margin-bottom:16px}
.map-wrap{height:360px;margin-top:18px;border-radius:14px;overflow:hidden;border:1px solid var(--line);background:var(--panel2);position:relative}
.dashboard-map{width:100%;height:100%}
.map-empty{z-index:2;position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--muted);gap:6px}
.map-empty strong{color:var(--ink)}
.map-link{color:var(--blue);font-size:13px;text-decoration:none}
.map-link:hover{text-decoration:underline}
.map-actions{display:flex;align-items:center;gap:7px}.map-type{padding:7px 10px;border:1px solid var(--line);border-radius:8px;background:var(--panel2);color:var(--muted);font-size:12px}.map-type.active{color:#fff;border-color:var(--primary);background:var(--primary-medium)}
.map-footer{display:flex;justify-content:space-between;gap:16px;margin-top:10px;color:var(--muted);font-size:11px}
.secondary.active{color:#fff;border-color:var(--error-border);background:var(--error-soft)}
@media(max-width:850px){.map-wrap{height:300px}}
@media(max-width:520px){.map-wrap{height:250px}.map-footer{align-items:flex-start;flex-direction:column;gap:4px}}

/* Link the element card visually to its highlighted map object. */
#map-element-list .map-element-card.map-element-highlighted{border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary),0 0 0 2px var(--primary-medium)}
/* Map workspace: compact left rail and editing inside the element card. */
#map-workspace .map-editor-panel{padding:0;overflow:visible}
.map-editor-stage{position:relative;isolation:isolate}
#map-workspace .shared-map{height:680px;min-height:540px}
.map-left-rail{position:absolute;left:14px;top:14px;z-index:2;display:flex;flex-direction:column;gap:10px}
body[data-theme] .map-left-rail :is(.map-rail-button,summary){display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-height:44px;padding:0;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);cursor:pointer;box-shadow:0 2px 8px #0002;list-style:none;font-size:12px}
.map-left-rail summary::-webkit-details-marker{display:none}
.map-left-rail summary::marker{content:''}
.map-rail-group{display:flex;flex-direction:column;gap:2px;padding:3px;border:1px solid var(--line);border-radius:12px;background:var(--panel);box-shadow:0 2px 8px #0002}
body[data-theme] .map-rail-group .map-rail-button{border:0;box-shadow:none;width:38px;height:40px;min-height:40px}
body[data-theme] .map-left-rail :is(button,summary):hover,body[data-theme] .map-left-rail .map-tool.active{background:var(--primary-medium);color:var(--ink);outline:1px solid var(--primary)}
.map-rail-popover{position:relative}
.map-rail-panel{position:absolute;left:54px;top:0;width:min(280px,calc(100vw - 110px));padding:16px;display:grid;gap:10px;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 28px #0003}
.map-rail-panel label{margin:0;font-size:12px}
.map-rail-panel p{font-size:12px;margin:0;color:var(--muted)}
.map-rail-panel input{min-width:0}
.map-draft-panel{position:absolute;right:14px;top:64px;z-index:1;width:min(300px,calc(100% - 85px));padding:16px;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 28px #0003}
#map-workspace .map-draft-panel .inline-field{display:grid;min-width:0;width:100%;margin-top:12px}
.map-draft-panel :is(input,select){width:100%;min-width:0}
.map-draft-actions,.map-inline-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
#map-workspace .map-element-actions{justify-content:flex-end;gap:8px}
body[data-theme] #map-workspace .element-icon{width:38px;min-width:38px;height:38px;min-height:38px;padding:8px;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;flex:0 0 38px}
#map-workspace .map-element-card.editing{border-color:var(--primary)}
.map-inline-editor{border-top:1px solid var(--line);margin-top:12px;padding-top:2px}
.map-inline-editor label{font-size:12px;margin-top:12px}
.map-inline-editor input,.map-inline-editor textarea{width:100%;min-width:0}
.map-inline-editor input[type="color"]{width:100%;height:42px;padding:4px;cursor:pointer}
#map-workspace .map-element-card.editing>.map-element-actions{display:none}
@media(max-width:850px){#map-workspace .shared-map{height:600px}.map-left-rail{left:10px;top:10px}.map-draft-panel{right:10px}}

.map-color-choices{display:grid;gap:10px;margin-top:10px}
.map-color-presets{display:flex;flex-wrap:wrap;gap:8px}
body[data-theme] #map-workspace .map-color-preset{width:32px;height:32px;min-height:32px;padding:0;border:2px solid var(--panel);background:var(--swatch);border-radius:50%;box-shadow:0 0 0 1px var(--line)}
body[data-theme] #map-workspace .map-color-preset[aria-pressed="true"]{outline:2px solid var(--link);outline-offset:2px}
body[data-theme] #map-workspace .map-color-preset:hover{transform:scale(1.1);background:var(--swatch)}
.map-color-hex{font-family:ui-monospace,monospace}
.map-marker-info p,.map-element-description{white-space:pre-wrap;overflow-wrap:anywhere}
#map-element-color{height:42px;padding:4px}

.map-search-suggestions{max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:8px;background:var(--panel2)}
.map-search-option{padding:12px;font-size:13px;line-height:1.4;color:var(--ink);cursor:pointer;border-bottom:1px solid var(--line)}
.map-search-option:last-child{border-bottom:0}
.map-search-option:hover,.map-search-option[aria-selected="true"]{background:var(--primary-medium)}

/* Prioritize map space with a narrow, independently scrolling object list. */
#map-workspace .shared-map-layout{grid-template-columns:minmax(0,1fr) 280px;gap:14px;margin-bottom:20px}
#map-workspace .shared-map{height:calc(100dvh - 250px);min-height:540px}
#map-workspace .shared-elements-panel{padding:14px;min-height:0;max-height:max(540px,calc(100dvh - 250px))}
#map-workspace .shared-elements-panel h2{font-size:17px}
#map-workspace .shared-elements-panel .eyebrow{font-size:9px;letter-spacing:.1em}
#map-workspace .map-element-list{gap:7px;margin-top:12px}
#map-workspace .map-element-card{padding:9px}
#map-workspace .map-element-focus{gap:7px;min-height:0}
#map-workspace .map-element-focus strong{font-size:13px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
#map-workspace .map-element-focus small{font-size:11px;margin-top:3px}
#map-workspace .map-element-actions{gap:6px;margin-top:7px}
body[data-theme] #map-workspace .element-icon{width:32px;min-width:32px;height:32px;min-height:32px;flex:0 0 32px;padding:6px}
#map-workspace .map-editor-help{min-height:0;font-size:12px;padding:9px 12px}
#map-workspace .map-sync-state button{font-size:13px;padding:9px 13px}
@media(max-width:980px){
 #map-workspace .shared-map-layout{grid-template-columns:1fr}
 #map-workspace .shared-elements-panel{max-height:420px}
 #map-workspace .shared-map{height:65dvh;min-height:540px}
}
@media(pointer:coarse){body[data-theme] #map-workspace .element-icon{width:44px;min-width:44px;height:44px;min-height:44px;flex-basis:44px}}

/* Google info windows use a light surface even when the portal is dark. */
body[data-theme] .gm-style .gm-style-iw-c,
body[data-theme] .gm-style .gm-style-iw-d{background:#fff;color:#17212b;color-scheme:light}
body[data-theme] .gm-style .map-marker-info,
body[data-theme] .gm-style .map-marker-info strong,
body[data-theme] .gm-style .map-marker-info p{color:#17212b}
body[data-theme] .gm-style .gm-ui-hover-effect{background:transparent;color:#17212b}
body[data-theme] .gm-style .gm-ui-hover-effect>span{background-color:#17212b}
body[data-theme] .gm-style .gm-ui-hover-effect>img{filter:none}

.map-draft-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
body[data-theme] #map-workspace .map-dismiss{display:flex;align-items:center;justify-content:center;flex:0 0 32px;width:32px;height:32px;min-height:32px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--muted);font-size:25px;line-height:1}
body[data-theme] #map-workspace .map-dismiss:hover{background:var(--primary-soft);color:var(--ink)}
@media(pointer:coarse){body[data-theme] #map-workspace .map-dismiss{width:44px;height:44px;min-height:44px;flex-basis:44px}}

/* Compact info bubble with its own accessible close control. */
body[data-theme] .gm-style .map-marker-info{min-width:160px;max-width:250px;padding:10px 12px;font-size:13px;line-height:1.4}
body[data-theme] .gm-style .map-info-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
body[data-theme] .gm-style .map-info-heading strong{font-size:14px;line-height:1.3;overflow-wrap:anywhere}
body[data-theme] .gm-style .map-marker-info p{margin:6px 0 0;font-size:13px;line-height:1.4}
body[data-theme] .gm-style button.map-info-close{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;width:28px;height:28px;min-height:28px;margin:0;padding:5px;border:0;border-radius:50%;background:#f0f2f5;color:#44505c;cursor:pointer;box-shadow:none;outline:none}
body[data-theme] .gm-style button.map-info-close:hover{background:#e2e7ed;color:#17212b}
body[data-theme] .gm-style button.map-info-close:focus-visible{outline:2px solid #2673dd;outline-offset:2px}
@media(pointer:coarse){body[data-theme] .gm-style button.map-info-close{width:40px;height:40px;min-height:40px;flex-basis:40px}}


/* Operative map workspace lives inside the selected operation. */
.map-workspace{margin-bottom:24px}
.map-workspace-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  margin:0 0 14px;
  padding:0 2px
}
.map-workspace-head .eyebrow{margin:0 0 5px}
.map-workspace-head h2{margin:0;font-size:22px}
.map-workspace-head .muted{margin:6px 0 0;max-width:760px}
#operation-map-workspace:empty{display:none}
#operations-page .operation-map-shell{margin:26px 0 30px}
#operations-page #map-workspace{padding-top:8px;border-top:1px solid var(--line)}
#operations-page #map-workspace .shared-map{height:min(66dvh,720px);min-height:520px}
#operations-page #map-workspace .shared-elements-panel{max-height:min(66dvh,720px)}
@media(max-width:980px){
  .map-workspace-head{align-items:flex-start;flex-direction:column}
  .map-workspace-head .map-sync-state{width:100%;display:flex;justify-content:space-between;gap:10px}
  #operations-page #map-workspace .shared-map{height:60dvh;min-height:480px}
}


#map-workspace .map-draft-actions{display:grid;grid-template-columns:1fr auto}
#map-workspace .map-draft-actions #save-map-element{min-width:0}
#map-workspace #save-map-element:disabled{opacity:.45;cursor:not-allowed}


#map-workspace #toggle-map-scope[aria-pressed="true"]{
  border-color:var(--primary);
  background:var(--primary-medium);
  color:var(--ink)
}
#map-workspace .map-element-scope-note{
  color:var(--muted);
  font-style:italic
}

/* Native Google Maps control keeps layer selection available in fullscreen. */
#dashboard-map-layer-controls{position:relative;left:auto;top:auto;margin:14px;overflow:visible}
#dashboard-map-layer-controls[hidden]{display:none}

/* Compact status and tabbed map library for the operation workspace. */
#map-workspace #map-sync-indicator{
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:30px;
  padding:5px 8px;
  border-color:transparent;
  background:transparent;
  font-size:11px;
  font-weight:700;
  cursor:default
}
#map-workspace #map-sync-indicator::before{
  content:"";
  width:7px;
  height:7px;
  flex:0 0 7px;
  border-radius:50%;
  background:currentColor;
  box-shadow:0 0 0 3px color-mix(in srgb,currentColor 12%,transparent)
}
#map-workspace .shared-elements-panel{
  overflow:auto;
  padding:10px 12px 14px
}
.map-library-tabs{
  position:sticky;
  top:-10px;
  z-index:3;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:4px;
  margin:-2px 0 8px;
  padding:8px 0 8px;
  border-bottom:1px solid var(--line);
  background:var(--panel)
}
body[data-theme] #map-workspace .map-library-tab{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-width:0;
  min-height:38px;
  padding:8px 7px;
  border:1px solid transparent;
  border-radius:9px;
  background:transparent;
  color:var(--muted);
  font-size:11px;
  font-weight:700
}
body[data-theme] #map-workspace .map-library-tab:hover{
  border-color:var(--line);
  background:var(--primary-soft);
  color:var(--ink)
}
body[data-theme] #map-workspace .map-library-tab.active{
  border-color:var(--primary);
  background:var(--primary-medium);
  color:var(--ink)
}
.map-library-count{
  display:inline-grid;
  place-items:center;
  min-width:21px;
  height:21px;
  padding:0 5px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--panel2);
  color:var(--muted);
  font-size:10px;
  line-height:1
}
.map-library-tab.active .map-library-count{
  border-color:color-mix(in srgb,var(--primary) 55%,var(--line));
  color:var(--ink)
}
.map-library-panel{
  min-height:0;
  padding-top:2px
}
.map-library-context{
  margin:6px 2px 8px;
  color:var(--muted);
  font-size:9px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase
}
#map-workspace .map-library-panel .map-element-list{
  margin-top:0
}
#map-workspace .map-library-panel .wayline-library-help{
  margin:7px 2px 10px;
  font-size:11px;
  line-height:1.4
}
#map-workspace .map-library-panel .wayline-list{
  gap:7px
}
#map-workspace .map-library-panel .map-list-empty,
#map-workspace .map-library-panel .compact-empty{
  min-height:72px;
  padding:18px 8px;
  place-items:center;
  text-align:center
}
@media(max-width:980px){
  .map-library-tabs{
    position:static;
    top:auto
  }
}



/* Keep the map refresh control square and centered despite generic map button padding. */
#map-workspace .map-sync-state .operation-refresh-button{
  display:grid;
  place-items:center;
  width:38px;
  min-width:38px;
  height:38px;
  min-height:38px;
  padding:0;
  line-height:1
}
#map-workspace .map-sync-state .operation-refresh-button svg{
  display:block;
  position:static;
  left:auto;
  top:auto;
  margin:0
}

/* Point marker navigation and locally generated QR code. */
body[data-theme] .gm-style .map-info-coordinates{
  margin-top:8px;
  color:#52606d;
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:12px;
  white-space:nowrap
}
body[data-theme] .gm-style .map-info-actions{
  display:grid;
  gap:7px;
  margin-top:10px
}
body[data-theme] .gm-style .map-info-action{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:36px;
  padding:8px 10px;
  border:1px solid #cbd5df;
  border-radius:8px;
  background:#f7f9fb;
  color:#1f5fae;
  font:inherit;
  font-weight:700;
  line-height:1.2;
  text-align:center;
  text-decoration:none;
  cursor:pointer;
  box-shadow:none
}
body[data-theme] .gm-style .map-info-action:hover{
  border-color:#8ba9ca;
  background:#edf4fb;
  color:#174c8c;
  text-decoration:none
}
body[data-theme] .gm-style .map-info-action:focus-visible{
  outline:2px solid #2673dd;
  outline-offset:2px
}
body[data-theme] .gm-style .map-info-qr[hidden]{display:none}
body[data-theme] .gm-style .map-info-qr{
  width:204px;
  margin:10px auto 0;
  padding:12px;
  border:1px solid #d8dee6;
  border-radius:10px;
  background:#fff;
  color:#17212b;
  text-align:center
}
body[data-theme] .gm-style .map-info-qr :is(canvas,img,svg){
  display:block;
  width:180px;
  height:180px;
  max-width:100%;
  margin:auto
}

