/* V1452.106 — targeted mobile usability refinements based on Oct 29–30 recordings.
   Existing auth, clock, message and invoice handlers remain authoritative. */
@media (max-width:1023px){
  /* The employee clock switches stay reachable while the time-entry list scrolls. */
  body:has(.v499-clock-page) .v499-clock-page {overflow:visible!important;contain:none!important;}
  body:has(.v499-clock-page) #page {overflow:visible!important;contain:none!important;}
  body:has(.v499-clock-page) .clock-subnav.v499-clock-tabs,
  body:has(.v499-clock-page) .v499-clock-tabs {
    position:sticky!important;
    top:calc(env(safe-area-inset-top,0px) + 78px)!important;
    z-index:60!important;
    box-sizing:border-box!important;
    margin:0 8px 12px!important;
    padding:5px!important;
    width:calc(100% - 16px)!important;
    max-width:none!important;
    height:auto!important;
    min-height:52px!important;
    border:1px solid #cddac9!important;
    border-radius:15px!important;
    background:rgba(249,251,246,.98)!important;
    box-shadow:0 8px 22px rgba(23,60,37,.12)!important;
    -webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);
  }
  body:has(.v499-clock-page) .v499-clock-tabs button {
    flex:1 1 50%!important;min-height:42px!important;height:42px!important;
    font-size:13px!important;font-weight:720!important;border-radius:11px!important;
    white-space:nowrap!important;
  }
  body:has(.v499-clock-page) .v499-clock-tabs button:focus-visible{outline:2px solid #245d43!important;outline-offset:2px!important}
  /* Dashboard cards: more legible metrics and clear shortcuts, without changing data or routes. */
  body #page :is(.er1034-ready-card,.v499-ready-card){border-radius:17px!important;padding:16px!important;gap:12px!important}
  body #page :is(.er1034-ready-card,.v499-ready-card) h2,
  body #page :is(.er1034-ready-card,.v499-ready-card) strong{line-height:1.3!important}
  body #page :is(.er1034-ready-card,.v499-ready-card) :is(button,a){min-height:43px!important;touch-action:manipulation}
  body #page :is(.er1034-next-shift,.hm-next,.home-shift-card){min-width:0!important;border-radius:14px!important;overflow-wrap:anywhere}
  body #page :is(.er1034-next-shift,.hm-next,.home-shift-card) :is(h3,strong){font-size:max(13px,1em)!important;line-height:1.4!important}
  body #page :is(.home-kpi,.hm-kpi,.er1034-kpi){min-width:0!important}
  /* Inbox rows are actual large tap targets. Avoid truncating multi-line summaries. */
  body[data-er99-chat] .er99-messages .chat-list{padding:13px 12px!important}
  body[data-er99-chat] .er99-messages .cv-threads{gap:7px!important;padding-bottom:16px!important}
  body[data-er99-chat] .er99-messages .cv-row{
    min-height:88px!important;padding:14px 12px!important;gap:12px!important;
    border:1px solid #e0e8d9!important;border-radius:14px!important;
    background:#fffefa!important;box-shadow:0 2px 5px rgba(33,66,40,.035)!important;
    overflow:visible!important;
  }
  body[data-er99-chat] .er99-messages .cv-row.active{background:#ebf3e6!important;border-color:#acc5ad!important}
  body[data-er99-chat] .er99-messages .cv-av{width:43px!important;min-width:43px!important;height:43px!important;min-height:43px!important;border-radius:13px!important}
  body[data-er99-chat] .er99-messages .cv-name{font-size:14px!important;font-weight:750!important;line-height:1.4!important}
  body[data-er99-chat] .er99-messages :is(.cv-sub,.cv-preview,.cv-last){font-size:12px!important;line-height:1.45!important;white-space:normal!important;overflow-wrap:anywhere!important;max-height:2.9em!important;overflow:hidden!important}
  body[data-er99-chat] .er99-messages .cv-row time{font-size:10px!important;white-space:nowrap!important}
  /* Conversation history: sender text and bubbles retain their own space. */
  body[data-er99-chat=thread] .er99-messages .chat-scroll{gap:10px!important;padding:18px 12px 28px!important;overscroll-behavior:contain!important}
  body[data-er99-chat=thread] .er99-messages .msg{max-width:100%!important;min-height:0!important;align-items:flex-end!important;overflow:visible!important}
  body[data-er99-chat=thread] .er99-messages .bubble{
    box-sizing:border-box!important;max-width:min(85%,560px)!important;min-width:0!important;
    padding:12px 14px!important;border-radius:16px!important;
    overflow-wrap:anywhere!important;word-break:normal!important;
  }
  body[data-er99-chat=thread] .er99-messages .b-text{font:400 14.5px/1.55 system-ui!important;overflow-wrap:anywhere!important;white-space:pre-wrap!important}
  body[data-er99-chat=thread] .er99-messages .b-author{font-size:11px!important;line-height:1.5!important}
  body[data-er99-chat=thread] .er99-messages .bubble time{font-size:10px!important}
  body[data-er99-chat=thread] .er99-messages .chat-thread-head{min-height:62px!important}
  body[data-er99-chat=thread] .er99-messages .chat-composer{min-height:66px!important}
  body[data-er99-chat=thread] .er99-messages .chat-composer #chatInput{font-size:16px!important;line-height:1.45!important;max-height:135px!important}
  /* Fix timesheet Add entry modal being hidden under iPhone status/navigation chrome. */
  body #modalHost:has(.er145227-entry-dialog){box-sizing:border-box!important;padding-top:env(safe-area-inset-top,0px)!important;padding-bottom:env(safe-area-inset-bottom,0px)!important}
  html.er-earth body #modalHost .modal.er152-dialog.er145227-entry-dialog{
    box-sizing:border-box!important;position:relative!important;top:auto!important;
    margin:max(12px,env(safe-area-inset-top,0px)) auto max(12px,env(safe-area-inset-bottom,0px))!important;
    height:auto!important;max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px)!important;
    border-radius:17px!important;
  }
  html.er-earth body #modalHost .er145227-entry-dialog .modal-head{
    position:relative!important;z-index:2!important;min-height:64px!important;
    padding:14px 16px!important;background:#f1f6eb!important;border-bottom:1px solid #d9e5d6!important;
  }
  html.er-earth body #modalHost .er145227-entry-dialog .modal-head h2{font-size:21px!important;line-height:1.3!important}
  html.er-earth body #modalHost .er145227-entry-dialog .modal-body{min-height:0!important;overflow-y:auto!important;overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important}
  html.er-earth body #modalHost .er145227-entry-dialog .modal-foot{background:#fbfcf8!important;border-top:1px solid #e0e7d9!important}
  /* Prevent menus/forms going under bottom navigation or notch. */
  body #page :is(input,textarea,select){scroll-margin-top:135px;scroll-margin-bottom:100px}
}
@media (max-width:380px){
  body:has(.v499-clock-page) .v499-clock-tabs{top:calc(env(safe-area-inset-top,0px) + 74px)!important}
  body:has(.v499-clock-page) .v499-clock-tabs button{font-size:12px!important;gap:5px!important}
  body[data-er99-chat] .er99-messages .cv-row{padding:12px 9px!important;gap:9px!important}
  body[data-er99-chat=thread] .er99-messages .bubble{max-width:88%!important}
}
@media(min-width:1024px){
  body[data-er99-chat] .er99-messages .cv-row{min-height:76px!important;padding:12px!important}
  body[data-er99-chat] .er99-messages .cv-name{font-size:13.5px!important}
}

/* Sender names and roles remain visible at the start of every message group, including direct chats. */
.chat-thread .er106-author-role,.er99-messages .er106-author-role{font-size:10px;letter-spacing:.01em;font-weight:550;opacity:.82}
