.housing-map-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,290px);gap:14px}
.housing-map [data-map-canvas]{height:min(65vh,650px);min-height:340px;border:1px solid var(--line,#ccd2d8);z-index:0}
.housing-map [data-map-index]{max-height:650px;overflow:auto}
.housing-map [data-map-index] article{padding:10px;border-bottom:1px solid var(--line,#ccd2d8)}
.housing-map [data-map-index] p{overflow-wrap:anywhere;margin:6px 0}
.housing-map [data-map-index] button{text-align:left;white-space:normal;width:100%}
.housing-map .housing-map-marker{background:transparent;border:0}
.housing-map-marker .housing-map-building{display:block;width:40px;height:44px;text-align:center;line-height:44px;font-size:34px;color:#14618a;-webkit-text-stroke:1px #fff;filter:drop-shadow(0 2px 2px #0008)}
.housing-map-marker .housing-map-count{position:absolute;right:-5px;top:-5px;min-width:20px;height:20px;padding:0 3px;box-sizing:border-box;border:1px solid #fff;border-radius:10px;background:#14618a;color:#fff;text-align:center;font:bold 12px/18px Arial;box-shadow:0 1px 3px #0006}
.housing-map .leaflet-marker-icon:focus-visible{outline:3px solid #e78b00;outline-offset:3px}
.housing-map .leaflet-control-attribution{color:#222;background:#fffe}
.housing-map input{max-width:100%}
.housing-map .acc-list-toolbar label{display:grid;gap:6px;min-width:0;align-items:start}
.housing-map .acc-list-toolbar input{width:100%;box-sizing:border-box}
.housing-map .leaflet-popup-content button{display:block;margin-top:8px;white-space:normal;color:#222;background:#fff;border:1px solid #77838f;width:100%;min-height:34px}
.housing-map .leaflet-popup-content{color:#222}
@media(max-width:800px){.housing-map-layout{grid-template-columns:minmax(0,1fr)}.housing-map [data-map-canvas]{height:48vh;min-height:300px}.housing-map [data-map-index]{max-height:none}}

/* Keep the map context visible beside the shared, permission-aware record form. */
dialog.sys-dynamic-editor.housing-map-detail{margin:0 0 0 auto;width:min(760px,92vw);max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0}
.housing-map .leaflet-popup-content section+section{border-top:1px solid #ccd2d8;margin-top:12px;padding-top:12px}
.housing-map .leaflet-popup-content p{margin:6px 0;overflow-wrap:anywhere}
@media(max-width:600px){dialog.sys-dynamic-editor.housing-map-detail{width:100vw}}
/* The map occupies the available width; the accessible index is a fallback. */
.housing-map-layout{grid-template-columns:minmax(0,1fr)}
.housing-map [data-map-index][hidden]{display:none}

.housing-map-options,.housing-map-legend{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0}
.housing-map-options label{display:flex;align-items:center;gap:8px;margin:8px 0}
.housing-map-options details{margin-left:auto;border:1px solid var(--line,#ccd2d8);padding:8px;background:var(--surface,#fff)}
.housing-map-options summary{cursor:pointer}
.housing-map-legend button{display:flex;align-items:center;gap:6px;min-height:34px}
.housing-map-legend button[aria-pressed=true]{outline:2px solid #3c8dbc;outline-offset:1px;font-weight:bold}
.housing-map-dot{width:12px;height:12px;border-radius:3px;display:inline-block}
.housing-map-marker .housing-map-building{color:var(--map-state,#14618a)}
.housing-map-label{position:absolute;left:44px;top:0;display:grid;gap:3px;min-width:130px;max-width:210px;padding:5px 7px;background:#fffffff2;color:#263238;border:1px solid #a8b1b8;border-radius:3px;box-shadow:0 1px 3px #0003;font:12px/1.3 Arial;pointer-events:none}
.housing-map-label strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.housing-map-label span{white-space:normal}
@media(max-width:600px){.housing-map-options details{margin-left:0}.housing-map-label{max-width:140px}}
.housing-map-preview-art{height:150px;display:flex;justify-content:center;overflow:hidden}.housing-map-preview-art svg{width:100%;height:100%;max-height:150px}

/* Compact operational header: controls, filters, result context, then map. */
.housing-map .housing-map-commands{display:flex;justify-content:flex-start;align-items:flex-end;gap:10px;flex-wrap:wrap;margin:0 0 10px}
.housing-map .housing-map-commands>label{display:grid;gap:5px;margin:0}
.housing-map .housing-map-commands>label:first-child{flex:1 1 260px;max-width:420px}
.housing-map .housing-map-commands input[type=search]{width:100%}
.housing-map .housing-map-commands>button{flex:0 0 auto}
.housing-map .housing-map-commands>details{margin-left:auto;position:relative}
.housing-map .housing-map-commands summary{cursor:pointer;min-height:34px;display:flex;align-items:center;padding:0 10px;border:1px solid var(--line,#ccd2d8)}
.housing-map .housing-map-commands>details[open]{flex-basis:100%;margin-left:0;padding:10px;border:1px solid var(--line,#ccd2d8)}
.housing-map .housing-map-commands>details label{display:flex;gap:8px;align-items:center;margin:8px 0}
.housing-map .housing-map-legend{margin:0 0 8px;gap:8px}
.housing-map [data-map-status]{margin:6px 0}
.housing-map .housing-map-help{margin:4px 0 10px;font-size:12px}
.housing-map .leaflet-popup-content{margin:12px 16px}
.housing-map .housing-map-preview-art{height:100px}
.housing-map .housing-map-preview-art svg{max-height:100px}
.housing-map .leaflet-popup-content section{padding:0 4px}
@media(max-width:600px){.housing-map .housing-map-commands>details{margin-left:0}.housing-map .housing-map-commands>label:first-child{max-width:none}}
.housing-map .leaflet-popup-content p,.housing-map .leaflet-popup-content small{color:#485563}

/* Options float beside the working area without changing its geometry. */
.housing-map .housing-map-commands>details.housing-map-settings,
.housing-map .housing-map-commands>details.housing-map-settings[open]{position:relative;flex:0 0 auto;flex-basis:auto;margin-left:auto;padding:0;border:0;z-index:1100}
.housing-map-settings-body{position:absolute;right:0;top:calc(100% + 6px);width:320px;max-width:calc(100vw - 48px);max-height:65vh;overflow:auto;box-sizing:border-box;padding:14px;border:1px solid var(--line,#ccd2d8);background:var(--surface,var(--panel-bg,#fff));color:var(--text,#263238);box-shadow:0 8px 24px #0003}
.housing-map .housing-map-settings-body>p{margin-top:0}
.housing-map .housing-map-settings-body label{white-space:normal}
.housing-map [data-map-canvas]{min-height:280px;max-height:none}
.housing-map-label{pointer-events:auto;cursor:pointer}
.housing-map-label:hover{border-color:#3c8dbc;box-shadow:0 0 0 1px #3c8dbc}
.housing-map-label .housing-map-badges{display:flex;gap:5px;flex-wrap:wrap}
.housing-map-label .housing-map-state-count{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;box-sizing:border-box;padding:0 5px;border-radius:50%;border:1px solid #fff;color:#fff;font:bold 12px/1 Arial;box-shadow:0 1px 2px #0004}
.housing-map-state-panel{position:fixed;inset:0 0 0 auto;margin:0;width:min(620px,92vw);max-width:100vw;height:100dvh;max-height:100dvh;box-sizing:border-box;padding:0;border:1px solid var(--adm-border,#ccd2d8);background:var(--adm-panel,var(--surface,#fff));color:var(--adm-text,var(--text,#263238))}
.housing-map-state-panel[open]{display:flex;flex-direction:column}
.housing-map-state-panel::backdrop{background:#0004}
.housing-map-state-panel header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--adm-border,#ccd2d8)}
.housing-map-state-content{padding:16px;overflow:auto}
.housing-map-state-content section{margin-bottom:18px}
.housing-map-state-content .housing-map-unit{display:block;width:100%;text-align:left;white-space:normal;margin:6px 0;min-height:36px}
.housing-map-label button.housing-map-state-count{cursor:pointer;min-height:24px}
.housing-map-label button.housing-map-state-count:focus-visible{outline:3px solid #14618a;outline-offset:2px}
@media(max-width:600px){.housing-map-state-panel{width:100vw}}.housing-map .housing-map-settings>summary{width:34px;box-sizing:border-box;justify-content:center;padding:0;list-style:none}
.housing-map .housing-map-settings>summary::-webkit-details-marker{display:none}
.housing-map .housing-map-settings-body{padding-top:52px}
.housing-map .housing-map-settings-close{position:absolute;top:8px;right:8px;min-width:34px;min-height:34px}
.housing-map .housing-map-settings>summary:focus-visible{outline:2px solid #3c8dbc;outline-offset:2px}
.housing-map .housing-map-loading{padding:12px;border:1px solid var(--line,#ccd2d8);background:var(--surface,var(--panel-bg,#fff));font-weight:600}

.housing-map .housing-map-label button.housing-map-state-count{background:var(--badge-color)!important;color:#fff!important;border-radius:3px!important;border:2px solid #fff!important;min-width:46px!important;width:auto!important;height:28px!important;min-height:28px!important;padding:0 7px!important;display:inline-flex!important;align-items:center;justify-content:center;gap:6px}
.housing-map-state-content button.housing-map-unit{display:grid;gap:7px;padding:14px;border:1px solid var(--adm-border,#ccd2d8);border-left:5px solid var(--unit-state);background:var(--adm-surface-2,var(--surface,#fff));color:inherit;border-radius:4px}
.housing-map-unit>strong{font-size:15px}
.housing-map-unit-state{font-weight:600;display:flex;align-items:center;gap:6px}
.housing-map-unit-state::before{content:"";width:10px;height:10px;border-radius:50%;background:var(--unit-state)}
.housing-map-state-content button.housing-map-unit:focus-visible{outline:2px solid #3c8dbc;outline-offset:2px}.housing-map-state-content .housing-map-state-summary{font-size:16px;font-weight:600;margin-top:0}
.housing-map-state-content h3{font-size:14px;margin:0 0 6px}
.housing-map-state-content h3 small{font-size:12px;font-weight:400}
.housing-map-state-content section{border-top:1px solid var(--line,#ccd2d8);padding-top:14px}

.housing-map-state-icon{flex:0 0 auto;width:14px;text-align:center}
.housing-map .housing-map-legend-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:3px;color:#fff;font-size:12px}

/* Visible while authorized buildings load; independent of icon font loading. */
.housing-map [data-map-canvas]{position:relative}
.housing-map .housing-map-loading-overlay{position:absolute;inset:0;z-index:1100;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--adm-surface,var(--surface,#fff)) 72%,transparent);cursor:progress}
.housing-map .housing-map-loading-overlay[hidden]{display:none}
.housing-map-loading-message{display:flex;align-items:center;gap:12px;max-width:calc(100% - 48px);box-sizing:border-box;padding:16px 20px;border:1px solid var(--adm-border,var(--line,#ccd2d8));border-radius:4px;background:var(--adm-panel,var(--surface,#fff));color:var(--adm-text,var(--text,#263238));font-weight:600;box-shadow:0 2px 8px #0002}
.housing-map-spinner{display:inline-block;flex:0 0 auto;width:26px;height:26px;box-sizing:border-box;border:3px solid var(--adm-border,var(--line,#ccd2d8));border-top-color:var(--adm-accent,#3c8dbc);border-radius:50%;animation:housing-map-loading-spin .8s linear infinite}
@keyframes housing-map-loading-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.housing-map-spinner{animation:none}}
.housing-map [data-map-index]>details>summary{cursor:pointer;min-height:34px;box-sizing:border-box;padding:8px 12px;border:1px solid var(--adm-border,var(--line,#ccd2d8));background:var(--adm-panel,var(--surface,#fff));color:var(--adm-text,var(--text,#263238));font-weight:600}
.housing-map [data-map-index]>details>summary:focus-visible{outline:2px solid #3c8dbc;outline-offset:2px}
.housing-map dialog.housing-map-buildings-panel{position:fixed;inset:140px 16px 16px auto;margin:0;width:380px;max-width:calc(100vw - 24px);height:auto;max-height:calc(100dvh - 156px);padding:0;border:1px solid var(--adm-border,var(--line,#ccd2d8));border-radius:4px;background:var(--adm-panel,var(--surface,#fff));color:var(--adm-text,var(--text,#263238));box-shadow:0 8px 28px #0004;z-index:1200}
.housing-map .housing-map-buildings-panel[open]{display:flex;flex-direction:column}
.housing-map-buildings-panel>header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid var(--adm-border,var(--line,#ccd2d8))}
.housing-map-buildings-panel>header button{min-width:34px;min-height:34px}
.housing-map-buildings-panel>label{display:grid;gap:6px;padding:12px 16px 0}
.housing-map-buildings-panel input{min-height:34px;width:100%;box-sizing:border-box}
.housing-map-buildings-panel>p{margin:10px 16px}
.housing-map .housing-map-buildings-panel [data-map-index]{overflow:auto;min-height:0;max-height:none;padding:0 6px 12px}
.housing-map-buildings-panel [aria-pressed=true]{outline:2px solid #3c8dbc;outline-offset:1px}
.housing-map-list-location{font-size:12px;font-weight:600}
.housing-map .housing-map-selected{outline:3px solid #14618a;outline-offset:3px}
@media(max-width:600px){.housing-map dialog.housing-map-buildings-panel{inset:12px 12px 12px auto;max-height:calc(100dvh - 24px)}}
.housing-map-buildings-panel [data-map-index] button{min-height:34px}
.housing-map-buildings-panel [data-map-index] button:focus-visible{outline:2px solid #3c8dbc;outline-offset:2px}

/* Business views: readable names and optional contextual information. */
.housing-map .housing-map-settings>summary{width:auto;min-height:34px;padding:0 10px;white-space:normal}
.housing-map .housing-map-label{max-width:250px;width:max-content;white-space:normal}
.housing-map .housing-map-label>strong{display:block;white-space:normal;overflow:visible;text-overflow:clip;max-width:240px;line-height:1.3}
.housing-map .housing-map-label>small{display:block;line-height:1.4}
.housing-map .housing-map-label button.housing-map-state-count{font-size:11px;min-height:30px!important}
.housing-map .leaflet-popup-content section{padding:8px 0}
.housing-map .housing-map-settings-body button:focus-visible{outline:2px solid #3c8dbc;outline-offset:2px}
@media(max-width:600px){.housing-map .housing-map-label{max-width:190px}.housing-map .housing-map-commands{flex-wrap:wrap}}

@media(max-width:600px){.housing-map .housing-map-label{transform:translateX(-50%)}}

/* Compact markers; descriptions live in the accessible preview. */
.housing-map .housing-map-commands>details.housing-map-settings,
.housing-map .housing-map-commands>details.housing-map-settings[open]{margin-left:0}
.housing-map .housing-map-settings>summary{width:34px;height:34px;padding:0;display:flex;align-items:center;justify-content:center}
.housing-map-marker-dots{position:absolute;left:0;top:0;width:40px;height:44px;pointer-events:none}
.housing-map-marker-dots>button.housing-map-marker-dot{position:absolute;pointer-events:auto}
.housing-map-marker-dots>button:nth-child(1){left:30px;top:16px}
.housing-map-marker-dots>button:nth-child(2){left:22px;top:36px}
.housing-map-marker-dots>button:nth-child(3){left:0;top:36px}
.housing-map-marker-dots>button:nth-child(4){left:-12px;top:16px}
.housing-map-marker-dots>button:nth-child(5){left:-4px;top:-5px}
.housing-map-marker .housing-map-count{width:22px;height:22px;min-width:22px;border-radius:50%;line-height:20px;padding:0}
.housing-map button.housing-map-marker-dot,.housing-map-tooltip-dot{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;min-width:26px;width:auto;height:26px;padding:0 4px;box-sizing:border-box;border:2px solid #fff;background:var(--badge-color)!important;color:#fff!important;font:bold 12px/1 Arial;box-shadow:0 1px 3px #0005}
.housing-map button.housing-map-marker-dot{cursor:pointer}
.housing-map button.housing-map-marker-dot:focus-visible{outline:3px solid #14618a;outline-offset:2px}
.housing-map-tooltip-legend p{display:flex;align-items:center;gap:6px}

/* Align display options with the adjacent building command, open or closed. */
.housing-map .housing-map-commands>details.housing-map-settings,
.housing-map .housing-map-commands>details.housing-map-settings[open]{align-self:flex-end;margin:0!important;padding:0!important}
.housing-map .housing-map-commands>details.housing-map-settings>summary{margin:0!important;box-sizing:border-box;vertical-align:middle;line-height:1;width:34px;height:34px;min-height:34px;padding:0!important}
.housing-map .housing-map-settings>summary>i{margin:0;font-size:14px;line-height:1}

.housing-map .housing-map-tooltip-address{white-space:normal;overflow-wrap:anywhere;line-height:1.45;margin:6px 0 10px}

.housing-map .housing-map-tooltip-address{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:start;gap:8px}
.housing-map .housing-map-tooltip-address>i{flex:0 0 12px;text-align:center;line-height:1.45;color:inherit}
.housing-map .housing-map-tooltip-address>span{min-width:0}

.housing-map .leaflet-popup-content a.housing-map-directions{display:inline-flex;align-items:center;justify-content:center;width:34px;min-height:34px;box-sizing:border-box;margin:0;text-decoration:none;flex-shrink:0;align-self:start}
.housing-map .housing-map-directions:focus-visible{outline:2px solid #3c8dbc;outline-offset:2px}

.housing-map .housing-map-tooltip-building>strong{display:block;line-height:1.4;overflow-wrap:anywhere}
.housing-map .housing-map-tooltip-address .housing-map-directions:hover{filter:brightness(.95)}

.housing-map-layout:has(>.housing-map-state-panel[open]){display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,390px);gap:14px;align-items:start}
.housing-map-layout>dialog.housing-map-state-panel[open]{position:static;inset:auto;display:flex;flex-direction:column;width:auto;min-width:0;max-width:none;max-height:65vh;margin:0;box-sizing:border-box;box-shadow:none}
@media(max-width:1050px){.housing-map-layout:has(>.housing-map-state-panel[open]){grid-template-columns:1fr}.housing-map-layout>dialog.housing-map-state-panel[open]{max-height:none}}
