/* Phone-first overrides shared by all CRM workflows; desktop layouts stay available. */
@media (pointer:coarse) {
  button,.btn,.btn.sm,.chipbtn,.wa-tool,.seg button,.wa-tab { min-height:48px; min-width:44px; touch-action:manipulation; }
  input:not([type=checkbox]):not([type=radio]):not([type=color]),select,textarea { min-height:48px; font-size:16px; }
  label.row,.perm { min-height:48px; }
}
@media (max-width:760px) {
  html,body { overflow:hidden; overscroll-behavior:none; }
  #app,.shell { height:var(--app-height,100dvh); }
  .shell { padding-top:max(env(safe-area-inset-top),var(--status-height,0px)); }
  main,.content,.wa-body,.wa-mid { min-height:0; }
  .content,.list,.thread,.wa-chats,.wa-thread,.side { overscroll-behavior-y:contain; -webkit-overflow-scrolling:touch; }
  button,.btn,.btn.sm,.chipbtn,.wa-tool,.seg button,.wa-tab { min-height:48px; min-width:44px; touch-action:manipulation; }
  input:not([type=checkbox]):not([type=radio]):not([type=color]),select,textarea { min-height:48px; font-size:16px; max-width:100%; }
  input[type=checkbox]:not(.toggle input),input[type=radio] { width:24px!important; height:24px; flex:none; }
  label.row,.perm { min-height:48px; }
  .row { flex-wrap:wrap; }
  .row > .grow { flex-basis:150px; }
  .row > .f { flex:1 1 150px; min-width:0; }
  .grid:not(.stats) { grid-template-columns:minmax(0,1fr)!important; }
  .grid.stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .topbar { gap:8px; padding:10px 12px; }
  .topbar h1 { flex:1 0 60%; }
  .topbar > .grow:empty { display:none; }
  .topbar > input,.topbar > select { flex:1 1 150px; width:100%!important; max-width:100%!important; }
  .topbar .row { width:100%; }
  .topbar .btn { flex:1 1 auto; text-align:center; white-space:normal; }
  .tabbar { padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right); }
  .tabbar button { min-height:56px; }
  body.typing .tabbar { display:none; }
  body.typing .wa-top,body.typing .wa-head .seg,body.typing .wa-head .callbtns { display:none; }
  .modal-bg { top:var(--viewport-top,0px); bottom:auto; height:var(--app-height,100dvh); }
  .modal { display:flex; flex-direction:column; max-height:calc(var(--app-height,100dvh) - 12px); padding:0; overflow:hidden; }
  .modal-title { flex:none; padding:16px 16px 12px; margin:0!important; border-bottom:1px solid var(--line); }
  .modal-body { min-height:0; overflow:auto; overscroll-behavior:contain; padding:16px; }
  .modal-actions { flex:none; position:relative; display:flex; gap:8px; flex-wrap:wrap; margin:0!important; padding:10px 12px calc(10px + env(safe-area-inset-bottom)); background:var(--panel); border-top:1px solid var(--line); }
  .modal-actions .btn { flex:1 1 130px; white-space:normal; }
  .modal-actions .primary { flex-grow:2; }
  .modal-body .card { padding:12px; }
  .modal-body .row > input,.modal-body .row > select { flex:1 1 140px; width:auto; }
  .modal-body pre { max-width:100%; }
  .login { padding:16px; }
  .login .card { width:100%; max-width:380px; }
  .mobile-table,.mobile-table tbody { display:block; width:100%; }
  .mobile-table thead { display:none; }
  .mobile-table tbody { display:grid; gap:10px; padding:8px; }
  .mobile-table tr { display:grid; min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--panel); }
  .mobile-table td { display:block; padding:5px 0; border:0; width:auto!important; white-space:normal!important; overflow-wrap:anywhere; }
  .mobile-table td:empty { display:none; }
  .mobile-table td[data-label]:not([data-label=''])::before { content:attr(data-label); display:block; color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.04em; margin-bottom:3px; }
  .mobile-table td .row { align-items:center; }
  .mobile-table td .callbtns { display:flex; width:100%; }
  .mobile-table td .callbtns .btn { flex:1; }
  .mobile-table td .callbtns.compact .lbl { display:inline; }
  .import-navigation { display:grid; grid-template-columns:auto 1fr auto; align-items:center; }
  .import-navigation .grow { text-align:center; font-size:13px; }
  .modal-body summary { min-height:48px; padding:12px 0; cursor:pointer; }
  .mobile-table .empty { padding:20px 0; }
  .callrow { padding:14px; }
  .callrow > .row:first-child { flex-wrap:nowrap; }
  .callrow > .row:first-child > .grow { flex:1; }
  .callrow select { width:100%; }
  .callbar { max-width:calc(100vw - 20px); bottom:calc(72px + env(safe-area-inset-bottom)); }
  body.typing .callbar { display:none; }
  body.typing .installbar,body:has(.wa-body.chat-open) .installbar { display:none; }
  .toast { bottom:calc(74px + env(safe-area-inset-bottom)); max-width:calc(100vw - 24px); width:max-content; text-align:center; }
  .wa-head { flex-wrap:wrap; }
  .wa-head .who { flex:1; }
  .wa-head > .grow:empty { display:none; }
  .wa-head .who b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .wa-head .seg { order:5; width:100%; justify-content:space-around; }
  .wa-head .seg button { flex:1; }
  .wa-composer { display:grid; grid-template-columns:44px 44px minmax(0,1fr) 48px; gap:4px; padding:8px 6px; }
  .wa-composer .wa-emoji-toggle { display:none; }
  .wa-composer .wa-input { min-width:0; width:100%; }
  .wa-send { width:48px; height:48px; }
  .wa-msg img,.wa-msg video { max-width:100%; }
  .wa-msg .acts { position:static; display:flex; justify-content:flex-end; opacity:.8; background:transparent; border:0; box-shadow:none; }
  .wa-msg .acts button { min-height:40px; }
  .wa-pop { max-width:calc(100vw - 20px); }
  .content.flush:has(> .mobile-pipeline-controls) { display:flex; flex-direction:column; }
  .mobile-pipeline-controls { display:block; flex:none; padding:12px; border-bottom:1px solid var(--line); background:var(--panel); }
  .board { flex:1; min-height:0; height:auto; padding:12px; overflow-y:auto; align-items:stretch; }
  .board .col { display:none; width:100%; max-height:none; }
  .board .col.mobile-stage { display:flex; }
  .board .cards { overflow:visible; }
  .deal { cursor:pointer; }
  .deal .mobile-move { display:block; width:100%; margin-top:10px; }
  .today-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
  .today-actions .btn { padding:14px; text-align:left; display:grid; gap:4px; }
  .today-actions .btn small { font-weight:normal; }
}
@media (min-width:761px) {
  .mobile-pipeline-controls,.mobile-move,.today-actions { display:none; }
}
@media (max-width:760px) and (max-height:500px) {
  .modal { max-height:var(--app-height,100dvh); border-radius:0; }
  .modal-actions { padding-bottom:8px; }
}
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto!important; transition:none!important; } }
