:root {
            --panel-bg: rgba(255,255,255,.96);
            --panel-border: rgba(17,17,17,.08);
            --panel-shadow: 0 10px 30px rgba(0,0,0,.16);
            --panel-radius: 14px;
            --safe-gap: 12px;
            --brand-bar-height: 48px;
            /* Absolute clearance from viewport top to below toolbar (updated by JS). */
            --toolbar-height: 128px;
            --chrome-stack-gap: 10px;
            --address-search-offset: 0px;
        }
        html, body { margin:0; width:100%; height:100%; overflow:hidden; font-family:Arial,sans-serif; }
        #layout { display:grid; grid-template-columns:60% 40%; width:100%; height:100%; position:relative; }
        #mapWrap, #rightWrap { position:relative; width:100%; height:100%; }
        #map { width:100%; height:100%; }
        #googleBasemap {
            display: none;
            position: absolute;
            inset: 0;
            z-index: 0;
            pointer-events: none;
            background: #0b1a12;
        }
        #mapWrap.has-google-basemap #googleBasemap { display: block; }
        #mapWrap.has-google-basemap #map {
            position: absolute;
            inset: 0;
            z-index: 1;
            background: transparent;
        }
        #mapWrap.has-google-basemap #map .ol-viewport,
        #mapWrap.has-google-basemap #map .ol-layers,
        #mapWrap.has-google-basemap #map .ol-layer,
        #mapWrap.has-google-basemap #map canvas {
            background: transparent !important;
        }
        #layout.layout-map, #layout.layout-3d { display: block; }
        #layout.layout-map #mapWrap { position:absolute; inset:0; z-index:1; }
        #layout.layout-map #rightWrap { position:absolute; top:10px; right:10px; width:320px; height:240px; z-index:2; border-radius:8px; overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,.2); }
        #layout.layout-map #profileWrap { display:none !important; }
        #layout.layout-3d #rightWrap { position:absolute; inset:0; z-index:1; }
        #layout.layout-3d #mapWrap { position:absolute; top:10px; right:10px; width:320px; height:240px; z-index:2; border-radius:8px; overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,.2); }
        #rightWrap { display:flex; flex-direction:column; }
        #rightWrap.lineSelected { display:grid; grid-template-rows:52% 48%; gap:0; }
        #three, #profileWrap { width:100%; position:relative; }
        #three { flex:1; min-height:0; }
        #profileWrap { display:none; flex:0 0 42%; min-height:0; }
        #rightWrap.lineSelected #profileWrap { display:flex; flex-direction:column; }
        #rightWrap { border-left:1px solid #ddd; background:#f4f4f4; }
        .siteChrome {
            position: fixed;
            top: var(--safe-gap);
            left: var(--safe-gap);
            z-index: 1900;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            max-width: calc(100% - 24px);
            pointer-events: auto;
        }
        .siteBrand {
            font-family: "DM Sans", "Segoe UI", sans-serif;
            font-weight: 600;
            font-size: 15px;
            letter-spacing: -0.03em;
            color: #111;
            text-decoration: none;
            line-height: 1;
            padding: 8px 10px;
            border-radius: 8px;
            background: rgba(255,255,255,.94);
            border: 1px solid var(--panel-border);
            box-shadow: 0 4px 14px rgba(0,0,0,.08);
            white-space: nowrap;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        .siteBrandMark {
            width: 15px;
            height: 15px;
            display: block;
            flex: 0 0 auto;
            border-radius: 3px;
        }
        .siteBrand:hover { color: #000; background: #fff; }
        .siteChromeBtn {
            font-family: "DM Sans", "Segoe UI", sans-serif;
            font-size: 12px;
            font-weight: 500;
            color: #333;
            background: rgba(255,255,255,.94);
            border: 1px solid var(--panel-border);
            border-radius: 8px;
            padding: 8px 10px;
            cursor: pointer;
            box-shadow: 0 4px 14px rgba(0,0,0,.08);
            white-space: nowrap;
        }
        .siteChromeBtn:hover { background: #fff; }
        .toolbar {
            position:fixed; top:calc(var(--safe-gap) + var(--brand-bar-height)); left:var(--safe-gap); z-index:1200;
            display:flex; gap:10px; flex-wrap:wrap; align-items:flex-start;
            max-width:min(960px, calc(100% - 24px));
        }
        .toolbar button, .toolbar select, .toolbar input { padding:8px 10px; font-size:14px; }
        .toolbar button.active { background:#111; color:#fff; }
        .toolbar button:disabled { opacity:.45; cursor:not-allowed; }
        .cancelDrawBtn {
            background:#c00; color:#fff; border:1px solid #a00; border-radius:8px; cursor:pointer;
        }
        .cancelDrawBtn:hover { background:#e00; }
        .panelTitle {
            position:absolute; top:10px; left:10px; z-index:10; background:rgba(255,255,255,.96);
            padding:8px 10px; border-radius:8px; box-shadow:0 2px 10px rgba(0,0,0,.15);
        }
        .threeDControlStack {
            position:fixed;
            top:calc(var(--toolbar-height) + var(--chrome-stack-gap));
            right:var(--safe-gap);
            z-index:1260;
            display:flex;
            flex-direction:column;
            gap:8px;
            align-items:flex-end;
            max-width:min(380px, calc(100% - 24px));
        }
        body.layout-3d-mode .threeDControlStack {
            right:calc(320px + 24px);
        }
        .threeDControls {
            background:var(--panel-bg);
            padding:10px 12px; border-radius:var(--panel-radius); box-shadow:var(--panel-shadow);
            display:flex; gap:10px; align-items:center; font-size:13px;
            border:1px solid var(--panel-border);
            max-width:min(380px, calc(100% - 24px));
            flex-wrap:wrap;
        }
        .threeDControls label { display:inline-flex; align-items:center; gap:4px; }
        .threeDControls select, .threeDControls input { padding:4px 6px; }
        .threeDMapControls {
            flex-wrap:nowrap;
            gap:8px;
            padding:8px 10px;
            max-width:min(420px, calc(100vw - 24px));
        }
        .threeDMapOpacityLabel {
            flex: 1 1 auto;
            min-width: 0;
            white-space: nowrap;
        }
        .threeDMapOpacityLabel input[type="range"] {
            width: min(120px, 28vw);
            vertical-align: middle;
        }
        .cutFillPanelToggle {
            flex: 0 0 auto;
            border: 1px solid #111;
            background: #fff;
            color: #111;
            border-radius: 8px;
            padding: 6px 10px;
            cursor: pointer;
            font: inherit;
            font-size: 12px;
            font-weight: 600;
            white-space: nowrap;
        }
        .cutFillPanelToggle:hover { background: #f1f3f5; }
        .cutFillPanelToggle[aria-expanded="true"] {
            background: #111;
            color: #fff;
        }
        .polygonCutFillControls {
            max-width:min(420px, calc(100vw - 24px));
            align-items:flex-end;
        }
        .polygonCutFillControls[hidden] {
            display: none !important;
        }
        .cutFillHeading {
            flex: 1 1 100%;
            font-weight: 700;
            font-size: 13px;
            color: #111;
        }
        .cutFillCalcBtn {
            border: 1px solid #111;
            background: #111;
            color: #fff;
            border-radius: 8px;
            padding: 6px 10px;
            cursor: pointer;
            font: inherit;
        }
        .cutFillCalcBtn:hover { background: #333; }
        .cutFillClearBtn {
            border: 1px solid #adb5bd;
            background: #fff;
            color: #333;
            border-radius: 8px;
            padding: 6px 10px;
            cursor: pointer;
            font: inherit;
        }
        .cutFillClearBtn:hover { background: #f1f3f5; }
        .cutFillLayerToggles {
            flex: 1 1 100%;
            display: flex;
            flex-wrap: wrap;
            gap: 8px 12px;
            align-items: center;
            padding-top: 2px;
        }
        .cutFillLayer {
            font-size: 12px;
            gap: 5px;
        }
        .cutFillLayer::before {
            content: '';
            width: 10px;
            height: 10px;
            border-radius: 2px;
            flex: 0 0 auto;
        }
        .cutFillLayer.swatchCut::before { background: #d94841; }
        .cutFillLayer.swatchFill::before { background: #1c7ed6; }
        .cutFillLayer.swatchOwn::before { background: #f59f00; }
        .cutFillLayer.swatchSlope::before {
            background: linear-gradient(135deg, #d94841 50%, #1c7ed6 50%);
        }
        .mobileProfileToggle {
            display:none;
        }
        .itemsPanel {
            position:fixed; top:calc(var(--toolbar-height) + var(--chrome-stack-gap) + var(--address-search-offset)); left:var(--safe-gap); z-index:1230; width:min(286px, calc(100% - 24px));
            max-height:min(58vh, 560px); overflow:hidden; background:var(--panel-bg); border-radius:var(--panel-radius);
            box-shadow:var(--panel-shadow); padding:10px 10px 10px 8px; border:1px solid var(--panel-border);
            transition:transform .2s ease, opacity .2s ease;
            display:flex;
            flex-direction:column;
        }
        .itemsPanel.collapsed {
            transform:translateX(calc(-100% + 32px));
        }
        .itemsPanelHeader {
            display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 8px;
        }
        .itemsPanelHeader h3 { margin:0; font-size:14px; }
        .panelTabs {
            display:flex;
            gap:6px;
            margin:0 0 10px;
        }
        .panelTabBtn {
            flex:1;
            border:1px solid #ccc;
            background:#fff;
            border-radius:8px;
            padding:7px 10px;
            font-size:12px;
            cursor:pointer;
        }
        .panelTabBtn.active {
            background:#111;
            color:#fff;
            border-color:#111;
        }
        .panelContent {
            min-height:0;
            display:flex;
            flex-direction:column;
            flex:1;
        }
        .panelPane {
            display:none;
            min-height:0;
            flex:1;
            overflow:auto;
            padding-right:2px;
        }
        .panelPane.active {
            display:block;
        }
        .itemsPanelFooter {
            display:flex;
            justify-content:flex-start;
            padding-top:10px;
            border-top:1px solid rgba(17,17,17,.08);
            margin-top:10px;
        }
        .itemsPanelFooter .cancelDrawBtn {
            padding:8px 12px;
            font-size:13px;
        }
        .itemsPanelToggleBtn {
            border:1px solid #ccc; background:#fafafa; border-radius:12px; padding:2px 6px; font-size:11px; cursor:pointer;
        }
        .mobileItemsFab {
            display:none;
            position:fixed;
            left:var(--safe-gap);
            bottom:calc(var(--safe-gap) + 72px);
            z-index:1270;
            width:52px;
            height:52px;
            border:none;
            border-radius:999px;
            background:#111;
            color:#fff;
            box-shadow:0 10px 24px rgba(0,0,0,.24);
            align-items:center;
            justify-content:center;
            cursor:pointer;
        }
        .mobileItemsFab .bi {
            font-size:1.2rem;
        }
        .ol-zoom {
            top: auto !important;
            left: auto !important;
            right: 12px;
            bottom: 12px;
            width: auto !important;
            height: auto !important;
        }
        .itemRow {
            border:1px solid #ddd; border-radius:8px; padding:8px; margin-bottom:8px; cursor:pointer;
            background:#fff;
        }
        .itemRow.active { border-color:#111; box-shadow:inset 0 0 0 1px #111; }
        .itemName {
            width:100%; border:1px solid #ccc; border-radius:6px; padding:6px 8px; font-size:13px; box-sizing:border-box;
        }
        .itemMeta { margin-top:6px; font-size:12px; color:#555; white-space:pre-wrap; }
        .itemActions { display:flex; justify-content:flex-end; gap:6px; margin-top:6px; }
        .itemExport,
        .itemDelete {
            border:1px solid #ccc; background:#fff; border-radius:6px; padding:4px 8px; font-size:12px; cursor:pointer;
        }
        .sectionTitle {
            position:absolute; top:10px; left:10px; z-index:10; background:rgba(255,255,255,.96);
            padding:8px 10px; border-radius:8px; box-shadow:0 2px 10px rgba(0,0,0,.15);
        }
        .profileInner {
            position:absolute; inset:0; padding:44px 10px 10px; box-sizing:border-box; background:#f8f6f1;
            display:flex; flex-direction:column; overflow:hidden;
        }
        .profileChartScroll {
            flex:0 0 auto; overflow-x:auto; overflow-y:hidden; min-height:0;
            border:1px solid #ddd; border-radius:8px; background:#fff;
        }
        .profileChart {
            min-height:180px; min-width:min-content;
            display:inline-block;
        }
        .profileInfo { flex-shrink:0; }
        .profileTableScroll { flex:1; min-height:0; overflow:auto; margin-top:10px; }
        .profileInfo {
            margin-top:10px; font-size:12px; white-space:pre-wrap;
        }
        .profileTable {
            width:100%; border-collapse:collapse; margin-top:10px; background:#fff; font-size:12px;
        }
        .profileTable th, .profileTable td {
            border:1px solid #ddd; padding:4px 6px; text-align:right;
        }
        .profileTable th:first-child, .profileTable td:first-child { text-align:left; }
        #threeDPointTooltip {
            position:absolute; pointer-events:none; z-index:100; background:rgba(0,0,0,.85); color:#fff;
            padding:8px 10px; border-radius:6px; font-size:12px; white-space:pre-line; max-width:200px;
            display:none; box-shadow:0 2px 8px rgba(0,0,0,.3);
        }
        #threeDPointTooltip.visible { display:block; }
        .viewLayoutBtns { display:flex; gap:6px; }
        .toolbarGroup {
            display:flex; gap:6px; align-items:flex-end; padding:8px;
            background:var(--panel-bg); border-radius:var(--panel-radius); box-shadow:var(--panel-shadow);
            border:1px solid var(--panel-border);
        }
        .toolbarIconBtn { display:inline-flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; min-width:44px; padding:6px 8px; font-size:14px; border:1px solid #ccc; border-radius:8px; background:#fff; cursor:pointer; }
        .toolbarIconBtn:hover { background:#f0f0f0; }
        .toolbarIconBtn.active { background:#111; color:#fff; border-color:#111; }
        .toolbarIconBtn.switchOn { background:#111; color:#fff; border-color:#111; }
        .toolbarIconBtn.switchReady { border-color:#2f9e44; color:#2f9e44; }
        .toolbarIconBtn.switchOn.switchReady { background:#2f9e44; border-color:#2f9e44; color:#fff; }
        .toolbarIconBtn .bi { font-size:1.25rem; }
        .toolbarBtnLabel { font-size:10px; line-height:1.2; white-space:nowrap; }
        .itemsPanelHeaderActions { display:flex; align-items:center; gap:6px; }
        .clearBtn { font-size:12px; padding:4px 8px; border:1px solid #c00; background:#fff; color:#c00; border-radius:6px; cursor:pointer; }
        .clearBtn:hover { background:#fee; }
        .toolbarLabel {
            display:flex; align-items:center; gap:4px; flex-wrap:wrap; padding:8px 10px;
            background:var(--panel-bg); border-radius:var(--panel-radius); box-shadow:var(--panel-shadow);
            border:1px solid var(--panel-border);
        }
        .toolbarCheckLabel { cursor:pointer; user-select:none; }
        #rightWrap.emptyState { display:none; }
        #infoContent {
            white-space:pre-wrap;
            font-size:13px;
            line-height:1.4;
        }
        .statusPanel {
            position:fixed;
            left:var(--safe-gap);
            bottom:var(--safe-gap);
            z-index:1220;
            width:min(340px, calc(100% - 24px));
            background:var(--panel-bg);
            border:1px solid var(--panel-border);
            border-radius:var(--panel-radius);
            box-shadow:var(--panel-shadow);
            padding:10px 12px;
            font-size:13px;
            line-height:1.4;
        }
        #statusContent {
            white-space:pre-wrap;
        }
        .introModal {
            position:fixed;
            inset:0;
            z-index:2000;
            display:none;
            align-items:center;
            justify-content:center;
            padding:20px;
            background:rgba(15, 23, 42, 0.42);
        }
        .introModal.visible {
            display:flex;
        }
        .introModalDialog {
            width:min(760px, calc(100% - 24px));
            max-height:min(86vh, 760px);
            overflow:auto;
            background:#fffdf8;
            border:1px solid rgba(17,17,17,.08);
            border-radius:20px;
            box-shadow:0 24px 60px rgba(0,0,0,.24);
            padding:18px;
        }
        .introModalHeader h2 {
            margin:0 0 6px;
            font-size:22px;
        }
        .introModalHeader p {
            margin:0;
            font-size:14px;
            color:#555;
            line-height:1.45;
        }
        .introOptions {
            display:grid;
            grid-template-columns:repeat(3, minmax(0, 1fr));
            gap:12px;
            margin:16px 0;
        }
        .introOptionBtn {
            text-align:left;
            border:1px solid #d7d7d7;
            border-radius:16px;
            background:#fff;
            padding:14px;
            cursor:pointer;
        }
        .introOptionBtn.active {
            border-color:#111;
            box-shadow:inset 0 0 0 1px #111;
            background:#f7f7f7;
        }
        .introOptionIcon {
            display:inline-flex;
            align-items:center;
            justify-content:center;
            width:42px;
            height:42px;
            border-radius:12px;
            background:#111;
            color:#fff;
            font-size:1.2rem;
            margin-bottom:10px;
        }
        .introOptionTitle {
            display:block;
            margin-bottom:6px;
            font-size:15px;
            font-weight:700;
        }
        .introOptionText {
            display:block;
            font-size:13px;
            line-height:1.5;
            color:#444;
        }
        .introModalActions {
            display:flex;
            justify-content:flex-end;
            gap:10px;
        }
        .introPrimaryBtn,
        .introSecondaryBtn {
            border-radius:10px;
            padding:10px 14px;
            font-size:14px;
            cursor:pointer;
        }
        .introPrimaryBtn {
            border:1px solid #111;
            background:#111;
            color:#fff;
        }
        .introSecondaryBtn {
            border:1px solid #ccc;
            background:#fff;
            color:#111;
        }
        @media (max-width: 960px) {
            #layout { grid-template-columns:1fr; }
            #rightWrap {
                position:fixed; inset:auto 0 0 0; height:min(48vh, 360px); z-index:900;
                border-left:none; border-top:1px solid #ddd;
            }
            #layout.layout-map #rightWrap,
            #rightWrap.emptyState { display:none; }
            #layout.layout-map #mapWrap { width:100%; }
            #layout.layout-3d #rightWrap {
                position:absolute;
                inset:0;
                width:100%;
                height:100%;
                z-index:1;
                border-top:none;
            }
            #layout.layout-3d #mapWrap {
                position:absolute;
                inset:0;
                width:100%;
                height:100%;
                top:0;
                right:auto;
                z-index:2;
                border-radius:0;
                overflow:visible;
                box-shadow:none;
                background:transparent;
                pointer-events:none;
            }
            /* Dölj bara kartytan — verktygsfält, objektlista och status ligger kvar ovanpå 3D. */
            #layout.layout-3d #map,
            #layout.layout-3d #googleBasemap {
                display:none !important;
            }
            #layout.layout-3d #mapWrap .toolbar,
            #layout.layout-3d #mapWrap .itemsPanel,
            #layout.layout-3d #mapWrap .statusPanel,
            #layout.layout-3d #mapWrap .mobileItemsFab {
                pointer-events:auto;
            }
            #layout.layout-3d .siteChrome {
                pointer-events:auto;
            }
            #layout.layout-3d #rightWrap.lineSelected {
                display:flex;
            }
            .siteChrome {
                top: 8px;
                left: 8px;
            }
            .toolbar {
                top: calc(8px + var(--brand-bar-height));
                left:8px; right:8px; max-width:none; gap:8px; flex-wrap:nowrap; overflow-x:auto; align-items:stretch;
            }
            .toolbarGroup, .toolbarLabel { width:auto; box-sizing:border-box; flex:0 0 auto; }
            .toolbarGroup { justify-content:flex-start; overflow:visible; }
            #viewDouble { display:none; }
            .itemsPanel {
                top:auto; bottom:84px; left:8px; width:min(320px, calc(100% - 16px)); max-height:32vh;
            }
            .itemsPanel.collapsed {
                transform:translateY(calc(100% + 16px));
                opacity:0;
                pointer-events:none;
            }
            .mobileItemsFab {
                display:inline-flex;
            }
            .ol-zoom {
                top: auto !important;
                left: auto !important;
                right: 8px;
                bottom: 8px;
                width: auto !important;
                height: auto !important;
            }
            .threeDControlStack {
                top:calc(var(--toolbar-height) + var(--chrome-stack-gap));
                right:8px;
                bottom:auto;
                left:auto;
                max-width:min(360px, calc(100% - 16px));
                z-index:1265;
            }
            body.layout-3d-mode .threeDControlStack {
                right:8px;
            }
            .threeDControls {
                width:auto;
                max-width:min(360px, calc(100% - 16px));
                justify-content:flex-start;
                flex-wrap:wrap;
            }
            .threeDMapControls {
                width:auto;
                max-width:min(360px, calc(100% - 16px));
                flex-wrap:nowrap;
            }
            .threeDMapOpacityLabel input[type="range"] {
                width: min(88px, 22vw);
            }
            .cutFillPanelToggle {
                padding: 6px 8px;
                font-size: 11px;
            }
            .polygonCutFillControls {
                width: min(320px, calc(100vw - 16px));
                max-width: min(320px, calc(100vw - 16px));
            }
            .mobileProfileToggle {
                display:inline-flex;
                width:min(320px, calc(100% - 16px));
                justify-content:center;
            }
            #profileWrap {
                display:none !important;
            }
            #rightWrap.mobileProfileVisible #profileWrap {
                display:flex !important;
                position:absolute;
                inset:calc(var(--toolbar-height) + var(--chrome-stack-gap)) 0 0 0;
                height:auto;
                z-index:3;
                border-top:none;
            }
            #rightWrap.mobileProfileVisible #three {
                display:none;
            }
            #rightWrap.mobileProfileVisible .panelTitle {
                display:none !important;
            }
            #rightWrap.mobileProfileVisible #threeDMapControls,
            #rightWrap.mobileProfileVisible #threeDControls,
            #rightWrap.mobileProfileVisible #threeDPolygonControls,
            #rightWrap.mobileProfileVisible #cutFillPanelToggleBtn {
                display:none !important;
            }
            #rightWrap.mobileProfileVisible .threeDControlStack {
                top:calc(var(--toolbar-height) + var(--chrome-stack-gap));
                right:8px;
                left:auto;
                z-index:1275;
            }
            #rightWrap.mobileProfileVisible .mobileProfileToggle {
                display:inline-flex !important;
            }
            #rightWrap.mobileProfileVisible .profileInner {
                inset:0;
                padding:52px 8px 12px;
                display:flex;
                flex-direction:column;
                gap:8px;
                overflow:auto;
                -webkit-overflow-scrolling:touch;
            }
            #rightWrap.mobileProfileVisible .profileChartScroll {
                flex:0 0 auto;
                min-height:140px;
                max-height:38vh;
            }
            #rightWrap.mobileProfileVisible .profileChart {
                min-height:140px;
            }
            #rightWrap.mobileProfileVisible .profileInfo {
                margin-top:0;
                flex:0 0 auto;
            }
            #rightWrap.mobileProfileVisible .profileTableScroll {
                flex:1 0 auto;
                min-height:180px;
                margin-top:0;
                padding-bottom:16px;
                box-sizing:border-box;
                overflow:visible;
            }
            #rightWrap.mobileProfileVisible .profileTable {
                margin-top:0;
            }
            .statusPanel {
                left:8px;
                bottom:8px;
                width:min(320px, calc(100% - 16px));
            }
            .introOptions {
                grid-template-columns:1fr;
            }
        }
        @media (max-width: 640px) {
            .siteChrome {
                top: 8px;
                left: 8px;
                gap: 6px;
            }
            .siteBrand {
                font-size: 13px;
                padding: 7px 9px;
                gap: 6px;
            }
            .siteBrandMark {
                width: 13px;
                height: 13px;
            }
            .siteChromeBtn {
                font-size: 11px;
                padding: 7px 9px;
            }
            .toolbar { top:calc(8px + var(--brand-bar-height)); }
            .toolbarIconBtn { min-width:40px; padding:6px; }
            .toolbarBtnLabel { font-size:9px; }
            .itemsPanel {
                width:calc(100% - 16px);
                left:8px;
                right:auto;
            }
            .threeDControlStack {
                max-width:calc(100vw - 16px);
            }
            .threeDControls,
            .threeDMapControls {
                width:auto;
                max-width:min(calc(100vw - 16px), 340px);
            }
            .polygonCutFillControls {
                width: min(280px, calc(100vw - 16px));
                max-width: min(280px, calc(100vw - 16px));
            }
            .statusPanel {
                width:min(calc(100% - 16px), calc(100% - 88px));
            }
        }

