/* ==========================================================
   MOBILE RESPONSIVE — SafeTrack EHS
   Loaded AFTER ui-dark.css. All rules scoped to media queries
   so desktop is never touched.
   ========================================================== */

/* ---------- viewport & safe-area foundation ---------- */
@supports (padding: env(safe-area-inset-bottom)) {
  html {
    padding:
      env(safe-area-inset-top)
      env(safe-area-inset-right)
      env(safe-area-inset-bottom)
      env(safe-area-inset-left);
  }
}

/* ======================================================
   WORKSPACE / CONTEXT SELECTOR — CRITICAL FIX
   The .ws-page inside #workspaceOverlay uses flex-row
   with 35%/65% split. On mobile it overflows the viewport
   because the overlay itself has no scroll and the panels
   use fixed padding + min-height: 100vh.
   ====================================================== */

/* --- Below 900px: stack vertically, allow scroll --- */
@media (max-width: 900px) {
  #workspaceOverlay {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }

  #workspaceOverlay > div {
    border-radius: 0 !important;
    border: none !important;
  }

  .ws-page {
    flex-direction: column !important;
    min-height: auto !important;
    height: auto !important;
    overflow-y: auto !important;
  }

  .ws-brand-panel {
    flex: none !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 28px 20px 20px !important;
    justify-content: flex-start !important;
  }

  .ws-brand-features {
    display: none !important;
  }

  .ws-brand-top {
    margin-bottom: 16px !important;
    gap: 14px !important;
  }

  .ws-brand-logo {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
  }

  .ws-brand-name {
    font-size: 20px !important;
  }

  .ws-brand-hint {
    display: none !important;
  }

  .ws-selector-panel {
    flex: none !important;
    width: 100% !important;
    padding: 24px 20px 40px !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
  }

  .ws-selector-inner {
    max-width: 100% !important;
    width: 100% !important;
  }

  .ws-selector-header {
    margin-bottom: 24px !important;
  }

  .ws-selector-header h2 {
    font-size: 24px !important;
  }

  .ws-selector-header p {
    font-size: 14px !important;
  }

  .ws-step {
    margin-bottom: 24px !important;
  }

  .ws-module-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .ws-module-card {
    padding: 14px !important;
    gap: 8px !important;
  }

  .ws-module-card p {
    display: none !important;
  }

  .ws-layout-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .ws-layout-card {
    padding: 12px !important;
  }

  .ws-layout-preview {
    height: 48px !important;
  }

  .ws-confirm-btn {
    width: 100% !important;
    min-height: 48px !important;
  }

  .ws-actions {
    position: sticky;
    bottom: 0;
    padding: 16px 0 0;
    z-index: 5;
  }
}

/* --- Below 480px: single column module/layout grids --- */
@media (max-width: 480px) {
  .ws-brand-panel {
    padding: 20px 16px 16px !important;
  }

  .ws-selector-panel {
    padding: 20px 16px 36px !important;
  }

  .ws-module-grid {
    grid-template-columns: 1fr !important;
  }

  .ws-module-card {
    flex-direction: row !important;
    text-align: left !important;
    align-items: center !important;
    min-height: 64px !important;
  }

  .ws-module-icon {
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 40px !important;
  }

  .ws-module-icon svg {
    width: 20px !important;
    height: 20px !important;
  }

  .ws-layout-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .ws-selector-header h2 {
    font-size: 20px !important;
  }

  .ws-step-label {
    font-size: 14px !important;
  }
}


/* ======================================================
   LOGIN SCREEN
   ====================================================== */
@media (max-width: 640px) {
  .app-overlay-auth {
    padding: 12px !important;
  }

  .auth-split {
    height: auto !important;
    min-height: auto !important;
  }

  .auth-split-media {
    display: none !important;
  }

  .auth-split-form {
    width: 100% !important;
    flex: none !important;
    padding: 0 !important;
  }

  .auth-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 24px 16px !important;
    border-radius: 20px !important;
  }

  .auth-logo {
    width: 72px !important;
    height: 72px !important;
    border-radius: 18px !important;
  }

  .auth-title {
    font-size: 20px !important;
  }

  .auth-submit {
    min-height: 48px !important;
    font-size: 15px !important;
  }
}


