/* Mobile-first corrections for phones and small tablets */
html,body{max-width:100%;overflow-x:hidden}
img,svg,canvas,video{max-width:100%}
.shell,.main,.content{min-width:0;width:100%}
.content{overflow-wrap:anywhere}
/* Keep wide data tables usable without stretching the whole page */
.tbl-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.tbl-wrap table{min-width:620px}
.tbl-wrap th,.tbl-wrap td{overflow-wrap:normal}
.mono{white-space:nowrap}
.fields{grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr))}
input,select,textarea,button{max-width:100%}
@media(max-width:820px){
  .shell{display:block;min-height:100vh}
  .main{width:100%;min-height:100vh}
  .side{position:fixed;top:0;bottom:0;inset-inline-start:0;inset-inline-end:auto;width:min( min(86vw,320px), 320px);height:100dvh;max-height:100dvh;overflow-y:auto;z-index:1002;transform:translateX(110%);transition:transform .22s ease;box-shadow:0 0 28px rgba(0,0,0,.24);padding:16px 12px calc(18px + env(safe-area-inset-bottom))}
  html[dir="ltr"] .side{transform:translateX(-110%)}
  .side.open,.side.open[dir="rtl"]{transform:translateX(0)}
  html[dir="ltr"] .side.open{transform:translateX(0)}
  body.nav-open{overflow:hidden}
  body.nav-open::after{content:"";position:fixed;inset:0;background:rgba(4,13,23,.52);z-index:1001}
  .side-brand{padding:4px 10px 18px}
  .side nav{overflow:visible;flex:1}
  .side-foot{margin-top:18px}
  .bar{position:sticky;top:0;z-index:900;min-height:64px;padding:10px 12px;gap:8px}
  .bar-title{flex:1;min-width:0}
  .bar-title h1{font-size:clamp(15px,4vw,19px);line-height:1.35;overflow-wrap:anywhere}
  .bar-title p{font-size:10px}
  .bar-actions{gap:5px;flex:none}
  .tool-btn{min-width:34px;height:34px;padding:0 8px;font-size:12px}
  .burger{display:inline-flex;align-items:center;justify-content:center;flex:none;width:38px;height:38px;padding:8px;background:var(--surface2);color:var(--text);border:1px solid var(--border)}
  .content{padding:17px 12px calc(28px + env(safe-area-inset-bottom));}
  .welcome-row{align-items:flex-start;flex-direction:column;gap:8px;margin-bottom:15px}
  .welcome-row h2{font-size:20px}
  .updated-chip{white-space:normal}
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .stat-card{padding:12px;min-width:0}
  .stat-card strong{font-size:clamp(21px,6vw,27px);overflow-wrap:anywhere}
  .stat-top{font-size:11px;gap:5px}
  .stat-icon{width:30px;height:30px;flex:none}
  .dashboard-columns,.lower-columns{grid-template-columns:minmax(0,1fr);gap:11px}
  .surface,.panel,.card{padding:13px;border-radius:11px;min-width:0}
  .section-head{align-items:flex-start;flex-wrap:wrap}
  .tower-map{height:clamp(220px,62vw,320px)}
  .device-row{gap:8px;flex-wrap:wrap}
  .device-copy{min-width:0;flex:1 1 130px}
  .settings-grid{grid-template-columns:minmax(0,1fr)}
  .filter{align-items:stretch;flex-direction:column}
  .filter select{width:100%;min-width:0}
  .btns{flex-wrap:wrap}
  .btns .btn,.fields .btn{max-width:100%}
  .info-list>div{gap:4px;padding:10px 2px}
}
@media(max-width:420px){
  .bar{padding-inline:9px;gap:6px}
  .bar-title p{display:none}
  .bar-actions{gap:4px}
  .tool-btn{min-width:32px;padding-inline:6px}
  .content{padding-inline:9px}
  .stats-grid{gap:7px}
  .stat-card{padding:10px}
  .stat-card strong{font-size:22px}
  .stat-top{font-size:10px}
  .surface,.panel{padding:11px}
  .section-head h3{font-size:14px}
  th,td{padding:9px 10px;font-size:13px}
}
@media(prefers-reduced-motion:reduce){.side{transition:none}}