.addressSearchPanel {
    position: fixed;
    top: calc(var(--toolbar-height) + var(--chrome-stack-gap));
    left: var(--safe-gap);
    z-index: 1245;
    width: min(286px, calc(100% - 24px));
}
.addressSearchPanelInner {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-shadow);
    padding: 8px;
}
.addressSearchBox {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 0 10px;
}
#addressSearchInput {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
}
.addressSearchResults {
    margin-top: 8px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-shadow);
    max-height: min(42vh, 360px);
    overflow: auto;
    padding: 6px;
}
.addressSearchResultBtn {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
}
.addressSearchResultBtn:hover, .addressSearchResultBtn.active { background: rgba(17,17,17,.06); }
.addressSearchPrimary { display:block; font-size: 13px; font-weight: 700; }
.addressSearchMeta { display:block; margin-top: 4px; font-size: 12px; color: #555; }
.mapPointTooltip {
    position: absolute;
    transform: translate(-50%, calc(-100% - 14px));
    pointer-events: auto;
    z-index: 1260;
    background: rgba(17,17,17,.92);
    color: #fff;
    padding: 10px 12px 12px;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0,0,0,.22);
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    min-width: 240px;
    max-width: min(420px, calc(100vw - 32px));
}
.mapPointTooltip[hidden] {
    display: none;
}
.mapPointTooltipBody {
    display: grid;
    gap: 6px;
}
.mapPointTooltipTitle {
    font-size: 13px;
    font-weight: 700;
    padding-right: 18px;
}
.mapPointTooltipRow {
    display: grid;
    gap: 2px;
}
.mapPointTooltipLabel {
    font-size: 11px;
    color: rgba(255,255,255,.72);
}
.mapPointTooltipValue,
.mapPointTooltipLine {
    word-break: break-word;
}
.mapPointTooltipClose {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.mapPointTooltipClose:hover {
    background: rgba(255,255,255,.22);
}
.mapPointTooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: rgba(17,17,17,.92);
    transform: translateX(-50%) rotate(45deg);
}
@media (max-width: 960px) {
    .addressSearchPanel {
        left: 8px;
        width: min(320px, calc(100% - 16px));
    }
}