/* ======================================================
   SIDEBAR / MENU — MOBILE
   At <=1024px the sidebar is already position:fixed with
   transform slide. We improve: better sizing, close on
   nav, overlay, safe area.
   ====================================================== */
@media (max-width: 1024px) {
  .tabs.app-sidebar {
    width: min(280px, calc(100vw - 48px)) !important;
    padding: 16px !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 0 20px 20px 0 !important;
    inset: 0 auto 0 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    gap: 12px !important;
  }

  .sidebar-brand {
    padding-bottom: 12px !important;
    gap: 10px !important;
  }

  .sidebar-brand img {
    width: 40px !important;
    height: 40px !important;
  }

  .sidebar-nav .tab-btn,
  .sidebar-link {
    min-height: 44px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
  }

  .sidebar-footer {
    padding: 14px 12px !important;
  }

  .sidebar-scrim {
    -webkit-tap-highlight-color: transparent;
  }

  /* Sidebar toggle button visible and accessible */
  .sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 0;
    padding: 0 !important;
    border-radius: 12px !important;
  }

  /* Hamburger icon via pseudo-element */
  .sidebar-toggle::before {
    content: "\2630";
    font-size: 22px;
    line-height: 1;
  }
}


/* ======================================================
   HEADER / TOPBAR
   ====================================================== */
@media (max-width: 768px) {
  header.app-topbar {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "brand"
      "search"
      "actions" !important;
    padding: 14px !important;
    gap: 12px !important;
    border-radius: 18px !important;
  }

  .brand {
    width: 100% !important;
    gap: 10px !important;
  }

  .brand-logo {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 12px !important;
  }

  .brand-text h1 {
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
  }

  .brand-company {
    font-size: 10px !important;
  }

  .brand-subtitle {
    display: none !important;
  }

  .topbar-search-wrap {
    width: 100% !important;
  }

  .topbar-search {
    min-height: 44px !important;
    padding: 0 12px !important;
    border-radius: 14px !important;
  }

  .header-right {
    width: 100% !important;
  }

  .header-right .header-info {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .header-info > div,
  .header-chip {
    padding: 8px 10px !important;
    min-width: 0 !important;
    border-radius: 10px !important;
  }

  .header-info-label {
    font-size: 9px !important;
  }

  .header-info strong,
  .header-chip strong {
    font-size: 12px !important;
  }

  .topbar-actions {
    width: 100% !important;
    gap: 8px !important;
  }

  .topbar-actions select,
  .topbar-actions button,
  .topbar-select {
    width: 100% !important;
    min-height: 44px !important;
  }

  /* Hide non-essential header info */
  .header-chip[data-chip="date"],
  .header-chip[data-chip="photos"] {
    display: none !important;
  }
}

@media (max-width: 480px) {
  header.app-topbar {
    padding: 10px !important;
    gap: 10px !important;
    border-radius: 14px !important;
  }

  .brand-logo {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
  }

  .brand-text h1 {
    font-size: 1rem !important;
  }

  .header-right .header-info {
    grid-template-columns: 1fr !important;
  }
}


/* ======================================================
   MODULE SUBNAV (tab bar below sidebar)
   ====================================================== */
@media (max-width: 768px) {
  .module-subnav {
    padding: 8px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 14px !important;
  }

  .module-subnav::-webkit-scrollbar {
    display: none;
  }

  .module-subnav .tab-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 10px 12px !important;
    min-height: 40px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }
}


/* ======================================================
   CONTAINER
   ====================================================== */
@media (max-width: 1024px) {
  .container {
    padding: 14px !important;
    gap: 16px !important;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 10px !important;
    gap: 12px !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 8px !important;
    gap: 10px !important;
  }
}


