.atlas-map-toolbar{
  position:absolute;
  top:max(12px,calc(12px + env(safe-area-inset-top,0px)));
  right:max(12px,calc(12px + env(safe-area-inset-right,0px)));
  z-index:620;
  display:flex;
  align-items:center;
  gap:6px;
}
.atlas-tool-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-width:40px;
  height:40px;
  padding:0 10px;
  border:1px solid var(--border);
  border-radius:var(--r-pill);
  background:var(--surface);
  color:var(--ink-2);
  box-shadow:var(--shadow-1);
  font-family:var(--font-sans);
  font-size:.82rem;
  font-weight:600;
  line-height:1;
  cursor:pointer;
  transition:background var(--dur-1),color var(--dur-1),border-color var(--dur-1),transform var(--dur-1),box-shadow var(--dur-1);
}
.atlas-tool-icon:hover,
.atlas-tool-icon:focus-visible{
  background:var(--surface-2);
  border-color:var(--accent);
  color:var(--accent);
  transform:translateY(-1px);
  box-shadow:var(--shadow-2);
  outline:none;
}
.atlas-tool-icon[aria-expanded="true"]{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}
.atlas-tool-icon .atlas-tool-glyph{font-size:1rem;line-height:1}
.atlas-tool-tools-label{letter-spacing:.01em}
.atlas-fab-row{display:none!important}

.atlas-tool-mount{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important;border:0!important}

.atlas-tools-scrim{
  position:fixed;
  inset:0;
  z-index:11980;
  background:rgba(0,0,0,.38);
  opacity:0;
  transition:opacity .18s ease;
}
.atlas-tools-scrim[hidden]{display:none}
.atlas-tools-scrim.open{opacity:1}

.atlas-tool-sheet{
  position:fixed;
  z-index:11990;
  left:12px;
  right:12px;
  bottom:calc(12px + env(safe-area-inset-bottom,0px));
  max-height:min(72vh,560px);
  display:flex;
  flex-direction:column;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-3);
  color:var(--ink);
  transform:translateY(10px);
  opacity:0;
  transition:opacity .18s ease,transform .18s ease;
}
.atlas-tool-sheet[hidden]{display:none}
.atlas-tool-sheet.open{transform:none;opacity:1}
.atlas-tools-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px 10px;
  border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.atlas-tools-title{
  font-family:var(--font-serif);
  font-size:var(--t-lg);
  font-weight:600;
  color:var(--ink);
}
.atlas-tools-close{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  border:0;
  border-radius:var(--r-sm);
  background:transparent;
  color:var(--ink-3);
  font-size:1.05rem;
  cursor:pointer;
}
.atlas-tools-close:hover,
.atlas-tools-close:focus-visible{background:var(--surface-2);color:var(--ink);outline:none}
.atlas-tools-list{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:8px;
  overflow:auto;
  overscroll-behavior:contain;
}
.atlas-tool-row,
.atlas-tool-row-main{
  display:flex;
  align-items:center;
  gap:11px;
  width:100%;
  padding:10px 11px;
  border:1px solid transparent;
  border-radius:var(--r-md);
  background:transparent;
  color:var(--ink);
  font-family:var(--font-sans);
  text-align:left;
  cursor:pointer;
  transition:background var(--dur-1),border-color var(--dur-1);
}
.atlas-tool-row:hover,
.atlas-tool-row:focus-visible,
.atlas-tool-row-main:hover,
.atlas-tool-row-main:focus-visible{
  background:var(--surface-2);
  border-color:var(--border);
  outline:none;
}
.atlas-tool-row.is-active,
.atlas-tool-row-main.is-active{
  background:var(--accent-tint);
  border-color:var(--accent);
}
.atlas-tool-row-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  flex:0 0 30px;
  border-radius:var(--r-sm);
  background:var(--surface-2);
  color:var(--accent);
  font-size:.95rem;
  line-height:1;
}
.atlas-tool-row.is-active .atlas-tool-row-icon,
.atlas-tool-row-main.is-active .atlas-tool-row-icon{background:var(--accent);color:#fff}
.atlas-tool-row-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.atlas-tool-row-name{font-size:.9rem;font-weight:600;line-height:1.25;color:var(--ink)}
.atlas-tool-row-desc{font-size:.76rem;line-height:1.35;color:var(--ink-3)}
.atlas-tool-row-export{display:flex;align-items:center;gap:4px;padding:2px;border-radius:var(--r-md)}
.atlas-tool-row-export:hover{background:var(--surface-2)}
.atlas-tool-row-export .atlas-tool-row-main{flex:1;min-width:0}
.atlas-tool-row-action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  height:36px;
  padding:0 10px;
  flex-shrink:0;
  border:1px solid var(--border);
  border-radius:var(--r-sm);
  background:transparent;
  color:var(--accent);
  font-family:var(--font-sans);
  font-size:.74rem;
  font-weight:600;
  cursor:pointer;
}
.atlas-tool-row-action:hover,
.atlas-tool-row-action:focus-visible{background:var(--surface);border-color:var(--accent);outline:none}
.atlas-tool-row[aria-pressed="true"]{background:var(--accent-tint);border-color:var(--accent)}

