/* Fleet Integrity — Admin mobile UI polish
   Visual-only layer. Keeps existing behaviour and data workflows intact. */

@media(max-width:900px){
  html,body{max-width:100%;overflow-x:hidden}
  body.v4-ready{font-size:14px}
  body.v4-ready main{
    width:100%!important;
    max-width:none!important;
    padding:0 12px calc(96px + env(safe-area-inset-bottom))!important;
  }

  body.v4-ready main>header{
    min-height:0!important;
    margin:0 -12px 14px!important;
    padding:max(11px,env(safe-area-inset-top)) 12px 12px!important;
    gap:8px 10px!important;
    border-bottom:1px solid var(--v4-line)!important;
  }
  body.v4-ready main>header>div:first-child{min-width:0;flex:1 1 180px}
  body.v4-ready main>header .eyebrow{margin-bottom:4px;font-size:9px;letter-spacing:.13em}
  body.v4-ready #viewTitle{font-size:22px!important;line-height:1.12!important;overflow-wrap:anywhere}
  body.v4-ready #viewSub{margin-top:4px;font-size:11px!important;line-height:1.35}
  body.v4-ready .v4-header-tools{gap:6px!important;margin-left:auto!important}
  body.v4-ready .v4-search-trigger,
  body.v4-ready .v4-create-trigger{
    min-width:44px;min-height:44px!important;padding:9px 11px!important;border-radius:12px!important;
  }
  body.v4-ready .v4-search-trigger .label,
  body.v4-ready .v4-search-trigger kbd{display:none!important}
  body.v4-ready .user{gap:6px!important}
  body.v4-ready .user #userEmail,
  body.v4-ready .user .avatar{display:none!important}
  body.v4-ready .header-signout{min-height:44px!important;padding:8px 10px!important;font-size:11px!important}

  body.v4-ready .view{width:100%;max-width:100%;padding-bottom:20px}
  body.v4-ready .view>.toolbar,
  body.v4-ready .toolbar{
    width:100%;display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:start!important;
    gap:10px!important;margin:0 0 14px!important;
  }
  body.v4-ready .toolbar>div{min-width:0}
  body.v4-ready .toolbar h2{margin:0!important;font-size:20px!important;line-height:1.15!important}
  body.v4-ready .toolbar p{margin:5px 0 0!important;font-size:11px!important;line-height:1.4!important}
  body.v4-ready .toolbar>button{
    min-height:44px!important;padding:9px 12px!important;border-radius:11px!important;white-space:nowrap;font-size:11px!important;
  }

  body.v4-ready .stats,
  body.v4-ready .invoice-stats,
  body.v4-ready .v4-grid-4{gap:9px!important}
  body.v4-ready .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important;margin-bottom:12px!important}
  body.v4-ready .stats article,
  body.v4-ready .invoice-stats article,
  body.v4-ready .v4-stat{
    min-width:0;padding:13px!important;border-radius:14px!important;
  }
  body.v4-ready .stats span,
  body.v4-ready .invoice-stats span,
  body.v4-ready .v4-stat span{font-size:9px!important;line-height:1.25!important}
  body.v4-ready .stats strong,
  body.v4-ready .v4-stat strong{margin-top:5px!important;font-size:22px!important;line-height:1.1!important}

  body.v4-ready .grid,
  body.v4-ready .grid.lower,
  body.v4-ready .workspace-grid,
  body.v4-ready .tm-columns{grid-template-columns:minmax(0,1fr)!important;gap:12px!important}

  body.v4-ready .panel,
  body.v4-ready .v4-panel{
    min-width:0!important;padding:14px!important;margin-bottom:12px!important;border-radius:15px!important;
  }
  body.v4-ready .panel-head{gap:9px!important;align-items:flex-start!important}
  body.v4-ready .panel-head h2,
  body.v4-ready .v4-panel h3{font-size:15px!important;line-height:1.25!important}
  body.v4-ready .panel-head p{font-size:10.5px!important;line-height:1.4!important}

  body.v4-ready input,
  body.v4-ready select,
  body.v4-ready textarea{
    max-width:100%;min-width:0;min-height:46px!important;font-size:16px!important;border-radius:11px!important;
  }
  body.v4-ready textarea{line-height:1.45}
  body.v4-ready button{touch-action:manipulation}

  body.v4-ready .filterbar,
  body.v4-ready .v4-filter-row{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important;width:100%;margin:0 0 12px!important;
  }
  body.v4-ready .filterbar>*,
  body.v4-ready .v4-filter-row>*{width:100%!important;min-width:0!important;margin:0!important}
  body.v4-ready .v4-filter-row button{grid-column:1/-1}

  body.v4-ready .fi-searchbar,
  body.v4-ready .fi-search-input-wrap,
  body.v4-ready .table-search,
  body.v4-ready .search-wrap{width:100%!important;max-width:100%!important;min-width:0!important}
  body.v4-ready .fi-search-input-wrap{display:flex!important}
  body.v4-ready .fi-search-input-wrap input{flex:1!important;min-width:0!important}

  body.v4-ready .table-wrap,
  body.v4-ready .table{
    max-width:100%!important;border-radius:15px!important;
  }
  body.v4-ready .fi-mobile-record-table tbody{gap:9px!important}
  body.v4-ready .fi-mobile-record-table tbody tr{
    padding:12px!important;border-radius:14px!important;box-shadow:none!important;
  }
  body.v4-ready .fi-mobile-record-table tbody td{
    padding:7px 6px!important;font-size:12px!important;line-height:1.35!important;
  }
  body.v4-ready .fi-mobile-record-table tbody td:first-child{
    padding-bottom:10px!important;font-size:15px!important;line-height:1.2!important;
  }
  body.v4-ready .fi-mobile-record-table tbody td button{
    min-height:40px!important;margin:2px 2px 2px 0!important;padding:8px 10px!important;
  }

  body.v4-ready .v4-workspace-head{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:11px!important;
    padding:8px 0 13px!important;margin-bottom:12px!important;
  }
  body.v4-ready .v4-workspace-head h1{font-size:23px!important;line-height:1.12!important}
  body.v4-ready .v4-workspace-head p{font-size:11px!important;line-height:1.4!important}
  body.v4-ready .v4-workspace-head-actions{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important;width:100%;
  }
  body.v4-ready .v4-workspace-head-actions>*,
  body.v4-ready .v4-workspace-head>.v4-back-button{width:100%!important;min-height:44px!important}
  body.v4-ready .v4-workspace-tab-select{margin-bottom:10px!important}
  body.v4-ready .v4-workspace-tab-select select,
  body.v4-ready .v4-subnav-select select{box-shadow:none!important}

  body.v4-ready .v4-detail-grid{gap:8px!important}
  body.v4-ready .v4-detail{padding:11px!important;border-radius:11px!important}
  body.v4-ready .v4-detail strong{font-size:13px!important;line-height:1.35!important}
  body.v4-ready .v4-mini-list{gap:7px!important}
  body.v4-ready .v4-mini-row{
    min-width:0!important;align-items:flex-start!important;padding:11px!important;border-radius:12px!important;
  }
  body.v4-ready .v4-mini-row>div,
  body.v4-ready .v4-mini-row>span{min-width:0}
  body.v4-ready .v4-mini-row strong{font-size:13px!important;white-space:normal!important;line-height:1.3!important}
  body.v4-ready .v4-mini-row small{white-space:normal!important;line-height:1.35!important}

  body.v4-ready .v4-record-drawer{width:100vw!important}
  body.v4-ready .v4-drawer-head{padding:14px!important;padding-top:calc(14px + env(safe-area-inset-top))!important}
  body.v4-ready .v4-drawer-head h2{font-size:21px!important}
  body.v4-ready .v4-drawer-body{padding:14px 14px 24px!important}
  body.v4-ready .v4-drawer-actions{gap:8px!important;padding:10px 12px calc(10px + env(safe-area-inset-bottom))!important}

  body.v4-ready #v4Command{padding:6vh 10px!important}
  body.v4-ready .v4-command-box{border-radius:16px!important;max-height:84dvh!important}
  body.v4-ready .v4-command-input{padding:10px!important}
  body.v4-ready .v4-command-result{
    grid-template-columns:64px minmax(0,1fr) auto!important;padding:10px!important;
  }

  body.v4-ready .v4-bottom-nav{
    padding:6px 4px calc(6px + env(safe-area-inset-bottom))!important;
    box-shadow:0 -8px 28px rgba(2,9,19,.12);
  }
  body.v4-ready .v4-bottom-nav button{min-width:0!important;min-height:52px!important}
  body.v4-ready .v4-bottom-nav button span:first-child{font-size:18px!important}
  body.v4-ready .v4-bottom-nav button span:last-child{font-size:9px!important}

  body.v4-ready dialog:not(#fiOnboardingDialog){
    max-width:calc(100vw - 20px)!important;max-height:calc(100dvh - 20px)!important;
    border-radius:16px!important;
  }
  body.v4-ready dialog form{max-width:100%!important}
  body.v4-ready .form-grid{grid-template-columns:minmax(0,1fr)!important;gap:11px!important}
  body.v4-ready .form-grid .full{grid-column:auto!important}
  body.v4-ready .modal-head{gap:10px!important;padding:14px!important}
  body.v4-ready .modal-actions{gap:8px!important;padding:12px 14px!important}
  body.v4-ready .modal-actions>*{min-height:44px!important}
}

