/* ATLAS MAP 7.1.2 — Picchettamento / Trigonometria UI */
:root{--staking-dock-h:60px}
.workspace,.layercard{background:rgba(255,255,255,.94)!important;border:1px solid rgba(34,58,94,.14)!important;box-shadow:0 16px 42px rgba(26,47,77,.16)!important;backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important}
.workspace,.layercard,.maptools button,.tabs button,.field-actions button,.polybar button,.exportbar button,.triggrid button,.navpanel button{transition:transform .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease}
.workspace-head{min-height:58px;padding:11px 14px 9px!important;border-bottom:1px solid rgba(34,58,94,.08)}
.tabs{padding:9px 12px!important;border-bottom:1px solid rgba(34,58,94,.08)}
.tabs button{min-height:38px!important;border-radius:10px!important}
.field-actions button,.polybar button,.exportbar button,.triggrid button,.navpanel button,.addrow button{min-height:40px!important;border-radius:10px!important}
.field-actions button:hover,.polybar button:hover,.exportbar button:hover,.triggrid button:hover{transform:translateY(-1px);box-shadow:0 5px 14px rgba(26,47,77,.10)}
.workspace.collapsed{height:58px!important;bottom:auto!important}
.open-workspace-btn,.open-layers-btn{border-radius:12px!important;box-shadow:0 8px 24px rgba(26,47,77,.14)!important}
.field-actions button{min-width:0!important}
.field-actions button span:last-child{min-width:0}
.field-actions button small{white-space:normal!important}
@media(max-width:430px){.field-actions button{padding:9px 8px!important;font-size:10px!important}}

/* Popup e finestre */
.leaflet-popup-content-wrapper{border-radius:14px!important;border:1px solid rgba(34,58,94,.12)!important;box-shadow:0 12px 32px rgba(26,47,77,.18)!important}
.leaflet-popup-content{margin:12px 13px!important;font-size:12px!important;line-height:1.45!important}
.popupactions{gap:7px!important;margin-top:10px!important}
.popupactions button{min-height:38px!important;border-radius:9px!important;font-weight:800!important}
.modalcard{border:1px solid rgba(34,58,94,.12)!important;border-radius:18px!important;box-shadow:0 22px 60px rgba(15,39,66,.25)!important}
@media(max-width:900px){
 body:has(.workspace.mobile-open) .maptools,body:has(.layercard.mobile-open) .maptools{opacity:0!important;visibility:hidden!important;pointer-events:none!important;transform:translateY(8px)!important}
 .maptools{transition:opacity .16s ease,transform .16s ease,visibility .16s ease!important}
}