.accountModal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0,0,0,.45);
    pointer-events: none;
}
.accountModal.visible {
    display: flex !important;
    pointer-events: auto;
}
.accountModalDialog {
    width: min(520px, 100%);
    max-height: min(90vh, 820px);
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
    padding: 18px 18px 20px;
    pointer-events: auto;
}
.accountModalHeader {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.accountModalHeader h2 { margin: 0; font-size: 18px; }
.accountUserLabel { margin: 4px 0 0; color: #555; font-size: 13px; }
.accountModalClose {
    border: 0;
    background: #f1f1f1;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.accountStatus {
    min-height: 1.2em;
    margin: 0 0 12px;
    font-size: 13px;
    color: #1b5e20;
}
.accountStatus.error { color: #b71c1c; }
.accountForm {
    display: grid;
    gap: 10px;
    margin: 0 0 12px;
}
.accountForm label {
    display: grid;
    gap: 4px;
    font-size: 13px;
}
.accountForm input, .accountForm select, .accountForm textarea {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font: inherit;
}
.accountForm textarea {
    resize: vertical;
    min-height: 96px;
}
.aboutModalDialog {
    width: min(560px, 100%);
}
.aboutContent {
    display: grid;
    gap: 10px;
    font-size: 14px;
    line-height: 1.45;
    color: #222;
}
.aboutContent h3 {
    margin: 8px 0 0;
    font-size: 15px;
}
.aboutContent p { margin: 0; }
.aboutContent a { color: #0b57d0; }
.aboutSocialRow { margin-top: 4px !important; }
.aboutSocialBtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #d8dee8;
    background: #f5f8fc;
    color: #1877f2 !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.aboutSocialBtn:hover {
    background: #eef4ff;
}
.aboutSocialBtn i {
    font-size: 18px;
    line-height: 1;
}
.aboutQuote {
    margin: 0;
    padding: 12px 14px;
    background: #f6f6f6;
    border-left: 3px solid #111;
    border-radius: 0 10px 10px 0;
    color: #333;
    font-size: 13px;
}
.aboutQuote footer {
    margin-top: 8px;
    color: #666;
    font-size: 12px;
}
.aboutLogoWrap { margin: 4px 0 0; }
.aboutCompanyLogo {
    display: block;
    width: min(180px, 100%);
    height: auto;
}
.guideModalDialog {
    width: min(520px, 100%);
}
.guideAccordion {
    display: grid;
    gap: 8px;
}
.guideItem {
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.guideItem summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.guideItem summary::-webkit-details-marker {
    display: none;
}
.guideItem summary::after {
    content: '+';
    font-weight: 500;
    color: #666;
    font-size: 16px;
    line-height: 1;
}
.guideItem[open] summary::after {
    content: '–';
}
.guideItem summary:hover {
    background: #f7f7f7;
}
.guideBody {
    padding: 0 14px 12px;
    display: grid;
    gap: 8px;
    font-size: 14px;
    line-height: 1.45;
    color: #333;
}
.guideBody p {
    margin: 0;
}
.guideBody strong {
    font-weight: 600;
}
.accountFormInline {
    grid-template-columns: 1fr auto;
    align-items: end;
}
.accountPrimaryBtn, .accountSecondaryBtn {
    border: 0;
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    font: inherit;
}
.accountPrimaryBtn { background: #111; color: #fff; }
.accountSecondaryBtn { background: #eee; color: #111; }
.accountLinks, .accountActionsRow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.accountLinks button {
    border: 0;
    background: transparent;
    color: #0b7285;
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
}
.accountHint { color: #666; font-size: 13px; }
.projectsList { display: grid; gap: 8px; }
.projectRow {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
}
.projectRow.active { border-color: #111; background: #fafafa; }
.projectMeta { display: grid; gap: 2px; }
.projectMeta span { font-size: 12px; color: #666; }
.projectActions { display: flex; flex-wrap: wrap; gap: 6px; }
.projectActions button {
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
}

.dashboardModalDialog {
    width: min(760px, 100%);
    max-height: min(90vh, 900px);
}
.dashboardToolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin: 0 0 10px;
}
.dashboardToolbar label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}
.dashboardToolbar select {
    min-width: 140px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
}
.dashboardContent {
    display: grid;
    gap: 14px;
    overflow: auto;
    max-height: min(70vh, 720px);
    padding-bottom: 8px;
}
.dashboardCard {
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
}
.dashboardCard h3 {
    margin: 0 0 8px;
    font-size: 14px;
}
.dashboardMetrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}
.dashboardMetric {
    background: #f6f7f9;
    border-radius: 8px;
    padding: 10px;
}
.dashboardMetric strong {
    display: block;
    font-size: 18px;
}
.dashboardMetric span {
    font-size: 12px;
    color: #555;
}
.dashboardTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dashboardTable th,
.dashboardTable td {
    text-align: left;
    padding: 6px 4px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}
.dashboardTable th:last-child,
.dashboardTable td:last-child {
    text-align: right;
    white-space: nowrap;
}
.dashboardBarRow {
    display: grid;
    grid-template-columns: minmax(70px, 120px) 1fr 40px;
    gap: 8px;
    align-items: center;
    margin: 6px 0;
    font-size: 13px;
}
.dashboardBarTrack {
    height: 8px;
    background: #eceff3;
    border-radius: 999px;
    overflow: hidden;
}
.dashboardBarFill {
    height: 100%;
    background: #2f6fed;
    border-radius: 999px;
}
.dashboardTabs {
    display: flex;
    gap: 6px;
    margin: 0 0 12px;
}
.dashboardTab {
    border: 1px solid #d5dbe5;
    background: #f5f7fa;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #334;
}
.dashboardTab.active {
    background: #009DC1;
    border-color: #009DC1;
    color: #fff;
}
.dashboardWishBadge {
    display: inline-block;
    margin-left: 6px;
    min-width: 1.25em;
    padding: 0 6px;
    border-radius: 999px;
    background: #c62828;
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
    vertical-align: middle;
}
.dashboardTab.active .dashboardWishBadge {
    background: #fff;
    color: #c62828;
}
.wishModalDialog,
.wishImplementDialog {
    width: min(520px, 100%);
}
.wishContent {
    display: grid;
    gap: 10px;
}
.wishLead {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #333;
}
.wishHintLabel {
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}
.wishPromptList {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.wishPrompt {
    border: 1px solid #d5dbe5;
    background: #f5f8fc;
    color: #1a4a6b;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}
.wishPrompt:hover {
    background: #e8f4f8;
    border-color: #009DC1;
}
.wishDashList {
    display: grid;
    gap: 12px;
}
.wishDashCard {
    border: 1px solid #e6eaf0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafbfc;
}
.wishDashMeta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}
.wishDashMessage {
    margin: 0 0 8px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.4;
}
.wishDashContact {
    margin: 0 0 8px;
    font-size: 12px;
    color: #555;
}
.wishDashActions {
    display: flex;
    justify-content: flex-end;
}
.wishDoneLabel {
    font-size: 12px;
    color: #2e7d32;
    font-weight: 600;
}
.wishAdminReply {
    margin: 0 0 8px;
    font-size: 13px;
    color: #333;
    background: #eef7f0;
    border-radius: 8px;
    padding: 8px 10px;
}
.wishImplementOriginal {
    margin: 0 0 10px;
    padding: 10px 12px;
    background: #f5f7fa;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.4;
}
.seoPanel {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 1850;
    width: min(420px, calc(100vw - 24px));
    pointer-events: auto;
}
.seoPanel.isClosed {
    display: none !important;
}
.seoPanelInner {
    height: 100%;
    max-height: calc(100vh - 24px);
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,.22);
    border: 1px solid rgba(17,17,17,.08);
    padding: 16px 16px 18px;
    box-sizing: border-box;
}
@media (max-width: 720px) {
    .seoPanel {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: min(48vh, 420px);
    }
    .seoPanelInner {
        max-height: min(48vh, 420px);
        border-radius: 16px 16px 0 0;
    }
    .seoModalBody {
        max-height: min(36vh, 320px);
    }
}
.seoModalBody {
    overflow: auto;
    max-height: calc(100vh - 120px);
    padding-bottom: 8px;
}
.seoArticle {
    display: grid;
    gap: 14px;
    color: #222;
    font-size: 15px;
    line-height: 1.55;
}
.seoArticleHeader h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    line-height: 1.25;
    color: #0b3b4d;
}
.seoEyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #009DC1;
}
.seoLead {
    margin: 0;
    color: #444;
}
.seoToolHint {
    margin: 8px 0 0;
    font-size: 13px;
    color: #555;
}
.seoSection h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #123;
}
.seoSection p {
    margin: 0 0 10px;
}
.seoSteps {
    margin: 0;
    padding-left: 1.2em;
}
.seoSteps li {
    margin: 0 0 6px;
}
.seoCta {
    display: grid;
    gap: 8px;
    margin-top: 4px;
}
.seoCtaBtn {
    display: inline-flex;
    justify-content: center;
    text-decoration: none;
    text-align: center;
}
.seoRelated h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}
.seoRelated ul {
    margin: 0;
    padding-left: 1.1em;
}
.seoRelated a {
    color: #0b57d0;
}
.seoDisclaimer {
    margin-top: 4px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f6f8fa;
    border: 1px solid #e2e7ee;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
}
.seoDisclaimer h2 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #0b3b4d;
}
.seoDisclaimer p {
    margin: 0 0 8px;
}
.seoDisclaimer p:last-child {
    margin-bottom: 0;
}
.seoDisclaimer a {
    color: #0b57d0;
}
.seoGroupTitle {
    margin: 14px 0 6px;
    font-size: 13px;
    font-weight: 700;
    color: #445;
}
.guideTopicList {
    margin: 8px 0 12px;
    padding-left: 1.2em;
}
.guideTopicList a {
    color: #0b57d0;
}
.accountSubheading { margin: 18px 0 8px; font-size: 15px; }
