/* Match the three existing 30px wayfinding tools, including their labels. */
#v40_wayfinding_tools > #v40_osm_open{position:relative;inset:auto;flex:0 0 30px;box-sizing:border-box;width:30px;min-width:0;height:30px;margin:0 13px;padding:6px;border:0;border-radius:4px;background:#171a1d;color:#fff;box-shadow:0 2px 5px #0004;cursor:pointer}
#v40_wayfinding_tools > #v40_osm_open svg{display:block;width:18px;height:18px}
#v40_wayfinding_tools > #v40_osm_open span{position:absolute;top:34px;left:50%;transform:translateX(-50%);width:max-content;color:#18212a;font:500 9px/11px Arial,Helvetica,sans-serif}
#v40_wayfinding_tools > #v40_osm_open:hover{background:#087fd1;transform:translateY(-1px)}
#v40_osm_panel{position:fixed;top:135px;left:8px;width:min(374px,calc(100vw - 16px));max-height:calc(100dvh - 151px);overflow:auto;background:#fff;color:#172033;border:1px solid #dce2e8;box-shadow:0 8px 30px #15263930;border-radius:12px;z-index:2147483647;font:13px/1.5 Arial,Helvetica,sans-serif;box-sizing:border-box;text-align:left}
#v40_osm_panel *,#v40_osm_panel *::before,#v40_osm_panel *::after{box-sizing:border-box}
#v40_osm_panel[hidden],#v40_osm_panel [hidden]{display:none!important}
#v40_osm_panel .v40-osm-header{display:flex;align-items:center;gap:10px;padding:16px;border-bottom:1px solid #e8edf2;background:#fafbfd}
#v40_osm_panel .v40-osm-heading-icon{flex:0 0 32px;width:32px;height:32px;padding:7px;border-radius:8px;background:#e8f0ff;color:#245bd6}
#v40_osm_panel svg{display:block;width:18px;height:18px}
#v40_osm_panel h2{margin:0;color:#172033;font:700 15px/1.3 Arial,Helvetica,sans-serif}
#v40_osm_panel .v40-osm-header p{margin:3px 0 0;color:#687482;font-size:11px}
#v40_osm_panel button{display:inline-flex;align-items:center;justify-content:center;min-height:36px;margin:0;padding:8px 10px;border:1px solid #d3dce5;border-radius:6px;background:#fff;color:#28384a;font:600 12px/1.35 Arial,Helvetica,sans-serif;cursor:pointer;white-space:normal}
#v40_osm_panel button:hover:not(:disabled){background:#f1f5f9;border-color:#aebdcd}
#v40_osm_panel button:disabled{background:#f3f5f8;color:#8a95a4;border-color:#e0e5ec;cursor:default}
#v40_osm_panel button.v40-osm-primary{background:#2563eb;border-color:#2563eb;color:#fff}
#v40_osm_panel button.v40-osm-primary:hover:not(:disabled){background:#1d4ed8;border-color:#1d4ed8}
#v40_osm_panel button.v40-osm-primary:disabled{background:#edf2fa;color:#8796ac;border-color:#dce4ef}
#v40_osm_panel button.v40-osm-danger{color:#b42318;background:#fff8f7;border-color:#f0d0cc}
#v40_osm_panel button.v40-osm-danger:hover:not(:disabled){background:#ffedea;border-color:#e3a9a2}
#v40_osm_panel #v40_osm_close{flex:0 0 28px;min-height:28px;width:28px;height:28px;margin-left:auto;padding:0;border:0;background:transparent;color:#687482;font-size:23px;font-weight:400}
#v40_osm_panel button:focus-visible,#v40_osm_panel select:focus-visible,#v40_osm_panel summary:focus-visible,#v40_osm_open:focus-visible{outline:2px solid #2563eb;outline-offset:3px}
#v40_osm_panel .v40-osm-body{padding:14px 16px 16px}
#v40_osm_stage{display:inline-block;margin:0 0 12px;padding:3px 8px;border-radius:5px;background:#edf3ff;color:#29549c;font-size:11px;font-weight:600}
#v40_osm_steps{display:flex;gap:12px;margin:0 0 18px;padding:0;list-style:none;color:#84909e;font-size:11px}
#v40_osm_steps li{display:flex;align-items:center;gap:5px;margin:0;padding:0}
#v40_osm_steps li span{display:inline-flex;align-items:center;justify-content:center;width:19px;height:19px;border:1px solid #dce3eb;border-radius:50%;font-size:10px}
#v40_osm_steps[data-step="1"] li:first-child,#v40_osm_steps[data-step="2"] li:nth-child(2){color:#245bd6;font-weight:700}
#v40_osm_steps[data-step="1"] li:first-child span,#v40_osm_steps[data-step="2"] li:nth-child(2) span{background:#2563eb;color:#fff;border-color:#2563eb}
#v40_osm_panel label{display:block;margin:0 0 5px;color:#344256;font-size:12px;font-weight:600}
#v40_osm_panel select{display:block;width:100%;height:36px;margin:0;padding:6px 9px;border:1px solid #ccd6e0;border-radius:6px;background:#fff;color:#172033;font:13px Arial,Helvetica,sans-serif}
#v40_osm_panel #v40_osm_context_status{margin:6px 0 12px;color:#687482;font-size:11px;line-height:1.4}
#v40_osm_panel .v40-osm-area-actions{display:grid;grid-template-columns:1.3fr 1fr;gap:8px}
#v40_osm_panel .v40-osm-help{margin:10px 0 0;color:#687482;font-size:11px}
#v40_osm_panel summary{cursor:pointer}
#v40_osm_panel details p{margin:7px 0 0}
#v40_osm_status{margin:14px 0;white-space:pre-line;overflow-wrap:anywhere;background:#f3f6fa;border-left:3px solid #92ade1;border-radius:0 6px 6px 0;padding:11px 12px;color:#344256;font-size:12px;line-height:1.55}
#v40_osm_status:empty{display:none}
#v40_osm_bundle_actions{display:grid;grid-template-columns:1fr;gap:8px;margin-bottom:14px}
#v40_osm_panel .v40-osm-footer-actions{display:flex;justify-content:flex-end;gap:8px;padding-top:12px;border-top:1px solid #e8edf2}
#v40_osm_panel .v40-osm-credit{display:flex;flex-wrap:wrap;justify-content:space-between;gap:6px 12px;padding:11px 16px;border-top:1px solid #e8edf2;background:#fafbfd;color:#738093;font-size:10px;line-height:1.5}
#v40_osm_panel .v40-osm-credit details{max-width:100%}
#v40_osm_panel a{color:#536d92;text-decoration:underline;text-underline-offset:2px}
.v40-osm-pick-surface{position:absolute;inset:0;z-index:1100;cursor:crosshair;touch-action:none}
@media(max-height:550px){#v40_osm_panel{top:80px;max-height:calc(100dvh - 88px)}}

#v40_osm_panel #v40_osm_load{gap:7px}
#v40_osm_panel .v40-osm-spinner{flex:0 0 14px;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:v40-osm-spin .75s linear infinite}
#v40_osm_panel #v40_osm_load[aria-busy="true"]{background:#edf3ff;border-color:#c6d6f5;color:#245bd6}
#v40_osm_loading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0 0;color:#687482;font-size:11px}
#v40_osm_elapsed{color:#245bd6;font:600 13px/1.4 Arial,Helvetica,sans-serif;font-variant-numeric:tabular-nums}
@keyframes v40-osm-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#v40_osm_panel .v40-osm-spinner{animation:none}}

.v40-osm-move-handle { display:flex; align-items:center; justify-content:center; background:#fff; color:#2563eb; border:2px solid #2563eb; border-radius:8px; box-shadow:0 2px 8px #0003; font-size:30px; cursor:move; touch-action:none; }

/* Match the existing visibility rows, including their fixed eye and label size. */
.v40-osm-template-row{clear:both;margin:0 0 12px;padding:0;}
.v40-osm-template-toggle{display:flex;align-items:center;gap:5px;width:100%;box-sizing:border-box;min-height:24px;margin:0;padding:0;border:0;background:transparent;color:#000;text-align:left;cursor:pointer;font:10px/1.3 Arial,Helvetica,sans-serif;}
.v40-osm-template-toggle .v40-osm-template-eye{display:block;flex:0 0 20px;width:20px;height:20px;border-radius:4px;background:#ff0000;}
.v40-osm-template-toggle[aria-pressed="true"] .v40-osm-template-eye{background:#07d332;}
.v40-osm-template-toggle > span:not(.v40-osm-template-sample){white-space:nowrap;}
.v40-osm-template-sample{flex:1 1 10px;min-width:8px;max-width:18px;height:1px;background:#2563eb;margin-left:auto;}
.v40-osm-template-toggle:focus-visible{outline:2px solid #00a6eb;outline-offset:2px;}
.v40-osm-template-status{display:block;margin:4px 0 0;padding:0;color:#64748b;font:10px/1.4 Arial,Helvetica,sans-serif;}
.v40-osm-template-status:empty{display:none;}


/* Modeless reference-layer chooser. Closing it leaves selected layers visible. */
#v40_osm_layers_open{display:flex;align-items:center;gap:7px;clear:both;width:100%;min-height:30px;box-sizing:border-box;margin:0 0 14px;padding:6px 7px;border:1px solid #d9dfe6;border-radius:6px;background:#fff;color:#172033;text-align:left;font:600 10px/1.3 Arial,Helvetica,sans-serif;cursor:pointer;}
#v40_osm_layers_open:hover,#v40_osm_layers_open[aria-expanded="true"]{background:#edf3ff;border-color:#b7c9ef;}
#v40_osm_layers_open svg{flex:0 0 17px;width:17px;height:17px;}
#v40_osm_layers_count{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;margin-left:auto;padding:0 4px;border-radius:9px;background:#e8eef8;color:#245bd6;font-size:10px;}
#v40_osm_layers_panel{position:fixed;top:120px;right:220px;display:flex;flex-direction:column;width:min(330px,calc(100vw - 16px));max-height:calc(100dvh - 16px);box-sizing:border-box;overflow:hidden;border:1px solid #dce2e8;border-radius:12px;background:#fff;color:#172033;box-shadow:0 8px 30px #15263930;z-index:2147483646;text-align:left;font:13px/1.4 Arial,Helvetica,sans-serif;}
#v40_osm_layers_panel[hidden]{display:none!important;}
#v40_osm_layers_panel *,#v40_osm_layers_panel *::before,#v40_osm_layers_panel *::after{box-sizing:border-box;}
#v40_osm_layers_header{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:12px;padding:16px;border-bottom:1px solid #e8edf2;cursor:move;touch-action:none;user-select:none;}
#v40_osm_layers_panel h2{margin:0;padding:0;color:#172033;font:700 18px/1.25 Arial,Helvetica,sans-serif;}
#v40_osm_layers_header p{margin:4px 0 0;color:#64748b;font:11px/1.4 Arial,Helvetica,sans-serif;}
#v40_osm_layers_panel #v40_osm_layers_close{display:flex;align-items:center;justify-content:center;flex:0 0 28px;width:28px;height:28px;min-height:0;margin:0;padding:0;border:0;border-radius:5px;background:#111;color:#fff;font:700 24px/1 Arial,Helvetica,sans-serif;cursor:pointer;}
#v40_osm_layers_panel .v40-osm-layers-body{overflow-y:auto;min-height:0;padding:14px 16px 4px;}
#v40_osm_layers_panel .v40-osm-layers-intro{margin:0 0 16px;color:#64748b;font-size:11px;line-height:1.5;}
#v40_osm_layers_panel .v40-osm-template-row{margin:0 0 14px;padding:0 0 14px;border-bottom:1px solid #e8edf2;}
#v40_osm_layers_panel .v40-osm-template-row:last-child{margin-bottom:0;border-bottom:0;}
#v40_osm_layers_panel .v40-osm-template-toggle{min-height:30px;gap:10px;font:600 13px/1.4 Arial,Helvetica,sans-serif;color:#172033;}
#v40_osm_layers_panel .v40-osm-template-eye{flex:0 0 26px;width:26px;height:26px;}
#v40_osm_layers_panel .v40-osm-template-sample{max-width:28px;}
#v40_osm_layers_panel .v40-osm-layer-hint{margin:5px 0 0 36px;color:#64748b;font:11px/1.45 Arial,Helvetica,sans-serif;}
#v40_osm_layers_panel .v40-osm-template-status{margin-left:36px;color:#324d72;}
#v40_osm_layers_panel .v40-osm-layers-footer{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:12px 16px;border-top:1px solid #e8edf2;background:#fafbfd;}
#v40_osm_layers_panel #v40_osm_layers_clear{margin:0;padding:6px 9px;border:1px solid #d3dce5;border-radius:5px;background:#fff;color:#28384a;font:600 11px/1.4 Arial,Helvetica,sans-serif;cursor:pointer;}
#v40_osm_layers_panel #v40_osm_layers_clear:disabled{color:#8796ac;cursor:default;}
#v40_osm_layers_panel a{color:#536d92;font-size:10px;text-decoration:underline;text-underline-offset:2px;}
#v40_osm_layers_panel button:focus-visible,#v40_osm_layers_panel a:focus-visible,#v40_osm_layers_open:focus-visible{outline:2px solid #2563eb;outline-offset:2px;}

#v40_osm_layers_panel .v40-osm-data-group{margin:4px 0 12px;padding:0;color:#64748b;font:700 11px/1.4 Arial,Helvetica,sans-serif;text-transform:uppercase;letter-spacing:.04em;}
#v40_osm_layers_panel .v40-osm-point-row .v40-osm-template-sample{flex:0 0 8px;width:8px;height:8px;border-radius:50%;margin-right:10px;}
#v40_osm_layers_open>span:not(#v40_osm_layers_count){white-space:nowrap;}

#v40_osm_data_dates{flex:0 0 100%;color:#475569;font:11px/1.5 Arial,Helvetica,sans-serif;}
#v40_osm_data_dates small{display:block;color:#64748b;font-size:10px;margin-bottom:3px;}
#v40_osm_data_refresh{margin:0;padding:6px 9px;border:1px solid #b7c9ef;border-radius:5px;background:#edf3ff;color:#245bd6;font:600 11px/1.4 Arial,Helvetica,sans-serif;cursor:pointer;}
#v40_osm_data_refresh:disabled{background:#f1f5f9;border-color:#d3dce5;color:#8796ac;cursor:default;}

#v40_osm_layers_panel .v40-osm-area-controls{margin:0 0 16px;padding:12px;background:#f3f6fa;border-radius:7px;}
#v40_osm_area_draw{padding:8px 12px;border:0;border-radius:5px;background:#2563eb;color:#fff;font:600 12px Arial,Helvetica,sans-serif;cursor:pointer;}
#v40_osm_area_status{margin:8px 0 0;font:11px/1.5 Arial,Helvetica,sans-serif;color:#475569;}
#v40_osm_layers_panel .v40-osm-template-toggle:disabled{opacity:.4;cursor:default;}
#v40_osm_layers_panel.v40-osm-area-drawing #v40_osm_layers_rows,#v40_osm_layers_panel.v40-osm-area-drawing .v40-osm-layers-intro,#v40_osm_layers_panel.v40-osm-area-drawing .v40-osm-layers-footer{display:none;}

/* Keep the reference-area SVG centered independently of Leaflet's SVG rules. */
.leaflet-marker-icon.v40-osm-move-handle.v40-osm-reference-handle{box-sizing:border-box;display:grid;place-items:center;padding:0;background:#111;color:#fff;border:1px solid #111;border-radius:7px;box-shadow:0 2px 6px #0003;font-size:0;line-height:0;cursor:move;}
.leaflet-marker-icon.v40-osm-reference-handle > svg{position:absolute;left:50%;top:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);display:block;width:19px;height:19px;max-width:none;margin:0;padding:0;pointer-events:none;color:inherit;}
.leaflet-marker-icon.v40-osm-reference-handle:hover{color:#fff;background:#262626;border-color:#262626;}
.leaflet-marker-icon.v40-osm-reference-handle:focus-visible{outline:2px solid #2563eb;outline-offset:3px;}
.leaflet-marker-icon.v40-osm-reference-handle.leaflet-drag-target{color:#fff;background:#111;border-color:#111;box-shadow:0 3px 9px #0004;}

#v40_osm_preferences_status{display:block;margin:0 0 12px;color:#64748b;font:10px/1.4 Arial,Helvetica,sans-serif;}
#v40_osm_preferences_status:empty{display:none;}
#v40_osm_area_draw:disabled{opacity:.5;cursor:default;}

/* Translated labels can wrap without pushing the eye or the sample out of view. */
#v40_osm_layers_panel .v40-osm-template-label { min-width:0; flex:1 1 auto; white-space:normal; overflow-wrap:anywhere; }
#v40_osm_layers_panel .v40-osm-template-sample { flex-shrink:0; }
#v40_osm_layers_header > div, #v40_osm_panel .v40-osm-header > div { min-width:0; }
#v40_osm_layers_panel button, #v40_osm_panel button { max-width:100%; height:auto; white-space:normal; overflow-wrap:anywhere; }
#v40_osm_layers_panel p, #v40_osm_layers_panel small, #v40_osm_panel p { overflow-wrap:anywhere; }
#v40_osm_layers_open > span:not(#v40_osm_layers_count) { min-width:0; white-space:normal; overflow-wrap:anywhere; }
#v40_osm_layers_count { flex-shrink:0; }