/* Picchettamento layout — consolidated desktop/mobile structure */
.module-info-strip{
  display:grid;grid-template-columns:repeat(3,1fr);gap:6px;
  padding:0 12px 10px;font-size:8.5px;line-height:1.25;color:#607286;
}
.module-info-strip span{padding:7px 8px;border:1px solid rgba(34,58,94,.09);border-radius:9px;background:rgba(244,248,251,.8)}
.module-info-strip b{color:#223A5E}
.field-actions{grid-template-columns:1fr!important}
.colorpick{display:inline-flex!important;align-items:center!important;gap:6px!important}
.colorpick input[type=color]{
  width:24px!important;height:24px!important;min-width:24px!important;min-height:24px!important;
  padding:2px!important;border-radius:6px!important;display:block!important;margin:auto!important;
}
.desktop-module-rail{display:none}
.window-dots{display:none!important}

@media(min-width:901px){
  body.atlas-shell-staking .layercard{
    display:block!important;position:absolute!important;
    left:0!important;top:0!important;bottom:0!important;
    width:276px!important;max-height:none!important;margin:0!important;
    border:0!important;border-right:1px solid #dbe5ee!important;border-radius:0!important;
    box-shadow:4px 0 18px rgba(23,47,80,.06)!important;
    background:#fff!important;backdrop-filter:none!important;
    transform:none!important;z-index:850!important;
  }
  body.atlas-shell-staking .layercard.is-hidden{display:none!important}
  body.atlas-shell-staking .layercard .layercard-head{
    padding:15px 14px 10px!important;border-bottom:1px solid #e8eef4!important;
  }
  body.atlas-shell-staking .layercard .layercard-head::before{
    content:"▱";display:inline-grid;place-items:center;
    width:27px;height:27px;margin-right:8px;border-radius:8px;
    background:linear-gradient(135deg,#dff5fb,#bfe9f4);color:#087f9c;font-size:16px;vertical-align:middle;
  }
  body.atlas-shell-staking .layercard .layercard-head strong{font-size:14px!important;color:#223a5e!important}

  body.atlas-shell-staking .desktop-module-rail{
    display:flex!important;position:absolute!important;flex-direction:column!important;
    right:10px!important;top:50%!important;transform:translateY(-50%)!important;
    width:54px!important;min-width:54px!important;max-width:54px!important;
    padding:6px!important;gap:5px!important;
    border:1px solid rgba(34,58,94,.16)!important;border-radius:15px!important;
    background:rgba(255,255,255,.97)!important;box-shadow:0 8px 24px rgba(26,47,77,.16)!important;
    backdrop-filter:blur(12px);z-index:1500!important;
  }
  body.atlas-shell-staking .desktop-module-rail button{
    width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;
    padding:0!important;border:0!important;border-radius:10px!important;
    background:transparent;color:#223A5E;display:grid;place-items:center;cursor:pointer;font-size:18px!important;
  }
  body.atlas-shell-staking .desktop-module-rail button span{font-size:20px;line-height:1}
  body.atlas-shell-staking .desktop-module-rail button b{display:none}
  body.atlas-shell-staking .desktop-module-rail button:hover,
  body.atlas-shell-staking .desktop-module-rail button.active{background:#223a5e!important;color:#fff!important}
  body.atlas-shell-staking .desktop-module-rail .desktop-rail-separator{
    height:1px;width:32px;background:#dbe5ee;margin:2px auto!important;
  }
  body.atlas-shell-staking .desktop-module-rail #railZoomIn{background:#223a5e!important;color:#fff!important;font-size:22px!important}
  body.atlas-shell-staking .desktop-module-rail #railZoomOut{background:#0891b2!important;color:#fff!important;font-size:22px!important}
  body.atlas-shell-staking .desktop-module-rail #railLocate{background:#47c27a!important;color:#fff!important;margin-top:3px!important}

  body.atlas-shell-staking .workspace{
    display:block!important;position:absolute!important;
    right:74px!important;top:12px!important;bottom:12px!important;
    width:min(470px,38vw)!important;height:auto!important;max-height:none!important;
    border-radius:16px!important;
    transform:translateX(calc(100% + 100px))!important;
    opacity:0!important;visibility:hidden!important;pointer-events:none!important;
    transition:transform .2s ease,opacity .16s ease!important;z-index:1400!important;
  }
  body.atlas-shell-staking .workspace.desktop-open{
    transform:translateX(0)!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important;
  }
  body.atlas-shell-staking .workspace.desktop-open .tab.active{display:block!important;visibility:visible!important;opacity:1!important}
  body.atlas-shell-staking .workspace.desktop-open .tab:not(.active){display:none!important}
  body.atlas-shell-staking .workspace-head{padding:13px 15px 10px!important;cursor:default!important}
  body.atlas-shell-staking .workspace .tab{padding:13px 15px 18px!important}
  body.atlas-shell-staking .workspace .tabs{display:none!important}
  body.atlas-shell-staking .module-info-strip{display:none!important}
  body.atlas-shell-staking .open-workspace-btn{display:none!important}
  body.atlas-shell-staking .maptools{display:none!important}

  body.atlas-shell-staking #traceCard.desktop-trace-open{
    display:block!important;visibility:visible!important;position:absolute!important;
    right:74px!important;top:12px!important;bottom:12px!important;
    width:min(470px,38vw)!important;z-index:1400!important;overflow:auto!important;
    margin:0!important;border-radius:16px!important;
    background:rgba(255,255,255,.97)!important;box-shadow:0 16px 42px rgba(26,47,77,.18)!important;padding:14px!important;
  }
  body.atlas-shell-staking .trace-card{display:none}
}

@media(max-width:900px){
  body.atlas-shell-staking .desktop-module-rail{display:none!important}
  body.atlas-shell-staking .module-info-strip{display:none!important}
  body.atlas-shell-staking .mobile-dock button[data-mobile-view="layers"] .dockicon{font-size:17px!important}
  body.atlas-shell-staking .layercard.mobile-open,
  body.atlas-shell-staking .workspace.mobile-open{
    display:flex!important;visibility:visible!important;opacity:1!important;transform:none!important;
    background:rgba(255,255,255,.97)!important;
    border-radius:18px 18px 0 0!important;
    box-shadow:0 -12px 38px rgba(15,39,66,.18)!important;
  }
  body.atlas-shell-staking .layercard.mobile-open{display:block!important;max-height:min(70dvh,640px)!important;overflow:auto!important}
  body.atlas-shell-staking .workspace.mobile-open{
    height:min(70dvh,640px)!important;max-height:min(70dvh,640px)!important;overflow:hidden!important;
  }
  body.atlas-shell-staking .workspace.mobile-open .tab.active{
    display:block!important;visibility:visible!important;opacity:1!important;overflow:auto!important;flex:1 1 auto!important;
  }
  body.atlas-shell-staking .workspace.mobile-open .tab:not(.active){display:none!important}
  body.atlas-shell-staking .workspace.mobile-open .workspace-head{display:flex!important}
  body.atlas-shell-staking .layercard.mobile-open .grab,
  body.atlas-shell-staking .workspace.mobile-open .grab{
    display:block!important;width:42px!important;height:4px!important;margin:7px auto 4px!important;
    border-radius:99px!important;background:#c7d2dc!important;
  }
  body.atlas-shell-staking #traceCard:not([hidden]){display:block!important;visibility:visible!important}
  body.atlas-shell-staking.trace-mode .mobile-dock button[data-mobile-view="trace"]{background:#223A5E!important;color:#fff!important}

  body.atlas-shell-staking .field-actions{display:block!important;grid-template-columns:1fr!important}
  body.atlas-shell-staking .field-actions #stakeFromDeviceBtn{
    display:flex!important;width:100%!important;max-width:none!important;min-height:54px!important;
    justify-content:flex-start!important;padding:10px 12px!important;border-radius:12px!important;
  }
  body.atlas-shell-staking .field-actions #stakeFromDeviceBtn small{display:block!important}
}


/* Mobile Picchettamento: dock e pannelli */
@media(max-width:900px){
 body.atlas-shell-staking main{overflow:hidden!important}
 body.atlas-shell-staking .mac-window-dot,
 body.atlas-shell-staking .workspace-head-actions{display:none!important}
 body.atlas-shell-staking .mobile-dock{
  position:fixed!important;left:0!important;right:0!important;bottom:0!important;height:60px!important;
  padding:4px 6px calc(4px + env(safe-area-inset-bottom,0px))!important;
  display:grid!important;grid-template-columns:repeat(4,1fr)!important;gap:3px!important;
  background:#223a5e!important;border:0!important;border-radius:0!important;z-index:5000!important
 }
 body.atlas-shell-staking .mobile-dock button{min-width:0!important;height:50px!important;padding:4px 2px!important;border:0!important;border-radius:9px!important;background:transparent!important;color:#fff!important;font-size:9px!important;font-weight:800!important}
 body.atlas-shell-staking .mobile-dock button .dockicon{display:block!important;font-size:18px!important;line-height:20px!important;margin-bottom:2px!important}
 body.atlas-shell-staking .mobile-dock button.active{background:rgba(255,255,255,.16)!important;color:#fff!important}
 body.atlas-shell-staking .layercard.mobile-open,
 body.atlas-shell-staking .workspace.mobile-open{
  position:fixed!important;left:8px!important;right:8px!important;top:auto!important;
  bottom:calc(60px + env(safe-area-inset-bottom,0px) + 6px)!important;
  width:auto!important;height:min(70dvh,640px)!important;max-height:min(70dvh,640px)!important;
  margin:0!important;border:1px solid rgba(34,58,94,.14)!important;border-radius:18px 18px 10px 10px!important;
  background:#fff!important;box-shadow:0 -12px 38px rgba(15,39,66,.18)!important;z-index:4800!important
 }
 body.atlas-shell-staking .layercard.mobile-open{padding:12px!important;overflow-y:auto!important}
 body.atlas-shell-staking .workspace.mobile-open{display:flex!important;flex-direction:column!important;overflow:hidden!important}
 body.atlas-shell-staking .workspace.mobile-open .workspace-head{flex:0 0 auto!important;min-height:56px!important;padding:10px 12px!important}
 body.atlas-shell-staking .workspace.mobile-open .tab.active{display:block!important;flex:1 1 auto!important;min-height:0!important;padding:10px 12px 18px!important;overflow-y:auto!important;overflow-x:hidden!important}
 body.atlas-shell-staking .field-actions-card{display:block!important}
 body.atlas-shell-staking #stakeFromDeviceBtn{display:flex!important;width:100%!important;min-height:58px!important;padding:10px 12px!important;justify-content:flex-start!important;text-align:left!important}
 body.atlas-shell-staking #traceCard:not([hidden]){
  position:fixed!important;left:8px!important;right:8px!important;top:auto!important;
  bottom:calc(60px + env(safe-area-inset-bottom,0px) + 6px)!important;
  width:auto!important;max-height:min(70dvh,640px)!important;margin:0!important;padding:12px!important;
  overflow-y:auto!important;border-radius:18px 18px 10px 10px!important;background:#fff!important;z-index:4800!important
 }
 body.atlas-shell-staking:has(.workspace.mobile-open) .maptools,
 body.atlas-shell-staking:has(.layercard.mobile-open) .maptools,
 body.atlas-shell-staking.trace-mode .maptools{opacity:0!important;visibility:hidden!important;pointer-events:none!important}
 body.atlas-shell-staking .open-workspace-btn,
 body.atlas-shell-staking .open-layers-btn{display:none!important}
}


/* Controlli mobile e pulizia moduli */
.atlas-module-clear{display:flex;justify-content:flex-end;margin:0 0 10px}
.atlas-clear-btn{min-height:34px!important;padding:6px 12px!important;border:1px solid #d7e2eb!important;border-radius:9px!important;background:#fff!important;color:#b33a3a!important;font-size:10px!important;font-weight:900!important}
@media(max-width:900px){
 body.atlas-shell-staking #traceCloseBtn{display:none!important}
 body.atlas-shell-staking .atlas-module-clear{position:sticky;top:0;z-index:3;padding:2px 0 6px;background:#fff}
 body.atlas-shell-staking .mobile-dock button:not(.active){background:transparent!important;color:#fff!important}
 body.atlas-shell-staking .mobile-dock button.active{background:rgba(255,255,255,.18)!important;color:#fff!important}
}

/* Modalità geometria picchetti */
.geometry-mode{display:flex;align-items:center;gap:6px;font-size:10px;font-weight:900;color:#223a5e}
.geometry-mode select{min-height:34px;padding:5px 28px 5px 9px;border:1px solid #d7e2eb;border-radius:9px;background:#fff;color:#223a5e;font:inherit}
@media(max-width:900px){.polybar .geometry-mode{width:100%;justify-content:space-between}.polybar .geometry-mode select{flex:1;max-width:180px}}

/* Catasto card mobile */
@media(max-width:900px){
 body.atlas-shell-staking #layercard .atlas-catasto-card{border:1px solid #b8d2e6!important;border-left:6px solid #0797b7!important;border-radius:0 16px 16px 16px!important;background:#fff!important;overflow:hidden!important}
 body.atlas-shell-staking #layercard .atlas-catasto-card summary{display:flex!important;align-items:center!important;gap:10px!important;min-height:62px!important;padding:8px 12px!important;background:#f7fafc!important;border-bottom:1px solid #e3ebf2!important}
 body.atlas-shell-staking #layercard .atlas-catasto-card summary:before{display:none!important}
 body.atlas-shell-staking .atlas-catasto-summary-icon{display:grid!important;place-items:center!important;width:38px!important;height:38px!important;border-radius:11px!important;background:#0797b7!important;color:#fff!important;font-size:22px!important}
 body.atlas-shell-staking #layercard .atlas-catasto-card summary b{color:#213b61!important}
 body.atlas-shell-staking #layercard .atlas-catasto-card summary em{font-style:normal!important;font-size:11px!important;color:#9aaac0!important;margin-left:4px!important}
 body.atlas-shell-staking #layercard .atlas-catasto-card label{min-height:43px!important;padding:0 12px 0 18px!important;color:#3c506d!important}
 body.atlas-shell-staking .atlas-layer-swatch{display:inline-block;width:17px;height:17px;border-radius:5px;margin-right:10px;vertical-align:-3px}
 body.atlas-shell-staking .sw-buildings{background:#d69a25} body.atlas-shell-staking .sw-sheets{background:#9a7a1c} body.atlas-shell-staking .sw-parcels{background:#f0b63d} body.atlas-shell-staking .sw-dress{background:#4d6d7b}
}

@media(max-width:900px){body.atlas-shell-staking .atlas-catasto-summary-icon svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}}


/* Catasto e VisualTAF: icone uniformi */
body.atlas-shell-staking .atlas-catasto-summary-icon,
body.atlas-shell-staking .atlas-taf-icon{
  display:grid!important;
  place-items:center!important;
  width:38px!important;
  height:38px!important;
  min-width:38px!important;
  min-height:38px!important;
  flex:0 0 38px!important;
  border-radius:11px!important;
}
body.atlas-shell-staking .atlas-catasto-summary-icon svg{
  width:23px!important;
  height:23px!important;
}
body.atlas-shell-staking .atlas-taf-icon{
  font-size:22px!important;
  line-height:1!important;
}


/* Rail e crediti Picchettamento */
body.atlas-shell-staking #map .leaflet-control-attribution{display:none!important}
body.atlas-shell-staking .staking-attribution-drawer[hidden]{display:none!important}
body.atlas-shell-staking .staking-attribution-drawer{
  position:fixed!important;z-index:49990!important;box-sizing:border-box!important;
  max-width:min(620px,calc(100vw - 100px))!important;
  padding:6px 9px!important;margin:0!important;
  border:1px solid rgba(34,58,94,.14)!important;border-radius:9px!important;
  background:rgba(255,255,255,.98)!important;color:#52657b!important;
  box-shadow:0 5px 16px rgba(26,47,77,.14)!important;
  font-family:Montserrat,sans-serif!important;font-size:11px!important;font-weight:600!important;line-height:1.4!important;
  white-space:normal!important;
}
body.atlas-shell-staking .staking-attribution-drawer a{color:#0891B2!important;font-weight:700!important;text-decoration:none!important}

@media(min-width:901px){
  body.atlas-shell-staking .desktop-module-rail #railAttributionToggle{
    width:40px!important;min-width:40px!important;max-width:40px!important;
    height:40px!important;min-height:40px!important;max-height:40px!important;
    margin:0!important;padding:0!important;border:0!important;border-radius:10px!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    background:#223A5E!important;color:#fff!important;box-shadow:none!important;
  }
  body.atlas-shell-staking .desktop-module-rail #railAttributionToggle.is-open{background:#0891B2!important}
  body.atlas-shell-staking .desktop-module-rail #railAttributionToggle span,
  body.atlas-shell-staking .desktop-module-rail #railAttributionToggle svg{
    width:21px!important;height:21px!important;display:block!important;
  }
  body.atlas-shell-staking .desktop-module-rail #railAttributionToggle b{display:none!important}
}

@media(max-width:900px){
  body.atlas-shell-staking .maptools{
    position:fixed!important;
    display:flex!important;flex-direction:column!important;
    visibility:visible!important;opacity:1!important;pointer-events:auto!important;
    right:10px!important;top:auto!important;
    bottom:calc(60px + env(safe-area-inset-bottom,0px) + 34px)!important;
    z-index:50000!important;
    width:52px!important;padding:5px!important;box-sizing:border-box!important;align-items:center!important;
    gap:0!important;border:1px solid rgba(34,58,94,.16)!important;border-radius:14px!important;
    background:rgba(255,255,255,.97)!important;box-shadow:0 8px 24px rgba(26,47,77,.16)!important;
    backdrop-filter:blur(8px)!important;-webkit-backdrop-filter:blur(8px)!important;
  }
  body.atlas-shell-staking .maptools .atlas-mobile-map-zoom{
    order:1!important;display:flex!important;flex-direction:column!important;
    width:40px!important;gap:4px!important;align-items:center!important;margin:0 auto!important;padding:0!important;
    background:transparent!important;box-shadow:none!important;
  }
  body.atlas-shell-staking .maptools .atlas-mobile-map-zoom button,
  body.atlas-shell-staking .maptools #atlasLocateBtn,
  body.atlas-shell-staking .maptools #stakingAttributionToggle{
    position:static!important;left:auto!important;right:auto!important;transform:none!important;
    width:40px!important;min-width:40px!important;max-width:40px!important;
    height:40px!important;min-height:40px!important;max-height:40px!important;
    margin:0 auto!important;padding:0!important;align-self:center!important;box-sizing:border-box!important;
    border:0!important;border-radius:10px!important;display:flex!important;align-items:center!important;justify-content:center!important;
    color:#fff!important;box-shadow:none!important;
  }
  body.atlas-shell-staking .maptools .atlas-mobile-map-zoom #stakingZoomIn,
  body.atlas-shell-staking .maptools .atlas-mobile-map-zoom #stakingZoomOut{
    background:#223A5E!important;font-size:22px!important;font-weight:800!important;line-height:1!important;
  }
  body.atlas-shell-staking .maptools #atlasLocateBtn{
    order:2!important;display:flex!important;margin-top:4px!important;background:#47C27A!important;
  }
  body.atlas-shell-staking .maptools #atlasLocateBtn .atlas-tool-glyph,
  body.atlas-shell-staking .maptools #atlasLocateBtn .atlas-tool-glyph svg{
    width:21px!important;height:21px!important;color:#fff!important;
  }
  body.atlas-shell-staking .maptools #atlasLocateBtn .atlas-map-action-label{display:none!important}
  body.atlas-shell-staking .maptools #stakingAttributionToggle{
    order:3!important;display:flex!important;align-items:center!important;justify-content:center!important;
    margin-top:4px!important;background:#223A5E!important;color:#fff!important;border:0!important;border-radius:10px!important;
  }
  body.atlas-shell-staking .maptools #stakingAttributionToggle.is-open{background:#0891B2!important}
  body.atlas-shell-staking .maptools #stakingAttributionToggle .atlas-map-action-label{display:none!important}
  body.atlas-shell-staking .maptools #stakingAttributionToggle .atlas-tool-glyph,
  body.atlas-shell-staking .maptools #stakingAttributionToggle svg{width:21px!important;height:21px!important}
  body.atlas-shell-staking .staking-attribution-drawer{
    max-width:calc(100vw - 88px)!important;font-size:10px!important;line-height:1.4!important;
  }
}

