/* Dashboard-only mobile ownership layer. The live shell marks the route on
   <html>, so these rules cannot alter Orders or any desktop page. */
@media (max-width: 767.98px) {
  html[data-gm-dashboard-mobile="1"] header.premium-header {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 10px !important;
    overflow: visible !important;
    transform: none !important;
    animation: none !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > * {
    pointer-events: auto !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > button:not(:first-child):not([data-sidebar="trigger"]):not(.mobile-theme-toggle),
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > a {
    display: none !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > button:first-child,
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > button[data-sidebar="trigger"],
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions .mobile-notification-shell,
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions .mobile-theme-toggle {
    position: absolute !important;
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > button:first-child,
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions > button[data-sidebar="trigger"] {
    inset-inline-start: 10px !important;
    inset-inline-end: auto !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions .mobile-notification-shell {
    inset-inline-end: 58px !important;
    inset-inline-start: auto !important;
    display: inline-flex !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-actions .mobile-theme-toggle {
    inset-inline-end: 10px !important;
    inset-inline-start: auto !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-meta {
    position: static !important;
    order: 0 !important;
    display: flex !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 96px 0 48px !important;
    overflow: visible !important;
  }

  html[dir="rtl"][data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-meta {
    padding: 0 48px 0 96px !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-header-meta > div:first-child,
  html[data-gm-dashboard-mobile="1"] header.premium-header .store-switcher-trigger {
    display: flex !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-account-locale,
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-live-sync,
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-search-host {
    display: none !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-search-row {
    position: static !important;
    order: 1 !important;
    display: block !important;
    width: 100% !important;
    height: 40px !important;
    margin: 0 !important;
  }

  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-search-row .global-search-desktop,
  html[data-gm-dashboard-mobile="1"] header.premium-header .mobile-search-row .global-search-desktop > div {
    display: block !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  html[data-gm-dashboard-mobile="1"],
  html[data-gm-dashboard-mobile="1"] body,
  html[data-gm-dashboard-mobile="1"] #root {
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  html[data-gm-dashboard-mobile="1"] .app-shell-bg {
    width: 100%;
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html[data-gm-dashboard-mobile="1"] .app-shell-bg > .flex,
  html[data-gm-dashboard-mobile="1"] .app-shell-main {
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html[data-gm-dashboard-mobile="1"] main.app-scroll-viewport {
    width: 100% !important;
    max-width: 100vw !important;
    min-height: 0 !important;
    padding: 12px 10px max(22px, env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-x: none !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-gutter: auto !important;
  }

  html[data-gm-dashboard-mobile="1"] main.app-scroll-viewport > div {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding-inline: 0 !important;
    overflow: visible !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home > * {
    min-width: 0 !important;
    max-width: 100% !important;
    margin-block: 0 !important;
    contain: layout style;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home.gm-enter > *,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .gm-motion-kpis > *,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .gm-hover-lift,
  html[data-gm-dashboard-mobile="1"] .dashboard-home [class*="animate-"],
  html[data-gm-dashboard-mobile="1"] .dashboard-home [class*="transition-"] {
    animation: none !important;
    transform: none !important;
    transition-duration: 0s !important;
    backface-visibility: visible !important;
    will-change: auto !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home :where(.shadow-card, .shadow-sm) {
    box-shadow: 0 4px 14px rgb(3 10 24 / 0.16) !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home :where([class*="backdrop-blur"], [style*="backdrop-filter"]) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home h1 {
    font-size: 1.45rem !important;
    line-height: 1.18 !important;
    letter-spacing: 0 !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .gm-motion-kpis,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-summary-grid,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-rate-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  html[data-gm-dashboard-mobile="1"] body #root main.app-scroll-viewport .dashboard-home .grid.grid-cols-1:not(.gm-motion-kpis) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-gm-dashboard-mobile="1"] body #root main.app-scroll-viewport .dashboard-home .gm-read > .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-summary-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-header-actions,
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div:first-child > div:first-child > .flex.flex-wrap.gap-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-header-actions > :first-child,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-header-actions > button:first-child,
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div:first-child > div:first-child > .flex.flex-wrap.gap-2 > :first-child {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-header-actions > :where(button, [role="button"]),
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div:first-child > div:first-child > .flex.flex-wrap.gap-2 > :where(button, [role="button"]) {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center !important;
    padding-inline: 10px !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-filter-bar,
  html[data-gm-dashboard-mobile="1"] .dashboard-home div:has(> .dashboard-filter-basis),
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div.flex.flex-col.gap-3 > div.flex.items-center.gap-2.flex-wrap {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-filter-basis,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-date-presets,
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div.flex.flex-col.gap-3 > div.flex.items-center.gap-2.flex-wrap > div:first-child,
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div.flex.flex-col.gap-3 > div.flex.items-center.gap-2.flex-wrap > div:nth-child(2) {
    grid-column: 1 / -1 !important;
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-filter-basis > button,
  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-date-presets > button,
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div.flex.flex-col.gap-3 > div.flex.items-center.gap-2.flex-wrap > div:first-child > button,
  html[data-gm-dashboard-mobile="1"] .dashboard-home > .space-y-4 > div.flex.flex-col.gap-3 > div.flex.items-center.gap-2.flex-wrap > div:nth-child(2) > button {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding-inline: 5px !important;
    white-space: nowrap !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home :where(.recharts-wrapper, .recharts-responsive-container, .recharts-surface) {
    max-width: 100% !important;
    touch-action: pan-y !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-chart-grid .recharts-responsive-container {
    max-height: 210px !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .dashboard-rate-grid > * {
    min-width: 0 !important;
    min-height: 106px !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home div:has(> table) {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home table {
    min-width: 520px;
  }
}

@media (max-width: 420px) {
  html[data-gm-dashboard-mobile="1"] .dashboard-home :where(.gm-motion-kpis, .dashboard-summary-grid, .dashboard-rate-grid) {
    gap: 7px !important;
  }

  html[data-gm-dashboard-mobile="1"] .dashboard-home .gm-motion-kpis > * {
    min-height: 112px !important;
  }
}
