#pwa-dialog{width:min(620px,94vw);max-height:90dvh;overflow:auto;padding:0;border:1px solid #d3d9e0;border-radius:16px;background:#fff;color:#202630}
#pwa-dialog .modal-header{padding:18px 22px;border-bottom:1px solid #d3d9e0;display:flex;justify-content:space-between;align-items:center;gap:12px}
#pwa-dialog .modal-header h2{margin:0;font-size:22px}#pwa-dialog .modal-header button{flex-shrink:0;min-width:44px;min-height:44px}
.pwa-body{padding:20px 22px}.pwa-body section+section{border-top:1px solid #d3d9e0;margin-top:24px;padding-top:20px}.pwa-body h3{font-size:18px;margin:0 0 12px}.pwa-body p,.pwa-body li{font-size:15px;line-height:1.6;overflow-wrap:anywhere}.pwa-body ol{padding-left:22px}.pwa-body li+li{margin-top:8px}.pwa-actions{display:flex;gap:8px;flex-wrap:wrap}.pwa-actions button{min-height:44px}.pwa-state{padding:12px;border:1px solid #cbd3dd;border-radius:10px;background:#f5f7fa}.pwa-state[data-state=enabled]{background:#edf7ef;border-color:#99bfa1}.pwa-state[data-state=error]{background:#fff3e5;border-color:#d5b581}.pwa-body [hidden]{display:none!important}.pwa-note{color:#52606e}.pwa-entry{min-height:40px}.auth-card>.pwa-entry{margin-top:18px;width:100%}.auth-pending>#pwa-dialog[open]{display:block}
.pwa-offline{box-sizing:border-box;margin:0;min-height:100dvh;display:grid;place-items:center;padding:24px;font-family:"Segoe UI",Arial,sans-serif;background:#f4f5f7;color:#202630}.pwa-offline main{box-sizing:border-box;width:min(440px,100%);padding:28px;border:1px solid #d3d9e0;border-radius:18px;background:#fff}.pwa-offline h1{font-size:26px}.pwa-offline p{line-height:1.6}.pwa-offline img{border-radius:18px}.pwa-offline a{display:inline-block;padding:13px 18px;border-radius:10px;background:#19613f;color:#fff;text-decoration:none;font-weight:600}.pwa-offline small{color:#52606e}
@media(max-width:750px){
  html{scroll-padding-top:72px}body{padding-bottom:env(safe-area-inset-bottom)}main{min-width:0;max-width:100%}
  .sidebar{padding-top:max(8px,env(safe-area-inset-top));padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
  .nav-toggle{min-height:44px}#workspace-nav{max-height:65dvh;overscroll-behavior:contain}
  .account-bar{padding:8px 16px;justify-content:flex-start;gap:6px}.account-bar>span{flex:1 1 100%;font-size:13px}.account-bar button{min-height:40px;font-size:13px}
  input,select,textarea,.auth-card input{font-size:16px}button{touch-action:manipulation}input,select,textarea{max-width:100%}
  .workspace-actions>button,.workspace-filters>button,.task-actions>button{min-height:44px}.workspace-row{min-width:0}
  dialog:not(#detail){max-width:calc(100% - 16px);max-height:calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overscroll-behavior:contain}
  #tasks-dialog,#inbox-dialog,#settings-dialog,#create-dialog{width:calc(100% - 16px)}
  #auth-screen{min-height:100dvh;padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom))}.auth-card{padding:22px}.auth-card button{min-height:44px}
  .pwa-body{padding:16px}#pwa-dialog .modal-header{padding:16px}.pwa-actions>button{flex:1 1 160px}
}
@media(max-width:600px){
  #detail .deal-chat-context{padding-top:max(8px,env(safe-area-inset-top));padding-left:max(14px,env(safe-area-inset-left))}
  #detail .modal-header{top:max(0px,env(safe-area-inset-top))}
  #detail[data-pane=fields],#detail[data-pane=tools]{padding-bottom:env(safe-area-inset-bottom)}
  .task-card dl{grid-template-columns:minmax(90px,.7fr) minmax(0,1fr)}.task-card dd{overflow-wrap:anywhere}.task-title{flex-wrap:wrap}
  #toast{bottom:max(16px,env(safe-area-inset-bottom))}.incoming-banner{bottom:max(12px,env(safe-area-inset-bottom))}
}

@media(max-width:760px){
 /* Specificity must beat compact desktop selectors, including labels and tables. */
 body input,body select,body textarea,body label input,body label select,
 body .search input,body .filters select,body .stage-row input,body .stage-row select,
 body .proposal-table input,body .proposal-table td input+input,
 body #assign-form select,body #pipeline-period input,body #pipeline-period select{font-size:16px}
 #detail[data-pane="chat"] .detail-navigation button,
 #detail[data-pane="chat"] .conversation-heading button,
 #detail[data-pane="chat"] .conversation-tabs button,
 #detail[data-pane="chat"]>#detail-body>.claim-notice button{min-height:44px}
 #detail[data-pane="chat"] .chat-messages{min-height:180px;height:36dvh;max-height:360px}
}

@media(max-width:760px){
 /* The app has several compact selectors (including IDs). This single explicit
    mobile floor must win over all of them so Safari never receives tiny fields. */
 input:not([type="checkbox"]):not([type="radio"]),select,textarea{font-size:16px!important}
}
