/* Atlas WebGIS map-first workspace: one small set of controls always visible.
   Original cards, saved points, data layers and diagnostics remain intact. */
.panel-collapse-toggle{display:inline-flex;align-items:center;justify-content:center;min-height:40px}
.analytics,.interest-context{border-radius:15px;box-shadow:0 14px 38px var(--shadow)}
.analytics{width:min(352px,calc(100vw - 36px));padding:15px}
.interest-context{width:min(322px,calc(100vw - 36px))}
.analytics-head h1{font-size:1.24rem;line-height:1.25}
.analytics-cards{gap:7px;margin-top:11px}
.indicator-card:not(.active){opacity:.85;padding:8px 10px}
.workspace-tools{position:relative;pointer-events:auto}
.workspace-tools>summary{
  display:flex;align-items:center;gap:6px;list-style:none;
  min-height:40px;padding:9px 13px;
  border:1px solid var(--border);border-radius:12px;
  background:var(--panel);box-shadow:0 8px 30px var(--shadow);
  font-size:.8125rem;font-weight:700;cursor:pointer;
}
.workspace-tools>summary::-webkit-details-marker{display:none}
.workspace-tools>summary:after{content:'⌄';font-weight:900;font-size:1rem;line-height:1}
.workspace-tools[open]>summary:after{transform:rotate(180deg)}
.workspace-tools-menu{
  position:absolute;right:0;top:calc(100% + 7px);z-index:15;
  display:grid;gap:5px;width:min(228px,80vw);
  padding:7px;border-radius:13px;background:var(--panel-solid);
  border:1px solid var(--border);box-shadow:0 14px 35px var(--shadow);
}
.topbar .workspace-tools-menu button{
  box-shadow:none;text-align:left;width:100%;min-height:42px;
  border-radius:8px;background:var(--surface);font-size:.8125rem;
}
.topbar-actions{overflow:visible}
.topbar-actions>button{min-height:40px}
.layer-advanced{margin-top:12px;padding:0;border-top:1px solid var(--border)}
.layer-advanced>summary{
  cursor:pointer;display:flex;align-items:center;justify-content:space-between;
  gap:6px;min-height:44px;padding:10px 2px 3px;
  color:var(--text);font-size:.8125rem;font-weight:750;
}
.layer-advanced>summary:after{content:'+';font-size:1rem}
.layer-advanced[open]>summary:after{content:'−'}
.layer-advanced>*:not(summary){margin-top:8px}
.layer-advanced .detail-zoom-control{margin-top:7px}
.layer-advanced .source-disclosure{display:block}
.interest-context.mobile-collapsed{
  width:230px;max-height:69px;overflow:hidden;padding:11px 12px;
}
.interest-context.mobile-collapsed>.map-first-note,
.interest-context.mobile-collapsed>.layer-presets,
.interest-context.mobile-collapsed>.interest-layer-chips,
.interest-context.mobile-collapsed>.layer-advanced,
.interest-context.mobile-collapsed>.compact-map-legend{display:none!important}
.interest-context.mobile-collapsed .context-visibility-summary{display:none}
.analytics.mobile-collapsed{max-height:65px;overflow:hidden}
.analytics.mobile-collapsed>p,.analytics.mobile-collapsed>.analytics-cards,
.analytics.mobile-collapsed>.perf{display:none}
#app:has(.interest-context.mobile-collapsed) .maplibregl-ctrl-top-right{right:254px}
#app:has(.interest-context.mobile-collapsed) .map-legend{right:254px}
.topbar-actions>button:focus-visible,
.workspace-tools>summary:focus-visible,.layer-advanced>summary:focus-visible,
.panel-collapse-toggle:focus-visible{outline:2px solid #38bdf8;outline-offset:2px}
@media (min-width:1025px){
  .interest-context.mobile-collapsed{top:80px}
  .analytics{max-height:calc(100dvh - 188px)}
}
@media (min-width:761px) and (max-width:1024px){
  .topbar-actions{overflow:visible;max-width:calc(100vw - 260px)}
  .analytics.mobile-collapsed,.interest-context.mobile-collapsed{width:190px}
  .maplibregl-ctrl-top-right{right:205px}
  #app:has(.interest-context.mobile-collapsed) .maplibregl-ctrl-top-right{right:205px}
  #app:has(.interest-context.mobile-collapsed) .map-legend{right:205px}
  .interest-context.mobile-collapsed{max-height:64px}
}
@media (max-width:760px){
  .topbar-actions{
    display:flex;grid-template-columns:none;
    justify-content:flex-start;overflow:visible;gap:6px;
    width:100%;max-width:none;padding:0;
  }
  .topbar-actions>button,.workspace-tools>summary{
    flex:1 1 0;min-width:0;min-height:44px;
    display:flex;align-items:center;justify-content:center;
    padding:9px 8px;font-size:.75rem;line-height:1.2;text-align:center;
  }
  .workspace-tools{flex:1 1 0;min-width:0}
  .workspace-tools>summary{width:100%}
  .workspace-tools-menu{right:0;top:calc(100% + 5px)}
  .topbar{z-index:10}
  .analytics.mobile-collapsed,.interest-context.mobile-collapsed{max-height:56px}
  .interest-context.mobile-collapsed{width:auto;max-height:56px;padding:9px 12px}
  .interest-context.mobile-collapsed .interest-context-head h2{font-size:.9rem}
  .analytics.mobile-collapsed{max-height:57px}
  #app:has(.interest-context.mobile-collapsed) .maplibregl-ctrl-top-right,
  #app:has(.interest-context.mobile-collapsed) .map-legend{right:8px}
  .maplibregl-ctrl-top-right{top:calc(env(safe-area-inset-top) + 145px);right:8px}
  .analytics{max-height:min(37dvh,330px)}
  .layer-advanced>summary{min-height:44px}
}
@media(max-width:480px){
  .brand-panel{min-height:42px}
  .topbar-actions>button{font-size:.74rem}
}
@media(max-width:760px) and (max-height:540px){
  .topbar-actions{max-width:none}
  .topbar-actions>button,.workspace-tools>summary{min-height:40px;padding:6px 5px;font-size:.72rem}
  .maplibregl-ctrl-top-right{top:calc(env(safe-area-inset-top) + 120px)}
}


/* Compact panels identify their purpose instead of squeezing a full heading,
   interactive question selector or a multi-line status into 190px. */
.collapsed-panel-label{display:none;font-size:.88rem;font-weight:800;line-height:1.3}
.analytics.mobile-collapsed .collapsed-panel-label,
.interest-context.mobile-collapsed .collapsed-panel-label{display:block}
.analytics.mobile-collapsed .analytics-heading,
.interest-context.mobile-collapsed .interest-context-head>div{display:none!important}
#app.question-fallback-needed .analytics.mobile-collapsed .question-fallback{display:none!important}
.analytics.mobile-collapsed .analytics-head,
.interest-context.mobile-collapsed .interest-context-head{align-items:center;gap:9px}
.analytics.mobile-collapsed .analytics-head-actions{margin-left:auto}
@media(min-width:761px) and (max-width:1024px){
  .analytics,.interest-context{
    top:calc(78px + var(--coach-height,70px) + 16px);
  }
  .maplibregl-ctrl-top-right,
  #app:has(.interest-context.mobile-collapsed) .maplibregl-ctrl-top-right{
    top:calc(78px + var(--coach-height,70px) + 16px);
  }
}

/* On narrow portrait screens the selected-point coach and compact Layers
   heading occupy the upper map band. Keep native map actions below both. */
@media(max-width:760px) and (min-height:541px){
  #app:has(.selection-coach:not(.hidden)) .maplibregl-ctrl-top-right{
    top:calc(env(safe-area-inset-top) + 281px);
  }
}
