/* Tracking desktop layout repair. */
@media (min-width: 721px) {
  /* Tracking follows the Dispatch board's desktop chrome and spacing. */
  html body .tracking-header-search-slot {
    display: none !important;
  }

  html body #trackingView > .tracking-metric-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 8px !important;
  }

  html body #trackingView > .tracking-metric-grid > .metric {
    flex: 0 1 220px !important;
    min-width: 180px !important;
    max-width: 220px !important;
  }

  html body #trackingView > .shipment-tools {
    position: relative !important;
    z-index: 30050 !important;
    display: grid !important;
    grid-template-columns: minmax(320px, 420px) repeat(3, minmax(125px, 180px)) auto !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: min(1120px, 100%) !important;
    max-width: 100% !important;
    margin: 0 auto 8px !important;
    padding: 0 !important;
    background: transparent !important;
  }

  html body #trackingView > .shipment-tools > :is(.search-wrap, select, .custom-select, .operational-clear-filters) {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
  }

  html body #trackingView > .shipment-tools .search-wrap,
  html body #trackingView > .shipment-tools #trackingSearch,
  html body #trackingView > .shipment-tools :is(select, .custom-select-button, .custom-select-toggle) {
    height: 42px !important;
  }

  html body #trackingView > .shipment-tools .operational-mobile-filter-toggle {
    display: none !important;
  }

  /* Auto TMS uses one unambiguous play icon and swaps to stop only while running. */
  html body #trackingView .tracking-auto-tms-header {
    padding: 0 6px !important;
    overflow: visible !important;
    text-align: center !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button {
    display: inline-grid !important;
    place-items: center !important;
    box-sizing: border-box !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 1px solid #cfe0f2 !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: #0f8a9a !important;
    overflow: hidden !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button svg {
    grid-area: 1 / 1 !important;
    width: 16px !important;
    height: 16px !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button .auto-tms-start-icon {
    display: block !important;
    fill: currentColor !important;
    stroke: none !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button .auto-tms-start-icon path {
    fill: currentColor !important;
    stroke: none !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button .auto-tms-stop-icon {
    display: none !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button.is-running .auto-tms-start-icon {
    display: none !important;
  }

  html body #trackingView .tracking-auto-tms-toggle-button.is-running .auto-tms-stop-icon {
    display: block !important;
    fill: currentColor !important;
    stroke: none !important;
  }

  /* Hide Owner and dedicate the recovered width to Customer and Pickup. */
  html body #trackingView .tracking-loads-table :is(col, th, td):nth-child(13) {
    display: none !important;
  }

  html body #trackingView .tracking-loads-table :is(col, th, td):nth-child(8) {
    width: 15% !important;
  }

  html body #trackingView .tracking-loads-table :is(col, th, td):nth-child(9) {
    width: 16% !important;
  }

  html body #trackingView .tracking-loads-table :is(col, th, td):nth-child(10) {
    width: 9% !important;
  }

  html body #trackingView .tracking-loads-table :is(col, th, td):nth-child(11) {
    width: 15% !important;
  }

  html body #trackingView .tracking-loads-table :is(th, td),
  html body #trackingRows .desktop-tracking-customer,
  html body #trackingRows .tracking-route-main,
  html body #trackingRows .tracking-note-cell {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

/* Match the exact Dispatch tile width at common desktop resolutions. */
@media (min-width: 1400px) and (max-width: 2200px) {
  html body #trackingView > .tracking-metric-grid > .metric {
    flex: 0 1 calc((100% - 56px) / 8) !important;
    min-width: 135px !important;
    max-width: calc((100% - 56px) / 8) !important;
  }
}