@media(min-width:760px){
  .atlas-tool-sheet{
    left:auto;
    right:max(16px,calc(16px + env(safe-area-inset-right,0px)));
    top:calc(62px + env(safe-area-inset-top,0px));
    bottom:auto;
    width:min(390px,calc(100vw - 32px));
    max-height:calc(100vh - 86px);
    transform:translateY(-4px) scale(.985);
    transform-origin:top right;
  }
  .atlas-tool-sheet.open{transform:none}
  .atlas-tools-scrim{background:transparent}
}

@media(max-width:480px){
  .atlas-map-toolbar{gap:5px;top:max(9px,calc(9px + env(safe-area-inset-top,0px)));right:max(9px,calc(9px + env(safe-area-inset-right,0px)))}
  .atlas-tool-icon{min-width:38px;height:38px;padding:0 9px}
  .atlas-tool-tools-label{display:none}
  .atlas-tool-sheet{left:8px;right:8px;bottom:calc(8px + env(safe-area-inset-bottom,0px))}
}

@media(pointer:coarse){
  .atlas-tool-icon{min-width:44px;height:44px}
  .atlas-tool-row,.atlas-tool-row-main{min-height:50px}
}

.leaflet-popup-content-wrapper{
  border-radius:14px;
  background:var(--surface);
  border:1px solid var(--border);
  box-shadow:var(--shadow-3);
  overflow:hidden;
  color:var(--ink);
}
.leaflet-popup-content{margin:10px 12px;font-family:var(--font-sans);font-size:.82rem;line-height:1.42;max-width:264px}
.leaflet-popup-content:has(.city-popup){margin:0;max-width:292px}
.city-popup{margin:0;border-radius:0;overflow:hidden;background:var(--surface)}
.city-popup .city-media{height:126px;max-height:126px;border-radius:0}
.city-popup .city-text{padding:8px 11px 5px;background:var(--surface)}
.city-popup .city-name{font-size:1.04rem;margin-bottom:1px}
.city-popup .city-ref{font-size:.7rem;margin-bottom:3px}
.city-popup .city-blurb{font-size:.79rem;line-height:1.45}
.city-popup .city-footer{padding:0 11px 9px;background:var(--surface)}
.city-popup .city-footer .popup-note{font-size:.77rem;line-height:1.45}
.city-popup .city-footer .popup-apostolic{margin-top:6px;font-size:.75rem}
.popup-title{font-size:1.02rem;margin-bottom:2px}
.popup-ref{font-size:.7rem;margin-bottom:4px}
.popup-note{font-size:.79rem;line-height:1.45}
.popup-apostolic{margin-top:6px;padding:3px 0 3px 8px;font-size:.75rem}
.popup-actions{display:flex;align-items:center;gap:4px;flex-wrap:wrap;margin-top:7px;padding-top:7px;border-top:1px solid var(--border)}
.popup-actions .atlas-bp-btn{min-width:28px;height:28px;padding:0 7px;font-size:.86rem}
.popup-actions .popup-study-btn,
.popup-actions .atlas-note-place-btn,
.popup-actions .atlas-copy-coords,
.popup-actions .popup-builder-btn,
.popup-actions .city-btn{
  display:inline-flex;
  align-items:center;
  gap:4px;
  height:28px;
  margin:0;
  padding:0 8px;
  border:1px solid var(--border);
  border-radius:var(--r-sm);
  background:transparent;
  color:var(--accent);
  font-family:var(--font-sans);
  font-size:.72rem;
  font-weight:600;
  line-height:1;
  cursor:pointer;
}
.popup-actions .popup-study-btn:hover,
.popup-actions .popup-study-btn:focus-visible,
.popup-actions .atlas-note-place-btn:hover,
.popup-actions .atlas-note-place-btn:focus-visible,
.popup-actions .atlas-copy-coords:hover,
.popup-actions .atlas-copy-coords:focus-visible,
.popup-actions .popup-builder-btn:hover,
.popup-actions .popup-builder-btn:focus-visible,
.popup-actions .city-btn:hover,
.popup-actions .city-btn:focus-visible{
  background:var(--surface-2);
  border-color:var(--border-strong);
  outline:none;
}
.popup-actions .atlas-bookmark-btn{height:28px;padding:0 8px}

.leaflet-control-layers{margin-top:8px!important}
.leaflet-bottom.leaflet-right{
  right:max(10px,calc(10px + env(safe-area-inset-right,0px)))!important;
  bottom:calc(18px + env(safe-area-inset-bottom,0px))!important;
  padding-bottom:0!important;
}
@media(max-width:600px){
  .leaflet-bottom.leaflet-right{bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}
}
