/* RG-MOBILE-20261024: phone and small-tablet foundation shared by every staff portal. Every rule sits inside a max-width query, so desktop is untouched. */
@media (max-width: 900px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { max-width: 100vw; overflow-x: clip; padding-bottom: env(safe-area-inset-bottom, 0px); }
  img, video, canvas, iframe { max-width: 100%; }
  img { height: auto; }
  pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
  p, li, td, th, label, h1, h2, h3, h4, h5, h6 { overflow-wrap: anywhere; }
  input, select, textarea { font-size: 16px; max-width: 100%; }
  input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
  button, [role="button"], .btn, a.btn, summary { min-height: 44px; touch-action: manipulation; }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="button"]:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
  [role="dialog"], dialog, .modal-content, .modal-box, .rg-modal { max-width: 100vw; box-sizing: border-box; }
  [role="dialog"], dialog { max-height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  table:not(.rgm-keep) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  [style*="position:fixed"][style*="bottom"], [style*="position: fixed"][style*="bottom"] { max-width: calc(100vw - 24px); }
}
@media (max-width: 480px) {
  h1 { font-size: clamp(20px, 6vw, 26px); }
  h2 { font-size: clamp(18px, 5.2vw, 22px); }
}
@media (hover: none) and (pointer: coarse) {
  a, button, select { -webkit-tap-highlight-color: rgba(166, 135, 66, 0.25); }
}

/* RG-MOBILE-EMPLOYEE-20261030: screen-only corrections to the existing mobile foundation. */
@media screen and (max-width: 900px) {
  #appView .view-panel { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  #appView .view-panel > *, #appView .split-layout > section { min-width: 0; }
  .ac-workspace-ui .ac-main, .ac-workspace-ui .ac-content { min-width: 0; }
  .ac-workspace-ui .ac-sidebar .ac-ni, .sa-sidebar .sa-ni { min-height: 44px; }
  .ac-workspace-ui .ac-burger, .sa-topbar .sa-mobile-menu-btn { min-width: 44px; min-height: 44px; justify-content: center; padding: 8px; flex-shrink: 0; }
  .ac-workspace-ui .ac-stats[style*="grid-template-columns"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .ac-workspace-ui .ac-stat { min-width: 0; }
  .ac-workspace-ui .ac-stat-val { overflow-wrap: anywhere; }
  .ac-workspace-ui .ac-mail-reply .ac-ws-text-button { min-height: 44px; }
}
@media screen and (max-width: 768px) {
  .sa-topbar { height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .sa-topbar .sa-tbl { min-width: 0; flex: 1 1 150px; overflow: visible; }
  .sa-topbar .sa-page-title { display: block; white-space: normal; overflow-wrap: anywhere; font-size: 14px; }
  .sa-topbar .sa-tbr { margin-left: auto; flex-wrap: wrap; }
  .sa-kpi-strip .sa-kpi { min-width: 160px; }
  .sa-kpi-strip .sa-kpi-label, .sa-kpi-strip .sa-kpi-change { font-size: 12px; line-height: 1.4; white-space: normal; }
}
@media screen and (max-width: 480px) {
  .ac-workspace-ui .ac-stats[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
}

/* RG-MOBILE-LEAD-DIALOG-20261030: existing Sales Advisor and Team Leader detail dialogs only. */
@media screen and (max-width: 640px) {
  .shell ~ #detail-panel #dm-header { padding: 12px 14px 0 !important; }
  .shell ~ #detail-panel #dm-header > div:first-child { flex-wrap: wrap; gap: 12px; }
  .shell ~ #detail-panel #dm-header > div:first-child > div:first-child { flex: 1 1 100%; min-width: 0; }
  .shell ~ #detail-panel #dm-header > div:first-child > div:first-child > div:last-child { min-width: 0; flex: 1; }
  .shell ~ #detail-panel #dm-name { overflow-wrap: anywhere; }
  .shell ~ #detail-panel #dm-header > div:first-child > div:last-child { width: 100%; flex-wrap: wrap; }
  .shell ~ #detail-panel #dm-header > div:first-child > div:last-child > button { min-width: 44px; min-height: 44px; }
  .shell ~ #detail-panel .dm-hbtn { font-size: 12px; }
  .shell ~ #detail-panel #dm-header > div:last-child { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .shell ~ #detail-panel .dm-tab { flex: 0 0 auto; font-size: 12px; min-height: 44px; }
  .shell ~ #detail-panel #dm-overview > div[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .shell ~ #detail-panel .dm-row > span { min-width: 0; overflow-wrap: anywhere; }
}
