/* R71: driver mobile navigation and targeted transport layout fixes.
   Loaded after ui_page_size; no changes to administration sidebar rules. */
:where(html.aic-layout-refactor) .driver-mobile-nav { display:none; }

/* No dashboard identity Hero: the first transport card is the page heading. */
:where(html.aic-layout-refactor) .dashboard-page { padding-top:0; }
:where(html.aic-layout-refactor) .dashboard-page .card.card--full,
:where(html.aic-layout-refactor) .dashboard-page .empty-state,
:where(html.aic-layout-refactor) .dashboard-page .dispatch-card,
:where(html.aic-layout-refactor) .transport-history-page .mypage__grid,
:where(html.aic-layout-refactor) .transport-history-page .empty-state,
:where(html.aic-layout-refactor) .transport-history-page .dispatch-card { background:var(--ui-surface, #fff); }
:where(html.aic-layout-refactor) .dashboard-page .card__title { min-width:0; }

/* The shared Hero already draws the desired thin dashed separator. */
:where(html.aic-layout-refactor) .transport-history-page .hero-filter {
  border-top:0;
  margin-top:0;
  padding-top:0;
}
:where(html.aic-layout-refactor) .transport-history-page .input::placeholder {
  font-size:12px;
  opacity:.8;
}
:where(html.aic-layout-refactor) .transport-history-page .history-navigation {
  grid-column:1 / -1;
  min-width:0;
}
:where(html.aic-layout-refactor) .transport-history-page .history-navigation .hero-filter-form__actions {
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:8px;
  width:100%;
}
:where(html.aic-layout-refactor) .transport-history-page .history-navigation .hero-filter-form__actions > .btn-plan {
  min-width:0;
  width:100%;
  justify-content:center;
  flex:unset;
}
:where(html.aic-layout-refactor) .transport-history-page .history-navigation__reset {
  display:flex;
  justify-content:flex-end;
  margin-top:8px;
}

/* Driver mini-sidebar profile and compact undecorated logo. */
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__inner { position:relative; }
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__close {
  display:flex; align-items:center; justify-content:center;
  align-self:flex-end; flex:0 0 auto;
  width:44px; height:44px; min-width:44px; min-height:44px;
  border:1px solid #d1d9e5; border-radius:12px;
  color:#293749; background:#fff; cursor:pointer;
}
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__profile {
  align-items:center; justify-content:center; padding:10px 8px;
}
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__profile-body {
  width:100%; text-align:center; align-items:center;
}
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__profile-meta {
  justify-content:center; width:100%;
}
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__profile-name {
  text-align:center; max-width:100%; overflow-wrap:anywhere;
}
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__footer {
  width:100%; min-height:0; padding:4px 0 0;
  display:flex; align-items:center; justify-content:center;
}
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__logo-image {
  display:block; width:auto; max-width:84px; max-height:32px;
  height:auto; object-fit:contain; filter:none; mix-blend-mode:normal;
}
/* A compact logo is not a card: remove leftover decorative surfaces. */
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__logo-box,
:where(html.aic-layout-refactor) .dashboard-mini-sidebar__logo-surface {
  border:0; box-shadow:none; min-height:0; padding:0; background:transparent;
}

@media (max-width: 1024px) {
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav {
    --driver-nav-height:64px;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-sidebar-toggle {
    display:none !important;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .driver-mobile-nav {
    position:fixed; display:grid; grid-template-columns:repeat(5,minmax(0,1fr));
    inset-inline:0; bottom:0;
    min-height:calc(var(--driver-nav-height) + env(safe-area-inset-bottom,0px));
    padding:4px calc(8px + env(safe-area-inset-right,0px))
      calc(4px + env(safe-area-inset-bottom,0px))
      calc(8px + env(safe-area-inset-left,0px));
    gap:4px; border-top:1px solid #dce3ed;
    background:#fff; z-index:1080;
    box-shadow:0 -3px 14px rgba(15,23,42,.055);
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .driver-mobile-nav__item {
    appearance:none; width:100%; min-width:0; min-height:52px;
    display:flex; flex-direction:column; justify-content:center; align-items:center;
    gap:4px; padding:4px 0; border:0; border-radius:10px;
    background:transparent; color:#475569; text-align:center;
    font-size:12px; font-weight:700; line-height:1.2; text-decoration:none;
    cursor:pointer;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .driver-mobile-nav__item i { font-size:19px; }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .driver-mobile-nav__item.is-active,
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .driver-mobile-nav__item[aria-expanded="true"] {
    color:#1c4e94; background:#eff5ff;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .driver-mobile-nav__item:focus-visible {
    outline:2px solid #2563eb; outline-offset:-2px;
  }
  /* Reserve the actual navigation height exactly once below main content. */
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav main.main-content {
    margin-bottom:calc(var(--driver-nav-height) + env(safe-area-inset-bottom,0px) + 20px);
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav main.main-content .ui-hero__top,
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav main.main-content > :first-child:not(.ui-page) {
    padding-inline-end:0;
  }
  /* Open the drawer from the top because there is no top hamburger. */
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar {
    top:calc(12px + env(safe-area-inset-top,0px));
    right:calc(12px + env(safe-area-inset-right,0px));
    max-height:calc(100dvh - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
    width:min(260px, calc(100vw - 24px));
    min-width:0;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar__inner {
    max-height:calc(100dvh - 48px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
    height:auto;
    overflow-y:auto;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar__nav {
    min-height:0;
    overflow-y:auto;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-page .toast {
    bottom:calc(var(--driver-nav-height) + env(safe-area-inset-bottom,0px) + 16px);
    max-width:calc(100vw - 24px);
    z-index:1070;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .group-dispatch-page .group-dispatch-modal {
    z-index:1200;
  }
}
@media (max-width: 720px) {
  /* Only the compact icon buttons: keep the 44px tap region via their row. */
  :where(html.aic-layout-refactor) .dashboard-page .dispatch-kv--compact .row-copy-btn,
  :where(html.aic-layout-refactor) .transport-history-page .dispatch-kv--compact .row-copy-btn {
    min-height:28px; height:28px; width:28px; min-width:28px; flex:0 0 28px;
  }
  :where(html.aic-layout-refactor) .dashboard-page .dispatch-kv--compact .row-copy-btn,
  :where(html.aic-layout-refactor) .transport-history-page .dispatch-kv--compact .row-copy-btn {
    position:relative;
  }
  :where(html.aic-layout-refactor) .dashboard-page .dispatch-kv--compact .row-copy-btn::after,
  :where(html.aic-layout-refactor) .transport-history-page .dispatch-kv--compact .row-copy-btn::after {
    content:""; position:absolute; inset:-8px;
  }
  :where(html.aic-layout-refactor) .dashboard-page .dispatch-kv--compact .dispatch-kv__row,
  :where(html.aic-layout-refactor) .transport-history-page .dispatch-kv--compact .dispatch-kv__row {
    min-height:44px;
  }
  :where(html.aic-layout-refactor) .transport-history-page .hero-filter-form__row--history {
    grid-template-columns:minmax(0,1fr);
  }
  :where(html.aic-layout-refactor) .transport-history-page .hero-filter-form__field--keyword,
  :where(html.aic-layout-refactor) .transport-history-page .hero-filter-form__field--period,
  :where(html.aic-layout-refactor) .transport-history-page .history-navigation {
    grid-column:1 / -1;
  }
}

/* R72: Other-tab anchored mini popover, not a top drawer. */
@media (max-width:1024px) {
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar__backdrop {
    z-index:1079;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar {
    top:auto; left:auto;
    right:calc(8px + env(safe-area-inset-right,0px));
    bottom:calc(var(--driver-nav-height,64px) + env(safe-area-inset-bottom,0px) + 8px);
    width:min(240px, calc(100vw - 16px)); min-width:0;
    max-height:calc(100dvh - var(--driver-nav-height,64px) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px);
    transform-origin:bottom right;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar__inner {
    height:auto;
    max-height:calc(100dvh - var(--driver-nav-height,64px) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 48px);
    overflow:auto; padding-top:0;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar__profile {
    border:0; box-shadow:none; backdrop-filter:none;
    -webkit-backdrop-filter:none; background:transparent;
  }
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar__profile::after {
    display:none; content:none;
  }
}

/* R73: compact My popover does not borrow management drawer dimensions. */
@media (max-width:1024px) {
  :where(html.aic-layout-refactor) body.aic-driver-mobile-nav .dashboard-mini-sidebar {
    width:min(220px, calc(100vw - 24px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)));
    max-width:220px;
  }
}

/* R79: no fake Back action on the fallback landing page. */
:where(html.aic-layout-refactor) .driver-mobile-nav__item:disabled {
  opacity:.5;
  cursor:default;
}
