/* Breakpoints are read from global-tokens.css by mobileLayout.js. */
.pb-mobile-only { display: none !important; }
#mobileViewport { display: contents; }
.pb-mobile #mobileViewport {
  position: fixed; left: var(--pb-mobile-visible-left); top: var(--pb-mobile-visible-top);
  width: var(--pb-mobile-visible-width); height: var(--pb-mobile-visible-height);
  display: grid; grid-template-rows: auto minmax(var(--pb-mobile-touch), 1fr) auto;
  overflow: auto; min-width: var(--pb-space-0);
}
.pb-mobile .auth-landing-active #mobileViewport { display: contents; }
.pb-mobile [hidden] { display: none !important; }
.pb-mobile { height: var(--pb-mobile-full); }
.pb-mobile body { min-width: var(--pb-space-0); margin: var(--pb-space-0); padding: var(--pb-space-0); }
.pb-mobile .pb-mobile-only { display: flex !important; }
.pb-mobile .pb-mobile-only[hidden] { display: none !important; }
.pb-mobile :is(button, input, select, textarea) { touch-action: manipulation; }
.pb-mobile :is(input, select, textarea) { font-size: var(--pb-font-size-md); max-width: var(--pb-mobile-full); }
.pb-mobile :focus-visible { outline: var(--pb-border-width-md) solid var(--brand-primary); outline-offset: var(--pb-space-1); }
.pb-mobile .pb-mobile-button {
  min-height: var(--pb-mobile-touch); padding: var(--pb-space-2) var(--pb-space-3);
  border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-md);
  background: var(--surface-card); color: var(--text-primary); font: inherit; cursor: pointer;
}
.pb-mobile .pb-mobile-button[aria-current="page"], .pb-mobile .pb-mobile-button[aria-pressed="true"] { color: var(--brand-primary); background: var(--surface-card-alt); }
.pb-mobile .pb-mobile-header {
  position: relative; grid-row: 1; z-index: var(--pb-mobile-shell-z);
  min-height: calc(var(--pb-mobile-header-height) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--pb-space-3) var(--pb-space-0);
  align-items: center; justify-content: space-between; gap: var(--pb-space-2); background: var(--surface-card); color: var(--text-primary);
  border-bottom: var(--pb-border-width-sm) solid var(--border-color); box-sizing: border-box;
}
.pb-mobile .pb-mobile-header strong { font-size: var(--pb-font-size-sm); min-width: var(--pb-space-0); overflow-wrap: anywhere; }
.pb-mobile .pb-mobile-nav {
  position: relative; grid-row: 3; z-index: var(--pb-mobile-shell-z);
  min-height: calc(var(--pb-mobile-nav-height) + env(safe-area-inset-bottom)); padding: var(--pb-space-1) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface-card); border-top: var(--pb-border-width-sm) solid var(--border-color); box-sizing: border-box;
}
.pb-mobile .pb-mobile-nav button { flex: 1; min-width: var(--pb-space-0); white-space: normal; overflow-wrap: anywhere; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--pb-space-1); border: none; font-size: var(--pb-font-size-xs); padding: var(--pb-space-1); }
.pb-mobile .pb-mobile-nav svg { width: var(--pb-size-icon-md); height: var(--pb-size-icon-md); fill: none; }
.pb-mobile .pb-mobile-more { position: absolute; grid-row: 2; align-self: start; right: var(--pb-space-0); top: var(--pb-space-0); z-index: var(--pb-mobile-menu-z); box-sizing: border-box; max-width: var(--pb-mobile-full); padding: var(--pb-space-2); gap: var(--pb-space-1); flex-direction: column; background: var(--surface-card); box-shadow: var(--pb-shadow-lg); max-height: min(var(--pb-mobile-menu-height), var(--pb-mobile-visible-height)); overflow: auto; }
.pb-mobile #dashboardNavigation { display: none; }
.pb-mobile #dashboardMain {
  position: relative; grid-row: 2; inset: auto;
  width: auto; height: auto; min-height: var(--pb-space-0); min-width: var(--pb-space-0); border-radius: var(--pb-space-0); margin: var(--pb-space-0) env(safe-area-inset-right) var(--pb-space-0) env(safe-area-inset-left);
}
.pb-mobile #dashboardMain > .tab-container { inset: var(--pb-space-0); width: var(--pb-mobile-full); height: var(--pb-mobile-full); padding: var(--pb-space-0); }
.pb-mobile #dashboardMain iframe { display: block; width: var(--pb-mobile-full); height: var(--pb-mobile-full); margin: var(--pb-space-0); border: none; }
.pb-mobile .auth-landing-active :is(#mobileHeader, #mobileNavigation, #mobileMoreMenu) { display: none !important; }

/* Inventory retains row identities, search, filters and the existing detail handlers. */
.pb-mobile .shortage-page :is(.container, .inventory-workspace, .shortage-main-shell, .shortage-main-pane, .shortage-table-shell) { min-width: var(--pb-space-0); max-width: var(--pb-mobile-full); }
.pb-mobile .shortage-page .container { padding: var(--pb-space-0); height: var(--pb-mobile-viewport); box-sizing: border-box; display: flex; flex-direction: column; overflow: auto; }
.pb-mobile .shortage-page :is(.inventory-workspace, .shortage-main-shell) { display: flex; flex-direction: column; flex: 1; min-height: var(--pb-space-0); height: auto; overflow: visible; }
.pb-mobile .shortage-page .shortage-table-shell { height: auto; flex: 1; min-height: auto; overflow: visible; }
.pb-mobile .shortage-page .table-container { height: auto; flex: 1; min-height: var(--pb-space-0); }
.pb-mobile .shortage-page .table-wrapper { flex: 1; min-height: calc(var(--pb-mobile-touch) * 3); }
.pb-mobile .shortage-page #mobilePageSearch { flex: none; }
.pb-mobile .shortage-page .inventory-filter-sidebar:not(.is-open) { display: none; }
.pb-mobile .shortage-command-bar { display: grid; grid-template-columns: minmax(var(--pb-space-0), 1fr) auto; align-items: center; flex: none; gap: var(--pb-space-2); }
.pb-mobile .shortage-command-left { flex-wrap: nowrap; min-width: var(--pb-space-0); }
.pb-mobile .shortage-command-right { width: auto; margin: var(--pb-space-0); }
.pb-mobile .shortage-button-panel { min-width: var(--pb-space-0); flex-wrap: wrap; }
.pb-mobile .shortage-button-panel-label { display: none; }
.pb-mobile .shortage-search-field { min-width: var(--pb-space-0); flex-basis: var(--pb-mobile-full); width: var(--pb-mobile-full); }
.pb-mobile .shortage-page :is(.header-columns, .group-header, .child-row) { min-width: var(--pb-space-0); }
.pb-mobile .shortage-page :is(.col-eta, .col-details) { display: none; }
.pb-mobile .shortage-page :is(.col-description, .header-col.col-description) { min-width: var(--pb-space-0); width: auto; flex: 1; white-space: normal; overflow-wrap: anywhere; }
.pb-mobile .shortage-page :is(.col-item-code, .header-col.col-item-code) { width: var(--pb-mobile-code-width); min-width: var(--pb-mobile-code-width); }
.pb-mobile .shortage-page :is(.col-quantity, .header-col.col-quantity) { width: var(--pb-mobile-quantity-width); min-width: var(--pb-mobile-quantity-width); }
.pb-mobile .shortage-page :is(.col-status, .header-col.col-status) { width: var(--pb-mobile-status-width); min-width: var(--pb-mobile-status-width); }
.pb-mobile .shortage-page :is(table, .table-container) { min-width: var(--pb-space-0); width: var(--pb-mobile-full); }
.pb-mobile .shortage-page :is(td, .header-col) { padding: var(--pb-space-2) var(--pb-space-1); font-size: var(--pb-font-size-xs); }
.pb-mobile .shortage-page tr { min-height: var(--pb-mobile-touch); }
.pb-mobile #inventoryPage :is(.header-columns, tr, tr.has-expanded) { grid-template-columns: minmax(var(--pb-space-0), 1fr) var(--pb-mobile-status-width); column-gap: var(--pb-space-2); min-width: var(--pb-space-0); height: auto; padding-inline: var(--pb-space-2) !important; }
.pb-mobile #inventoryPage .child-row.visible { height: auto; min-height: var(--pb-mobile-touch); padding-block: var(--pb-space-2) !important; }
.pb-mobile #inventoryPage .child-row .col-item-code { display: flex; grid-column: 1; grid-row: 2; width: auto; }
.pb-mobile #inventoryPage .child-row .col-quantity { display: flex; grid-column: 2; grid-row: 2; width: auto; }
.pb-mobile #inventoryPage .child-row .col-item-code::before { content: 'Item '; margin-right: var(--pb-space-1); }
.pb-mobile #inventoryPage .child-row .col-quantity::before { content: 'Qty '; margin-right: var(--pb-space-1); }
.pb-mobile #inventoryPage :is(.col-details, .col-eta) { display: none !important; }
.pb-mobile #inventoryPage :is(.col-description, .col-status) { width: auto; }
.pb-mobile-narrow #inventoryPage :is(.header-columns, tr, tr.has-expanded) { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile-narrow #inventoryPage .header-col.col-status { display: none; }
.pb-mobile.pb-mobile-narrow #inventoryPage tr > :is(.col-description, .col-status, .col-item-code, .col-quantity) { grid-column: 1; grid-row: auto; width: auto; min-width: var(--pb-space-0); overflow-wrap: anywhere; }
.pb-mobile .shortage-page .inventory-filter-sidebar { max-width: var(--pb-mobile-full); }
.pb-mobile .pb-mobile-modal-switch { gap: var(--pb-space-2); padding: var(--pb-space-2) var(--pb-space-3); flex-shrink: 0; }
.pb-mobile :is(#detailsModal, #companionModal).active { position: fixed !important; inset: var(--pb-space-0) !important; width: var(--pb-mobile-full) !important; height: var(--pb-mobile-viewport) !important; transform: none !important; padding: var(--pb-space-0) !important; animation: none !important; z-index: var(--pb-mobile-dialog-z) !important; }
.pb-mobile[data-mobile-inventory-mode="knowledge"] #detailsModal.active,
.pb-mobile[data-mobile-inventory-mode="inventory"] #companionModal.active { display: none !important; }
.pb-mobile :is(#detailsModal, #companionModal) .modal-container { width: var(--pb-mobile-full) !important; max-width: var(--pb-mobile-full) !important; height: var(--pb-mobile-full) !important; max-height: var(--pb-mobile-full) !important; min-width: var(--pb-space-0) !important; border-radius: var(--pb-space-0); transform: none !important; display: flex; flex-direction: column; }
.pb-mobile :is(#detailsModal, #companionModal) .modal-body { min-height: var(--pb-space-0); overflow: auto !important; padding: var(--pb-space-3); background: transparent; }
.pb-mobile :is(#detailsModal, #companionModal) .modal-header { flex-shrink: 0; padding: var(--pb-space-3); }
.pb-mobile :is(#detailsModal, #companionModal) .modal-title { min-width: var(--pb-space-0); white-space: normal; font-size: var(--pb-font-size-lg); }
.pb-mobile :is(#detailsModal, #companionModal) :is(.modal-close-btn, button) { min-height: var(--pb-mobile-touch); }
.pb-mobile :is(#detailsModal, #companionModal) :is(.modal-drug-info, .inv-cards-container, .drug-info-grid) { min-width: var(--pb-space-0); max-width: var(--pb-mobile-full); }
.pb-mobile #companionModal :is(#companionPriceCard, #companionInvCard, #companionPriceExpansion) { display: none !important; }
.pb-mobile #companionModal .summary-cards-row { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile #companionModal :is(.item-details-container, .companion-section) { min-width: var(--pb-space-0); max-width: var(--pb-mobile-full); }
.pb-mobile.pb-mobile-wide #companionModal .item-details-container { display: grid; grid-template-columns: repeat(2, minmax(var(--pb-space-0), 1fr)); align-items: start; gap: var(--pb-space-4); }
.pb-mobile.pb-mobile-wide #companionModal .summary-cards-row { grid-column: 1 / -1; }
.pb-mobile .pb-mobile-usage { display: block !important; padding: var(--pb-space-0); margin: var(--pb-space-0); border: none; background: transparent; }
.pb-mobile .pb-mobile-usage-summary { padding: var(--pb-space-3); background: var(--pb-color-surface-base); border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-lg); }
.pb-mobile .pb-mobile-usage-metrics { display: grid; grid-template-columns: repeat(3, minmax(var(--pb-space-0), 1fr)); gap: var(--pb-space-3); margin: var(--pb-space-3) var(--pb-space-0); }
.pb-mobile .pb-mobile-usage-metrics dt { color: var(--text-secondary); font-size: var(--pb-font-size-sm); }
.pb-mobile .pb-mobile-usage-metrics dd { margin: var(--pb-space-1) var(--pb-space-0); font-size: var(--pb-font-size-xl); font-weight: var(--pb-font-weight-bold); overflow-wrap: anywhere; }
.pb-mobile .pb-mobile-usage-ranges { display: flex; gap: var(--pb-space-2); }
.pb-mobile .pb-mobile-usage-ranges button { flex: 1; min-width: var(--pb-space-0); padding-inline: var(--pb-space-1); }
.pb-mobile .pb-mobile-usage-chart { display: grid; gap: var(--pb-space-4); padding: var(--pb-space-0); list-style: none; }
.pb-mobile .pb-mobile-usage-bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--pb-space-3); margin-bottom: var(--pb-space-2); font-size: var(--pb-font-size-md); overflow-wrap: anywhere; }
.pb-mobile .pb-mobile-usage-bar-label span { min-width: var(--pb-space-0); }
.pb-mobile .pb-mobile-usage-bar-label strong { flex-shrink: 0; }
.pb-mobile .pb-mobile-usage-track { height: var(--pb-space-2); background: var(--surface-card-alt); border-radius: var(--pb-radius-pill); overflow: hidden; }
.pb-mobile .pb-mobile-usage-bar { height: var(--pb-mobile-full); width: var(--pb-mobile-usage-share); background: var(--brand-primary); border-radius: inherit; }
.pb-mobile .pb-mobile-usage-bar[data-ai-sign="negative"] { background: var(--text-secondary); }
.pb-mobile :is(#modalScrollArrowUp, #modalScrollArrowDown, #companionModalScrollArrowUp, #companionModalScrollArrowDown) { display: none !important; }
.pb-mobile .pb-mobile-usage p { color: var(--text-secondary); font-size: var(--pb-font-size-sm); overflow-wrap: anywhere; }

/* The task tree is the mobile list; existing modal/report actions remain authoritative. */
.pb-mobile :is(#tasksContainer, #tasksMainPane, #tasksContent, #tasksWorkspace, #tasksMainSurface, #tasksTimelineFrame) { min-width: var(--pb-space-0); width: var(--pb-mobile-full); max-width: var(--pb-mobile-full); margin: var(--pb-space-0); box-sizing: border-box; }
.pb-mobile #tasksContainer { padding: var(--pb-space-0); height: var(--pb-mobile-viewport); min-height: var(--pb-space-0); }
.pb-mobile #tasksContainer { background: var(--pb-color-bg-shell); }
.pb-mobile #tasksShell { display: grid; grid-template-columns: minmax(var(--pb-space-0), 1fr) !important; min-height: var(--pb-space-0); overflow: hidden; }
.pb-mobile #tasksShell > .tasks-card:first-child { min-width: var(--pb-space-0); overflow: hidden; display: flex; flex-direction: column; }
.pb-mobile :is(#tasksSplitter, #tasksShell > .tasks-card:last-child, #tasksListGap, .tasks-list-header, #tasksActualOverlayBtn, #tasksTodayBtn, #tasksTimelinePrintBtn) { display: none !important; }
.pb-mobile #tasksListBody { overflow: auto !important; min-height: var(--pb-space-0); height: auto !important; flex: 1; padding: var(--pb-space-2); }
.pb-mobile #tasksListBody .tasks-row { display: grid; flex: none; grid-template-columns: var(--pb-mobile-touch) minmax(var(--pb-space-0), 1fr) var(--pb-mobile-touch) !important; height: auto !important; min-height: var(--pb-mobile-touch); padding: var(--pb-space-2); margin-bottom: var(--pb-space-2); border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-lg); gap: var(--pb-space-1); animation: none; }
.pb-mobile .tasks-row .task-title-wrap { padding-left: var(--pb-space-0) !important; min-width: var(--pb-space-0); }
.pb-mobile .tasks-row .task-title { white-space: normal; overflow-wrap: anywhere; line-height: var(--pb-line-height-normal); font-size: var(--pb-font-size-sm); }
.pb-mobile .tasks-row .tasks-list-col { display: none; }
.pb-mobile .tasks-row .tree-toggle { width: var(--pb-mobile-touch); height: var(--pb-mobile-touch); }
.pb-mobile .tasks-row.depth-1 { margin-left: var(--pb-space-3); }
.pb-mobile .tasks-row:is(.depth-2, .depth-3) { margin-left: var(--pb-space-6); }
.pb-mobile .pb-mobile-task-meta { grid-column: 2 / -1; flex-wrap: wrap; gap: var(--pb-space-2); align-items: center; font-size: var(--pb-font-size-xs); color: var(--text-secondary); }
.pb-mobile .tasks-row-report-btn { position: static; min-height: var(--pb-mobile-touch); min-width: var(--pb-mobile-touch); }
.pb-mobile .tasks-row.has-report-action .tasks-row-report-btn { grid-column: 1; grid-row: 2; opacity: 1; pointer-events: auto; }
.pb-mobile .tasks-row .task-assignee-stack { grid-column: 3; grid-row: 1; }
.pb-mobile .tasks-row .pb-mobile-task-meta { grid-row: 2; }
.pb-mobile #tasksMainPane .analytics-header { padding: var(--pb-space-2); }
.pb-mobile .tasks-header { min-width: var(--pb-space-0); gap: var(--pb-space-2); }
.pb-mobile .tasks-controls-header { padding: var(--pb-space-0); min-height: var(--pb-space-0); }
.pb-mobile .tasks-top-controls { flex-wrap: wrap; gap: var(--pb-space-2); }
.pb-mobile .tasks-timeline-frame-header { min-height: var(--pb-space-0); padding: var(--pb-space-3); gap: var(--pb-space-2); }
.pb-mobile #tasksTimelineTodayBtn { display: none; }
.pb-mobile .tasks-alert-badges { flex-wrap: wrap; gap: var(--pb-space-2); }
.pb-mobile .tasks-alert-badge { min-width: var(--pb-space-0); flex: none; padding: var(--pb-space-0); font-size: var(--pb-font-size-xs); }
.pb-mobile .tasks-timeline-frame-footer { padding: var(--pb-space-2); flex-wrap: wrap; gap: var(--pb-space-1); min-height: var(--pb-mobile-touch); font-size: var(--pb-font-size-xs); }
.pb-mobile #tasksContent { padding: var(--pb-space-0); }
.pb-mobile #tasksBodyViewIcons { order: 3; flex: 1 var(--pb-mobile-full); width: var(--pb-mobile-full); min-width: var(--pb-space-0); }
.pb-mobile #tasksBodyViewIcons .tasks-view-toggle { min-width: var(--pb-space-0); min-height: var(--pb-mobile-touch); flex: 1; width: auto; white-space: normal; overflow-wrap: anywhere; font-size: var(--pb-font-size-md); }
.pb-mobile #tasksReportSearchSeparator { display: none; }
/* One page scroll keeps content reachable when the browser keyboard or landscape reduces height. */
.pb-mobile #tasksMainPane { display: block; height: var(--pb-mobile-full); overflow: auto; }
.pb-mobile :is(#tasksContent, #tasksWorkspace, #tasksMainSurface, #tasksTimelineFrame) { height: auto; max-height: none; display: block; overflow: visible; }
.pb-mobile #tasksShell { height: auto; overflow: visible; }
.pb-mobile #tasksShell > .tasks-card:first-child { overflow: visible; }
.pb-mobile #tasksListBody { flex: none; overflow: visible !important; }
.pb-mobile .tasks-controls { flex-wrap: wrap; height: auto; gap: var(--pb-space-2); }
.pb-mobile .tasks-filter-sidebar { position: fixed; right: var(--pb-space-0); max-width: var(--pb-mobile-full); z-index: var(--pb-mobile-dialog-z); }
.pb-mobile .task-modal { padding: var(--pb-space-2); }
.pb-mobile .task-modal-card { width: var(--pb-mobile-full); max-width: var(--pb-mobile-full); max-height: var(--pb-mobile-viewport); min-width: var(--pb-space-0); }
.pb-mobile .task-form-grid { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile .task-modal-body { overflow: auto; }
.pb-mobile #taskModal :is(input, select, textarea, .task-form-section, .task-date-field) { min-width: var(--pb-space-0); box-sizing: border-box; }
.pb-mobile #taskModal .task-optional-grid { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile #taskModal .task-dates-row { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile #taskModal .task-date-arrow { display: none; }
.pb-mobile #taskModal .task-assign-entry-row { flex-wrap: wrap; }
.pb-mobile #taskModal .task-form-section { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile #taskModal :is(.task-assign-toolbar, .task-section-head, .task-checklist-title) { flex-wrap: wrap; min-width: var(--pb-space-0); }
.pb-mobile #taskModal .task-assign-toolbar > div { flex: 1; min-width: var(--pb-space-0); }
.pb-mobile #taskModal .task-assign-toolbar input { width: var(--pb-mobile-full); }
.pb-mobile #taskModal :is(.task-link-section-grid, .task-optional-grid, .task-form-grid) { min-width: var(--pb-space-0); max-width: var(--pb-mobile-full); }
.pb-mobile #taskModal .task-link-section-grid { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile #taskModal :is(.task-form-grid, .task-optional-grid, .task-link-section-grid, .task-parent-assigner-row) > * { min-width: var(--pb-space-0); }
.pb-mobile #taskModal details:not([open]) > :not(summary) { display: none; }
.pb-mobile #taskModal .task-checklist-icon-btn { width: var(--pb-mobile-touch); min-width: var(--pb-mobile-touch); height: var(--pb-mobile-touch); overflow: hidden; flex-shrink: 0; }
.pb-mobile #taskModal :is(.task-section-actions, .task-checklist-actions) { flex-wrap: wrap; }
.pb-mobile #tasksKanbanView.visible { grid-template-columns: minmax(var(--pb-space-0), 1fr); height: auto; }
.pb-mobile.pb-mobile-wide #tasksKanbanView.visible { grid-template-columns: repeat(2, minmax(var(--pb-space-0), 1fr)); }
.pb-mobile .task-modal-actions { flex-wrap: wrap; gap: var(--pb-space-2); }

/* Contacts remain a searchable, expanding list at every mobile width. */
.pb-mobile :is(.contacts-shell, .contacts-page) { height: var(--pb-mobile-viewport); min-height: var(--pb-space-0); min-width: var(--pb-space-0); width: var(--pb-mobile-full); }
.pb-mobile .contacts-page { display: block; overflow: auto; padding: var(--pb-space-0); box-sizing: border-box; }
.pb-mobile .contacts-toolbar { display: grid; grid-template-columns: minmax(var(--pb-space-0), 1fr) auto; align-items: start; gap: var(--pb-space-2); }
.pb-mobile .contacts-search { flex: 1; min-width: var(--pb-space-0); width: auto; }
.pb-mobile .contacts-category-nav { order: 0; width: auto; min-width: var(--pb-space-0); flex-wrap: nowrap; overflow-x: auto; }
.pb-mobile #contactsCategoryNav .contacts-category-btn { width: auto; min-width: var(--pb-mobile-touch); min-height: var(--pb-mobile-touch); padding: var(--pb-space-2); gap: var(--pb-space-2); }
.pb-mobile #contactsCategoryNav .contacts-category-label { position: static; width: auto; height: auto; clip: auto; clip-path: none; overflow: visible; margin: var(--pb-space-0); white-space: normal; font-size: var(--pb-font-size-sm); }
.pb-mobile :is(.contacts-main, .contacts-list-pane, .contacts-list) { display: block; height: auto; max-height: none; min-width: var(--pb-space-0); overflow: visible; }
.pb-mobile :is(.contacts-splitter, .contacts-detail-pane) { display: none; }
.pb-mobile .pb-contact-row { margin-block: var(--pb-space-2); border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-lg); background: var(--surface-card); overflow-wrap: anywhere; }
.pb-mobile .pb-contact-disclosure { display: flex; align-items: center; justify-content: space-between; gap: var(--pb-space-3); width: var(--pb-mobile-full); min-height: var(--pb-mobile-touch); padding: var(--pb-space-3); border: none; background: transparent; color: var(--text-primary); text-align: left; font: inherit; cursor: pointer; }
.pb-mobile .pb-contact-disclosure > span:first-child { display: grid; gap: var(--pb-space-1); min-width: var(--pb-space-0); }
.pb-mobile .pb-contact-disclosure strong { font-size: var(--pb-font-size-md); }
.pb-mobile .pb-contact-disclosure span span { color: var(--text-secondary); font-size: var(--pb-font-size-sm); }
.pb-mobile .pb-contact-personnel { padding: var(--pb-space-3); border-top: var(--pb-border-width-sm) solid var(--border-color); }
.pb-mobile .pb-contact-personnel :is(button, a) { min-height: var(--pb-mobile-touch); }
.pb-mobile .pb-contact-personnel :is(.contacts-detail-section, .contacts-info-row, .contacts-info-link, .contacts-info-list, .contacts-email-action-menu) { min-width: var(--pb-space-0); max-width: var(--pb-mobile-full); white-space: normal; font-size: var(--pb-font-size-md); }
.pb-mobile .pb-contact-personnel .contacts-info-row span { overflow-wrap: anywhere; }
.pb-mobile .pb-contact-personnel > .pb-mobile-button { margin-block: var(--pb-space-2); }
.pb-mobile .pb-contact-personnel p { color: var(--text-secondary); font-size: var(--pb-font-size-md); }

/* The chronology is vertical on phones and unfolded inner screens. */
.pb-mobile .pb-task-summary { display: grid; grid-template-columns: repeat(3, minmax(var(--pb-space-0), 1fr)); gap: var(--pb-space-2); margin-block: var(--pb-space-3); }
.pb-mobile .pb-task-summary button { display: grid; gap: var(--pb-space-1); min-width: var(--pb-space-0); padding: var(--pb-space-2); font-size: var(--pb-font-size-sm); overflow-wrap: anywhere; }
.pb-mobile .pb-task-summary strong { font-size: var(--pb-font-size-xl); }
.pb-mobile .pb-task-timeline h2 { font-size: var(--pb-font-size-lg); margin-block: var(--pb-space-4) var(--pb-space-3); }
.pb-mobile .pb-task-timeline ol { list-style: none; padding: var(--pb-space-0); margin: var(--pb-space-0); }
.pb-mobile .pb-task-timeline li { position: relative; padding: var(--pb-space-0) var(--pb-space-0) var(--pb-space-3) var(--pb-space-6); margin-left: var(--pb-space-3); border-left: var(--pb-border-width-md) solid var(--border-color); }
.pb-mobile .pb-task-marker { position: absolute; left: calc(var(--pb-space-3) * -1); top: var(--pb-space-3); display: grid; place-items: center; width: var(--pb-space-6); height: var(--pb-space-6); background: var(--surface-card); color: var(--text-secondary); border-radius: var(--pb-radius-pill); }
.pb-mobile .pb-task-marker svg { width: var(--pb-size-icon-md); height: var(--pb-size-icon-md); }
.pb-mobile .pb-task-timeline [data-ai-state="active"] > .pb-task-marker { color: var(--brand-primary); outline: var(--pb-border-width-md) solid var(--brand-primary); }
.pb-mobile .pb-task-card { min-width: var(--pb-space-0); padding: var(--pb-space-3); background: var(--surface-card); border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-lg); font-size: var(--pb-font-size-md); overflow-wrap: anywhere; }
.pb-mobile .pb-task-card p { margin: var(--pb-space-2) var(--pb-space-0); color: var(--text-secondary); }
.pb-mobile .pb-task-open { min-height: var(--pb-mobile-touch); display: block; width: var(--pb-mobile-full); text-align: left; background: transparent; border: none; color: var(--text-primary); padding: var(--pb-space-0); font: inherit; cursor: pointer; }
.pb-mobile .pb-task-progress { display: flex; align-items: center; gap: var(--pb-space-2); }
.pb-mobile .pb-task-progress progress { flex: 1; min-width: var(--pb-space-0); width: var(--pb-mobile-full); accent-color: var(--brand-primary); }
.pb-mobile .pb-task-card .pb-task-parent { font-size: var(--pb-font-size-sm); }
.pb-mobile-narrow .pb-task-summary { grid-template-columns: minmax(var(--pb-space-0), 1fr); }
.pb-mobile.pb-mobile-wide .task-form-grid { grid-template-columns: repeat(2, minmax(var(--pb-space-0), 1fr)); }
.pb-mobile.pb-mobile-wide .shortage-page :is(td, .header-col) { padding: var(--pb-space-3); font-size: var(--pb-font-size-sm); }

.pb-mobile .pb-mobile-modal-switch > button { flex: 1; min-width: var(--pb-space-0); padding-inline: var(--pb-space-1); }
.pb-mobile[data-mobile-detail-section="stock"] .pb-mobile-usage { display: none !important; }
.pb-mobile[data-mobile-detail-section="usage"] #modalDrugInfo > :not(.pb-mobile-usage),
.pb-mobile[data-mobile-detail-section="usage"] #detailsModal .modal-body > :not(#modalDrugInfo) { display: none !important; }

.pb-mobile .contacts-search { flex-basis: var(--pb-mobile-full); }
.pb-mobile .contacts-info-list .contacts-detail-subtitle { color: var(--text-primary); font-size: var(--pb-font-size-md); }
.pb-mobile .tasks-timeline-frame-actions, .pb-mobile #tasksTimelineShowing { display: none; }

.pb-mobile .pb-mobile-catalog-filter { align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--pb-space-2); padding: var(--pb-space-2); background: var(--surface-card-alt); border-radius: var(--pb-radius-md); font-size: var(--pb-font-size-md); overflow-wrap: anywhere; }
.pb-mobile .pb-mobile-catalog-filter span { flex: 1; min-width: var(--pb-space-0); }

/* Shared search position; the original controls and listeners move back on desktop. */
/* Keep the frame height stable while native touch scrolling is active. */
.pb-mobile .pb-mobile-page-search { position: sticky; top: var(--pb-space-0); z-index: var(--pb-mobile-shell-z); padding: var(--pb-space-2); margin: var(--pb-space-0); background: var(--pb-color-surface-base); border-bottom: var(--pb-border-width-sm) solid var(--border-color); box-sizing: border-box; }
.pb-mobile .pb-mobile-page-search > :is(.contacts-search, .shortage-search-field, #tasksSearchWrap, .pb-analytics-search) { display: flex; align-items: center; gap: var(--pb-space-2); width: var(--pb-mobile-full); max-width: var(--pb-mobile-full); min-width: var(--pb-space-0); min-height: var(--pb-mobile-touch); margin: var(--pb-space-0); padding: var(--pb-space-0) var(--pb-space-2); box-sizing: border-box; overflow: visible; transition: none; background: var(--surface-card-alt); border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-md); }
.pb-mobile .pb-mobile-page-search input { flex: 1; width: var(--pb-mobile-full); min-width: var(--pb-space-0); min-height: var(--pb-mobile-touch); border: none; background: transparent; color: var(--text-primary); font-size: var(--pb-font-size-md); padding: var(--pb-space-0); box-shadow: none; }
.pb-mobile .pb-mobile-page-search svg { width: var(--pb-size-icon-md); height: var(--pb-size-icon-md); flex-shrink: 0; }
.pb-mobile .pb-mobile-page-search button { min-height: var(--pb-mobile-touch); min-width: var(--pb-mobile-touch); }
.pb-mobile .pb-mobile-more { grid-row: 2 / 3; top: auto; bottom: var(--pb-space-0); align-self: end; min-width: min(var(--pb-inventory-action-menu-width), var(--pb-mobile-full)); background: var(--pb-color-surface-base); border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-lg) var(--pb-radius-lg) var(--pb-space-0) var(--pb-radius-lg); }
.pb-mobile :is(#tasksBodyViewIcons, #tasksReportActions, #tasksKanbanView, #tasksPrintView, [data-ai-id="task-filter-search"]) { display: none !important; }
.pb-mobile #tasksReportSearchSeparator { display: none !important; }
.pb-mobile #contactsCategoryNav .contacts-category-label { position: absolute; width: var(--pb-space-0); height: var(--pb-space-0); overflow: hidden; clip-path: inset(100%); padding: var(--pb-space-0); }
.pb-mobile #contactsCategoryNav .contacts-category-btn { padding: var(--pb-space-2); gap: var(--pb-space-0); width: var(--pb-mobile-touch); height: var(--pb-mobile-touch); }
.pb-mobile #contactsListTitle { position: absolute; width: var(--pb-space-0); height: var(--pb-space-0); overflow: hidden; clip-path: inset(100%); }
.pb-mobile :is(.contacts-list-pane, .contacts-list-header, .contacts-list) { background: transparent; border: none; box-shadow: none; }


.pb-mobile .pb-mobile-nav [aria-expanded="true"] { background: var(--surface-card-alt); color: var(--brand-primary); }

/* Mobile frame polish: edge-to-edge chrome and one surface per content card. */
.pb-mobile, .pb-mobile * { scrollbar-width: none; scrollbar-gutter: auto; }
.pb-mobile::-webkit-scrollbar, .pb-mobile *::-webkit-scrollbar { width: var(--pb-space-0); height: var(--pb-space-0); }
.pb-mobile :is(#scrollArrowUp, #scrollArrowDown, #settingsModalScrollArrowUp, #settingsModalScrollArrowDown) { display: none !important; }
.pb-mobile :is(body, #dashboardMain, #tasksContainer, .contacts-page) { background: var(--pb-color-bg-shell); }
.pb-mobile :is(#mobileHeader, #mobileNavigation, .pb-mobile-page-search) { width: var(--pb-mobile-full); margin: var(--pb-space-0); border-radius: var(--pb-space-0); background: var(--pb-color-surface-base); box-shadow: none; }
.pb-mobile #dashboardMain { border: none; box-shadow: none; }
.pb-mobile #mobileNavigation { padding-top: var(--pb-space-0); gap: var(--pb-space-0); }
.pb-mobile #mobileNavigation button { border-radius: var(--pb-space-0); background: transparent; box-shadow: none; border-top: var(--pb-border-width-md) solid transparent; }
.pb-mobile #mobileNavigation :is([aria-current="page"], [aria-expanded="true"]) { border-top-color: var(--brand-primary); color: var(--brand-primary); }
.pb-mobile .pb-mobile-page-search { padding: var(--pb-space-2) var(--pb-space-3); }
.pb-mobile .pb-mobile-page-search > :is(.contacts-search, .shortage-search-field, #tasksSearchWrap, .pb-analytics-search) { border-color: transparent; background: var(--pb-color-surface-subtle); box-shadow: none; }
.pb-mobile .pb-mobile-page-search button { border: none; background: transparent; box-shadow: none; border-radius: var(--pb-radius-md); }
.pb-mobile .pb-mobile-button { box-shadow: none; }
.pb-mobile .pb-mobile-more .pb-mobile-button { text-align: left; border-color: transparent; background: transparent; }

.pb-mobile .shortage-page :is(.inventory-workspace, .shortage-main-shell, .shortage-main-pane, .shortage-table-shell) { margin: var(--pb-space-0); padding: var(--pb-space-0); border: none; border-radius: var(--pb-space-0); background: transparent; box-shadow: none; }
.pb-mobile .shortage-command-bar { margin: var(--pb-space-0); padding: var(--pb-space-3); border: none; border-radius: var(--pb-space-0); background: transparent; box-shadow: none; }
.pb-mobile .shortage-page :is(.inventory-table-caption, .header-columns, .footer) { margin: var(--pb-space-0); padding-inline: var(--pb-space-3); border-radius: var(--pb-space-0); background: var(--pb-color-surface-base); box-shadow: none; }
.pb-mobile .shortage-page .footer { border: none; border-top: var(--pb-border-width-sm) solid var(--border-color); }
.pb-mobile .shortage-page .table-container { background: transparent; border: none; border-radius: var(--pb-space-0); }
.pb-mobile #inventoryPage :is(.group-header, .child-row) { box-shadow: none; border-radius: var(--pb-space-0); }

.pb-mobile :is(#detailsModal, #companionModal) .modal-container { border: none; box-shadow: none; background: var(--pb-color-bg-shell); }
.pb-mobile :is(#detailsModal, #companionModal) .modal-header { margin: var(--pb-space-0); border-radius: var(--pb-space-0); background: var(--pb-color-surface-base) !important; border-bottom: var(--pb-border-width-sm) solid var(--border-color); box-shadow: none; }
.pb-mobile :is(#detailsModal, #companionModal) .modal-title { color: var(--text-primary); }
.pb-mobile :is(#detailsModal, #companionModal) .modal-title svg { width: var(--pb-size-icon-md); height: var(--pb-size-icon-md); flex-shrink: 0; }
.pb-mobile :is(#detailsModal, #companionModal) .modal-close-btn { display: grid; place-items: center; width: var(--pb-mobile-touch); min-width: var(--pb-mobile-touch); padding: var(--pb-space-0); border: none; border-radius: var(--pb-radius-md); background: transparent; color: var(--text-primary); box-shadow: none; }
.pb-mobile .pb-mobile-modal-switch { padding: var(--pb-space-0); gap: var(--pb-space-0); background: var(--pb-color-surface-base); border-bottom: var(--pb-border-width-sm) solid var(--border-color); }
.pb-mobile .pb-mobile-modal-switch .pb-mobile-button { border: none; border-bottom: var(--pb-border-width-md) solid transparent; border-radius: var(--pb-space-0); background: transparent; }
.pb-mobile .pb-mobile-modal-switch [aria-pressed="true"] { border-bottom-color: var(--brand-primary); color: var(--brand-primary); }
.pb-mobile :is(.modal-drug-info, .inv-cards-container, .drug-info-grid, #companionModal .item-details-container, #companionModal .summary-cards-row) { border: none; background: transparent; box-shadow: none; }
.pb-mobile :is(.inventory-item, #companionModal .companion-section, .pb-mobile-usage-summary) { border: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-radius-lg); background: var(--pb-color-surface-base); box-shadow: none; }
.pb-mobile .pb-mobile-usage > section + section { margin-top: var(--pb-space-5); }
.pb-mobile .pb-mobile-usage h3 { margin-block: var(--pb-space-0) var(--pb-space-2); }

.pb-mobile :is(#tasksWorkspace, #tasksMainSurface, #tasksTimelineFrame, #tasksShell, #tasksShell > .tasks-card, #tasksContent) { border: none; border-radius: var(--pb-space-0); background: transparent; box-shadow: none; }
.pb-mobile #tasksMainPane .analytics-header { margin: var(--pb-space-0); padding: var(--pb-space-2) var(--pb-space-3); border: none; border-radius: var(--pb-space-0); background: transparent; box-shadow: none; }
.pb-mobile :is(.tasks-timeline-frame-header, .tasks-timeline-frame-footer) { padding-inline: var(--pb-space-3); border-radius: var(--pb-space-0); background: var(--pb-color-surface-base); box-shadow: none; }
.pb-mobile #tasksListBody { padding: var(--pb-space-3); }
.pb-mobile :is(.pb-task-card, .pb-contact-row) { background: var(--pb-color-surface-base); box-shadow: none; }
.pb-mobile .pb-task-marker { background: var(--pb-color-bg-shell); }
.pb-mobile .pb-task-summary .pb-mobile-button { background: transparent; border-color: transparent; }
.pb-mobile .pb-task-summary [aria-pressed="true"] { background: var(--pb-color-surface-base); border-color: var(--border-color); }

.pb-mobile .contacts-toolbar { padding: var(--pb-space-2) var(--pb-space-3); border-bottom: var(--pb-border-width-sm) solid var(--border-color); }
.pb-mobile .contacts-main { padding: var(--pb-space-0) var(--pb-space-3) var(--pb-space-3); }
.pb-mobile .contacts-list-header { padding-inline: var(--pb-space-0); }
.pb-mobile #contactsCategoryNav { gap: var(--pb-space-1); }
.pb-mobile #contactsCategoryNav .contacts-category-btn { display: grid; place-items: center; border: none; background: transparent; box-shadow: none; border-radius: var(--pb-radius-md); }
.pb-mobile #contactsCategoryNav .contacts-category-btn[aria-pressed="true"] { background: var(--pb-color-surface-base); color: var(--brand-primary); }
.pb-mobile #contactsCategoryNav svg { width: var(--pb-size-icon-md); height: var(--pb-size-icon-md); }
.pb-mobile .pb-contact-personnel .contacts-detail-section { padding: var(--pb-space-0); border: none; background: transparent; box-shadow: none; }
.pb-mobile :is(.pb-mobile-more button, .modal-close-btn, .pb-mobile-page-search button):hover { background: var(--pb-color-surface-subtle); }

.pb-mobile .shortage-button-panel { border: none; background: transparent; box-shadow: none; }
.pb-mobile .shortage-view-toggle { box-shadow: none; min-height: var(--pb-mobile-touch); }
.pb-mobile .shortage-page .inventory-table-caption { min-height: var(--pb-mobile-touch); }
.pb-mobile .shortage-page :is(.container, .shortage-main-shell, .shortage-command-bar) { transition: none; }
.pb-mobile .pb-contact-personnel .contacts-detail-section + .contacts-detail-section { margin-top: var(--pb-space-3); padding-top: var(--pb-space-3); border-top: var(--pb-border-width-sm) solid var(--border-color); border-radius: var(--pb-space-0); }

/* Native scrolling and dynamic viewport sizing are shared across mobile routes. */
.pb-mobile :is(.container, #tasksMainPane, .contacts-page, .table-container) { overscroll-behavior-y: auto; }
.contacts-mobile-add-icon { display: none; }
.pb-mobile .contacts-toolbar-actions { display: contents; }
.pb-mobile #contactsStatus { grid-column: 1 / -1; grid-row: 2; min-width: var(--pb-space-0); }
.pb-mobile #contactsStatus:empty { display: none; }
.pb-mobile #newContactBtn { grid-column: 2; grid-row: 1; display: grid; place-items: center; width: var(--pb-mobile-touch); min-width: var(--pb-mobile-touch); height: var(--pb-mobile-touch); padding: var(--pb-space-2); }
.pb-mobile #newContactBtn > :not(.contacts-mobile-add-icon) { display: none; }
.pb-mobile #newContactBtn .contacts-mobile-add-icon { display: block; fill: none; }

.pb-mobile .shortage-view-toggle { white-space: normal; overflow-wrap: anywhere; padding-inline: var(--pb-space-1); }
