/* =========================================================
   S Task — phones & small tablets (shared shell + components)
   Page-specific phone rules live at the end of each page's CSS file.
   Loaded last so it can override desktop rules.
   ========================================================= */
.sb-backdrop{display:none}

@media (max-width: 767px){
  :root{ --header-h:52px; --safe-top:env(safe-area-inset-top,0px); --safe-bottom:env(safe-area-inset-bottom,0px); }
  html,body{font-size:13px;-webkit-text-size-adjust:100%}
  body{overscroll-behavior:none}
  input,select,textarea{font-size:16px!important}           /* stops iOS zooming into fields */

  /* ---------- slide-out sidebar ---------- */
  .sidebar{width:280px;max-width:86vw;transform:translateX(-102%);transition:transform .22s ease;box-shadow:none;z-index:40;padding-top:var(--safe-top);padding-bottom:var(--safe-bottom)}
  #app.drawer-open .sidebar{transform:none;box-shadow:4px 0 24px rgba(0,0,0,.35)}
  #app.collapsed .sidebar{transform:translateX(-102%)}
  #app.collapsed.drawer-open .sidebar{transform:none}
  #app.drawer-open .sb-backdrop{display:block;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:35}
  .sb-card{height:50px}
  .sb-item{height:44px}
  .sb-item .txt{font-size:15px}
  .sb-customize{height:40px}
  .sb-user{height:60px}
  .sidebar.rail .sb-subpanel{width:calc(100% - var(--rail-w))}

  /* ---------- header ---------- */
  .header,#app.collapsed .header{left:0;height:calc(var(--header-h) + var(--safe-top));padding-top:var(--safe-top)}
  .hdr-expand,#app.collapsed .hdr-expand{display:flex;width:40px;height:40px;margin-left:6px;color:#555;border-radius:50%;padding:8px}
  .hdr-expand:active{background:#f0f0f0}
  .hdr-search,#app.collapsed .hdr-search{margin-left:4px;flex:1;min-width:0;width:auto;height:36px}
  .hdr-search .kbd{display:none}
  .hdr-right{margin-right:8px;margin-left:8px}
  .btn-addnew{width:40px;height:40px;padding:0;justify-content:center;border-radius:50%}
  .btn-addnew span:not(.ic){display:none}
  .btn-addnew .ic{width:22px;height:22px}
  .hdr-help{display:none}
  .hdr-bell{width:40px;height:40px;margin-left:4px}
  .main,#app.collapsed .main{left:0;top:calc(var(--header-h) + var(--safe-top) + 1px);bottom:0}

  /* ---------- page toolbar: title row, then a scrollable row of tools ---------- */
  .ptb{height:auto;min-height:52px;flex-wrap:wrap;padding:8px 12px;row-gap:8px}
  .ptb h1{font-size:17px}
  .vtoggle{margin-left:auto}
  .vtoggle button{padding:0 12px;height:34px}
  .ptb-right{order:3;width:100%;margin-left:0;overflow-x:auto;gap:8px;padding-bottom:2px;scrollbar-width:none}
  .ptb-right::-webkit-scrollbar{display:none}
  .ptb-right>*{flex:none}
  .tb-search{width:auto;flex:1 1 160px!important;min-width:150px;height:36px}
  .tb-btn{height:36px}
  .filters-tab{display:none}

  /* ---------- tables scroll sideways; first column stays visible ---------- */
  .grid-wrap{margin:0 0 0 0;-webkit-overflow-scrolling:touch}
  .dt td{height:46px}

  /* ---------- dialogs become full-width sheets ---------- */
  .modal-mask{align-items:flex-end}
  .modal{width:100vw!important;max-width:100vw!important;max-height:calc(100% - 24px - var(--safe-top));border-radius:14px 14px 0 0;padding-bottom:var(--safe-bottom)}
  .modal-h{height:54px;font-size:17px}
  .modal-h .x{width:30px;height:30px}
  .modal-b{padding:16px}
  .modal-f{padding:10px 16px}
  .modal-f .btn{flex:1;height:42px}
  .btn{height:40px}
  .fld input,.fld select{height:42px}

  /* ---------- popovers & menus fit the screen ---------- */
  .pop{max-width:calc(100vw - 16px);max-height:70vh;overflow:auto}
  .pop .mi{height:42px;font-size:15px}
  .pop-notif{width:calc(100vw - 16px)!important}
  .nt-b{width:auto;flex:1;margin-left:14px}

  div.empty{padding:0 24px 60px}
  .help-fab{width:50px;height:50px;right:12px;bottom:calc(12px + var(--safe-bottom))}
  .help-fab svg{width:26px;height:26px}
  .toast{bottom:calc(80px + var(--safe-bottom));max-width:calc(100vw - 32px);text-align:center}
  .storage-full-bar{top:calc(60px + var(--safe-top));width:calc(100vw - 24px);font-size:12px}
}

/* installed app (PWA / native shell): no browser chrome around it */
@media (display-mode: standalone){
  body{-webkit-user-select:none;user-select:none}
  input,textarea,[contenteditable]{-webkit-user-select:text;user-select:text}
}

/* install instructions (iPhone) */
.pwa-ios{margin:0;padding-left:20px;font:400 14px/24px var(--font);color:var(--text-2)}
.pwa-share{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border:1px solid #ccc;border-radius:5px;font-size:12px}

@media (max-width: 767px){
  /* the floating help button would cover the chat's send button */
  #app:has(.page-collaboration) .help-fab{display:none}
}
