/* Layer Explorer */
.exp-wrap { position: relative; display: flex; gap: 12px; height: calc(100vh - 120px); min-height: 520px; }
.exp-side { width: 340px; flex: 0 0 340px; overflow-y: auto; background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 10px; }
.exp-main { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
#exp_map { flex: 1 1 auto; min-height: 360px; border: 1px solid #ddd; border-radius: 4px; position: relative; }
.exp-table { flex: 0 0 auto; max-height: 38vh; overflow: auto; margin-top: 8px; }
.exp-ws { margin-bottom: 6px; } .exp-ws > summary { cursor: pointer; font-weight: 600; color: #52514e; }
.exp-cat-row { display: flex; align-items: center; justify-content: space-between; padding: 3px 0 3px 12px; border-bottom: 1px solid #f2f2f2; font-size: 12px; }
.exp-cat-row .btn { padding: 1px 8px; font-size: 11px; }
.exp-layer { border: 1px solid #e5e5e5; border-radius: 4px; padding: 6px; margin-bottom: 6px; font-size: 12px; background: #fff; }
.exp-layer-head { display: flex; align-items: center; gap: 6px; }
.exp-layer-head .exp-title { flex: 1 1 auto; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-drag { cursor: grab; color: #999; }
.exp-layer-tools { display: flex; flex-wrap: wrap; gap: 0 8px; }
.exp-layer-tools a { margin-right: 0; color: #2a78d6; cursor: pointer; font-size: 12px; }
.exp-layer input[type=range] { width: 100%; }
.exp-warn { color: #c0392b; } .exp-filtered { color: #2a78d6; }
.exp-legend img { max-width: 100%; margin-top: 4px; }
.exp-popup { background: #fff; border: 1px solid #bbb; border-radius: 4px; padding: 8px 10px; max-width: 360px; max-height: 300px; overflow: auto; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.exp-popup table th { padding-right: 8px; color: #52514e; vertical-align: top; } .exp-popup-layer { font-weight: 600; margin-top: 4px; color: #1f5fae; }
.exp-popup-close { float: right; text-decoration: none; color: #888; font-size: 16px; }
.exp-mouse { position: absolute; bottom: 28px; right: 8px; background: rgba(255,255,255,.8); padding: 1px 6px; font-size: 11px; border-radius: 3px; }
.exp-right { box-sizing: border-box; width: var(--exp-right-w, 300px); flex: 0 0 var(--exp-right-w, 300px); max-width: 50%; overflow-y: auto; background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 10px; }
.exp-right-headrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.exp-right-head { margin: 0; font-size: 15px; font-weight: 700; color: #52514e; }
.exp-wrap.exp-right-hidden .exp-right { display: none; }
.exp-right-hide { border: 1px solid #ccc; background: #fff; color: #52514e; font-size: 12px; line-height: 1; padding: 5px 9px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.exp-right-hide:hover { background: #eef4fc; }
.exp-right-show { display: none; position: absolute; top: 56px; right: 0; z-index: 900; flex-direction: column; align-items: center; gap: 8px; padding: 10px 5px; border: 1px solid #ccc; border-right: 0; border-radius: 6px 0 0 6px; background: #fff; color: #52514e; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: -1px 1px 4px rgba(0,0,0,.15); }
.exp-right-show:hover { background: #eef4fc; }
.exp-right-show-label { writing-mode: vertical-rl; letter-spacing: .04em; }
.exp-wrap.exp-right-hidden .exp-right-show { display: inline-flex; }
.exp-right-hide:focus-visible, .exp-right-show:focus-visible { outline: 2px solid #2a78d6; outline-offset: 2px; }
/* drag handle between the map and the panel: sits inside the flex gap so layout is unchanged */
.exp-right-resize { position: relative; z-index: 5; flex: 0 0 8px; width: 8px; margin: 0 -10px; cursor: col-resize; touch-action: none; border-radius: 4px; }
.exp-right-resize::after { content: ""; position: absolute; top: 50%; left: 50%; width: 3px; height: 40px; margin: -20px 0 0 -1.5px; border-radius: 2px; background: #b8bdc6; opacity: 0; transition: opacity .12s; }
.exp-right-resize:hover::after, .exp-right-resize:focus-visible::after, .exp-right-resize.exp-dragging::after { opacity: 1; }
.exp-right-resize.exp-dragging::after { background: #2a78d6; }
.exp-right-resize:focus-visible { outline: 2px solid #2a78d6; outline-offset: -1px; }
.exp-wrap.exp-right-hidden .exp-right-resize { display: none; }
body.exp-resizing { cursor: col-resize; user-select: none; }
.exp-tree-hint { font-size: 12px; color: #52514e; margin: 0 0 6px; }
.exp-folder.exp-selected { outline: 2px solid #2a78d6; background: #eef4fc; }
/* side panel narrows on laptop-class screens */
@media (max-width: 1399px) { .exp-side { width: 300px; flex-basis: 300px; } }
/* overlay mode (set by JS when the map would be under 500 px beside the panel): panel floats over the right of the map */
.exp-wrap.exp-overlay .exp-right { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 90%); flex: none; max-width: none; z-index: 900; border-radius: 4px 0 0 4px; box-shadow: -2px 0 10px rgba(0,0,0,.25); }
.exp-wrap.exp-overlay .exp-right-resize { display: none; }
@media (max-width: 900px) {
  .exp-wrap { flex-direction: column; height: auto; } .exp-side { width: auto; flex: none; } #exp_map { height: 60vh; }
  .exp-right { position: fixed; top: 60px; right: 0; bottom: 0; width: min(320px, 90vw); flex: none; z-index: 1040; border-radius: 4px 0 0 4px; box-shadow: -2px 0 10px rgba(0,0,0,.25); }
  .exp-right-resize { display: none; } .exp-right { max-width: none; }
  .exp-right-show { position: fixed; top: 80px; z-index: 1050; }
}

/* layers tree */
.exp-tree-tools { margin: 4px 0 8px; font-size: 12px; } .exp-tree-tools a { margin-right: 12px; cursor: pointer; color: #2a78d6; }
.exp-tree-list { min-height: 4px; }
.exp-tree-list .exp-tree-list { margin-left: 14px; border-left: 1px dashed #d6d6d6; padding-left: 6px; }
.exp-collapsed-drop { min-height: 6px; }
.exp-node { border: 1px solid #e5e5e5; border-radius: 4px; padding: 4px 6px; margin-bottom: 4px; background: #fff; font-size: 12px; }
.exp-folder { background: #f7f9fc; }
.exp-folder-head, .exp-layer-head { display: flex; align-items: center; gap: 6px; }
.exp-folder-name { font-weight: 600; color: #52514e; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.exp-caret { cursor: pointer; color: #52514e; width: 10px; } .exp-count { color: #888; }
.exp-folder-tools a.exp-folder-text { font-size: 11px; }
.exp-folder-tools a { margin-left: 6px; cursor: pointer; color: #2a78d6; text-decoration: none; }
.exp-rename { flex: 1 1 auto; font-size: 12px; padding: 1px 4px; }
.exp-node input[type=range] { width: 100%; }
.exp-unavailable { opacity: .55; } .exp-na { color: #888; font-style: italic; }
.exp-icons span { margin-left: 4px; }
.exp-maps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; }
.exp-maps .btn { padding: 1px 8px; font-size: 11px; } .exp-dirty { color: #eb6834; font-weight: 700; }

.exp-vault { margin-right: 4px; font-size: 11px; }
.exp-swatch { display: block; margin-top: 4px; }

/* upload and vault tabs */
.exp-up-btns { display: flex; gap: 6px; margin-bottom: 8px; }
.exp-up-sum { font-size: 12px; border: 1px solid #e5e5e5; border-radius: 4px; padding: 6px 8px; background: #fbfbfb; }
.exp-up-kind { margin-top: 4px; } .exp-up-warn { color: #a05a00; margin-top: 4px; }
.exp-vhead { font-weight: 700; color: #52514e; margin: 10px 0 6px; }
.exp-vcard { border: 1px solid #e5e5e5; border-radius: 4px; padding: 6px 8px; margin-bottom: 6px; font-size: 12px; background: #fff; }
.exp-vtitle { font-weight: 600; overflow-wrap: anywhere; } .exp-vdesc { color: #52514e; margin-top: 2px; overflow-wrap: anywhere; }
.exp-vchips .exp-role, .exp-vcard .exp-role { display: inline-block; background: #eef4fc; color: #1f5fae; border-radius: 10px; padding: 1px 8px; margin: 2px 2px 0 0; font-size: 11px; }
.exp-private { display: inline-block; background: #f2f2f2; color: #666; border-radius: 10px; padding: 1px 8px; margin-top: 2px; font-size: 11px; }
.exp-vbtns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } .exp-vbtns .btn { padding: 1px 8px; font-size: 11px; }
.exp-dxf-table { max-height: 180px; overflow-y: auto; border: 1px solid #e5e5e5; border-radius: 4px; padding: 2px 8px; margin-bottom: 8px; }
.exp-dxf-table .checkbox { margin: 3px 0; }
.exp-dxf-hint { font-size: 12px; color: #555; margin: -4px 0 8px; }
.exp-dxf-all { font-size: 12px; margin-bottom: 2px; }
.exp-vgroup { border: 1px solid #cfd8e3; border-radius: 4px; margin-bottom: 8px; background: #f7f9fc; }
.exp-vgroup-head { cursor: pointer; position: relative; padding: 6px 8px 6px 20px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.exp-vgroup-head .exp-vgroup-name { font-weight: 600; font-size: 13px; }
.exp-vgroup-head .exp-vbtns { margin-top: 0; }
.exp-vgroup-body { padding: 0 6px 2px 14px; }
.exp-vgroup-head::before { content: "\25B8"; position: absolute; left: 6px; top: 6px; color: #52514e; font-size: 12px; transition: transform .15s; }
.exp-vgroup[open] > .exp-vgroup-head::before { transform: rotate(90deg); }
/* vault folders: nested <details>, indented; the chosen folder (new uploads go there) highlighted */
.exp-vtop { margin-bottom: 4px; } .exp-vtop .btn { padding: 1px 8px; font-size: 11px; }
.exp-vsel { font-size: 12px; margin-bottom: 6px; overflow-wrap: anywhere; }
.exp-vfolder { border: 1px solid #d9d4c7; border-radius: 4px; margin-bottom: 6px; background: #fcfbf7; }
.exp-vfolder-head { cursor: pointer; position: relative; padding: 5px 8px 5px 20px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; list-style: none; }
.exp-vfolder-head::-webkit-details-marker { display: none; }
.exp-vfolder-head::before { content: "\25B8"; position: absolute; left: 6px; top: 5px; color: #52514e; font-size: 12px; transition: transform .15s; }
.exp-vfolder[open] > .exp-vfolder-head::before { transform: rotate(90deg); }
.exp-vfolder-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; } .exp-vfolder-name .fa { color: #b08a2e; }
.exp-vfolder-pick { cursor: pointer; } .exp-vfolder-pick:hover, .exp-vfolder-pick:focus { text-decoration: underline; }
.exp-vfolder-head .exp-vbtns { margin-top: 0; }
.exp-vfolder-body { padding: 0 6px 2px 12px; }
.exp-vfolder-sel { border-color: #1f5fae; box-shadow: inset 3px 0 0 #1f5fae; }
.exp-vfolder-sel > .exp-vfolder-head { background: #eef4fc; }
.exp-vempty { font-size: 12px; margin: 2px 0 6px; }
.exp-vowner { font-weight: 600; font-size: 12px; color: #52514e; margin: 6px 0 4px; overflow-wrap: anywhere; }
.exp-vchips .exp-role.exp-role-inh, .exp-vcard .exp-role.exp-role-inh { background: transparent; border: 1px solid #1f5fae; padding: 0 7px; }
/* vault drag and drop (vault_drag.js, pointer events): handle, the dragged block dimmed, a ghost label at the pointer, a line before / after the
   row it would go beside, the folder it would go into highlighted, "Top level" strip while dragging */
.exp-vdrag { cursor: grab; color: #8a877f; font-size: 13px; line-height: 1; padding: 2px 4px; margin-right: 2px; user-select: none; -webkit-user-select: none;
  touch-action: none; }
.exp-vdrag:hover { color: #1f5fae; } .exp-vdrag:active { cursor: grabbing; }
.exp-vdragged { opacity: .5; }
.exp-vgrabbing, .exp-vgrabbing * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.exp-vghost { position: fixed; z-index: 10000; pointer-events: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 8px; font-size: 12px; color: #fff; background: rgba(31, 95, 174, .92); border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.exp-vtarget.exp-vins-before { box-shadow: inset 0 3px 0 #1f5fae; }
.exp-vtarget.exp-vins-after { box-shadow: inset 0 -3px 0 #1f5fae; }
.exp-vtarget.exp-vdrop-over, .exp-vdrop.exp-vdrop-over { background: #dbe8f8; outline: 2px dashed #1f5fae; outline-offset: -2px; }
.exp-vdrop-top { display: none; position: sticky; top: 0; z-index: 2; box-sizing: border-box; height: 30px; margin-bottom: -30px; padding: 6px 8px;      /* overlays: the list does not shift */
  font-size: 12px; font-weight: 600; text-align: center; color: #1f5fae; background: #f4f8fd; border: 1px dashed #8fb0d9; border-radius: 4px; }
.exp-vdragging .exp-vdrop-top { display: block; }
.exp-vundo { margin-left: 8px; padding: 0 8px; }

/* Colour picker (colour_picker.js) */
.exp-colour { position: relative; }
.lex-cp-row { display: flex; align-items: center; gap: 6px; }
.lex-cp-row input { flex: 1 1 auto; min-width: 0; }
.lex-cp-swatch { flex: 0 0 34px; height: 34px; border: 2px solid #8a8f98; border-radius: 4px; padding: 0; cursor: pointer; }
.lex-cp-swatch:focus-visible, .lex-cp-chip:focus-visible, .lex-cp-slider:focus-visible, .lex-cp-darker:focus-visible { outline: 2px solid #2a78d6; outline-offset: 2px; }
.lex-cp-pop { margin: 0 0 12px; padding: 10px; border: 1px solid #ccd0d6; border-radius: 6px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.lex-cp-pop[hidden] { display: none; }
.lex-cp-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.lex-cp-wheelbox { position: relative; width: 160px; height: 160px; flex: 0 0 160px; touch-action: none; cursor: crosshair; }
.lex-cp-wheel { display: block; width: 160px; height: 160px; border-radius: 50%; }
.lex-cp-marker { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #000; pointer-events: none; }
.lex-cp-sl { flex: 0 0 auto; }
.lex-cp-slider { -webkit-appearance: none; appearance: none; width: 100px; height: 14px; border-radius: 7px; border: 1px solid #8a8f98; }
.lex-cp-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #444; cursor: pointer; }
.lex-cp-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #444; cursor: pointer; }
.lex-cp-preview { flex: 1 1 auto; height: 60px; border: 1px solid #8a8f98; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-family: monospace; font-size: 13px; }
.lex-cp-sw-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.lex-cp-label { flex: 0 0 62px; font-size: 12px; color: #555; }
.lex-cp-sw-box { display: flex; flex-wrap: wrap; gap: 5px; }
.lex-cp-chip { width: 24px; height: 24px; border: 1px solid #555; border-radius: 4px; padding: 0; cursor: pointer; }
.lex-cp-darker { padding: 6px 0 0; font-size: 12px; }

/* basemap pills (bottom-left of the map), attribution (bottom-right), scale line above the pills */
#exp_map .ol-attribution { right: 0; bottom: 0; left: auto; max-width: 65%; background: rgba(255,255,255,.7); border-radius: 4px 0 0 0; }
#exp_map .ol-attribution ul { margin: 0; padding: 1px 6px; font-size: 10px; color: #666; text-shadow: none; }
#exp_map .ol-attribution a { color: #52514e; }
#exp_map .ol-attribution button { display: none; }
#exp_map .ol-scale-line { left: 8px; bottom: 38px; }
.exp-pills { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 2px; padding: 2px; background: rgba(255,255,255,.65); border-radius: 12px; }
.exp-pill { border: 0; background: transparent; color: #666; font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 10px; cursor: pointer; }
.exp-pill:hover { color: #222; background: rgba(255,255,255,.8); }
.exp-pill:focus-visible { outline: 2px solid #2a78d6; outline-offset: 1px; }
.exp-pill-on { background: #fff; color: #111; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.exp-layer-tools a.exp-tool-on { background: #fff4c2; color: #6b5400; border-radius: 3px; padding: 0 4px; font-weight: 600; }
@media (max-width: 600px) { .exp-mouse { display: none; } #exp_map .ol-attribution { bottom: 30px; max-width: calc(100% - 8px); } #exp_map .ol-attribution ul { font-size: 9px; } .exp-pill { font-size: 10px; padding: 4px 5px; } .exp-pills { left: 4px; bottom: 4px; } #exp_map .ol-scale-line { display: none; } }

/* layer editor (layer_editor.js): floating toolbar top-centre of the map, measure label, feature form in the right panel */
.lexe-bar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: calc(100% - 110px); box-sizing: border-box;
  background: rgba(255,255,255,.96); border: 1px solid #c9ced6; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 5px 8px; font-size: 12px; }
.lexe-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-width: 0; }
.lexe-badge { flex: 0 0 auto; background: #eb6834; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.lexe-title { flex: 1 1 auto; min-width: 0; font-weight: 700; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lexe-count { flex: 0 0 auto; color: #666; } .lexe-count.lexe-dirty { color: #b3471c; font-weight: 600; }
.lexe-part { color: #8a5a00; margin-bottom: 4px; }
.lexe-tools { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lexe-group { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.lexe-btn { border: 1px solid #c3c8d0; background: #fff; color: #333; font-size: 12px; line-height: 1.2; padding: 4px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.lexe-btn:hover:not(:disabled) { background: #eef4fc; }
.lexe-btn:focus-visible { outline: 2px solid #2a78d6; outline-offset: 1px; }
.lexe-btn:disabled { opacity: .45; cursor: default; }
.lexe-btn.lexe-on { background: #fff4c2; border-color: #c9a400; color: #4d3d00; font-weight: 600; }
.lexe-btn.lexe-save:not(:disabled) { background: #1f5fae; border-color: #1f5fae; color: #fff; }
.lexe-btn.lexe-save:hover:not(:disabled) { background: #194e8f; }
.lexe-small { padding: 2px 8px; font-size: 11px; }
.lexe-msg { margin-top: 4px; color: #1f5fae; overflow-wrap: anywhere; } .lexe-msg.lexe-err { color: #c0392b; font-weight: 600; }
.lexe-measure { background: rgba(0,0,0,.72); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; pointer-events: none; }
.lexe-form { border: 1px solid #f0c9b5; background: #fffaf6; border-radius: 4px; padding: 6px 8px; margin-bottom: 10px; font-size: 12px; }
.lexe-form-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lexe-form-title { margin: 0; font-size: 13px; font-weight: 700; color: #52514e; }
.lexe-form-hint { margin: 4px 0; color: #52514e; }
.lexe-field { margin-bottom: 6px; } .lexe-field label, .lexe-addfield label { display: block; margin: 0 0 2px; font-weight: 600; overflow-wrap: anywhere; }
.lexe-ftype { font-weight: 400; color: #888; font-size: 11px; }
.lexe-invalid { border-color: #c0392b !important; background: #fdf0ee; }
.lexe-ferr { color: #c0392b; font-size: 11px; margin-top: 2px; }
.lexe-addfield { border-top: 1px dashed #e0c2b2; border-bottom: 1px dashed #e0c2b2; margin: 6px 0; padding: 6px 0; }
.lexe-addfield .form-control { margin-bottom: 4px; }
.lexe-addfield-btns { display: flex; gap: 4px; }
@media (max-width: 600px) { .lexe-bar { max-width: calc(100% - 16px); top: 44px; } .lexe-btn { padding: 4px 6px; } }
.exp-layer-tools a.exp-tool-off, .exp-layer-tools a.exp-tool-off:hover { color: #9a9a9a; cursor: default; text-decoration: none; background: none; }
.lexe-form-note { margin: 4px 0; padding: 3px 6px; background: #fff4c2; border-radius: 3px; color: #4d3d00; font-size: 11px; }
