:root{--bg:#090909;--panel:#100f10;--line:#363638;--red:#b60000;--red2:#8b0505;--text:#e8e8e8;--muted:#a8a8a8}
*{box-sizing:border-box}html,body{height:100%;margin:0;background:var(--bg);color:var(--text);font:13px/1.4 system-ui,-apple-system,"Segoe UI",Arial,sans-serif}button,input,select,textarea{font:inherit}button{cursor:pointer;color:var(--text);background:#1c1c1e;border:1px solid #3d3d40;border-radius:8px;padding:8px 10px;font-weight:600}button:hover,a.head-btn:hover{border-color:#ce2525;background:#300e0e}button:disabled{opacity:.4;cursor:not-allowed}.accent,.selected{background:var(--red2)!important;border-color:#e51b1b!important;color:white!important}.danger{color:#ff8383!important}a{color:#e6e6e6;text-decoration:none}input,select,textarea{background:#0b0b0b;color:#f0f0f0;border:1px solid #454549;border-radius:8px;outline:none;min-width:0;padding:8px}input:focus,select:focus,textarea:focus{border-color:#e32b2b}input[type=checkbox]{accent-color:#b60000;min-width:auto}textarea{resize:vertical;width:100%;font:12px/1.5 Consolas,monospace}
.topbar{height:78px;background:#080808;position:absolute;top:0;left:0;right:0;z-index:800;display:flex;align-items:center;gap:15px;padding:0 26px;border-top:3px solid #ba0909;border-bottom:1px solid #393939}.brand{display:flex;align-items:center;gap:16px;min-width:0}.brand img{width:275px;max-width:26vw;height:auto;display:block}.tool-name{font-weight:750;color:#eaeaea;white-space:nowrap;font-size:14px;border-left:1px solid #464646;padding-left:16px}.header-actions{margin-left:auto;display:flex;align-items:center;gap:8px}.map-picker{display:flex;align-items:center;gap:7px}.map-picker label{font-weight:700}.map-picker select{width:115px}.help-wrap{position:relative;display:inline-flex}.help-btn{border-color:#c00000;color:#ff6969;padding:0;border-radius:50%;width:21px;height:21px;line-height:18px}.help-pop{display:none;position:absolute;right:-10px;top:29px;width:270px;max-width:80vw;background:#191516;border:1px solid #c52a2a;border-radius:9px;box-shadow:0 8px 25px #000b;padding:11px;color:#f5e9e9;line-height:1.4;font-size:12px;z-index:1600}.help-wrap:hover .help-pop,.help-wrap:focus-within .help-pop{display:block}.mode-switch{display:flex;gap:2px}.mode-switch button{white-space:nowrap}.head-btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid #9b0b0b;border-radius:9px;background:#150707;padding:10px 13px;font-weight:700;white-space:nowrap}.workspace{position:absolute;top:78px;bottom:0;left:0;right:0;overflow:hidden;background:#111}#map,#threeView{position:absolute;inset:0;background:#1a1a1b}#threeView canvas{width:100%;height:100%;display:block;background:radial-gradient(ellipse at center,#202124,#070707)}#threeView[hidden],#map[hidden]{display:none!important}.scene-guide{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);pointer-events:none;background:#090909ca;padding:7px 12px;border:1px solid #454545;border-radius:7px;font-size:11px;white-space:nowrap;color:#bbb}.left-tools{position:absolute;z-index:550;top:12px;left:12px;display:flex;flex-direction:column;gap:7px}.left-tools button{border:1px solid #c30707;background:#090909ed;padding:7px;display:flex;align-items:center;gap:6px;width:42px;min-height:42px;overflow:hidden;white-space:nowrap;transition:width .18s}.left-tools button:hover,.left-tools button.active{width:125px;background:#400607}.left-tools svg{flex:none;width:25px;height:25px;fill:none;stroke:#e30d13;stroke-width:1.8}.left-tools span{font-size:12px}.coords-pill{position:absolute;left:10px;bottom:9px;color:#eee;background:#090909e8;border:2px solid #bf0000;border-radius:9px;padding:5px 9px;z-index:510;font-size:12px;font-weight:700}.editor{position:absolute;z-index:540;top:88px;right:12px;bottom:12px;width:387px;max-width:calc(100% - 28px);display:flex;flex-direction:column;background:linear-gradient(160deg,#1f0303 0%,#120808 12%,#0c0b0b 48%);border:1px solid #a81919;border-radius:14px;overflow:hidden;box-shadow:0 10px 42px #000a}.editor-head{display:flex;align-items:center;justify-content:space-between;gap:9px;padding:15px 14px;background:#240606;border-bottom:1px solid #ae2222}.editor-head b{font-size:16px}.editor-head small{display:block;font-size:10px;color:#a9a9a9;margin-top:2px}.editor-head button{border:0;background:#222;width:35px;height:35px;font-size:22px}.editor-body{padding:9px 11px 14px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#5d2424 transparent;flex:1}.tabs{display:flex;gap:5px;margin-bottom:12px}.tabs button{padding:8px 9px;border-radius:999px;flex:1;font-size:12px}.tab-pane{display:block}.tab-pane[hidden]{display:none}strong{font-size:13px}.muted,.hint{color:var(--muted);font-size:11px}.hint{line-height:1.55;margin:9px 0}p{margin:8px 0}.line{display:flex;align-items:center;margin:8px 0}.split{justify-content:space-between}.gap{gap:6px;flex-wrap:wrap}.count{background:#3e1212;color:#ffc1c1;font-size:11px;border-radius:7px;padding:3px 6px}.tiny{padding:5px 8px;font-size:11px}.full{width:100%;display:block;margin:7px 0}.file-note{font-size:11px;background:#19181a;border:1px solid #37373a;border-radius:7px;padding:8px;color:#bdc2c8;white-space:normal;overflow-wrap:anywhere}#zoneList{height:100px;border-color:#424242;padding:4px}#zoneList option{padding:5px 8px}#zoneList option:checked{background:#7a1010 linear-gradient(#7a1010,#7a1010);color:#fff}.field-title{font-size:12px;font-weight:700;margin:12px 0 6px}.fields{display:grid;gap:6px}.cols3{grid-template-columns:repeat(3,minmax(0,1fr))}.fields label{color:#bfbfbf;font-size:11px;font-weight:600;min-width:0}.fields input{width:100%;margin-top:3px;text-align:left;padding:9px 6px;font-variant-numeric:tabular-nums}.mini-options{display:flex;justify-content:space-between;align-items:center;gap:6px;margin-top:9px;flex-wrap:wrap}.mini-options label{font-size:11px;white-space:nowrap}.mini-options input{vertical-align:-3px}.footer-status{border-top:1px solid #353535;margin-top:12px;padding-top:9px;color:#bcbcbc;font-size:11px;min-height:26px;overflow-wrap:anywhere}.footer-status.error{color:#ff8e8e}.upload{display:block;border:1px dashed #7d4040;border-radius:8px;padding:10px;margin:10px 0;font-size:12px;background:#1e1111;cursor:pointer}.upload input{padding:0;margin-top:7px;display:block;width:100%;font-size:11px}.wide{width:100%;margin:8px 0}.tab-pane details{margin:12px 0;border:1px solid #3e3e3e;border-radius:8px;padding:8px}.tab-pane summary{cursor:pointer}.tab-pane details textarea{margin:8px 0}.tab-pane code{color:#f4a1a1}.tab-pane hr{border:0;border-top:1px solid #383838;margin:15px 0}.reopen{position:absolute;right:10px;top:12px;z-index:560;background:#7c0808;border-color:#eb1717}.ug-handle div{background:#0a0a0a;border:2px solid #ff2b30;width:15px;height:15px;border-radius:4px;box-shadow:0 0 0 2px #111}.ug-handle.center div{border-radius:50%;background:#e41919;width:18px;height:18px}.ug-handle.rotate div{border-radius:50%;background:#151515;border-color:#e3ce65}.town-marker{font-size:11px;white-space:nowrap;color:#fafafa;text-align:center;letter-spacing:.1px;text-shadow:-1px -1px 2px #000,1px 1px 2px #000,0 0 5px #000;font-weight:700;pointer-events:none}.leaflet-container{font:inherit;background:#111}.leaflet-control-zoom{border:1px solid #555!important}.leaflet-control-zoom a{background:#19191a!important;color:white!important;border-bottom-color:#393939!important}.leaflet-control-zoom a:hover{background:#520c0c!important}.leaflet-tooltip{background:#1e1e1e;color:#fff;border:1px solid #6d1a1a;box-shadow:none}.leaflet-tooltip::before{border-top-color:#6d1a1a}.leaflet-container.navigation-locked{cursor:crosshair!important}
@media(max-width:900px){.tool-name{display:none}.topbar{padding:0 8px;gap:5px}.brand img{width:180px;max-width:23vw}.header-actions{gap:4px}.map-picker label,.head-btn:not(a){display:none}.editor{width:330px}.mode-switch button{padding:8px}}
@media(max-width:650px){.topbar{height:64px}.workspace{top:64px}.brand img{width:125px;max-width:28vw}.header-actions .head-btn{display:none}.map-picker select{width:100px}.mode-switch button{font-size:11px;padding:7px 5px}.editor{top:auto;left:6px;right:6px;bottom:6px;width:auto;max-width:none;max-height:54%;border-radius:10px}.editor-head{padding:8px 12px}.editor-body{padding:8px}.left-tools{top:6px;left:6px}.left-tools button{height:33px;min-height:33px;width:34px}.left-tools svg{width:20px;height:20px}.left-tools button:hover{width:112px}.scene-guide{left:8px;right:8px;transform:none;text-align:center;white-space:normal;bottom:56%}}

.editor[hidden]{display:none!important}

/* Compact XYZ/YPR measurements: each group stays on one horizontal row. */
.measure-row{display:grid;grid-template-columns:91px repeat(3,minmax(0,1fr));column-gap:5px;align-items:center;margin:10px 0;min-width:0}
.measure-title{font-size:10px;font-weight:700;white-space:nowrap;color:#f0f0f0}
.measure-title small{font-size:9px;font-weight:400;color:#aaa}
.measure-row label{display:flex;align-items:center;gap:3px;min-width:0;white-space:nowrap;color:#bdbdbd;font-size:10px;font-weight:600}
.measure-row input{display:block;flex:1 1 0;width:0;min-width:0;height:32px;padding:6px 3px;text-align:center;font-size:11px;font-variant-numeric:tabular-nums;-moz-appearance:textfield;appearance:textfield}
.measure-row input::-webkit-outer-spin-button,.measure-row input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.fit-slope-line{justify-content:flex-end;margin-top:-3px;margin-bottom:10px}
@media(max-width:650px){.measure-row{grid-template-columns:91px repeat(3,minmax(0,1fr));gap:4px}.measure-row label{font-size:10px}.measure-row input{font-size:10px;padding:5px 2px}}

/* Compact icon-only 2D toolbar. Hidden labels do not leak out of collapsed buttons. */
.left-tools{gap:15px}
.left-tools button{width:36px;min-width:36px;height:36px;min-height:36px;padding:6px;display:grid;place-items:center;overflow:hidden;transition:background .15s,border-color .15s}
.left-tools button:hover,.left-tools button.active{width:36px;min-width:36px}
.left-tools button svg{width:21px;height:21px}
.left-tools button span{display:none!important}
.workspace.view-3d .left-tools{display:none}
/* 3D transform gizmos use separate icon-only controls. */
.transform-tools{position:absolute;top:13px;left:13px;display:flex;flex-direction:column;gap:15px;z-index:570}
.transform-tools button{width:36px;height:36px;min-width:36px;min-height:36px;padding:7px;background:#080808ef;border:1px solid #c30707;display:grid;place-items:center;transition:background .15s}
.transform-tools button svg{width:20px;height:20px;fill:none;stroke:#ff282c;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.transform-tools button:hover,.transform-tools button.active{background:#500909;border-color:#ff2e32}
.transform-tools button.active svg{stroke:#fff}
.transform-label{position:absolute;left:62px;top:18px;background:#080808d9;border:1px solid #542020;border-radius:6px;padding:4px 8px;color:#e6dfdf;font-size:11px;pointer-events:none;z-index:570}
#scene3d{touch-action:none;cursor:grab}
#scene3d:active{cursor:grabbing}
.underground-footnote{border-top:1px solid #373737;padding-top:12px;margin-top:13px;font-size:10.5px}
@media(max-width:650px){.left-tools{gap:12px}.left-tools button,.left-tools button:hover,.left-tools button.active,.transform-tools button{width:33px;height:33px;min-width:33px;min-height:33px}.transform-tools{gap:12px;top:8px;left:8px}.transform-label{left:47px;top:12px}.scene-guide{bottom:56%;font-size:10px}}

/* Unified file actions within the normal editor; no superimposed tabs. */
.editor{top:14px;bottom:12px;width:392px;background:#0b0b0b}
.editor-head{background:#1c0606;padding:11px 12px}
.editor-body{padding:8px 10px}
.editor .section-title{margin:16px 0 6px;border-top:1px solid #353535;padding-top:10px}
.compact-file-info{max-height:37px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
#tab-files{display:block;border-top:1px solid #333;margin-top:13px;padding-top:2px}
#tab-files .help-pop{right:0;top:auto;bottom:30px;z-index:999}
#tab-files details{margin:7px 0}
#tab-files .upload{margin:6px 0;padding:7px}
#tab-files .wide{margin:5px 0}
#sourceInfo{margin:6px 0}
.editor-checks{display:flex;gap:5px;justify-content:space-between;align-items:center;margin:8px 0;white-space:nowrap}
.editor-checks label{display:flex;align-items:center;gap:2px;font-size:10px;white-space:nowrap}
.editor-checks input{margin:0;width:12px;height:12px}
.editor-checks input:disabled{opacity:.5}
#terrainInfo{max-height:64px;overflow:auto}
.measure-row{grid-template-columns:88px repeat(3,minmax(0,1fr));column-gap:4px}
.measure-row .measure-title{font-size:10px}
.measure-row label{font-size:10px}
.measure-row input{padding:4px 2px}
.transform-label{display:none!important}
.transform-tools{gap:16px}
.scene-guide{bottom:13px;max-width:calc(100% - 460px);white-space:normal;text-align:center;font-size:11px;left:calc((100% - 410px)/2)}
.altitude-control{position:absolute;left:12px;top:224px;z-index:510;background:#100808ed;border:1px solid #9c1717;border-radius:9px;padding:7px 5px;display:flex;flex-direction:column;align-items:center;gap:5px;font-size:10px;box-shadow:0 5px 16px #000a}
.altitude-control label{font-size:10px;font-weight:700}
.altitude-control>div{display:flex;flex-direction:column;gap:3px;align-items:center}
.altitude-control button{width:25px;height:25px;padding:0;font-size:17px}
.altitude-control input[type=range]{appearance:slider-vertical;-webkit-appearance:slider-vertical;writing-mode:vertical-lr;direction:rtl;width:18px;height:112px;padding:0;cursor:ns-resize;accent-color:#e0222a}
.altitude-control output{font-size:10px;max-width:50px}
.workspace.view-3d .altitude-control{display:none}
#autoY:disabled+span{opacity:.5}
@media(max-width:650px){.scene-guide{max-width:calc(100% - 25px);left:50%;bottom:56%;transform:translateX(-50%)}.editor{max-height:65%;top:auto}.editor-checks{gap:2px}.editor-checks label{font-size:9px}.altitude-control{top:192px}}

/* Mission file actions stay above the trigger form and never obscure map controls. */
.mission-actions{padding:3px 0 11px;margin-bottom:10px;border-bottom:1px solid #393030}
.mission-actions-title{display:flex;gap:7px;align-items:center;margin:0 0 7px}
.mission-actions-title .help-btn{width:18px;height:18px;line-height:15px;font-size:11px}
.mission-actions .help-pop{left:0;right:auto;z-index:990}
.mission-action-row,.mission-export-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:stretch}
.mission-action-row>button,.mission-export-row>button{margin:0;min-width:0;font-size:11px;padding:8px 9px}
.file-action{position:relative;min-width:0;border:1px solid #a61919;background:#2a0707;color:#f8f8f8;border-radius:8px;padding:8px 9px;font-weight:700;font-size:10.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.file-action:hover{background:#4a0808}
.file-action input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;padding:0}
.mission-export-row{grid-template-columns:minmax(0,1fr) auto}
.comment-field{display:block;margin:8px 0 11px;font-size:10px;color:#ccc;font-weight:700}
.comment-field input{display:block;margin-top:4px;width:100%;height:31px;padding:5px 8px;font-size:11px}
.altitude-control{display:none!important}
#tab-files{margin-top:12px;border-top:1px solid #353535}
#tab-files .section-title{margin-top:10px}
/* Keep the selected footprint visually above the satellite map tiles. */
.leaflet-overlay-pane .ug-selected-zone,
.leaflet-pane.leaflet-zoneHighlights-pane .ug-selected-zone{
 stroke:#ff3038!important;stroke-width:3.6px!important;stroke-opacity:1!important;
 fill:#a80012!important;fill-opacity:.27!important;
}
.scene-tile-selector{position:absolute;z-index:565;top:14px;right:418px;display:flex;align-items:center;gap:7px;
 padding:6px 8px;background:#0b0909ee;border:1px solid #542020;border-radius:8px;font-size:11px}
.scene-tile-selector label{font-size:10px;color:#ccc;font-weight:600;white-space:nowrap}
.scene-tile-selector select{padding:5px 24px 5px 7px;font-size:11px;max-width:185px}
@media(max-width:900px){.scene-tile-selector{right:10px;top:10px}}
@media(max-width:650px){.scene-tile-selector{top:9px;right:9px;padding:3px}.scene-tile-selector label{display:none}.scene-tile-selector select{font-size:10px}}

/* 2D map zoom lives below the left editing toolbar, not over the editor close button. */
#map .leaflet-top.leaflet-left{top:218px;left:12px}
#map .leaflet-top.leaflet-left .leaflet-control{margin:0}
#map .leaflet-control-zoom{box-shadow:none;border:1px solid #9b1414!important;border-radius:7px;overflow:hidden}
#map .leaflet-control-zoom a{width:35px;height:35px;line-height:33px;font-size:19px}
/* Explicit 3D camera zoom, separate from native satellite tile resolution. */
.scene-zoom-control{position:absolute;top:178px;left:12px;z-index:570;
 display:flex;flex-direction:column;gap:5px;padding:7px 5px;align-items:center;
 background:#0b0808ec;border:1px solid #a71919;border-radius:9px;box-shadow:0 5px 18px #0009}
.scene-zoom-control button{width:32px;height:30px;min-height:30px;padding:0;font-size:19px;font-weight:700}
.scene-zoom-control button#sceneZoomReset{font-size:11px}
.scene-zoom-control input[type=range]{appearance:slider-vertical;-webkit-appearance:slider-vertical;
 writing-mode:vertical-lr;direction:rtl;height:135px;width:18px;padding:0;accent-color:#e51b25;cursor:ns-resize}
.scene-imagery-state{position:absolute;z-index:560;bottom:48px;left:50%;transform:translateX(-50%);
 max-width:min(350px,calc(100% - 450px));font-size:10px;color:#e8c7a2;text-align:center;
 background:#1c1110df;border:1px solid #68402a;border-radius:7px;padding:5px 8px;pointer-events:none}
.scene-imagery-state[hidden]{display:none}
@media(max-width:900px){.scene-imagery-state{max-width:calc(100% - 20px)}}

@media(max-width:900px){.scene-tile-selector{left:60px;right:auto;top:12px}}
@media(max-width:650px){.scene-zoom-control{top:160px;left:8px}.scene-zoom-control input[type=range]{height:88px}}

/* Visible 3D zoom dock, independent of the transform toolbar. */
#threeView .scene-zoom-control{position:absolute!important;display:flex!important;flex-direction:row!important;left:62px!important;top:112px!important;right:auto!important;bottom:auto!important;gap:7px!important;padding:6px 8px!important;z-index:610!important;pointer-events:auto!important;align-items:center!important;background:#0e0909f2!important;border:1px solid #af2222!important;}
#threeView .scene-zoom-control input[type=range]{appearance:auto!important;-webkit-appearance:auto!important;writing-mode:horizontal-tb!important;direction:ltr!important;width:128px!important;height:18px!important;padding:0!important;cursor:ew-resize!important;}
#threeView .scene-zoom-control button{height:28px!important;width:30px!important;min-height:28px!important;flex:none!important;}
#threeView .scene-zoom-control button#sceneZoomReset{width:40px!important;}
#threeView .scene-tile-selector{left:62px!important;top:160px!important;right:auto!important;z-index:600!important;}
#threeView .scene-guide{left:calc((100% - 392px) / 2)!important;max-width:calc(100% - 450px);}
#threeView .scene-imagery-state{left:calc((100% - 392px) / 2)!important;}
@media(max-width:800px){#threeView .scene-zoom-control{left:50px!important;top:100px!important;}#threeView .scene-tile-selector{top:147px!important;left:50px!important;}#threeView .scene-guide{left:50%!important;max-width:95%;}#threeView .scene-imagery-state{left:50%!important;}}

/* Right-click trigger actions; menu belongs to the canvas, not the editing sidebar. */
.box-context-menu{position:absolute;z-index:950;width:192px;display:grid;gap:2px;padding:5px;border:1px solid #a8232a;border-radius:9px;background:#161013;box-shadow:0 12px 36px #000e}
.box-context-menu[hidden]{display:none!important}
.box-context-menu button{width:100%;min-height:31px;padding:6px 9px;background:transparent;border:0;border-radius:5px;text-align:left;color:#f2eded;font-size:12px;cursor:pointer}
.box-context-menu button:hover{background:#621219}
.box-context-menu button.danger{color:#ff6b71}
#terrainInfo{line-height:1.45;font-size:11px;max-height:none;overflow:visible}
#threeView .scene-zoom-control{top:179px!important;left:62px!important}
#threeView .scene-tile-selector{top:224px!important;left:62px!important}
/* Never allow the map controls to sit under the editor on narrower desktop windows. */
@media(max-width:850px){#threeView .scene-zoom-control{left:57px!important;top:172px!important}#threeView .scene-tile-selector{left:57px!important;top:219px!important}}

/* Camera magnification is independent of the selectable satellite image detail. */
#threeView .scene-zoom-label{font:600 10px system-ui,sans-serif;color:#bbb;white-space:nowrap;padding-right:2px;}
