
@media (max-width:900px){
  #main,#cnt,.pg{min-width:0}
  #tb{gap:8px}
  .tb-title{line-height:1.08}
  .tb-view-toggle,.vtog{flex:0 0 auto;border-radius:12px}
  .vbtn{min-width:38px;min-height:38px}
  .pg{padding-bottom:calc(12px + env(safe-area-inset-bottom));scroll-padding-bottom:calc(var(--mobile-nav-h) + 24px + env(safe-area-inset-bottom))}
  .pg>*,.card,.card-b,.dtb,.report-period,.rq-wrap,.rq-toolbar,.co-pipe-toolbar{max-width:100%;box-sizing:border-box}
  #sb{touch-action:pan-x;overscroll-behavior-x:contain}
  .ni{touch-action:manipulation}
  .ni-lb{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal}
  .btn,.vbtn,.co-more,.co-new,.co-setup,.dash-manager-tab{touch-action:manipulation}
  .card,.kpi,.rq-kpi,.driver-kpi,.co-fcard,.driver-card{box-shadow:0 7px 20px rgba(15,42,72,.06)}
  .card-h{gap:8px;flex-wrap:wrap;align-items:center}
  .card-t{min-width:0;line-height:1.2}
  .card-h .btn{min-height:36px}
  .card-b{min-width:0}

  .dash-pay-report,.dash-manager-report{scroll-margin-top:70px}
  .dash-pay-total{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .dash-pay-total span{border-radius:12px;text-align:center;padding:8px 10px;line-height:1.25}
  .dash-manager-tabs{position:sticky;top:0;z-index:6;background:#fff;border:1px solid var(--bor);border-radius:12px;padding:8px;margin:0 0 10px;box-shadow:0 8px 22px rgba(15,23,42,.06)}
  .dash-manager-tab{min-height:38px;padding:0 13px}
  .dash-pay-table-wrap,.dash-manager-table-wrap,.rq-table-wrap,.deals-table-wrap,.sp-table-wrap{max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y;border-radius:12px}
  .dash-pay-table-wrap .tbl,.dash-manager-table-wrap .tbl,.rq-table-wrap .tbl,.deals-table-wrap .tbl{display:table!important;white-space:normal}
  .dash-pay-table,.dash-manager-table{min-width:1040px;font-size:12px}
  .rq-full-table{min-width:1420px;font-size:12px}
  .deals-full-table{min-width:1380px;font-size:12px}
  .dash-pay-table th,.dash-pay-table td,.dash-manager-table th,.dash-manager-table td,.rq-full-table th,.rq-full-table td,.deals-full-table th,.deals-full-table td{padding:9px 8px}

  #pg-deals .dtb{display:grid!important;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px;position:sticky;top:0;z-index:8;background:#fff;border-bottom:1px solid var(--bor);box-shadow:0 8px 22px rgba(15,23,42,.06)}
  #pg-deals .dtb>.vtog{grid-column:1/2;width:max-content}
  #pg-deals .dtb>#pl-sel{grid-column:2/3;min-width:0!important;width:100%}
  #pg-deals .dtb>button{min-width:0!important;width:100%;justify-content:center;font-size:12px}
  #pg-deals .dtb>#no-task-btn{grid-column:1/-1}
  #pg-deals .dtb>div[style*="margin-left:auto"]{grid-column:1/-1;display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important;width:100%}
  #pg-deals .dtb>div[style*="margin-left:auto"] .deal-pipe-total{grid-column:1/-1;justify-content:flex-start;overflow-x:auto;padding:4px;border-radius:13px}
  .deal-period{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr)!important;align-items:center;gap:8px;position:relative;z-index:4;border-radius:0 0 14px 14px}
  .deal-period .report-period-title:first-child{grid-column:1/-1}
  .deal-period input[type="month"]{font-size:16px;min-width:0;width:100%}
  .deal-period #f-status{grid-column:1/-1}
  .deal-period .btn{min-width:0;width:100%;justify-content:center}
  .deal-period #deal-period-label{grid-column:1/-1;text-align:center;background:#eef5ff;border-radius:10px;padding:7px 9px}
  #fp{display:grid!important;grid-template-columns:1fr 1fr;gap:8px;padding:10px 12px;background:#edf4ff;border-bottom:1px solid var(--bor)}
  #fp .fc,#fp .plsel,#fp .btn,#fp .deal-filter-date{width:100%;min-width:0;max-width:none!important;height:42px}
  #fp .btn{grid-column:1/-1;justify-content:center}
  .kb-wrap,.rq-board,.co-funnel{padding-bottom:calc(18px + env(safe-area-inset-bottom))}

  .rq-toolbar{position:sticky;top:0;z-index:7;background:#fff;border-radius:0 0 14px 14px;box-shadow:0 8px 22px rgba(15,23,42,.06)}
  .rq-toolbar .fc,.rq-toolbar .plsel,.rq-toolbar .btn{min-height:44px}
  .rq-toolbar #rq-search{font-size:16px}
  .rq-kpis{gap:8px}
  .rq-kpi{min-height:96px}
  .rq-table-wrap{min-height:calc(100dvh - 300px)}
  .rq-board{min-height:calc(100dvh - 300px)}

  .co-pipe-toolbar{position:sticky;top:0;z-index:8;display:grid!important;grid-template-columns:auto minmax(0,1fr);gap:8px;min-height:auto;padding:10px 12px;background:#fff;border-radius:0 0 14px 14px;box-shadow:0 8px 22px rgba(15,23,42,.06)}
  .co-pipe-title{display:none!important}
  .co-pipe-toolbar>.vtog{grid-column:1/2;grid-row:1;width:max-content}
  .co-pipe-search{grid-column:1/-1;min-width:0;width:100%;min-height:44px}
  .co-pipe-search input{min-height:44px;font-size:16px}
  .co-pipe-actions{grid-column:1/-1;display:grid!important;grid-template-columns:1fr 44px;gap:8px;align-items:center;width:100%}
  .co-pipe-actions .co-pipe-total{grid-column:1/-1;min-width:0;text-align:left;font-size:12px;line-height:1.25}
  .co-more{width:44px!important;height:44px!important;min-width:44px}
  .co-new,.co-setup{height:44px!important;min-width:0!important;width:100%;font-weight:900}
  .co-pipe-actions .co-new:first-child,.co-pipe-actions .co-setup:first-child{grid-column:1/-1}
  .contact-filters{background:#edf4ff;border-bottom:1px solid rgba(203,213,225,.75)}
  .contact-filters .plsel,.contact-filters .btn{min-height:44px;font-size:16px}
  .cg,.lv,.cal-wrap{padding-bottom:calc(var(--mobile-nav-h) + 16px + env(safe-area-inset-bottom))}
  .co-funnel,.co-fcol,.co-fcards,.driver-grid{min-width:0}
  .co-fcard,.driver-card{min-height:0}
  .driver-card-top,.driver-line{min-width:0}
  .driver-name,.driver-carrier,.driver-line span{overflow-wrap:anywhere}

  #pg-mail-center,#pg-mail,#pg-email{overflow:hidden!important;padding:0!important}
  .m2{height:100%!important;min-height:0!important;display:flex!important;flex-direction:column!important}
  .m2-sb{width:100%!important;max-height:138px!important;min-height:0!important;border-right:0!important;border-bottom:1px solid #e0e7f0!important}
  .m2-fold{display:flex!important;gap:6px!important;overflow-x:auto!important;overflow-y:hidden!important;padding:0 10px 10px!important;scrollbar-width:none}
  .m2-fold::-webkit-scrollbar{display:none}
  .m2-f{flex:0 0 auto;min-width:118px;margin:0!important;justify-content:center}
  .m2-list{width:100%!important;flex:0 0 min(255px,36dvh)!important;border-right:0!important;border-bottom:1px solid #e0e7f0!important}
  .m2-view{width:100%!important;flex:1 1 auto!important;min-height:0!important}
  .m2-vt,.m2-lt{overflow-x:auto;scrollbar-width:none}
  .m2-vt::-webkit-scrollbar,.m2-lt::-webkit-scrollbar{display:none}
  .m2-vbody{padding:14px 14px calc(18px + env(safe-area-inset-bottom))!important}
  .m2-vsubj{font-size:18px;line-height:1.2}
  .m2-att .a{min-width:0;width:100%}
  .mail-editor-area,.mc-body,.client-mail-editor{min-height:180px;max-height:42dvh;font-size:16px}
  .mail-compose-box{height:94dvh!important}

  .mov{z-index:1600}
  .mod,.mod-lg,.mod-sm{height:calc(100dvh - env(safe-area-inset-top));max-height:calc(100dvh - env(safe-area-inset-top));border-radius:18px 18px 0 0}
  .mh{min-height:54px}
  .mb{padding-bottom:18px}
  .mf{grid-template-columns:repeat(auto-fit,minmax(104px,1fr));height:auto!important;min-height:58px;box-shadow:0 -8px 22px rgba(15,23,42,.08)}
  .deal-amo .mf,.company-amo .mf,.contact-amo .mf{height:auto!important;min-height:58px}
  textarea.fc,.client-mail-editor,.mail-editor-area,.mc-body{line-height:1.45}
  .deal-amo .mb,.company-amo .mb,.contact-amo .mb{height:calc(100dvh - 58px)}
  .dm-amo-head,.co-amo-head,.ct-amo-head{min-height:150px}
  .dm-amo-title,.co-amo-title,.ct-amo-title{font-size:19px;line-height:1.18;overflow-wrap:anywhere}
  .dm-main,.co-amo-main,.ct-amo-main,.dm-side,.co-amo-side,.ct-amo-side{padding-bottom:calc(var(--mobile-nav-h) + 16px + env(safe-area-inset-bottom))}
  .deal-amo .dm-main .fg,.co-fields .fg,.ct-fields .fg,.carrier-driver-panel .fg{padding-left:14px;padding-right:14px}
  .fc,.plsel{max-width:100%}
}
@media (max-width:520px){
  #tb{padding-left:10px;padding-right:10px}
  .tb-title{font-size:17px;max-width:calc(100vw - 86px)}
  body.page-requests .tb-title{max-width:calc(100vw - 172px)}
  #pg-deals .dtb{grid-template-columns:auto minmax(0,1fr)!important}
  #pg-deals .dtb>button{grid-column:auto}
  #pg-deals .dtb>#no-task-btn{grid-column:1/-1}
  .deal-period{grid-template-columns:1fr 1fr!important}
  .deal-period .report-period-title:first-child,.deal-period #f-status,.deal-period #deal-period-label{grid-column:1/-1}
  .deal-period .report-period-title:not(:first-child){display:none}
  .deal-period input[type="month"]{grid-column:auto}
  .deal-period .btn{grid-column:auto}
  #fp{grid-template-columns:1fr!important}
  .dash-pay-total,.contact-filters,.driver-summary{grid-template-columns:1fr!important}
  .co-pipe-actions{grid-template-columns:44px minmax(0,1fr)!important}
  .co-pipe-actions .co-pipe-total{grid-column:1/-1}
  .co-pipe-actions .co-more{grid-column:1/2;width:44px!important}
  .co-pipe-actions .co-setup,.co-pipe-actions .co-new{grid-column:2/3}
  .rq-kpis,.driver-summary{grid-template-columns:1fr 1fr!important}
  .rq-kpi,.driver-kpi{min-height:88px}
  .dash-pay-table,.dash-manager-table{min-width:960px}
  .rq-full-table{min-width:1320px}
  .deals-full-table{min-width:1280px}
}
