/* Lab RMS Fix 30 — Android-first presentation only.
   Screen-specific rules; no changes to clinical, print or PDF styles. */
@media screen and (max-width: 760px) {
  html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-bottom: 98px; }
  body { padding-bottom: env(safe-area-inset-bottom, 0px); overflow-x: hidden; }
  body.rms-mobile-dock-ready.rms-mobile-has-workspace { padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  body.rms-mobile-dock-ready.rms-mobile-has-workspace .layout,
  body.rms-mobile-dock-ready.rms-mobile-has-workspace .layout.sidebar-collapsed {
    display: block !important; grid-template-columns: none !important; min-height: 100dvh;
  }
  body.rms-mobile-dock-ready.rms-mobile-has-workspace .sidebar { display: none !important; }
  .layout-content, .main, .card, .editor, .editor-section, .report-entry-column, .tb-module, .hiv-module-card { min-width: 0 !important; max-width: 100%; }
  .layout-content .topbar { position: sticky; top: 0; z-index: 75; padding: 10px 13px !important; gap: 8px; align-items: center !important; box-shadow: 0 2px 8px rgba(18,46,67,.08); }
  .topbar .institution-heading { min-width: 0; flex: 1 1 65%; }
  .topbar .institution-heading b { font-size: 13px !important; line-height: 1.3; }
  .topbar .institution-heading strong { font-size: 13px !important; }
  .topbar .institution-heading small { display: none; }
  .topbar .profile { min-width: 0; gap: 5px; flex-wrap: wrap; justify-content: flex-start; }
  .topbar .profile select { max-width: min(100%, 180px); }
  .main { padding: 13px 12px 28px !important; }
  h1, .page-header h1 { font-size: clamp(21px, 5.8vw, 25px) !important; line-height: 1.25; }
  h2 { font-size: 18px; }
  .page-header { gap: 9px; margin-bottom: 14px; }
  .page-header .action-bar, .editor-header .action-bar { max-width: 100%; gap: 8px; }
  .card, .editor-section { border-radius: 12px; padding: 14px !important; margin-bottom: 12px; }
  .grid2, .grid3, .editor.resizable-editor .report-entry-column .grid2,
  .rms-commensal-row, .tb-module .tb-two-pane,
  .tb-module .tb-editor, .hiv-event-times-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .field, .field.full { min-width: 0 !important; }
  .field input, .field select, .field textarea,
  .rms-module-form input, .rms-module-form select, .rms-module-form textarea,
  .hiv-confidential-form input, .hiv-confidential-form select, .hiv-confidential-form textarea,
  input.search { font-size: 16px !important; min-height: 46px !important; max-width: 100%; }
  .field textarea, .hiv-confidential-form textarea { min-height: 90px !important; }
  .field { font-size: 13px; line-height: 1.45; gap: 7px; }
  button, .btn { min-height: 44px; touch-action: manipulation; }
  .small { min-height: 42px; font-size: 13px; }
  .report-actions-bottom, .report-actions-top, .action-bar { flex-wrap: wrap; gap: 9px; }
  .report-actions-bottom button, .report-actions-top button { flex: 1 1 140px; white-space: normal; }
  .editor, .editor.resizable-editor { display: block !important; }
  .editor .preview:not(.preview-fullscreen), .editor.resizable-editor .preview:not(.preview-fullscreen) { position: relative !important; top: auto !important; max-height: 68vh !important; padding: 10px; }
  .preview-scroll, .report-view, .table-wrap { max-width: 100%; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .preview-tools { flex-wrap: wrap; }
  .rms-status-grid, .tb-module .tb-stats, .hiv-stage-stats, .cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .stat { min-width: 0; padding: 12px !important; }
  .stat strong { font-size: 24px; }
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { max-width: 100%; flex: 1 1 100%; }
  .tb-module .tb-two-pane, .tb-module .tb-editor { min-width: 0; }
  .rms-sample-mobile { max-width: 100%; }
  table.app-table { font-size: 13px; }
  table.app-table th, table.app-table td { padding: 10px 9px; }
  .rms-mobile-dock { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1020; height: calc(70px + env(safe-area-inset-bottom, 0px)); padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid #d5e3e7; box-shadow: 0 -4px 18px rgba(18,46,67,.08); justify-content: space-around; gap: 5px; }
  .rms-mobile-dock[hidden] { display: none !important; }
  .rms-mobile-dock button { flex: 1 1 0; min-width: 0; padding: 4px 2px; display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; border: none; border-radius: 10px; background: transparent; color: #4b6171; font-size: 11px; line-height: 1.15; font-weight: 650; }
  .rms-mobile-dock button .rms-dock-icon { font-size: 22px; line-height: 1.1; }
  .rms-mobile-dock button[aria-current="page"] { color: #066c72; background: #e9f6f4; }
  .rms-mobile-dock button:disabled { opacity: .4; }
  .rms-mobile-sheet { position: fixed; inset: 0; z-index: 1190; background: rgba(6,25,38,.55); display: flex; align-items: flex-end; }
  .rms-mobile-sheet[hidden] { display: none !important; }
  .rms-mobile-sheet-panel { background: #fff; border-radius: 18px 18px 0 0; width: 100%; max-height: 82dvh; overflow: auto; padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -12px 38px rgba(5,25,36,.15); }
  .rms-mobile-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
  .rms-mobile-sheet-head strong { font-size: 18px; }
  .rms-mobile-sheet-close { min-width: 44px; padding: 8px; font-size: 18px; }
  .rms-mobile-sheet-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .rms-mobile-sheet-list button { padding: 12px; text-align: left; justify-content: flex-start; min-height: 54px; background: #f7fafb; white-space: normal; font-size: 13px; }
  .rms-mobile-sheet-list button.active { border: 2px solid #087f82; background: #e9f6f4; }
  .rms-mobile-sheet-note { color: #607989; font-size: 12px; margin-top: 12px; }
  body.rms-mobile-menu-open { overflow: hidden; }
  /* The original A4 paper remains at its print width; allow sideways scroll rather than distort results. */
  .preview .paper, .report-view .paper { max-width: none; }
}
@media screen and (min-width: 761px) {
  .rms-mobile-dock, .rms-mobile-sheet { display: none !important; }
}
@media print {
  .rms-mobile-dock, .rms-mobile-sheet { display: none !important; }
}
