/* MetStat R97 | scoped fixes applied AFTER R96. No map-data/forecast logic changes. */
:root{--ms97-panel:334px;--ms97-gutter:10px}
/* HEADER - right aligned MetStat + Persian title; actions together on the left. */
body>.top .top-in{display:grid!important;grid-template-columns:minmax(0,1fr) max-content!important;gap:10px!important;min-height:60px!important;padding:4px 12px!important;align-items:center!important;direction:rtl!important}
body>.top .top-in>#ms97-brand{grid-column:1!important;grid-row:1!important;display:flex!important;flex-flow:row nowrap!important;align-items:center!important;justify-content:flex-start!important;gap:10px!important;min-width:0!important;overflow:hidden!important;direction:rtl!important}
body>.top .top-in>#ms97-brand>.sign{position:static!important;display:block!important;flex:0 0 72px!important;width:72px!important;max-width:72px!important;height:56px!important;max-height:56px!important;object-fit:contain!important}
body>.top .top-in>#ms97-brand>.ttl{position:static!important;display:flex!important;flex:0 1 auto!important;flex-direction:column!important;justify-content:center!important;align-items:flex-start!important;text-align:right!important;width:auto!important;max-width:none!important;min-width:0!important;margin:0!important}
body>.top #ms97-brand .ttl h1{font-size:clamp(16px,1.5vw,21px)!important;white-space:nowrap!important;line-height:1.3!important;text-align:right!important;overflow:hidden!important;text-overflow:ellipsis!important}
body>.top #ms97-brand .ttl h1 .en{margin-inline:8px!important;font-size:15px!important}
body>.top #ms97-brand .ttl .pgrow{display:none!important}
body>.top #ms95-headerActions{grid-column:2!important;grid-row:1!important;justify-self:end!important;display:flex!important;align-items:center!important;flex-flow:row nowrap!important;gap:4px!important;max-width:none!important;white-space:nowrap!important}
body>.top #ms95-headerActions :is(button,.langbtn,select){font-size:12px!important;min-height:31px!important;padding:4px 7px!important}
body>.top #ms95-headerActions #backBtn:not([hidden]){max-width:96px!important;overflow:hidden!important;text-overflow:ellipsis!important}
/* No duplicate top-level (legacy hub) nav beneath the two-row site nav. */
html.ms97-nav-ready :is(#hubMain,#hubOff){display:none!important}
/* DESKTOP at all form factors: do not reinstate @media mobile layout. */
html:not(.nvfOn),html:not(.nvfOn) body{min-width:1240px!important}
body :is(.wrap,.mtPage,section.card,.panel){min-width:0;box-sizing:border-box}
/* Standard workbench: consistent right controls column, independent from document direction. */
html[dir=rtl] body>.wrap:not([hidden]):has(>aside):not(#caApp):not(#mtApp),
html[dir=rtl] #onApp:not([hidden]),html[dir=rtl] #anAuto:not([hidden]),html[dir=rtl] #labApp:not([hidden]){
 display:grid!important;grid-template-columns:minmax(0,1fr) var(--ms97-panel)!important;gap:var(--ms97-gutter)!important;direction:ltr!important;align-items:start!important}
html[dir=rtl] body>.wrap:not([hidden]):has(>aside):not(#caApp):not(#mtApp)>aside,
html[dir=rtl] #onApp:not([hidden])>aside,html[dir=rtl] #anAuto:not([hidden])>aside,
html[dir=rtl] #labApp:not([hidden])>aside{grid-column:2!important;grid-row:1!important;direction:rtl!important;width:100%!important;min-width:0!important}
html[dir=rtl] body>.wrap:not([hidden]):has(>aside):not(#caApp):not(#mtApp)>main,
html[dir=rtl] #onApp:not([hidden])>main,html[dir=rtl] #anAuto:not([hidden])>main,
html[dir=rtl] #labApp:not([hidden])>main{grid-column:1!important;grid-row:1!important;direction:rtl!important;width:100%!important;min-width:0!important;max-width:100%!important}
/* Left-to-right language reverses controls to left. */
html[dir=ltr] body>.wrap:not([hidden]):has(>aside):not(#caApp){grid-template-columns:var(--ms97-panel) minmax(0,1fr)!important}
/* Compact model/run stack; preserved state classes and pulse animation from R96. */
#onViewer #ms95-modelDock{top:42px!important;right:5px!important;left:auto!important;width:83px!important;max-width:83px!important;max-height:min(73%,660px)!important;padding:3px!important;gap:2px!important;border-radius:8px!important;background:rgba(255,253,255,.92)!important}
#onViewer #ms95-modelDock .ms95-dockCaption{font-size:9px!important;padding:0!important}
#onViewer #ms95-modelDock :is(.wxBar,.nvRunBar){gap:2px!important}
#onViewer #ms95-modelDock :is(.wxChip.wxM,button){font-size:10.2px!important;line-height:1.12!important;padding:3px 2px!important;min-height:24px!important;max-height:none!important;white-space:normal!important;overflow-wrap:normal!important;word-break:keep-all!important;hyphens:none!important}
#onViewer #ms95-modelDock :is(.wxChip.wxM,button).ms-g{background:#199b41!important;color:#fff!important;animation:ms95-pulse 1.15s ease-in-out infinite!important}
#onViewer #ms95-modelDock :is(.wxChip.wxM,button).ms-b{background:#1665cf!important;color:#fff!important;animation:none!important}
#onViewer #ms95-modelDock :is(.wxChip.wxM,button).ms-r{background:#cf2936!important;color:#fff!important;animation:none!important}
#onViewer #nvStage .nvZm{z-index:45!important}
#onViewer .nvTime :is(button,select,input),#onViewer .nvR5 :is(button,select,input),#onAside .nvR7 :is(button,select){writing-mode:horizontal-tb!important;word-break:keep-all!important;white-space:nowrap!important;min-width:0!important;color:var(--ms95-ink)!important}
/* All subpage nav in one row. Names must not wrap at character level. */
#msNav #msNavR1,#msNav #msNavR2{display:flex!important;flex-wrap:nowrap!important;overflow:hidden!important;gap:3px!important}
#msNav #msNavR2>.msSec{flex:1 1 0!important;min-width:0!important;padding:4px 3px!important;font-size:clamp(10px,.9vw,12px)!important;height:34px!important;line-height:1.1!important;white-space:nowrap!important;word-break:keep-all!important;overflow:hidden!important;text-overflow:ellipsis!important}
#msNav #msNavR2>.msSec.on{background:var(--ms95-green)!important;color:#17101e!important;border-color:#6ba91c!important}
/* Hide only duplicated applied/offline sub-tabs, after their full routing is present above. */
html.ms97-ap-nav #apApp #apMain>.card:has(>.apTabs),html.ms97-ap-nav #apMtBar{display:none!important}
html.ms97-nav-ready #anApp>#anTabs{display:none!important}
/* METEOGRAM (mountain): panels occupy proper right controls and left main graph tracks. */
#mtApp:not([hidden]){min-width:0!important;max-width:none!important;width:calc(100% - 20px)!important;margin:8px 10px!important;display:block!important}
#mtApp #mtMain.mtPage{display:grid!important;grid-template-columns:minmax(0,1fr) var(--ms97-panel)!important;grid-template-rows:auto auto 1fr auto!important;gap:9px!important;align-items:start!important;align-content:start!important;direction:ltr!important;max-width:none!important;width:100%!important;padding:0!important;margin:0!important}
#mtApp #mtMain>.apWB{grid-column:1 / -1!important;grid-row:1!important;margin:0!important}
#mtApp #mtMain>.mtTop{grid-column:2!important;grid-row:2!important;direction:rtl!important;max-width:100%!important;margin:0!important;padding:10px!important;min-width:0!important;position:relative!important}
#mtApp #mtMain>.card:not(.mtTop):not(.mtDet){grid-column:2!important;grid-row:3!important;direction:rtl!important;margin:0!important;padding:10px!important;max-width:100%!important;min-width:0!important;position:relative!important}
#mtApp #mtMain>.mtDet{grid-column:1!important;grid-row:2 / span 2!important;direction:rtl!important;margin:0!important;min-width:0!important;max-width:100%!important;align-self:start!important}
#mtApp #mtMain>p.hint{grid-column:1 / -1!important;grid-row:4!important}
#mtApp #mtMain>.mtTop :is(.mtBar,form,fieldset){display:flex!important;flex-flow:row wrap!important;gap:5px!important}
#mtApp #mtMain>.mtTop label{min-width:0!important;flex:1 1 125px!important;max-width:100%!important}
#mtApp #mtMain>.mtTop :is(select,input,button){max-width:100%!important;min-width:0!important}
#mtApp #mtMain>.mtDet :is(svg,canvas,img){max-width:100%!important}
#mtApp #mtMain .mtTabs{display:flex!important;flex-wrap:wrap!important;gap:4px!important}
#mtApp #mtMain .mtTabs button{font-size:12px!important;min-height:29px!important;max-width:100%!important;white-space:nowrap!important;word-break:keep-all!important}
#mtApp #mtMain .mtTbW{max-height:50vh!important;overflow:auto!important;max-width:100%!important}
/* Satellite/Radar page tabs and chart panel remain in their own columns. */
#saApp:not([hidden]) #saMain.saGrid{grid-template-columns:minmax(0,1fr) var(--ms97-panel)!important;gap:10px!important}
#saMain.saGrid>.saTop{grid-column:2!important;grid-row:1!important;direction:rtl!important;overflow-x:hidden!important;padding:9px!important}
#saMain.saGrid>.saCard{grid-column:1!important;grid-row:1!important;direction:rtl!important;min-width:0!important}
#saMain .saTabs{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px!important;min-width:0!important;max-width:100%!important}
#saMain .saTabs>.saTab{width:100%!important;min-width:0!important;max-width:100%!important;box-sizing:border-box!important;padding:5px 2px!important;font-size:11px!important;line-height:1.25!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;word-break:keep-all!important}
#saMain .saTop :is(.saGo,.saPanel,.saLays,.saLayRow){max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
#saMain .saTop .saGo{display:flex!important;flex-flow:row wrap!important;gap:6px!important}
#saMain .saTop .saGo>*{flex:1 1 130px!important;max-width:100%!important;min-width:0!important}
#saMain .saTop :is(.saGo,.saPanel) :is(button,select){font-size:12px!important;white-space:nowrap!important;word-break:keep-all!important}
/* FLASH FLOOD: narrow right-hand options and near-square map (fullscreen exempt). */
#flApp:not([hidden]) #flMain .flGrid{grid-template-columns:minmax(0,1fr) 275px!important;gap:10px!important;direction:ltr!important}
#flApp #flMain .flGrid>.flR,#flApp #flMain .flGrid>.p17-fl-side{grid-column:2!important;grid-row:1!important;width:100%!important;max-width:100%!important;min-width:0!important;direction:rtl!important}
#flApp #flMain .flGrid>.flL{grid-column:1!important;grid-row:1!important;width:100%!important;min-width:0!important;direction:rtl!important}
#flMain #flCv{display:block!important;aspect-ratio:1.14 / 1!important;width:min(100%,760px)!important;height:auto!important;min-height:0!important;max-height:none!important;margin-inline:auto!important}
#flMain .mtLgR{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:3px!important;align-items:center!important}
#flMain .mtLgR label{display:inline-flex!important;flex-wrap:nowrap!important;align-items:center!important;justify-content:flex-start!important;gap:3px!important;width:auto!important;min-width:0!important;max-width:100%!important;font-size:11px!important;white-space:nowrap!important;word-break:keep-all!important;padding:2px!important}
#flMain .flR :is(select,button,input){max-width:100%!important;min-width:0!important;font-size:12px!important}
/* Climate atlas: unite both settings racks on the right instead of tiny scattered columns. */
#caApp:not([hidden]){display:grid!important;grid-template-columns:minmax(0,1fr) 345px!important;grid-template-rows:auto auto!important;gap:8px!important;direction:ltr!important;align-items:start!important;max-width:100%!important;min-width:0!important}
#caApp:not([hidden])>main{grid-column:1!important;grid-row:1 / span 2!important;min-width:0!important;direction:rtl!important;max-width:100%!important;width:100%!important}
#caApp:not([hidden])>#caAside2{grid-column:2!important;grid-row:1!important;width:100%!important;max-width:100%!important;direction:rtl!important;position:relative!important;max-height:43vh!important;overflow-y:auto!important}
#caApp:not([hidden])>#caAside{grid-column:2!important;grid-row:2!important;width:100%!important;max-width:100%!important;direction:rtl!important;position:relative!important;max-height:50vh!important;overflow-y:auto!important}
#caApp:not([hidden]) :is(#caAside,#caAside2) :is(button,select,input){width:100%!important;max-width:100%!important;font-size:12px!important;writing-mode:horizontal-tb!important;word-break:keep-all!important}
/* Chart graphics must stay in the wide track, not overrun the side settings. */
#drApp :is(canvas,svg,img),#caApp main :is(canvas,svg,img),#ciApp main :is(canvas,svg,img){max-width:100%!important;height:auto;object-fit:contain}
#drApp :is(button,select),#ciApp :is(button,select),#caApp :is(button,select){writing-mode:horizontal-tb!important;word-break:keep-all!important}
/* Applied section: no tiles falling to the page bottom, all controls full-width and organized. */
#apApp:not([hidden]) #apMain{max-width:100%!important;min-width:0!important}
#apApp #apMain :is(.apGrid,.apRow,.apRow2){display:grid!important;grid-template-columns:repeat(auto-fit,minmax(250px,1fr))!important;gap:8px!important;align-items:start!important}
#apApp #apMain .apTabs button{font-size:12px!important;white-space:nowrap!important}
#apApp #apMain :is(button,select,input,textarea){min-width:0!important;max-width:100%!important;box-sizing:border-box!important;word-break:keep-all!important}
/* Keep notices noticeable through a subtle pulsing border, never flashing text. */
.apWB{border:2px solid #c9303c!important;border-radius:11px!important;animation:ms97-warn 1.7s ease-in-out infinite!important}
@keyframes ms97-warn{0%,100%{box-shadow:0 0 0 0 rgba(205,42,53,.10)}50%{box-shadow:0 0 0 4px rgba(205,42,53,.32)}}
@media(prefers-reduced-motion:reduce){.apWB{animation:none!important}}
/* Targeted button readability: semantic status chips, flood classes and map legends are excluded. */
html[data-ms95-theme=light] body :is(.mtPage,.panel,.card) :is(button,.btn,select,input,textarea):not(.wxM):not(.wxChip):not(.flB):not([style*="background:"]){color:#201429!important;background-color:#fbf8ff!important;border-color:#c7b6d0!important;text-shadow:none!important}
html[data-ms95-theme=light] body :is(.mtPage,.panel,.card) :is(button,.btn).on:not(.wxM):not(.wxChip),
html[data-ms95-theme=light] body :is(.mtPage,.panel,.card) :is(button,.btn)[aria-selected=true]:not(.wxM):not(.wxChip){color:#fff!important;background:#A935EB!important;border-color:#8328b9!important}
html[data-ms95-theme=dark] body :is(.mtPage,.panel,.card) :is(button,.btn,select,input,textarea):not(.wxM):not(.wxChip){color:#f6f3fa!important;background-color:#483c54!important;border-color:#796c88!important;text-shadow:none!important}
html[data-ms95-theme=dark] body :is(.mtPage,.panel,.card) :is(button,.btn).on:not(.wxM):not(.wxChip){color:#fff!important;background:#8535bc!important}
/* Never recolor the three live model state classes. */
#ms95-modelDock .ms-g{background:#199b41!important;color:#fff!important}#ms95-modelDock .ms-b{background:#1665cf!important;color:#fff!important}#ms95-modelDock .ms-r{background:#cf2936!important;color:#fff!important}
html.nvfOn #onViewer .nvStage{width:100%!important;max-width:none!important;aspect-ratio:auto!important}
