/* Shared device layouts; loaded after feature styles. No external dependencies. */
main,#app,.page-heading>div,.header-actions,.grid>*,.two-col>*,.three-col>*{min-width:0}
.actions,.inline-filters,.download-actions,.legend{flex-wrap:wrap}
.page-heading .actions{max-width:none}
.stat-value,.stat-note,.notice,.event-info,.archive-hero,.plant-caption{overflow-wrap:anywhere}
.nav-shade{display:none}
body.overlay-open{overflow:hidden}
.sidebar{overscroll-behavior:contain;padding-top:max(24px,env(safe-area-inset-top))}
.sidebar-close{display:none}
.filter-toggle{display:none}
.modal{overscroll-behavior:contain;max-height:calc(100dvh - 48px)}
.modal-head{position:sticky;top:-25px;background:white;z-index:5;padding:12px 0}
.modal-head h2{overflow-wrap:anywhere;line-height:1.5}
.modal-head .icon-btn{flex-shrink:0}
.modal-footer{flex-wrap:wrap}
.terminal-viewport{width:100%;max-width:516px;position:relative;margin:0 auto}
.terminal-viewport .terminal-case{position:absolute;top:0;left:0;transform-origin:top left;margin:0;max-width:none}
.diagram-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 16px;background:#112b42;color:#a9c9de;font-size:12px}
.diagram-tools button{min-height:36px;padding:6px 12px;border-color:#355d7b;background:#1a3a54;color:#c4e6f5}
.diagram-tools span{margin-right:auto;line-height:1.7}
.scada-scroll{overscroll-behavior-x:contain;max-width:100%;touch-action:pan-x pan-y}
.scada-scroll:focus-visible{outline:3px solid #60b8e0;outline-offset:-3px}
.scada-scroll.diagram-fit .process-svg,.scada-scroll.diagram-fit .scada-svg{width:100%;min-width:0}
@media(max-width:1200px){
 .topbar{gap:10px;padding:12px 20px;height:auto;min-height:76px}
 .topbar>strong{font-size:14px;max-width:260px;line-height:1.6}
 .header-actions{gap:8px;flex-shrink:0}
 .grid.equal{grid-template-columns:1fr}
 .page-heading{align-items:flex-start;flex-wrap:wrap}
 .page-heading .actions{justify-content:flex-start}
 .terminal-layout{grid-template-columns:minmax(0,1fr)}
 .terminal-copy{display:block;padding:12px 0}
 .cockpit-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .cockpit-hero{gap:20px}
}
@media(max-width:1000px){
 .sidebar{width:260px;transform:translateX(-100%);transition:transform .2s;z-index:40}
 .sidebar.open{transform:none}
 main{margin-left:0}
 .mobile-menu{display:inline-flex;flex-shrink:0}
 .sidebar-close{display:flex;position:absolute;right:8px;top:8px;color:#c8d8e8}
 .nav-shade:not([hidden]){display:block;position:fixed;inset:0;background:#10233d80;z-index:35;border:0;border-radius:0;width:100%;height:100%;backdrop-filter:blur(2px)}
 .topbar{position:sticky;top:0;z-index:25;padding-top:max(10px,env(safe-area-inset-top));background:#fff}
 .topbar>strong{max-width:none;flex:1}
 .sidebar-bottom{padding-top:16px;min-height:95px}
 .topbar .display-entry{font-size:12px}
 .header-actions .display-entry:before{content:none}
 #app{padding:24px}
 .filter-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .terminal-copy{display:none}
}
@media(max-width:700px){
 body{font-size:14px}
 #app{padding:20px 14px calc(24px + env(safe-area-inset-bottom))}
 .topbar{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right));flex-wrap:wrap;gap:6px 8px;min-height:100px}
 .topbar>strong{font-size:15px;max-width:calc(100% - 54px);line-height:1.5}
 .topbar .header-actions{width:100%;justify-content:flex-end;gap:8px}
 .topbar .display-entry{margin-right:auto;font-size:13px;min-height:40px;padding:8px 12px}
 .topbar .display-entry:before{content:none}
 .icon-btn{width:44px;height:44px;flex-shrink:0}
 .header-actions .user-button{min-width:44px;min-height:44px;justify-content:center}
 #user-label{display:none}
 button,.btn{min-height:44px;font-size:13px}
 input,select,textarea,.filter-grid input,.filter-grid select{font-size:16px;min-height:44px;max-width:100%}
 input[type=checkbox]{min-height:22px;min-width:22px;width:22px;height:22px}
 .filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px}
 .filter-grid label{font-size:12px}
 .filter-bar{padding:16px 14px;margin-bottom:16px}
 .filter-title{gap:12px;flex-wrap:wrap}
 .filter-toggle{display:inline-flex;margin-left:auto;font-size:13px}
 .filter-bar[data-folded=true] .filter-grid,.filter-bar[data-folded=true]>p{display:none}
 .page-heading{display:block;margin-bottom:20px}
 .page-heading h1{font-size:24px;line-height:1.4}
 .page-heading .actions{width:100%;max-width:none;justify-content:flex-start;margin-top:14px;gap:8px}
 .page-heading .actions button{font-size:13px;padding:10px 12px}
 .page-heading .actions select{width:100%!important}
 .eyebrow{font-size:9px;letter-spacing:1.4px}
 .muted{font-size:12px}
 .panel{padding:16px 14px}
 .panel h2{flex-wrap:wrap;line-height:1.7;gap:4px 10px}
 .panel h2 small{font-size:11px}
 .stats,.cockpit-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .stat{padding:16px 12px}
 .stat-label{font-size:12px;gap:5px}
 .stat-value{font-size:25px;line-height:1.3}
 .stat-value small{font-size:11px}
 .stat-note{font-size:11px;line-height:1.7}
 .stat-label .icon{width:17px;height:17px}
 .grid,.grid.equal,.two-col,.three-col{grid-template-columns:minmax(0,1fr)}
 .cockpit-hero{padding:22px 18px}
 .cockpit-hero h2{font-size:24px}
 .cockpit-hero:after{pointer-events:none}
 .cockpit-filter{gap:10px;margin:16px 0;flex-wrap:wrap}
 .cockpit-filter label{width:100%;justify-content:space-between;min-width:0}
 .cockpit-filter select{width:65%;min-width:0;max-width:100%}
 .cockpit-filter>span{line-height:1.8}
 .network-summary{justify-content:flex-start;gap:12px 18px;line-height:1.8}
 .station-cards{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x proximity;overscroll-behavior-x:contain;padding:3px 2px 12px}
 .station-card{padding:18px;flex:0 0 88%;scroll-snap-align:start}
 .station-card footer{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between;line-height:1.6}
 .station-card footer span{float:none}
 .severity-grid{gap:8px}
 .severity-card{padding:14px 10px;white-space:normal}
 .severity-card small{font-size:11px}
 .critical-strip{padding:14px;line-height:1.8}
 .page-tabs{flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding:3px 2px 8px;gap:7px;overscroll-behavior-x:contain}
 .page-tabs button{white-space:nowrap;flex-shrink:0;font-size:13px;min-height:44px}
 .selection-bar,.selection-bar .actions{align-items:flex-start;gap:10px}
 .selection-bar button{min-height:44px;font-size:13px;padding:8px 12px}
 .toolbar{align-items:stretch}
 .toolbar input,.toolbar select,.search-wrap{width:100%}
 .toolbar .spacer{display:none}
 .toolbar>.btn,.toolbar>button{flex:1}
 .scada-top{padding:16px 14px;line-height:1.8;flex-wrap:wrap}
 .scada-top>div{flex-wrap:wrap}
 .plant-caption{padding:14px;line-height:1.8}
 .diagram-tools{padding:12px}
 .diagram-tools button{min-height:44px}
 .room-info{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 12px}
 .archive-hero{align-items:flex-start;flex-wrap:wrap;line-height:1.8}
 .archive-toolbar{display:block}
 .archive-toolbar>.btn{margin-top:12px}
 .modal-backdrop{padding:10px max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}
 .modal,.modal.wide{width:100%;max-height:calc(100dvh - 24px - env(safe-area-inset-bottom));padding:16px;border-radius:12px}
 .modal-head{top:-16px;padding:10px 0;margin-bottom:16px;gap:10px}
 .modal-head h2{font-size:18px}
 .modal-footer{position:sticky;bottom:-16px;background:white;z-index:4;padding:12px 0;margin-top:16px;box-shadow:0 -8px 12px #fff;gap:10px}
 .modal-footer button{flex:1;white-space:normal}
 .modal .table-wrap{max-height:55dvh}
 .download-actions{gap:12px;align-items:flex-start}
 .timeline-item{flex-wrap:wrap;line-height:1.8}
 .timeline-item .event-info{min-width:150px}
 .toast{bottom:calc(16px + env(safe-area-inset-bottom));padding:12px 18px;line-height:1.8}
 .login-layout{display:block;min-height:100dvh}
 .login-story{display:none}
 .login-panel{padding:32px 24px 20px;min-height:100dvh;gap:24px}
 .login-panel footer{position:static;text-align:center;line-height:1.8}
 .login-form{width:390px}
 .login-form .muted{margin-bottom:24px}
 .login-form h2{font-size:25px}
 .login-form label{font-size:14px;margin-bottom:18px}
 .quick-login{padding:14px}
 .quick-login-grid{max-height:none}
 .quick-login-grid button{min-height:68px}
 .quick-login-grid button strong{font-size:13px}
 .quick-login-grid button small{font-size:11px;line-height:1.7}
 .login-hint{line-height:1.8}
 .install-card{padding:24px 18px}
 .requirements{flex-wrap:wrap}
}
/* Small screens keep every field and action, with column labels on each record. */
@media(max-width:600px){
 .table-wrap>table,.modal .table-wrap>table{min-width:0;display:block;width:100%}
 .table-wrap>table thead{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
 .table-wrap>table tbody{display:grid;gap:14px;width:100%}
 .table-wrap>table tr{display:block;border:1px solid #e2eaf4;border-radius:10px;padding:6px 12px;background:white;min-width:0}
 .table-wrap>table td,.modal .table-wrap>table td{display:block;width:100%;max-width:none;border-bottom:1px solid #eef2f7;padding:10px 0;font-size:13px;line-height:1.8;white-space:normal;overflow-wrap:anywhere}
 .table-wrap>table td:before{content:attr(data-label);display:block;font-size:11px;color:#8394aa;margin-bottom:4px;line-height:1.6}
 .table-wrap>table td:has(>input[type=checkbox]):before{display:inline-block;margin:0 12px 0 0}
 .table-wrap>table td:last-child{border:0}
 .table-wrap>table td .link{min-height:44px;padding:8px 10px;font-size:13px;border:1px solid #e1eaf6;background:#f5f9ff;margin:4px 6px 4px 0;white-space:normal}
 .table-wrap>table .cell-sub{font-size:11px}
 .table-footer{font-size:12px;line-height:1.8;align-items:flex-start}
 .table-footer .actions{width:100%}
 .table-footer button{flex:1;min-height:44px}
 .modal th{position:static}
}
@media(max-width:380px){
 .filter-grid{grid-template-columns:minmax(0,1fr)}
 .stat-value{font-size:23px}
 .stat-label .icon{display:none}
 .header-actions{gap:4px!important}
 .topbar .display-entry{padding:8px;font-size:12px}
 .severity-card{padding:12px 8px}
}
@media(max-height:600px) and (min-width:701px){
 .login-panel{justify-content:flex-start;padding:24px}
 .login-panel footer{position:static;margin-top:24px}
 .login-story-content{margin-top:20px}
 .login-art{height:120px;margin:10px 0}
 .modal{max-height:calc(100dvh - 24px)}
}
