/* Topographie — carte claire, mobile = map plein écran */
body.is-topo{background:#fff;min-height:100vh;color:#152536;margin:0;overflow-x:hidden}
body.is-topo .tabbar,body.is-topo .topbar,body.is-topo .site-footer{display:none!important}
.topo-app{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}

.topo-bar{
  display:flex;align-items:center;gap:8px;padding:8px 10px;
  background:#fff;border-bottom:1px solid #e5ebf2;position:relative;z-index:30;
  flex-shrink:0
}
.topo-back{
  color:#1565c0;text-decoration:none;font-size:13px;font-weight:700;
  padding:8px 10px;border:1px solid #d5e0ec;border-radius:10px;background:#fff;flex-shrink:0
}
.topo-back-txt{display:none}
.topo-zone{
  flex:1;min-width:0;appearance:none;border:1px solid #d5e0ec;border-radius:10px;
  background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231565c0' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding:9px 28px 9px 10px;font:inherit;font-size:13px;font-weight:600;color:#152536
}
.topo-goto-btn{
  appearance:none;border:1px solid #d5e0ec;border-radius:10px;background:#fff;color:#152536;
  font-size:13px;font-weight:700;padding:9px 12px;cursor:pointer;flex-shrink:0;white-space:nowrap
}
.topo-goto-btn:hover{background:#f3f7fc}
.topo-langs{display:none;gap:4px}
.topo-langs a{
  color:#1565c0;text-decoration:none;font-size:11px;font-weight:700;
  padding:6px 8px;border-radius:999px;border:1px solid #d5e0ec
}
.topo-langs a[aria-current=page]{background:#1565c0;border-color:#1565c0;color:#fff}

.topo-stage{position:relative;flex:1;min-height:0;display:block;background:#e8efe9}
.topo-map-wrap{position:absolute;inset:0}
#topo-map{position:absolute;inset:0}
.topo-rail{
  position:absolute;z-index:8;inset-inline-start:8px;top:10px;
  display:flex;flex-direction:column;gap:8px;pointer-events:none
}
.topo-tool-group{
  pointer-events:auto;display:flex;flex-direction:column;background:#fff;border-radius:12px;
  overflow:hidden;box-shadow:0 3px 14px #0003;border:1px solid #e8eee3
}
.topo-tool{
  appearance:none;border:0;background:#fff;color:#2c3640;width:44px;height:44px;
  display:grid;place-items:center;cursor:pointer;border-bottom:1px solid #eef2f6;padding:0
}
.topo-tool:last-child{border-bottom:0}
.topo-tool svg{width:20px;height:20px}
.topo-tool.is-on{background:#eef5ff;color:#1a73e8}
.topo-tool-danger{color:#a04848}
.topo-tool-danger.is-on{background:#fff0ee;color:#c62828}
.topo-layers{position:absolute;z-index:7;inset-inline-end:10px;bottom:max(14px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px}
.topo-layer-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  width:48px;height:48px;border-radius:12px;border:1px solid #d7e0ea;background:#fff;
  box-shadow:0 3px 14px #0003;color:#1a73e8;font-size:9px;font-weight:700;cursor:pointer;padding:0
}
.topo-layer-btn svg{width:20px;height:20px}
.topo-layer-txt{display:none}
.topo-layer-btn[aria-pressed=true]{background:#e8f0fe;border-color:#c5d8f5}
.topo-close-ico{font-size:16px;line-height:1;color:#1a73e8}
.topo-hint{
  position:absolute;z-index:6;left:50%;top:10px;transform:translateX(-50%);margin:0;
  padding:7px 12px;border-radius:999px;background:#fffffff0;color:#152536;
  font-size:12px;pointer-events:none;max-width:min(86%,340px);text-align:center;
  border:1px solid #dde5ef;box-shadow:0 4px 14px #0002
}
.topo-hint[hidden]{display:none!important}

/* Labels sur le trait — une bulle compacte (jamais pleine largeur) */
.maplibregl-marker.topo-ml-marker{
  width:auto!important;height:auto!important;max-width:none!important
}
.topo-measure-label{
  display:inline-flex;align-items:center;gap:6px;
  width:max-content;max-width:min(78vw,260px);
  box-sizing:border-box;
  background:#fff;color:#152536;border:1px solid #e5ebf2;border-radius:10px;
  padding:7px 10px;font-size:12px;font-weight:700;box-shadow:0 4px 14px #0003;
  white-space:nowrap;pointer-events:auto;position:relative;line-height:1.25
}
.topo-measure-label::after{
  content:"";position:absolute;left:50%;bottom:-6px;margin-left:-6px;
  border:6px solid transparent;border-top-color:#fff;filter:drop-shadow(0 1px 0 #e5ebf2)
}
.topo-measure-label .topo-ml-txt{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis}
.topo-measure-label .topo-ml-x{
  flex:0 0 auto;position:static;width:18px;height:18px;border:0;border-radius:50%;
  background:#f1f4f8;color:#6a7b8c;font-size:13px;cursor:pointer;line-height:18px;padding:0;text-align:center
}
.topo-measure-label.is-area{flex-direction:column;align-items:flex-start;gap:2px;padding-inline-end:10px;white-space:normal}
.topo-measure-label.is-area .topo-ml-row{display:flex;align-items:center;gap:6px;width:100%}
.topo-measure-label small{display:block;font-weight:600;color:#5b6d63;font-size:11px}

/* Panel desktop only */
.topo-panel{display:none}
.topo-panel h2{margin:0 0 12px;font-size:15px;font-weight:700}
.topo-field{display:flex;flex-direction:column;gap:6px;margin-bottom:10px;font-size:12px;color:#5b6d63}
.topo-field input,.topo-field select{
  border:1px solid #d5e0ec;background:#fff;color:#152536;border-radius:10px;
  padding:10px 12px;font:inherit;min-height:42px
}
.topo-xy-row{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.topo-xy-row .topo-field{margin:0}
.topo-xy-row label span{font-weight:700;color:#152536}
.topo-readout,.topo-stats{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.topo-stats{grid-template-columns:repeat(3,1fr)}
.topo-readout>div,.topo-stats>div{background:#f3f7fc;border:1px solid #dde5ef;border-radius:10px;padding:10px}
.topo-readout span,.topo-stats span{display:block;font-size:10px;color:#6a7b8c;margin-bottom:4px}
.topo-readout b,.topo-stats b{font-size:13px;font-weight:700;word-break:break-all;color:#152536}
.topo-actions{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.topo-btn{
  appearance:none;border:0;border-radius:10px;background:#1a73e8;color:#fff;
  font-size:13px;font-weight:700;padding:10px 12px;cursor:pointer
}
.topo-btn-ghost{background:#f3f7fc;color:#152536;border:1px solid #d5e0ec}
.topo-btn-wide,.topo-plus-wide{width:100%;margin-bottom:10px;min-height:46px;font-size:15px}
.topo-save-box{background:#f3f7fc;border:1px solid #dde5ef;border-radius:12px;padding:10px;margin-bottom:12px}
.topo-save-box p{margin:0 0 8px;font-size:11px;color:#6a7b8c;line-height:1.4}
.topo-save-row{display:grid;grid-template-columns:1fr auto;gap:8px;margin-bottom:8px}
.topo-save-row input{border:1px solid #d5e0ec;background:#fff;border-radius:10px;padding:9px 11px;font:inherit;min-height:40px}
.topo-plans{display:flex;flex-direction:column;gap:6px;max-height:140px;overflow:auto}
.topo-plan{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid #dde5ef;border-radius:10px;padding:8px 10px;font-size:12px}
.topo-plan strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topo-plan button{appearance:none;border:0;background:#eef5ff;color:#1a73e8;border-radius:8px;padding:5px 8px;font-size:11px;font-weight:700;cursor:pointer}
.topo-plan button.danger{background:#fff4f2;color:#8a2f22}
.topo-table-wrap{overflow:auto;max-height:280px;border:1px solid #dde5ef;border-radius:10px}
.topo-table{width:100%;border-collapse:collapse;font-size:12px}
.topo-table th,.topo-table td{padding:8px;border-bottom:1px solid #e8edf2;text-align:start}
.topo-table th{color:#6a7b8c;font-weight:600;position:sticky;top:0;background:#fff}
.topo-table button{appearance:none;border:0;background:transparent;color:#8a2f22;cursor:pointer}

/* Modal / sheet */
.topo-modal{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-end;justify-content:center}
.topo-modal[hidden]{display:none!important}
.topo-modal-backdrop{position:absolute;inset:0;background:#15253666}
.topo-sheet{
  position:relative;z-index:1;width:100%;max-width:440px;max-height:min(88vh,640px);
  overflow:auto;background:#fff;border-radius:18px 18px 0 0;padding:10px 16px 24px;
  box-shadow:0 -8px 40px #0004;padding-bottom:max(24px,env(safe-area-inset-bottom))
}
.topo-sheet-handle{width:40px;height:4px;border-radius:99px;background:#d5e0ec;margin:4px auto 12px}
.topo-sheet h3{margin:0 0 12px;font-size:16px;font-weight:700;color:#152536}
.topo-save-mobile{margin-top:4px}

/* SEO: caché sur mobile, visible desktop */
.topo-seo{display:none}
.topo-seo-inner{max-width:860px;margin:0 auto}
.topo-seo h1{font-size:clamp(1.4rem,3vw,2rem);margin:0 0 12px;line-height:1.25}
.topo-seo p{line-height:1.7;color:#405248}
.topo-seo a{color:#1f6b52}
.topo-faq{background:#fff;border:1px solid #dbe4da;border-radius:12px;padding:12px 14px;margin-bottom:8px}

/* MapLibre nav compact */
body.is-topo .maplibregl-ctrl-top-right{top:8px;right:8px}
body.is-topo .maplibregl-ctrl-group{border-radius:10px!important;overflow:hidden;box-shadow:0 3px 12px #0003!important}
body.is-topo .maplibregl-ctrl-bottom-left{display:none}

@media(min-width:921px){
  .topo-plans-btn{display:none!important}
  .topo-back-txt{display:inline}
  .topo-langs-desk{display:flex}
  .topo-bar{padding:10px 14px;gap:10px}
  .topo-zone{max-width:280px;flex:0 1 280px}
  .topo-stage{
    display:grid;grid-template-columns:minmax(0,1fr) 320px;
    position:relative;min-height:calc(100vh - 56px);flex:1
  }
  .topo-map-wrap{position:relative;min-height:calc(100vh - 56px)}
  .topo-rail{top:16px;inset-inline-start:12px}
  .topo-tool{width:48px;height:48px}
  .topo-layer-txt{display:block}
  .topo-layer-btn{width:58px;height:58px}
  .topo-panel{
    display:block;position:relative;background:#fff;border-inline-start:1px solid #dde5ef;
    padding:14px;overflow:auto;max-height:calc(100vh - 56px)
  }
  .topo-seo{display:block;background:#f4f7f4;color:#1c2e24;padding:28px 16px 48px}
  .topo-sheet{border-radius:16px;margin-bottom:24px;max-height:80vh}
  .topo-modal{align-items:center}
}


/* Longueurs de segment sans fond + superficie verte au centre */
.topo-seg-len{
  display:inline-block;width:max-content;
  background:transparent!important;border:0!important;box-shadow:none!important;
  padding:0;margin:0;color:#152536;font-size:11px;font-weight:700;
  text-shadow:0 0 3px #fff,0 0 5px #fff,1px 1px 0 #fff,-1px -1px 0 #fff,1px -1px 0 #fff,-1px 1px 0 #fff;
  white-space:nowrap;pointer-events:none;line-height:1
}
.topo-seg-len::after{display:none!important}
.topo-area-green{
  display:inline-block;width:max-content;text-align:center;
  background:transparent!important;border:0!important;box-shadow:none!important;
  padding:0;margin:0;color:#1b8a3e;font-size:12px;font-weight:800;
  text-shadow:0 0 3px #fff,0 0 6px #fff,1px 1px 0 #fff,-1px -1px 0 #fff;
  white-space:nowrap;pointer-events:none;line-height:1.2
}
.topo-area-green small{display:block;color:#1b8a3e;font-size:10px;font-weight:700;margin-top:1px}
.topo-area-green::after{display:none!important}


/* Mobile: sheet compact + pas de scroll body (évite front cassé) */
body.topo-modal-open{
  overflow:hidden!important;
  position:fixed;
  inset:0;
  width:100%;
  touch-action:none
}
body.topo-modal-open .topo-app{height:100dvh;overflow:hidden}
.topo-modal{overscroll-behavior:contain}
@media(max-width:920px){
  .topo-sheet{
    max-height:min(62vh,520px);
    padding:8px 14px max(14px,env(safe-area-inset-bottom));
  }
  .topo-sheet h3{font-size:15px;margin-bottom:8px}
  .topo-plus-wide{min-height:42px;margin-bottom:8px;font-size:14px}
  .topo-save-mobile{margin-top:2px;padding:8px}
  .topo-save-mobile p{margin-bottom:6px}
  .topo-plans{max-height:88px}
  .topo-field input{min-height:40px;padding:8px 10px}
  .topo-xy-row{margin-bottom:8px}
  .topo-actions{margin-bottom:8px}
}


.topo-plan button.edit{background:#eef5ff;color:#1a73e8;font-size:14px;min-width:32px;padding:5px 8px}
.topo-plan.is-editing{border-color:#1a73e8;background:#f3f8ff}
.topo-edit-bar{
  position:absolute;z-index:9;left:50%;bottom:max(14px,env(safe-area-inset-bottom));
  transform:translateX(-50%);display:flex;align-items:center;gap:8px;
  background:#fff;border:1px solid #d5e0ec;border-radius:14px;padding:8px 10px;
  box-shadow:0 6px 20px #0003;max-width:min(94vw,420px)
}
.topo-edit-bar[hidden]{display:none!important}
.topo-edit-ico{color:#1a73e8;font-size:15px;font-weight:700}
.topo-edit-name{flex:1;min-width:0;font-size:12px;font-weight:700;color:#152536;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topo-btn-sm{padding:8px 10px;font-size:12px;border-radius:10px;white-space:nowrap}
@media(max-width:920px){
  .topo-edit-bar{bottom:max(18px,env(safe-area-inset-bottom)); inset-inline-end:auto}
  .topo-layers{bottom:70px}
}


.topo-export-box{
  background:#f7faf7;border:1px solid #dbe4da;border-radius:12px;padding:10px;margin-bottom:12px
}
.topo-export-box p{margin:0 0 8px;font-size:11px;color:#5b6d63;line-height:1.35}
.topo-export-row{display:flex;gap:8px;flex-wrap:wrap}
.topo-export-row .topo-btn{flex:1;min-width:64px;justify-content:center}

/* === topo-locate-v1 === */
body.is-topo .topo-locate{
  position:absolute;z-index:8;
  top:8px;right:8px;
  width:36px;height:36px;min-width:36px;min-height:36px;
  margin:0;padding:0;border:1px solid #d7e0ea;border-radius:10px;
  background:#fff;box-shadow:0 3px 12px #0003;
  cursor:pointer;appearance:none;-webkit-appearance:none;
  display:grid;place-items:center;
}
body.is-topo .topo-locate::before{
  content:"";display:block;width:14px;height:14px;border-radius:50%;
  border:2px solid #1a73e8;box-sizing:border-box;
  box-shadow:inset 0 0 0 2.5px #fff, inset 0 0 0 5.5px #1a73e8;
}
body.is-topo .topo-locate[aria-busy=true]{opacity:.55;cursor:progress}
body.is-topo .maplibregl-ctrl-top-right{
  top:8px;right:8px;
  display:flex;flex-direction:column;align-items:flex-end;gap:8px;
}
body.is-topo .maplibregl-ctrl-top-right .topo-locate{
  position:static!important;top:auto;right:auto;
}
body.is-topo .maplibregl-ctrl-group button{
  width:36px!important;height:36px!important;min-height:36px!important;
}
.topo-you-dot{
  width:16px;height:16px;border-radius:50%;
  background:#1a73e8;border:2.5px solid #fff;
  box-shadow:0 0 0 6px rgba(26,115,232,.22),0 2px 6px #0004;
  animation: topo-you-pulse 1.8s ease-out infinite;
}
@keyframes topo-you-pulse{
  0%{box-shadow:0 0 0 0 rgba(26,115,232,.45),0 2px 6px #0004}
  70%{box-shadow:0 0 0 14px rgba(26,115,232,0),0 2px 6px #0004}
  100%{box-shadow:0 0 0 0 rgba(26,115,232,0),0 2px 6px #0004}
}
body.is-topo .topo-locate{pointer-events:auto;z-index:12}
body.is-topo .maplibregl-ctrl-top-right{z-index:12}


/* === topo-overlay-labels-v1 === */
#topo-labels-toggle .topo-eye-off[hidden],
#topo-labels-toggle .topo-eye-on[hidden]{display:none!important}
#topo-labels-toggle[aria-pressed="false"]{opacity:.72;background:#f4f6f8}
.topo-plan{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.topo-plan .topo-swatch{
  width:12px;height:12px;border-radius:3px;flex:0 0 auto;
  border:1px solid #0002;box-shadow:inset 0 0 0 1px #fff8
}
.topo-plan .vis{
  border:0;background:#eef2f6;color:#3a4652;border-radius:8px;
  width:30px;height:30px;cursor:pointer;font-size:14px;line-height:1
}
.topo-plan .vis.is-off{opacity:.45;text-decoration:line-through}
.topo-plan.is-hidden-plan{opacity:.55}
.topo-seg-len.topo-ov-lab,.topo-area-green.topo-ov-lab{opacity:.92}

/* === topo-locate-align-v2 === */
body.is-topo .maplibregl-ctrl-top-right{
  top:8px;right:8px;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  gap:8px!important;
  width:36px!important;
}
body.is-topo .maplibregl-ctrl-top-right .maplibregl-ctrl-group,
body.is-topo .maplibregl-ctrl-top-right .topo-locate{
  width:36px!important;margin:0!important;align-self:stretch!important;
}
body.is-topo .maplibregl-ctrl-group{
  width:36px!important;gap:0!important;
  border-radius:10px!important;overflow:hidden!important;
  background:#fff!important;border:1px solid #d7e0ea!important;
  box-shadow:0 3px 12px #0003!important;
}
body.is-topo .maplibregl-ctrl-group button{
  width:36px!important;height:36px!important;min-height:36px!important;
  margin:0!important;padding:0!important;border-radius:0!important;
  background:#fff!important;border:0!important;
  box-shadow:none!important;
}
body.is-topo .maplibregl-ctrl-group button+button{border-top:1px solid #d7e0ea!important}
body.is-topo .topo-locate{
  position:static!important;top:auto;right:auto;
  width:36px!important;height:36px!important;
  min-width:36px!important;min-height:36px!important;
  border-radius:10px!important;border:1px solid #d7e0ea!important;
  background:#fff!important;box-shadow:0 3px 12px #0003!important;
  display:grid!important;place-items:center!important;
}
body.is-topo .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
body.is-topo .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{
  background-image:none!important;position:relative!important;
  display:block!important;width:100%!important;height:100%!important;
}
body.is-topo .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::before,
body.is-topo .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon::before{
  content:""!important;position:absolute!important;left:50%!important;top:50%!important;
  width:13px!important;height:2px!important;background:#111!important;border-radius:2px!important;
  transform:translate(-50%,-50%)!important;
}
body.is-topo .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::after{
  content:""!important;position:absolute!important;left:50%!important;top:50%!important;
  width:2px!important;height:13px!important;background:#111!important;border-radius:2px!important;
  transform:translate(-50%,-50%)!important;
}

/* === topo-new-green-v1 === */
.topo-tool-new{color:#16a34a}
.topo-tool-new:active,.topo-tool-new.is-on{background:#eafff1;color:#15803d}

/* Curseur précis (+) pour dessiner — croix fine, pas un X épais */
#topo-map .maplibregl-canvas-container.maplibregl-interactive,
#topo-map canvas.maplibregl-canvas{
  cursor: crosshair;
}
body.is-topo .topo-tool[data-tool="pan"].is-on ~ * { }
#topo-map.is-pan .maplibregl-canvas,
#topo-map.is-pan .maplibregl-canvas-container{
  cursor: grab;
}
#topo-map.is-erase .maplibregl-canvas,
#topo-map.is-erase .maplibregl-canvas-container{
  cursor: pointer;
}

/* Petite popup info objet */
.topo-info-pop{
  min-width:148px;max-width:220px;padding:0;margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,sans-serif;
}
.topo-info-pop .hd{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  font-size:11px;font-weight:800;letter-spacing:.02em;color:#0f2744;
  margin:0 0 6px;text-transform:uppercase;
}
.topo-info-pop .hd b{font-weight:800;color:#1a73e8}
.topo-info-pop .row{
  display:grid;grid-template-columns:28px 1fr;gap:2px 6px;
  font-size:11px;line-height:1.35;color:#243447;margin:0 0 2px;
}
.topo-info-pop .row span{color:#6a7b8c;font-weight:600}
.topo-info-pop .row em{font-style:normal;font-variant-numeric:tabular-nums;font-weight:700}
.topo-info-pop .meta{
  margin-top:7px;padding-top:6px;border-top:1px solid #e6edf5;
  font-size:11px;color:#1a73e8;font-weight:700;
}
.topo-info-pop .meta small{display:block;color:#6a7b8c;font-weight:600;margin-top:2px}
.maplibregl-popup.topo-info-popup .maplibregl-popup-content{
  padding:10px 12px;border-radius:12px;box-shadow:0 8px 28px #0b1f3a26;
  border:1px solid #e2eaf3;background:#fff;
}
.maplibregl-popup.topo-info-popup .maplibregl-popup-tip{border-top-color:#fff}
.maplibregl-popup.topo-info-popup .maplibregl-popup-close-button{
  font-size:16px;color:#6a7b8c;padding:2px 6px;right:2px;top:2px;
}
#topo-map.is-info .maplibregl-canvas,
#topo-map.is-info .maplibregl-canvas-container{cursor:help}

/* Déplacer une borne (mobile + PC) */
.topo-borne-move{
  position:absolute;z-index:10;left:50%;bottom:max(16px,env(safe-area-inset-bottom));
  transform:translateX(-50%);
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center;
  padding:8px 10px;border-radius:14px;background:#fff;border:1px solid #d7e0ea;
  box-shadow:0 8px 28px #0b1f3a28;max-width:min(96%,420px);
}
.topo-borne-move,.topo-borne-move[hidden]{display:none!important}
.topo-borne-move #topo-borne-move-label{
  font-size:12px;font-weight:800;color:#1a73e8;min-width:28px;
}
.topo-borne-move .topo-borne-drag,
.topo-borne-move .topo-borne-done{
  appearance:none;border:0;border-radius:10px;padding:8px 12px;
  font-size:12px;font-weight:700;cursor:pointer;
}
.topo-borne-move .topo-borne-drag{background:#e8f0fe;color:#1a73e8}
.topo-borne-move .topo-borne-drag.is-on{background:#1a73e8;color:#fff}
.topo-borne-move .topo-borne-done{background:#eef2f6;color:#243447}
.topo-borne-nudge{display:grid;grid-template-columns:repeat(3,32px);grid-template-rows:repeat(2,32px);gap:4px}
.topo-borne-nudge button{
  appearance:none;border:1px solid #d7e0ea;background:#fff;border-radius:8px;
  font-size:14px;font-weight:700;color:#1a73e8;cursor:pointer;line-height:1;
}
.topo-borne-nudge button[data-nudge="up"]{grid-column:2;grid-row:1}
.topo-borne-nudge button[data-nudge="left"]{grid-column:1;grid-row:2}
.topo-borne-nudge button[data-nudge="right"]{grid-column:3;grid-row:2}
.topo-borne-nudge button[data-nudge="down"]{grid-column:2;grid-row:2}
@media (hover:hover) and (pointer:fine){
  /* PC: nudges less needed — keep compact */
  .topo-borne-nudge{display:none}
}

.topo-drag-pin{
  width:36px;height:48px;cursor:grab;touch-action:none;position:relative;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,.35));
}
.topo-drag-pin:active{cursor:grabbing}
.topo-drag-pin .pin-body{position:absolute;inset:0;width:36px;height:48px}
.topo-drag-pin .pin-svg{display:block;width:36px;height:48px;pointer-events:none}
.topo-drag-pin .lbl{
  position:absolute;left:50%;top:5px;transform:translateX(-50%);
  font:700 9px/1 ui-sans-serif,system-ui,sans-serif;color:#fff;
  text-shadow:0 1px 2px #0008;pointer-events:none;white-space:nowrap;
}
/* X exactement sur la pointe (= ancre MapLibre bottom) */
.topo-drag-pin .tip-x{
  position:absolute;left:50%;bottom:0;transform:translate(-50%,50%);
  width:14px;height:14px;display:block;pointer-events:none;
  filter:drop-shadow(0 0 1px #fff);
}


/* X precis seul — sans dawara */
.topo-precision-cross{
  width:18px;height:18px;position:relative;pointer-events:none;
}
.topo-precision-cross svg{
  position:absolute;inset:0;width:18px;height:18px;display:block;
  filter:drop-shadow(0 0 1px #fff) drop-shadow(0 1px 2px #0006);
}


/* === topo-rtl-fix-v1 : AR ne casse plus +/- ni la barre outils === */
/* Outils toujours à gauche physique ; zoom/locate toujours à droite */
body.is-topo .topo-rail{
  left:8px!important;
  right:auto!important;
  inset-inline-start:auto!important;
  inset-inline-end:auto!important;
  direction:ltr; /* icônes non miroir */
}
body.is-topo .topo-tool-group,
body.is-topo .topo-tool,
body.is-topo .topo-tool svg{
  direction:ltr;
  transform:none!important;
}
body.is-topo .topo-layers{
  right:10px!important;
  left:auto!important;
  inset-inline-start:auto!important;
  inset-inline-end:auto!important;
  direction:ltr;
}
body.is-topo .maplibregl-ctrl-top-right{
  right:8px!important;
  left:auto!important;
  top:8px!important;
  direction:ltr!important;
}
body.is-topo .maplibregl-ctrl-top-left{
  left:8px!important;
  right:auto!important;
}
/* Empêche le flip RTL des + / − */
body.is-topo .maplibregl-ctrl-group,
body.is-topo .maplibregl-ctrl-group button,
body.is-topo .maplibregl-ctrl-icon{
  direction:ltr!important;
  unicode-bidi:isolate;
}
body.is-topo .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::before,
body.is-topo .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon::before,
body.is-topo .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon::after{
  left:50%!important;
  right:auto!important;
  transform:translate(-50%,-50%)!important;
}
/* Barre top : flèche select + padding OK en arabe */
html[dir="rtl"] body.is-topo .topo-zone{
  background-position:left 10px center;
  padding:9px 10px 9px 28px;
}
html[dir="rtl"] body.is-topo .topo-bar{
  flex-direction:row; /* garder ordre logique via dir=rtl du html */
}
html[dir="rtl"] body.is-topo .topo-save-row{
  grid-template-columns:1fr auto;
}
html[dir="rtl"] body.is-topo .topo-table th,
html[dir="rtl"] body.is-topo .topo-table td{
  text-align:right;
}
@media(min-width:921px){
  body.is-topo .topo-rail{left:12px!important;top:16px}
  /* Panel reste à droite en desktop même en AR (carte | panel) */
  html[dir="rtl"] body.is-topo .topo-stage{
    grid-template-columns:minmax(0,1fr) 320px;
    direction:ltr; /* carte à gauche, panel à droite comme FR */
  }
  html[dir="rtl"] body.is-topo .topo-panel{
    direction:rtl;
    border-inline-start:0;
    border-left:1px solid #dde5ef;
  }
}

.topo-plan.is-selected{
  border-color:#1a73e8!important;background:#eef5ff!important;
  box-shadow:inset 3px 0 0 #1a73e8;
}

/* === point-choice + pdf export v34 === */
.topo-choice-lede{margin:0 0 14px;font-size:13px;color:#5b6d63;line-height:1.4}
.topo-choice-actions{display:flex;flex-direction:column;gap:8px}
.topo-sheet-choice{max-width:360px}
.topo-export-row .topo-btn[data-export="pdf"]{
  background:#152536;color:#fff;border-color:#152536;font-weight:700
}
.topo-export-row .topo-btn[data-export="pdf"]:hover{filter:brightness(1.08)}

/* === pdf mobile + capture v38 === */
.topo-pdf-btn{
  background:#152536!important;color:#fff!important;border-color:#152536!important;
  font-weight:800;letter-spacing:.02em;min-width:52px
}
@media(min-width:921px){
  .topo-pdf-btn{display:none!important}
}

/* === pdf progress v52 === */
.topo-pdf-progress{
  position:fixed;inset:0;z-index:120;
  display:flex;align-items:center;justify-content:center;
  background:rgba(12,18,28,.72);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
}
.topo-pdf-progress[hidden]{display:none!important}
.topo-pdf-progress-card{
  width:min(86vw,320px);
  background:#fff;border-radius:16px;padding:22px 20px 18px;
  box-shadow:0 16px 48px #0006;text-align:center;
}
.topo-pdf-spinner{
  width:36px;height:36px;margin:0 auto 12px;
  border:3px solid #dbe4ea;border-top-color:#152536;border-radius:50%;
  animation:topo-spin .8s linear infinite;
}
@keyframes topo-spin{to{transform:rotate(360deg)}}
.topo-pdf-progress-label{
  margin:0 0 12px;font-size:14px;font-weight:700;color:#152536;line-height:1.35
}
.topo-pdf-bar{
  height:8px;border-radius:99px;background:#e8eef3;overflow:hidden
}
.topo-pdf-bar i{
  display:block;height:100%;width:0%;border-radius:99px;
  background:linear-gradient(90deg,#1a73e8,#152536);
  transition:width .25s ease
}
.topo-pdf-progress-pct{
  margin:10px 0 0;font-size:12px;font-weight:700;color:#5b6d63
}

body.topo-pdf-busy{overflow:hidden!important;touch-action:none}
body.topo-pdf-busy .topo-app{pointer-events:none}
