/* Phone surfaces are isolated here; desktop layout remains in map-layout.css. */
#phone-dock,#phone-restore,#phone-add,#phone-pin,#phone-brand,.phone-focus-button,.phone-detail-toggle,.phone-editor-progress,.phone-editor-button,.phone-export-tabs{display:none}
.phone-optional>summary{display:none}
.map-controls>.phone-focus-button{display:none}
#phone-panel:not([open]){display:none}
@media(max-width:800px), (max-width:1000px) and (max-height:500px){
 .leaflet-tooltip{display:none!important}
 html,body{height:100%;overflow:hidden!important;overscroll-behavior:none}
 body{--phone-bottom:env(safe-area-inset-bottom,0px);--phone-top:env(safe-area-inset-top,0px)}
 #header{display:none}
 #workspace{height:100dvh;min-height:0!important;--map-tools-top:calc(82px + var(--phone-top));--summary-height:0px}
 #workspace .map-frame{min-height:0}
 #workspace .map-search-panel{top:calc(12px + var(--phone-top));left:12px;right:12px;transform:none;width:auto;border-radius:16px;box-shadow:0 4px 24px #24352a16}
 #workspace .map-search-panel .archive-head{display:flex;gap:2px;padding:5px;min-height:56px}
 #phone-brand{display:grid;place-items:center;flex-shrink:0;width:40px;height:44px}
 #phone-brand>svg{width:32px;height:32px}
 #workspace .map-search-panel .search-box{min-width:0;flex:1}
 #workspace .map-search-panel .search-box input{height:44px;min-height:44px;padding-inline:9px 33px;font-size:16px}
 #workspace .map-search-panel .search-box>svg{display:none}
 #workspace .map-search-panel .search-box .icon-button{top:0;width:32px;min-width:32px;height:44px}
 #workspace .map-search-panel .archive-tools{display:block;margin:0;flex:0 0 44px}
 #workspace .archive-tools>*,#workspace .period-bar,#workspace .search-filters{display:none!important}
 #workspace .archive-tools>.search-filter-button{display:flex!important;width:44px;height:44px;min-height:44px;padding:0;position:relative;background:var(--ground);border-radius:12px}
 #workspace .search-filter-button>span:not(.filter-count){display:none}
 #workspace .search-filter-button>.filter-count{position:absolute;inset-inline-end:-2px;top:-2px;min-width:17px;height:17px;padding:0 3px;font-size:10px;background:var(--accent);color:#fff;border-radius:10px;line-height:17px}
 #workspace .map-summary,#workspace #archive,#workspace .map-legend,#workspace .map-bottom{display:none!important}
 #workspace .map-controls{top:var(--map-tools-top)!important;bottom:auto!important;inset-inline-end:12px;border-radius:13px;box-shadow:0 3px 20px #24352a12;overflow:hidden;z-index:450}
 #workspace .map-controls>button{width:44px;height:44px;min-height:44px}
 #workspace .map-controls>button:nth-child(n+4){display:none}
 #workspace .map-controls>button.phone-focus-button{display:flex}
 #workspace .map-load-status{top:var(--map-tools-top);left:12px;max-width:calc(100% - 82px);font-size:12px}
 #workspace .map-credit{bottom:calc(86px + var(--phone-bottom));inset-inline-start:12px;max-width:calc(100% - 24px);font-size:8px;line-height:1.7;background:#ffffffd9;border-radius:5px;padding:2px 5px;z-index:400}
 #phone-dock{position:fixed;bottom:calc(12px + var(--phone-bottom));inset-inline:12px;z-index:520;display:grid;grid-template-columns:repeat(var(--phone-columns,4),minmax(0,1fr));gap:2px;padding:5px;background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:0 5px 30px #24352a1a}
 #phone-dock button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:52px;padding:4px 2px;border-radius:12px;font-size:11px;line-height:1.6}
 #phone-dock button>span{white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
 #phone-dock button[aria-expanded=true]{background:var(--accent-soft);color:var(--accent)}
 #phone-dock .icon{width:21px;height:21px}
 #phone-add:not([hidden]){position:fixed;z-index:480;inset-inline-start:14px;bottom:calc(112px + var(--phone-bottom));display:grid;place-items:center;width:48px;height:48px;border-radius:16px;background:var(--accent);color:#fff;box-shadow:0 5px 18px #24352a26}
 .phone-panel-open #phone-add,.phone-detail-open #phone-add{display:none!important}
 .phone-map-focus #search-panel,.phone-map-focus #phone-dock,.phone-map-focus #phone-add,.phone-map-focus #map-controls{display:none!important}
 #phone-restore:not([hidden]){position:fixed;top:calc(12px + var(--phone-top));inset-inline-end:12px;display:grid;place-items:center;width:48px;height:48px;z-index:700;background:white;border:1px solid var(--border);border-radius:14px;box-shadow:0 3px 18px #24352a18}
 .phone-map-focus #workspace .map-credit{bottom:calc(12px + var(--phone-bottom))}
 dialog{max-width:100vw;width:100vw;max-height:var(--phone-view-height,100dvh);height:var(--phone-view-height,100dvh);margin:0;border:0;border-radius:0;inset:var(--phone-view-top,0px) 0 auto;overflow:hidden}
 body>dialog:not(#detail-dialog):not(#phone-panel){width:100vw;max-width:100vw;max-height:var(--phone-view-height,100dvh);height:var(--phone-view-height,100dvh);border-radius:0;margin:0;inset:var(--phone-view-top,0px) 0 auto}
 dialog[open]{display:flex;flex-direction:column}
 dialog>.dialog-heading{flex-shrink:0;padding:12px 16px;min-height:62px;gap:8px;padding-top:max(12px,var(--phone-top))}
 dialog>.dialog-heading h2{font-size:19px;line-height:1.5}
 dialog>.dialog-heading .icon-button{width:44px;height:44px;flex-shrink:0}
 dialog>.dialog-body{overflow-y:auto;overscroll-behavior:contain;min-height:0;flex:1;padding:16px}
 dialog>.dialog-actions{flex-shrink:0;gap:8px;flex-wrap:wrap;padding:10px 12px calc(10px + var(--phone-bottom));background:var(--surface);border-top:1px solid var(--border)}
 dialog::backdrop{background:#17271d55}
 #phone-panel[open]{inset:auto 0 var(--phone-view-top,0px);height:auto;max-height:min(86dvh,var(--phone-view-height,100dvh));border-radius:22px 22px 0 0;padding:0;padding-bottom:var(--phone-bottom)}
 #phone-panel[data-panel=results]{height:min(82dvh,var(--phone-view-height,100dvh))}
 .phone-panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;flex-shrink:0;border-bottom:1px solid var(--border)}
 .phone-panel-heading h2{font-size:18px}
 #phone-panel-body{overflow-y:auto;min-height:0;padding:16px;overscroll-behavior:contain}
 #phone-panel-body:has(#archive){padding:0;display:flex;flex-direction:column;flex:1}
 #phone-panel #archive{display:flex!important;position:static;inset:auto;width:100%;height:auto;flex:1;min-height:0;max-height:none;box-shadow:none;border:0;border-radius:0}
 #phone-panel #archive .result-head{padding:8px 16px}
 #phone-panel #archive .result-head [data-action=hide-results]{display:none}
 #phone-panel #incident-list{padding-bottom:12px;overscroll-behavior:contain}
 #phone-panel .search-filters,#phone-panel .filters{display:block;position:static;max-height:none;overflow:visible;border:0;padding:0}
 #phone-panel .filter-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 12px}
 #phone-panel .filter-grid>.span2{grid-column:auto}
 #phone-panel .filters label{display:block;font-size:12px;line-height:1.7;margin-bottom:5px}
 #phone-panel .filters select{width:100%;min-height:46px;font-size:14px;padding-inline:8px}
 #phone-panel .place-search{position:relative;inset:auto;width:100%;max-width:none;margin:20px 0 0}
 #phone-panel .place-search input{font-size:16px;min-height:48px}
 #phone-panel .place-results{position:static;max-height:170px;margin-top:6px}
 #phone-panel .period-bar{display:flex;flex-direction:column;align-items:stretch;padding:0 0 16px;margin-bottom:16px;border:0;border-bottom:1px solid var(--border);border-radius:0;gap:8px}
 #phone-panel .period-tabs{display:flex;flex-wrap:wrap;gap:6px;overflow:visible}
 #phone-panel .period-tabs button{min-height:44px;flex:1 0 27%;font-size:12px;padding:8px;border:1px solid var(--border);border-radius:9px}
 #phone-panel .period-range{font-size:11px;line-height:1.9;gap:6px;max-width:100%;margin:0;flex-wrap:wrap}
 .phone-filter-actions{display:flex;gap:10px;margin-top:20px}
 .phone-filter-actions button{display:flex;align-items:center;justify-content:center;gap:6px;flex:1;min-height:46px;border:1px solid var(--border);border-radius:10px;font-size:13px}
 .phone-filter-actions button:last-child{background:var(--accent);color:white;border-color:var(--accent)}
 #phone-panel .map-summary{position:static;inset:auto;transform:none;width:100%;max-height:none;background:none;border:0;box-shadow:none;border-radius:0}
 #phone-panel #stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;overflow:visible;padding:16px 0}
 #phone-panel #stats .stat{padding:14px 8px;border:1px solid var(--border);border-radius:12px;background:var(--ground)}
 #phone-panel #stats .stat .stat-value{font-size:30px}
 #phone-panel #stats .stat-heading .symbol-label{display:inline;max-width:none;font-size:12px}
 #phone-panel .map-summary .summary-controls{flex-wrap:wrap;padding:0 0 12px}
 #phone-panel .map-summary .scope-select select{font-size:13px;max-width:100%;min-height:44px}
 #phone-panel .stat-chip-row{flex-wrap:wrap;overflow:visible;gap:8px;padding:12px 0}
 #phone-panel .stat-chip{border:1px solid var(--border);padding:7px 9px;border-radius:8px;font-size:12px;white-space:normal}
 #phone-panel .stat-chip-label{display:inline;max-width:none}
 .phone-stats-period{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:12px;padding-bottom:14px}.phone-stats-period button{display:flex;align-items:center;gap:6px;min-height:44px;padding:8px 12px;border:1px solid var(--border);border-radius:9px}
 .phone-menu-brand{font-size:13px;color:var(--muted);padding-bottom:14px}
 .phone-menu-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
 .phone-menu-grid button,.phone-menu-grid>a{display:flex;align-items:center;gap:10px;text-decoration:none;text-align:start;min-height:64px;line-height:1.8;padding:12px;border:1px solid var(--border);border-radius:12px;font-size:12px;min-width:0}
 .phone-menu-grid button[aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
 .phone-menu-grid .icon{width:22px;height:22px}
 .phone-language{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 0;font-size:13px}
 .phone-language select{min-width:140px;min-height:46px;font-size:16px}
 .phone-detail-open #phone-dock{display:none}
 #detail-dialog[open]{margin:0;position:fixed;inset:auto 0 0;width:100%;height:min(49dvh,430px);max-height:calc(100dvh - 90px - var(--phone-top));border:1px solid var(--border);border-bottom:0;border-radius:22px 22px 0 0;padding:0;box-shadow:0 -6px 30px #24352a1c;z-index:800;pointer-events:auto}
 #detail-dialog[data-phone-media=false]:not(.phone-detail-expanded)[open]{height:min(42dvh,360px)}
 #detail-dialog[data-phone-media=false][data-phone-totals=false]:not(.phone-detail-expanded)[open]{height:min(34dvh,290px)}
 #detail-dialog.phone-detail-expanded[open]{height:calc(100dvh - 12px - var(--phone-top));max-height:calc(100dvh - 12px - var(--phone-top))}
 #detail-dialog>.detail-toolbar{min-height:46px;height:46px;padding:2px 10px;border:0;gap:4px}
 #detail-dialog>.detail-toolbar .icon-button{height:42px;width:42px}
 .phone-detail-toggle{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;min-height:32px;height:32px;position:relative;color:var(--muted);font-size:11px;flex-shrink:0;touch-action:none;border-bottom:1px solid var(--border)}
 .phone-detail-toggle>i{position:absolute;width:36px;height:4px;left:calc(50% - 18px);top:-44px;background:#c4c8c0;border-radius:4px;pointer-events:none}
 .phone-detail-toggle .icon{width:15px;height:15px}
 #detail-dialog.phone-detail-expanded .phone-detail-toggle .icon{transform:rotate(180deg)}
 #detail-dialog>.compact-detail{padding:10px 16px;overflow-y:auto;overscroll-behavior:contain}
 #detail-dialog>.compact-actions{min-height:52px;padding:4px 12px calc(4px + var(--phone-bottom));justify-content:space-around;flex-wrap:nowrap;gap:10px}
 #detail-dialog>.compact-actions .icon-button{height:44px;min-width:44px}
 #detail-dialog .detail-header h2{font-size:19px;margin:3px 0;line-height:1.6}
 #detail-dialog .detail-meta{font-size:11px;line-height:1.7;margin:2px 0}
 #detail-dialog .detail-header .row{gap:5px}
 #detail-dialog .detail-header .badge{font-size:10px;min-height:20px;padding-block:0}
 #detail-dialog .detail-totals{margin-top:6px;padding:6px 0;gap:8px}
 #detail-dialog .metric-line strong{font-size:25px}
 #detail-dialog .early-media .media-item{height:150px}
 #detail-dialog .early-media img,#detail-dialog .early-media video{height:150px}
 #detail-dialog:not(.phone-detail-expanded) .detail-header h2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 #detail-dialog:not(.phone-detail-expanded) .actor-line,#detail-dialog:not(.phone-detail-expanded) .report-metadata,#detail-dialog:not(.phone-detail-expanded) .detail-damage-strip,#detail-dialog:not(.phone-detail-expanded) .human-table,#detail-dialog:not(.phone-detail-expanded) .human-breakdown,#detail-dialog:not(.phone-detail-expanded) .mini-metrics,#detail-dialog:not(.phone-detail-expanded) .detail-section,#detail-dialog:not(.phone-detail-expanded) .detail-updated,#detail-dialog:not(.phone-detail-expanded) .site-history-button{display:none}
 #detail-dialog:not(.phone-detail-expanded) .early-media{display:block}
 #detail-dialog:not(.phone-detail-expanded) .early-media .media-item,#detail-dialog:not(.phone-detail-expanded) .early-media img,#detail-dialog:not(.phone-detail-expanded) .early-media video{height:100px}
 #detail-dialog:not(.phone-detail-expanded) .early-media .reveal{min-height:100px}
 #workspace.picking .map-controls{display:flex}
 body:has(#workspace.picking) #phone-dock,body:has(#workspace.picking) #phone-add{display:none!important}
 #phone-pin{position:fixed;top:50%;left:50%;width:38px;height:38px;transform:translate(-50%,-100%);pointer-events:none;z-index:470;display:none}
 body:has(#workspace.picking) #phone-pin{display:block}
 #phone-pin:before{content:'';position:absolute;inset:0;background:var(--accent);border:3px solid white;border-radius:50% 50% 50% 0;transform:rotate(-45deg);box-shadow:0 2px 8px #24352a40}
 #phone-pin:after{content:'';position:absolute;width:10px;height:10px;left:14px;top:14px;background:white;border-radius:50%}
 #workspace .pick-banner{position:fixed;inset:auto 12px calc(12px + var(--phone-bottom));max-width:none;font-size:12px;padding:12px;display:flex;flex-direction:column;border-radius:16px;gap:10px;z-index:530}
 #workspace .pick-banner[hidden]{display:none}
 .phone-pick-title{text-align:center;font-weight:600}
 .phone-pick-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%}
 .phone-pick-actions button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;font-size:11px;border:1px solid var(--border);border-radius:10px;padding:6px}
 .phone-pick-actions button:first-child{grid-column:1/-1;background:var(--accent);color:white;border-color:var(--accent);font-size:14px;min-height:48px}
 .phone-pick-actions .icon{width:16px;height:16px}
 #editor-dialog{height:var(--phone-view-height,100dvh);max-height:var(--phone-view-height,100dvh);top:var(--phone-view-top,0px);border-radius:0}
 #editor-dialog>.dialog-heading{min-height:60px;padding-block:8px}
 #editor-dialog>.dialog-heading h2{font-size:19px}
 #editor-dialog>.dialog-heading small{display:none}
 .phone-editor-progress{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:8px 16px 12px;border-bottom:1px solid var(--border);flex-shrink:0}
 .phone-editor-progress button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;font-size:13px;border:1px solid var(--border);border-radius:10px}
 .phone-editor-progress b{font-size:11px;font-weight:500;width:20px;height:20px;line-height:20px;border-radius:50%;background:var(--raised)}
 .phone-editor-progress [aria-current=step]{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
 .phone-editor-button:not([hidden]){display:inline-flex}
 #editor-form{padding:0 16px 20px}
 #editor-form>.editor-section[hidden]{display:none!important}
 #editor-form>.editor-section{padding:18px 0}
 #editor-form .editor-grid{grid-template-columns:minmax(0,1fr);gap:16px}
 #editor-form .editor-grid>.span2{grid-column:auto}
 #editor-form .field label{font-size:13px;line-height:1.7}
 #editor-form input:not([type=checkbox]):not([type=radio]):not([type=range]),#editor-form select,#editor-form textarea{font-size:16px;min-height:46px;max-width:100%}
 #editor-form .phone-number{text-align:start;font-variant-numeric:tabular-nums}
 #editor-form textarea{line-height:1.9}
 #editor-form .casualty-inputs{grid-template-columns:minmax(0,1fr);gap:20px}
 #editor-form .casualty-bin,#editor-form .human-bins{min-width:0}
 #editor-form .editor-location{flex-wrap:wrap;font-size:12px;gap:8px}
 #editor-form .editor-location .coordinates{font-size:11px}
 #editor-form .editor-location button{min-height:44px}
 #editor-form .translation-tabs{display:flex;flex-wrap:wrap;gap:6px}
 #editor-form .translation-tabs button{min-height:44px}
 #editor-form .source-entry{grid-template-columns:minmax(0,1fr) 44px}
 #editor-form .source-entry input{grid-column:1}
 #editor-form .source-entry button{grid-column:2;grid-row:1/3}
 #editor-dialog .editor-note{display:none}
 #editor-dialog>.dialog-actions{display:flex;gap:8px;align-items:center;justify-content:stretch}
 #editor-dialog>.dialog-actions>button:not([hidden]){flex:1;min-width:0;font-size:12px;padding-inline:6px;min-height:46px}
 #editor-dialog>.dialog-actions>button[hidden]{display:none!important}
 #editor-dialog>.dialog-actions>button .icon{display:none}
 #editor-dialog .editor-feedback{flex:1 0 100%;width:100%;min-width:0}
 #editor-dialog .editor-feedback:has(.error:empty):has(#editor-progress:empty){display:none}
 #editor-dialog .editor-feedback p{font-size:12px;line-height:1.8;margin:0}
 #editor-form .phone-optional>summary{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
 #editor-form .phone-optional>summary:before{content:'+';font-size:19px}#editor-form .phone-optional[open]>summary:before{content:'−'}
 #editor-form .phone-casualty-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding-block:12px}#editor-form .phone-casualty-fields .casualty-bin{display:block}#editor-form .phone-casualty-fields label{display:block;font-size:12px;line-height:1.8;margin-bottom:4px}
 #editor-dialog details>summary{min-height:44px;line-height:1.8;padding-block:10px;cursor:pointer}
 #export-dialog{width:100vw;max-width:none;height:var(--phone-view-height,100dvh)}
 .phone-export-feedback{padding-inline:16px;flex-shrink:0;font-size:12px;line-height:1.8}.phone-export-feedback:has(#export-status:empty):has(#export-error:empty){display:none}
 .phone-export-tabs{display:flex;gap:8px;padding:8px 16px;border-bottom:1px solid var(--border);flex-shrink:0}
 .phone-export-tabs button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;flex:1;border-radius:9px;font-size:13px}
 .phone-export-tabs button[aria-pressed=true]{background:var(--accent-soft);color:var(--accent)}
 #export-dialog .export-body{display:block;flex:1;min-height:0;overflow:auto;padding:16px;overscroll-behavior:contain}
 #export-dialog[data-phone-export=preview] .export-options,#export-dialog[data-phone-export=settings] .export-preview{display:none}
 #export-dialog .export-preview{width:100%;min-height:0;padding:0;background:var(--ground)}
 #export-dialog .export-preview canvas{max-width:100%;width:100%;height:auto;display:block}
 #export-dialog .export-options{max-width:100%;padding:0}
 #export-dialog select,#export-dialog input[type=number]{font-size:16px;min-height:46px}
 #export-dialog>.dialog-actions>button{flex:1;padding-inline:8px;font-size:12px}
 .toast{bottom:calc(90px + var(--phone-bottom));max-width:calc(100vw - 32px);z-index:1200}
 .ui-tooltip{max-width:calc(100vw - 24px)}
 .phone-panel-open .ui-tooltip,.phone-detail-open .ui-tooltip{display:none!important}
}
@media(max-width:800px) and (max-height:540px), (max-width:1000px) and (max-height:500px){
 #detail-dialog[open]{width:55vw;inset:auto 0 0 auto;height:calc(100dvh - 12px);max-height:calc(100dvh - 12px);border-radius:18px 0 0 0}
 [dir=rtl] #detail-dialog[open]{inset:auto auto 0 0;border-radius:0 18px 0 0}
 #detail-dialog[data-phone-media=false]:not(.phone-detail-expanded)[open],#detail-dialog[data-phone-media=false][data-phone-totals=false]:not(.phone-detail-expanded)[open]{height:calc(100dvh - 12px)}
 #detail-dialog.phone-detail-expanded[open]{width:100vw}
 .phone-detail-open #search-panel{display:none}
 .phone-detail-open #workspace .map-controls{inset-inline-end:auto;inset-inline-start:12px}
 #phone-dock{inset-inline:22%;bottom:calc(6px + var(--phone-bottom))}
 #phone-dock button{min-height:44px;flex-direction:row;font-size:10px}
 #phone-panel[open]{max-height:95dvh}
 .phone-panel-heading{padding:6px 16px}
 .phone-menu-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .phone-editor-progress{padding-block:4px;gap:8px}
 .phone-editor-progress button{min-height:36px}
 #editor-dialog>.dialog-heading{min-height:46px;padding-block:2px}
 #editor-dialog>.dialog-actions{padding-block:6px}
 .phone-detail-toggle{height:28px;min-height:28px}
}
@media(prefers-reduced-motion:no-preference){
 @media(max-width:800px), (max-width:1000px) and (max-height:500px){#phone-panel[open]{animation:phone-sheet-in 160ms ease-out}#detail-dialog[open]{transition:height 180ms ease-out,width 180ms ease-out}}
}
@keyframes phone-sheet-in{from{opacity:.7;transform:translateY(24px)}to{opacity:1;transform:translateY(0)}}