/* ======================================================
   GRIDS, CARDS, STATS
   ====================================================== */
@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .exec-kpi-grid-primary {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .exec-kpi-grid-secondary {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .card {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  .stat-card {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  .exec-kpi-card {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  .stat-number {
    font-size: 24px !important;
  }

  .exec-kpi-card .kpi-value {
    font-size: 26px !important;
  }

  .card h3 {
    font-size: 14px !important;
    margin-bottom: 10px !important;
  }

  /* Executive hero section */
  .exec-hero-section {
    flex-direction: column !important;
    gap: 16px !important;
    padding: 16px !important;
    border-radius: 14px !important;
  }

  .exec-hero-score {
    width: 140px !important;
    height: 140px !important;
  }

  .exec-score-value {
    font-size: 36px !important;
  }

  .exec-score-components {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .exec-kpi-grid-primary,
  .exec-kpi-grid-secondary {
    grid-template-columns: 1fr !important;
  }

  .stat-card {
    padding: 10px !important;
  }

  .stat-number {
    font-size: 20px !important;
  }

  .stat-label {
    font-size: 10px !important;
  }

  .card {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  .card h3 {
    font-size: 13px !important;
  }
}

@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}


/* ======================================================
   TABLES — horizontal scroll wrapper
   ====================================================== */
@media (max-width: 768px) {
  table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
  }

  .exec-table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table th,
  table td,
  .exec-table th,
  .exec-table td {
    padding: 10px 12px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  /* Allow wrapping in first column for readability */
  table td:first-child,
  .exec-table td:first-child {
    white-space: normal;
    min-width: 120px;
  }
}


/* ======================================================
   FORMS, INPUTS, SELECTS, BUTTONS
   ====================================================== */
@media (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px !important;  /* prevents iOS zoom */
    min-height: 44px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
  }

  textarea {
    min-height: 80px !important;
  }

  button {
    min-height: 44px !important;
    font-size: 14px !important;
    touch-action: manipulation;
  }

  .form-group {
    margin-bottom: 12px !important;
  }

  label {
    font-size: 13px !important;
  }

  /* Form grids stack */
  .modal-form-grid,
  .incident-people-row,
  .incident-filter-grid,
  .incident-detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* Inline select + input combos */
  select[style*="min-width"] {
    min-width: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  input,
  select,
  textarea {
    padding: 10px !important;
    border-radius: 8px !important;
  }

  button {
    padding: 12px 14px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
  }

  /* Checklist items */
  .checklist-item {
    padding: 10px !important;
    font-size: 12px !important;
  }

  .checklist-item-v2 {
    padding: 10px !important;
  }

  .status-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}


/* ======================================================
   MODALS
   ====================================================== */
@media (max-width: 768px) {
  .modal {
    padding: 8px !important;
    align-items: flex-end !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    max-height: 90dvh !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px 16px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal-content--sm,
  .modal-content--md,
  .modal-content--wide {
    max-width: 100% !important;
    width: 100% !important;
  }

  .modal-close {
    position: sticky !important;
    top: 0;
    float: right;
    z-index: 10;
    background: var(--card) !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
  }

  .modal-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .modal-actions button {
    width: 100% !important;
    flex: none !important;
    min-height: 44px !important;
  }

  .modal-form-grid {
    grid-template-columns: 1fr !important;
  }

  .modal-media-image {
    border-radius: 12px !important;
  }
}

/* On very small screens, make modal full-screen */
@media (max-width: 480px) {
  .modal {
    padding: 0 !important;
  }

  .modal-content {
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    padding: 16px 12px !important;
  }
}


/* ======================================================
   INCIDENT CARDS, INSPECTION, NR SECTIONS
   ====================================================== */
@media (max-width: 768px) {
  .incident-item {
    overflow-x: hidden !important;
    word-break: break-word !important;
  }

  .incident-photos img {
    max-width: 80px !important;
    max-height: 80px !important;
  }

  .incident-type-rail {
    grid-template-columns: 1fr !important;
  }

  .incident-media-card {
    width: 100% !important;
  }

  .incident-media-actions,
  .incident-media-actions.triple {
    grid-template-columns: 1fr !important;
  }

  .nr-section {
    padding: 12px !important;
  }

  .nr-header {
    font-size: 13px !important;
  }

  /* Upload areas */
  .upload-area {
    padding: 16px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
  }

  .image-preview img {
    width: 60px !important;
    height: 60px !important;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
    gap: 8px !important;
  }
}


/* ======================================================
   RADAR / HEATMAP
   ====================================================== */
@media (max-width: 640px) {
  .radar-weekdays,
  .radar-grid {
    gap: 3px !important;
  }

  .radar-day,
  .radar-day--empty {
    min-height: 40px !important;
    border-radius: 8px !important;
    font-size: 11px !important;
  }

  .radar-photo-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .heatmap-sector {
    padding: 10px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
  }
}


/* ======================================================
   PRESENTATION / REPORTS
   ====================================================== */
@media (max-width: 768px) {
  .presentation-actions,
  .queue-actions {
    flex-direction: column !important;
  }

  .presentation-actions button,
  .queue-actions button {
    flex: none !important;
    width: 100% !important;
  }

  .presentation-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .presentation-kpi-grid {
    grid-template-columns: 1fr !important;
  }
}


/* ======================================================
   KPI CHARTS & CLIENT CATALOG
   ====================================================== */
@media (max-width: 768px) {
  .kpi-chart-card__header {
    padding: 14px 14px 6px !important;
  }

  .kpi-chart-card__body {
    padding: 0 12px 12px !important;
  }

  .kpi-chart-card__canvas {
    height: 240px !important;
  }

  .kpi-client-summary-grid {
    grid-template-columns: 1fr !important;
  }

  .kpi-hero-copy h3 {
    font-size: 18px !important;
  }

  .kpi-status-pill-row {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }
}


/* ======================================================
   AUDIT MODULE
   ====================================================== */
@media (max-width: 768px) {
  .audit-form-grid {
    grid-template-columns: 1fr !important;
  }

  .audit-active-info {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .audit-timer {
    font-size: 2rem !important;
  }

  .audit-hist-item {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}


/* ======================================================
   ENVIRONMENTAL MODULE
   ====================================================== */
@media (max-width: 768px) {
  .amb-hero-shell {
    grid-template-columns: 1fr !important;
  }

  .amb-form-grid,
  .amb-form-grid--3,
  .amb-fact-grid,
  .amb-quick-grid {
    grid-template-columns: 1fr !important;
  }

  .amb-data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .amb-timeline-item,
  .amb-attachment-item,
  .amb-attachment-upload,
  .amb-evidence-head {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .amb-form-actions,
  .amb-checklist-row,
  .amb-checklist-controls {
    flex-direction: column !important;
    align-items: stretch !important;
  }
}


/* ======================================================
   ADMIN MODULE
   ====================================================== */
@media (max-width: 768px) {
  .admin-section .grid-2 {
    grid-template-columns: 1fr !important;
  }

  .admin-section table {
    display: block !important;
    overflow-x: auto !important;
  }
}


/* ======================================================
   INLINE-STYLE GRID OVERRIDES
   Elements with inline grid styles need to be tamed on
   mobile. These selectors target common inline patterns.
   ====================================================== */
@media (max-width: 768px) {
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns:repeat(2,1fr)"],
  [style*="grid-template-columns: repeat(2,1fr)"] {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [style*="display: flex"][style*="gap"],
  [style*="display:flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }
}

@media (max-width: 480px) {
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"] {
    grid-template-columns: 1fr !important;
  }
}


/* ======================================================
   LEGACY THEME — MOBILE FIXES
   Legacy uses tabs-on-top instead of sidebar
   ====================================================== */
@media (max-width: 768px) {
  body.theme-legacy .tabs.app-sidebar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    padding: 0 0 8px 0 !important;
    scrollbar-width: none;
  }

  body.theme-legacy .tabs.app-sidebar::-webkit-scrollbar {
    display: none;
  }

  body.theme-legacy .app-sidebar .tab-btn,
  body.theme-legacy .app-sidebar button.tab-btn {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }

  body.theme-legacy .container {
    padding: 10px !important;
  }

  body.theme-legacy header,
  body.theme-legacy header.app-topbar {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  body.theme-legacy .brand-logo {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
  }

  body.theme-legacy h1 {
    font-size: 18px !important;
  }

  body.theme-legacy .module-subnav {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }
}


/* ======================================================
   SPLASH SCREEN
   ====================================================== */
@media (max-width: 480px) {
  .app-splash-logo {
    width: 100px !important;
    height: 100px !important;
  }

  .app-splash-title {
    font-size: 16px !important;
  }

  .app-splash-progress {
    width: 80vw !important;
  }
}


/* ======================================================
   GLOBAL MOBILE UTILITIES
   ====================================================== */

/* Prevent horizontal overflow */
@media (max-width: 1024px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* All major containers */
  .container,
  .tab-content,
  .tab-content.active {
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  /* Images and media */
  img, video, svg, canvas {
    max-width: 100% !important;
  }

  canvas {
    height: auto !important;
  }
}

/* Touch-friendly minimum sizes */
@media (max-width: 768px) {
  a, button, [role="button"], .tab-btn, .sidebar-link {
    min-height: 44px;
    /* Ensure touch targets */
  }

  /* Prevent text from being too small */
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

/* iOS keyboard push fix */
@media (max-width: 768px) {
  .modal,
  .app-overlay {
    /* Use fixed instead of trying to handle keyboard */
    position: fixed;
  }
}

/* Smooth scrolling for iOS */
@media (max-width: 1024px) {
  .modal-content,
  .app-overlay,
  .tabs.app-sidebar {
    -webkit-overflow-scrolling: touch;
  }
}


/* ======================================================
   WORKSPACE OVERLAY CARD (legacy/alt workspace picker)
   ====================================================== */
@media (max-width: 640px) {
  .workspace-overlay-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 16px !important;
    border-radius: 20px !important;
  }

  .workspace-choice-grid {
    grid-template-columns: 1fr !important;
  }

  .workspace-choice {
    min-height: 80px !important;
    padding: 14px !important;
  }

  .workspace-overlay-actions {
    flex-direction: column !important;
  }

  .workspace-overlay-actions button {
    width: 100% !important;
    min-height: 44px !important;
  }
}


/* ======================================================
   SEARCH RESULTS DROPDOWN
   ====================================================== */
@media (max-width: 768px) {
  .search-results {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    bottom: 0 !important;
    max-height: 60vh !important;
    border-radius: 18px 18px 0 0 !important;
    overflow-y: auto !important;
    z-index: 9999 !important;
  }
}


/* ======================================================
   WLA (Work Location Assessment)
   ====================================================== */
@media (max-width: 768px) {
  .wla-item-head {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .wla-risk-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .manhours-item {
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

@media (max-width: 480px) {
  .wla-risk-grid {
    grid-template-columns: 1fr !important;
  }
}


/* ======================================================
   MODULE TOOLBAR
   ====================================================== */
@media (max-width: 768px) {
  .module-toolbar-grid {
    grid-template-columns: 1fr !important;
  }

  .module-toolbar-actions {
    width: 100% !important;
  }

  .module-toolbar-actions button {
    flex: 1 1 auto !important;
    min-height: 44px !important;
  }
}


/* ======================================================
   PRINT — hide mobile-only UI in print
   ====================================================== */
@media print {
  .sidebar-toggle,
  .sidebar-scrim {
    display: none !important;
  }
}