@media(max-width:520px){
  body.v4-ready main{padding-inline:10px!important}
  body.v4-ready main>header{margin-inline:-10px!important;padding-inline:10px!important}
  body.v4-ready #viewTitle{font-size:20px!important}
  body.v4-ready #viewSub{display:none}
  body.v4-ready .toolbar{grid-template-columns:minmax(0,1fr)!important}
  body.v4-ready .toolbar>button{width:100%!important}
  body.v4-ready .stats,
  body.v4-ready .v4-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.v4-ready .invoice-stats{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  body.v4-ready .filterbar,
  body.v4-ready .v4-filter-row{grid-template-columns:minmax(0,1fr)!important}
  body.v4-ready .v4-filter-row button{grid-column:auto}
  body.v4-ready .v4-detail-grid{grid-template-columns:minmax(0,1fr)!important}
  body.v4-ready .v4-workspace-head-actions{grid-template-columns:minmax(0,1fr)!important}
  body.v4-ready .v4-command-result{grid-template-columns:54px minmax(0,1fr)!important}
  body.v4-ready .v4-command-result>span:last-child{display:none!important}
}

@media(max-width:360px){
  body.v4-ready .stats{grid-template-columns:minmax(0,1fr)!important}
  body.v4-ready .stats article{display:flex;align-items:center;justify-content:space-between;gap:10px}
  body.v4-ready .stats strong{margin-top:0!important}
}
