/* Mobile ergonomics for the driver PWA. Loaded after all legacy layers. */
.transport-table {
  min-width: 1480px;
}

@media (max-width: 560px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .driver-login {
    padding: 20px 16px;
  }

  .driver-login-card {
    padding: 28px 20px;
    border-radius: 20px;
  }

  .driver-login-card > img {
    width: 140px;
    height: 70px;
  }

  .driver-login-card h1 {
    font-size: 28px;
    line-height: 1.3;
  }

  .driver-login-card > p {
    font-size: 14px;
  }

  .driver-login-card form {
    gap: 14px;
    margin-top: 22px;
  }

  .driver-login-card label {
    gap: 8px;
    font-size: 13px;
  }

  .driver-login-card input {
    height: 50px;
    padding: 0 14px;
    font-size: 16px;
  }

  .driver-login-card button {
    height: 52px;
    font-size: 15px;
  }

  .driver-login-card > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 8px;
    padding: 0 8px;
    font-size: 12px;
  }

  .driver-app {
    padding-bottom: calc(88px + var(--safe-bottom));
  }

  .driver-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: calc(68px + var(--safe-top));
    padding: calc(8px + var(--safe-top)) 12px 8px;
  }

  .driver-brand {
    min-height: 44px;
    gap: 8px;
  }

  .driver-brand img {
    width: 42px;
    height: 42px;
  }

  .driver-brand b {
    font-size: 14px;
  }

  .driver-brand small {
    display: block;
    max-width: none;
    font-size: 11px;
  }

  .driver-header > div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    min-width: 0;
    gap: 6px;
  }

  .driver-header button,
  .driver-header #installApp {
    width: auto;
    min-width: 72px;
    height: 44px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.2;
  }

  .driver-network-status {
    top: calc(76px + var(--safe-top));
    right: 10px;
    left: 10px;
    font-size: 12px;
  }

  .driver-main {
    padding: 14px 12px 30px;
  }

  .driver-page-hero {
    min-height: 194px;
    margin: 0 0 16px;
    padding: 22px 18px 19px;
    border-radius: 15px;
  }

  .driver-page-hero__eyebrow {
    margin-bottom: 10px;
    font-size: 10px;
  }

  .driver-page-hero h1 {
    font-size: clamp(32px, 9vw, 36px);
    line-height: 1.1;
  }

  .driver-page-hero h1 em {
    font-size: 0.48em;
  }

  .driver-page-hero__inner > p:last-child {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.65;
  }

  .driver-page-hero > b {
    padding: 7px 9px;
    font-size: 10px;
  }

  .app-search,
  .vehicle-app-search {
    gap: 8px;
    margin-bottom: 14px;
  }

  .app-search input,
  .vehicle-app-search input {
    height: 48px;
    padding: 0 13px;
    font-size: 16px;
  }

  .app-search button,
  .vehicle-app-search button {
    min-width: 76px;
    min-height: 48px;
    padding: 0 13px;
    font-size: 12px;
  }

  .driver-purchase-period {
    gap: 8px;
    margin: 12px 0 14px;
    padding: 13px 11px;
  }

  .driver-purchase-period strong {
    font-size: 14px;
  }

  .driver-purchase-period label span {
    font-size: 11px;
  }

  .driver-purchase-period input,
  .vehicle-mobile-search-period input {
    min-height: 48px;
    font-size: 16px;
  }

  .driver-purchase-period button {
    min-height: 46px;
    font-size: 12px;
  }

  .driver-purchase-period small {
    font-size: 11px;
    line-height: 1.45;
  }

  .driver-farm-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
  }

  .driver-farm-toolbar span {
    font-size: 12px;
    line-height: 1.6;
  }

  .driver-farm-toolbar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-height: 44px;
    padding: 0 12px;
    font-size: 12px;
  }

  .driver-farm-frame {
    height: calc(100dvh - 350px);
    min-height: 400px;
    border-radius: 13px;
  }

  .receiving-app-form,
  .vehicle-mobile-form {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 15px;
  }

  .receiving-app-form .wide,
  .receiving-app-form button,
  .vehicle-mobile-form .wide {
    grid-column: auto;
  }

  .receiving-app-form label,
  .vehicle-mobile-form label {
    gap: 7px;
    font-size: 12px;
  }

  .receiving-app-form input,
  .receiving-app-form select,
  .vehicle-mobile-form input {
    min-height: 48px;
    padding: 0 12px;
    font-size: 16px;
  }

  .receiving-app-form textarea,
  .vehicle-mobile-form textarea {
    min-height: 88px;
    padding: 12px;
    font-size: 16px;
    line-height: 1.55;
    resize: vertical;
  }

  .receiving-app-actions,
  .vehicle-mobile-actions {
    display: flex;
    width: 100%;
    gap: 8px;
  }

  .receiving-app-actions button,
  .vehicle-mobile-actions button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 48px;
    padding: 0 12px;
    font-size: 13px;
  }

  .vehicle-mobile-search-period {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-bottom: 12px;
  }

  .vehicle-mobile-search-period > strong,
  .vehicle-mobile-search-period > b {
    font-size: 12px;
  }

  .vehicle-mobile-search-period label {
    gap: 6px;
    font-size: 11px;
  }

  .vehicle-mobile-card {
    gap: 13px;
    padding: 15px;
    border-radius: 13px;
  }

  .vehicle-mobile-card b {
    font-size: 15px;
  }

  .vehicle-mobile-card span,
  .vehicle-mobile-card small {
    font-size: 11px;
    line-height: 1.5;
  }

  .vehicle-mobile-card-actions {
    gap: 7px;
  }

  .vehicle-mobile-card-actions button {
    min-height: 42px;
    padding: 0 6px;
    font-size: 11px;
  }

  .transport-table-wrap,
  .receiving-table-wrap,
  .vehicle-app-table-wrap {
    border-radius: 13px;
    scrollbar-width: thin;
  }

  .transport-table,
  .receiving-table,
  .vehicle-app-table {
    font-size: 11px;
  }

  .transport-table th,
  .transport-table td,
  .receiving-table th,
  .receiving-table td,
  .vehicle-app-table th,
  .vehicle-app-table td {
    padding: 12px 10px;
    line-height: 1.5;
  }

  .transport-address-cell button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    font-size: 11px;
  }

  .receiving-row-actions,
  .vehicle-app-table-actions {
    gap: 7px;
  }

  .receiving-row-actions button,
  .vehicle-app-table-actions button {
    min-width: 44px;
    height: 40px;
    padding: 0 9px;
    font-size: 11px;
  }

  .farm-location-card > header > button {
    width: 44px;
    height: 44px;
  }

  .farm-location-card dt {
    font-size: 11px;
  }

  .farm-location-card dd {
    font-size: 13px;
  }

  .farm-location-actions a,
  .farm-location-actions button {
    min-height: 48px;
    font-size: 12px;
  }

  .driver-bottom-nav {
    height: calc(76px + var(--safe-bottom));
    padding: 5px 6px var(--safe-bottom);
  }

  .driver-bottom-nav button {
    min-width: 0;
    min-height: 64px;
    gap: 4px;
  }

  .driver-bottom-nav button span {
    font-size: 21px;
  }

  .driver-bottom-nav button b {
    font-size: 11px;
    line-height: 1.2;
  }

  .driver-toast {
    right: 12px;
    bottom: calc(88px + var(--safe-bottom));
    left: 12px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.5;
  }
}

@media (max-width: 380px) {
  .driver-header {
    padding-right: 10px;
    padding-left: 10px;
  }

  .driver-header button,
  .driver-header #installApp {
    font-size: 10px;
  }

  .driver-main {
    padding-right: 10px;
    padding-left: 10px;
  }

  .driver-page-hero {
    padding-right: 16px;
    padding-left: 16px;
  }
}

/* Keep both mobile date ranges on one row and center the separator on the input line. */
@media (max-width: 600px) {
  .vehicle-mobile-search-period {
    grid-template-columns: auto minmax(0, 1fr) 14px minmax(0, 1fr) !important;
    align-items: end !important;
    column-gap: 6px !important;
    row-gap: 0 !important;
  }

  .vehicle-mobile-search-period > strong,
  .vehicle-mobile-search-period > b,
  .driver-purchase-period > b {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: end !important;
    height: 48px !important;
    line-height: 1 !important;
  }

  .vehicle-mobile-search-period label,
  .vehicle-mobile-search-period input {
    min-width: 0 !important;
  }
}
