/* Compact mobile app frame — v0.6.1 */
@media (max-width:640px){
  html,body{width:100%;height:100%;overflow:hidden}
  body{font-size:13px;background:#070b13}
  .shell{position:relative;isolation:isolate;width:min(100%,420px);max-width:420px;height:100dvh;min-height:0;margin:0 auto;overflow:hidden;display:grid;grid-template-rows:56px minmax(0,1fr) 58px;background:rgba(11,15,25,.96);border-inline:1px solid rgba(255,255,255,.07);box-shadow:0 0 54px rgba(0,0,0,.45)}
  .shell:before,.shell:after{content:"";position:absolute;z-index:-1;border-radius:50%;pointer-events:none;filter:blur(78px);opacity:.2}
  .shell:before{width:210px;height:210px;right:-95px;top:68px;background:#8B5CF6}
  .shell:after{width:190px;height:190px;left:-105px;bottom:82px;background:#22D3EE;opacity:.12}
  .top{grid-row:1;position:relative;inset:auto;z-index:5;min-width:0;height:56px;padding:9px 11px;background:rgba(11,15,25,.83);border-bottom:1px solid rgba(255,255,255,.08);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)}
  .brand{min-width:0}.brand strong{display:block;font-size:15px;line-height:1.15}.brand small{max-width:220px;font-size:9px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .sync{flex:0 0 auto;max-width:116px;padding:5px 7px;font-size:9px;line-height:1.15;text-align:center;white-space:normal}
  .page{grid-row:2;position:relative;z-index:1;width:100%;max-width:none;min-width:0;height:100%;margin:0;padding:12px 10px 22px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:thin}
  .page>*{max-width:100%;min-width:0}
  .nav{grid-row:3;position:relative;z-index:6;display:flex;align-items:stretch;width:100%;height:58px;margin:0;padding:5px 6px calc(5px + env(safe-area-inset-bottom));gap:2px;overflow-x:auto;overflow-y:hidden;background:rgba(11,15,25,.9);border-top:1px solid rgba(255,255,255,.09);border-bottom:0;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);scrollbar-width:none}
  .nav::-webkit-scrollbar{display:none}
  .nav button,.nav button.active{flex:1 0 48px;min-width:48px;height:46px;margin:0!important;padding:6px 3px;border:1px solid transparent;border-radius:11px;box-shadow:none;font-size:9.5px;font-weight:700;line-height:1.05;transform:none;transition:color .15s,background-color .15s,border-color .15s}
  .nav button.active{background:rgba(139,92,246,.18);color:#C4B5FD;border-color:rgba(139,92,246,.28)}
  .toolbar,.main-toolbar{align-items:center;gap:8px;margin-bottom:10px}.toolbar h1,.page>h1{font-size:20px;line-height:1.2}.page>h2{font-size:15px;margin:19px 0 9px}
  .btn,.input{font-size:12px}.btn{padding:8px 10px;border-radius:10px}.btn.small{padding:7px 8px;font-size:11px}.input{padding:9px 10px}
  .grid,.customer-jobs,.cols,.detail-grid{grid-template-columns:minmax(0,1fr);gap:8px}
  .card,.form-card{padding:13px;border-radius:15px}.form-card{width:100%;margin:8px auto 18px}.card h3{font-size:15px;line-height:1.3}.meta{font-size:11px;gap:5px}.badge{font-size:10px;padding:3px 7px}.actions{gap:5px;margin-top:9px}
  .customer-list{gap:8px}.customer-group{border-radius:14px}.customer-group summary{min-height:54px;padding:8px 11px;gap:8px}.customer-main strong{font-size:13px}.customer-main small{font-size:10px}.customer-jobs{padding:0 8px 8px}.customer-jobs .card{padding:12px}
  .active-strip{gap:8px;padding:10px;margin-bottom:10px;border-radius:13px}.quick-grid{gap:5px}.quick-grid button{min-height:34px;font-size:10px;padding:6px 7px}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-bottom:14px}.stats>div{padding:9px;border-radius:12px}.stats strong{font-size:20px}.stats small{font-size:10px}
  .filters{gap:7px;padding:9px}.team-row{align-items:stretch;flex-direction:column;gap:7px}
  .dash-head{gap:10px;margin:0 0 12px}.dash-head h1{font-size:23px;margin:3px 0 4px}.dash-head p{font-size:11px;line-height:1.45}.date-control{width:100%;font-size:9px}
  .bento{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.glass{padding:11px;border-radius:15px;background:rgba(20,25,38,.78);border-color:rgba(255,255,255,.09);box-shadow:0 12px 34px rgba(0,0,0,.2);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
  .metric{min-height:108px}.metric-icon{top:11px;left:11px;width:27px;height:27px;border-radius:8px;font-size:11px}.metric strong{font-size:27px}.metric small,.metric p{font-size:9.5px}.metric:after{width:82px;height:82px}
  .workload-panel,.status-panel,.risk-panel,.briefing-panel{grid-column:span 2}.panel-title{gap:8px;margin-bottom:11px}.panel-title h2,.glass h2{font-size:14px}.panel-title p{font-size:10px}.panel-note{font-size:8.5px;padding:4px 6px}.workload-list{gap:10px}.avatar{width:30px;height:30px;border-radius:9px}.work-row{gap:8px}.work-row>b{font-size:15px}
  .donut-wrap{min-height:124px;gap:12px}.donut{width:102px;height:102px}.donut:before{inset:15px}.donut strong{font-size:21px}.legend{min-width:125px;gap:5px}.legend span{font-size:9px}.risk-list{gap:6px}.risk-list>div{padding:7px}.brief-list{gap:6px}.brief-row{min-height:48px;padding:8px 9px;gap:8px;border-radius:11px}.brief-row strong{font-size:11px}.brief-row small{font-size:9px}
  #install-app{right:max(10px,calc((100vw - 420px)/2 + 10px));bottom:66px;padding:9px 12px;font-size:11px}
  #theme-toggle{right:max(10px,calc((100vw - 420px)/2 + 10px));bottom:106px;width:36px;height:36px}
}

@media (max-width:360px){
  .shell{grid-template-rows:54px minmax(0,1fr) 56px}.top{height:54px;padding-inline:9px}.brand small{max-width:175px}.sync{max-width:92px;font-size:8px}.page{padding-inline:8px}.nav{height:56px;padding-inline:4px}.nav button,.nav button.active{flex-basis:46px;min-width:46px;font-size:9px}.glass,.card,.form-card{padding:10px}.metric{min-height:101px}.donut{width:92px;height:92px}.legend{min-width:112px}}

[data-theme="light"] .shell{background:rgba(244,247,252,.97);border-color:rgba(30,41,59,.08)}
@media (max-width:640px){[data-theme="light"] .top,[data-theme="light"] .nav{background:rgba(247,249,253,.87);border-color:rgba(30,41,59,.09)}[data-theme="light"] .glass{background:rgba(255,255,255,.82);border-color:rgba(30,41,59,.09)}}
