@media(max-width:640px){
  .ppt-dialog{
    position:fixed;
    top:calc(var(--p2-ticket-vv-top,0px) + 4px);
    right:4px;
    bottom:auto;
    left:4px;
    width:auto;
    max-width:none;
    height:calc(var(--p2-ticket-vv-height,100dvh) - 8px);
    max-height:calc(var(--p2-ticket-vv-height,100dvh) - 8px);
    margin:0;
  }
  .ppt-shell{height:100%;min-height:0}

  .ppt-head{flex:0 0 auto;padding:8px 10px;gap:8px;min-height:0}
  .ppt-head>div>span{display:none}
  .ppt-head h2{margin:0;font-size:20px;line-height:1.05}
  .ppt-close{font-size:24px;line-height:1;padding:2px 4px}

  .ppt-body:has(.ppt-detail){overflow:hidden;padding:6px 10px 4px;box-sizing:border-box}
  .ppt-detail{height:100%;min-height:0;display:flex;flex-direction:column;box-sizing:border-box}
  .ppt-detail>.ppt-back,.ppt-detail>.ppt-ticket-head{flex:0 0 auto}

  .ppt-detail>.ppt-back{margin:0 0 3px;padding:2px 0;font-size:12px;line-height:1.2}
  .ppt-ticket-head{align-items:center;gap:7px;padding:2px 0 5px}
  .ppt-ticket-head>div{min-width:0;flex:1}
  .ppt-ticket-head>div>span{display:block;font-size:9px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ppt-ticket-head h3{margin:1px 0 0;font-size:15px;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ppt-ticket-head small{display:none}
  .ppt-ticket-head>.ppt-status{min-height:21px;padding:2px 7px;font-size:9px;line-height:1;flex:0 0 auto}

  .ppt-thread{flex:1 1 auto;min-height:72px;max-height:none;overflow-y:auto;overscroll-behavior:contain;padding:7px 2px 5px;gap:7px}
  .ppt-message{padding:8px 10px;border-radius:11px}
  .ppt-message header{margin-bottom:3px;gap:8px}
  .ppt-message header b{font-size:11px}
  .ppt-message header small{font-size:9px}
  .ppt-message p{font-size:12px;line-height:1.35}

  .ppt-reply{flex:0 0 auto;position:relative;margin:0 -2px;padding:6px 2px calc(3px + env(safe-area-inset-bottom));border-top:1px solid #dce4df;background:#f7f6f1;z-index:4}
  .ppt-reply label{gap:3px}
  .ppt-reply label>span{font-size:11px;line-height:1.2}
  .ppt-reply textarea{min-height:50px;max-height:64px;resize:none;overflow-y:auto;padding:8px 9px;line-height:1.3}
  .ppt-reply>div{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:center;margin-top:4px}
  .ppt-reply>div .ppt-primary{width:auto;min-width:118px;min-height:36px;padding:7px 11px}
  .ppt-reply p{min-height:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

  /* Durante a digitação, o composer sai do fluxo e fica preso acima do teclado. */
  .ppt-dialog.ppt-keyboard-open{overflow:visible}
  .ppt-dialog.ppt-keyboard-open .ppt-shell{overflow:hidden;border-radius:12px}
  .ppt-dialog.ppt-keyboard-open .ppt-head{display:none}
  .ppt-dialog.ppt-keyboard-open .ppt-body:has(.ppt-detail){
    padding:4px 10px calc(var(--p2-ticket-composer-height,104px) + 10px);
  }
  .ppt-dialog.ppt-keyboard-open .ppt-detail>.ppt-back,
  .ppt-dialog.ppt-keyboard-open .ppt-ticket-head{display:none}
  .ppt-dialog.ppt-keyboard-open .ppt-thread{padding-top:4px;min-height:40px}
  .ppt-dialog.ppt-keyboard-open .ppt-reply{
    position:fixed!important;
    left:8px;
    right:8px;
    bottom:calc(var(--p2-ticket-keyboard-inset,0px) + 4px);
    width:auto;
    margin:0;
    padding:7px 8px calc(7px + env(safe-area-inset-bottom));
    border:1px solid #cbd9d2;
    border-radius:14px 14px 10px 10px;
    background:#f7f6f1;
    box-shadow:0 -8px 28px rgba(21,49,66,.18);
    z-index:2147483646;
  }
  .ppt-dialog.ppt-keyboard-open .ppt-reply textarea{
    min-height:58px;
    max-height:72px;
    background:#fff;
  }
  .ppt-dialog.ppt-keyboard-open .ppt-reply>div{
    grid-template-columns:minmax(0,1fr) auto;
  }
}

@media(max-width:390px){
  .ppt-head h2{font-size:18px}
  .ppt-ticket-head h3{font-size:14px}
  .ppt-reply>div{grid-template-columns:1fr}
  .ppt-reply>div .ppt-primary{width:100%}
  .ppt-dialog.ppt-keyboard-open .ppt-reply>div{grid-template-columns:minmax(0,1fr) auto}
  .ppt-dialog.ppt-keyboard-open .ppt-reply>div .ppt-primary{width:auto;min-width:108px}
}
