/* R87: driver-only 3-screen hero, filter and reliable desktop fallback. */
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero {
  min-width:0;
}
/* The two dashboard modes share the history Hero V3 surface on tablet/PC.
   Mobile retains the compact R89 surface in its own media query. */
@media (min-width:641px) {
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero {
    box-sizing:border-box;
    background:var(--ui-surface,#fff);
    border:1px solid var(--ui-color-border,#e5e7eb);
    border-radius:var(--ui-radius-xl,18px);
    box-shadow:var(--ui-shadow-xs);
    padding:14px 16px;
    margin:0 0 var(--ui-hero-after-gap,14px);
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__title {
    font-size:24px;font-weight:700;line-height:1.18;
  }
  /* R71 once forced the history heading to 30px; all three now use 38px. */
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__top {
    --ui-hero-heading-row-size:38px;
    grid-template-rows:minmax(38px,auto);
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__title-row {
    min-height:38px;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__context {
    margin-top:8px;padding-top:8px;
  }
}
/* 641–720px still needs the mobile-sized 44px tap target in both header rows. */
@media (min-width:641px) and (max-width:720px) {
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__top {
    --ui-hero-heading-row-size:44px;
    grid-template-rows:minmax(44px,auto);
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__title-row {min-height:44px;}
}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__action-row {display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:nowrap;}
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__toggle {
  display:none; flex:0 0 auto; align-items:center;justify-content:center;gap:3px;
  min-width:44px;min-height:44px;padding:5px 9px;border:0;border-radius:8px;
  background:transparent;color:#475569;cursor:pointer;font-size:19px;
}
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__toggle:focus-visible {
  outline:2px solid #2563eb; outline-offset:2px;
}
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__active {
  font-size:10px;font-weight:700;white-space:nowrap;color:#1d4ed8;
}
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__panel[hidden] {display:none!important;}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__panel {min-width:0;}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__form {display:block;}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__search-row {display:block;min-width:0;}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__search {
  display:block;width:100%;box-sizing:border-box;min-width:0;min-height:46px;border:1px solid #cbd5e1;
  border-radius:14px;padding:10px 14px;background:#fff;color:#111827;font-size:13px;
}
/* One search-field contract independent of the different dashboard/history classes.
   Keep the entered value at 16px on mobile; placeholder typography is separate. */
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero input[name="q"] {
  box-sizing:border-box;min-width:0;min-height:46px;padding:10px 14px;
  border-radius:14px;font-size:13px;font-weight:400;
}
html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero input[name="q"]::placeholder {
  font-size:12px;font-weight:400;font-style:normal;letter-spacing:normal;opacity:.8;
}
@media (max-width:720px) {
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero input[name="q"] {font-size:16px;}
}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__panel-bottom {display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px;}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__clear {font-size:12px;font-weight:700;color:#1d4ed8;}
html.aic-layout-refactor .dashboard-page .r87-driver-hero__panel-bottom .dashboard-bulk-submit-btn {margin-left:auto;max-width:100%;white-space:normal;}
/* Existing history has its own .hero-filter divider; the shared hero alone owns the rule. */
html.aic-layout-refactor .transport-history-page .r87-driver-hero .hero-filter {margin:0;padding:0;border:0;}
/* On desktop make filter criteria visible even if the user resizes from mobile. */
@media (min-width:641px) {
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__panel[hidden] {display:block!important;}
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__toggle {display:none!important;}
}
@media (max-width:640px) {
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero {
    background:#fff;border:1px solid var(--ui-color-border,#e5e7eb);
    border-radius:20px;box-shadow:var(--ui-shadow-xs);
    padding:4px 12px;margin-bottom:14px;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__top,
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__top:not(:has(.ui-hero__meta)):has(.ui-hero__actions > :only-child) {
    display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:minmax(44px,auto);
    align-items:center;column-gap:4px;row-gap:0;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__main {
    grid-column:1;grid-row:1;min-width:0;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__right,
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__top:not(:has(.ui-hero__meta)):has(.ui-hero__actions > :only-child) > .ui-hero__right {
    grid-column:2;grid-row:1;flex:0 0 auto;max-width:none;width:auto;margin-left:0;min-width:0;
    flex-wrap:nowrap;gap:0;justify-content:flex-end;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__actions {
    flex-wrap:nowrap;max-width:none;width:auto;gap:0;margin-left:0;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__title {
    font-size:17px;line-height:1.25;letter-spacing:-.02em;white-space:nowrap;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__toggle {display:inline-flex;}
  /* All three collapsed heroes use the exact same 44px top row. */
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__title-row {
    min-height:44px; display:flex; align-items:center;
  }
  /* One 44px action row on every screen; override R81's 7px outer margins. */
  html.aic-layout-refactor .dashboard-page .r87-driver-hero--dashboard .r87-today-link {
    box-sizing:border-box;min-width:44px;height:44px;min-height:44px;
    margin:0;padding:0 7px;line-height:1;font-size:12px;
    border:0;box-shadow:none;gap:4px;
  }
  /* The older R81 oversized pseudo-element must not change the tap geometry. */
  html.aic-layout-refactor .dashboard-page .r87-driver-hero--dashboard .r87-today-link::before {content:none;}
  html.aic-layout-refactor .dashboard-page .r87-driver-hero--dashboard .r87-driver-hero__panel-bottom .dashboard-bulk-submit-btn {
    margin-left:0;
  }
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero .ui-hero__context {
    margin-top:2px;padding-top:2px;border-top:1px dashed var(--ui-color-border-strong,#cbd5e1);
  }
  html.aic-layout-refactor .transport-history-page .r87-driver-hero .hero-filter {margin:0;padding:0;border:0;}
  html.aic-layout-refactor .transport-history-page .r87-driver-hero .hero-filter-form__row--history {grid-template-columns:minmax(0,1fr);}
  html.aic-layout-refactor .transport-history-page .r87-driver-hero .history-navigation .hero-filter-form__actions {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));}
  html.aic-layout-refactor .transport-history-page .r87-driver-hero .history-navigation .hero-filter-form__actions > a {min-width:0;white-space:nowrap;}
}
@media (max-width:360px) {
  html.aic-layout-refactor .dashboard-page .r87-driver-hero--dashboard .r87-today-link i {display:none;}
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero__active {font-size:9px;}
  html.aic-layout-refactor .dashboard-page .r87-driver-hero__action-row {gap:2px;}
  html.aic-layout-refactor :is(.dashboard-page,.transport-history-page) .r87-driver-hero {padding-inline:10px;}
}


/* R90: empty-state surface must target the actual live-search region hierarchy.
   Do not change border styles: dashed in dashboard, solid in history. */
html.aic-layout-refactor .dashboard-page [data-live-search-region="r88-driver-results"] > .empty-state,
html.aic-layout-refactor .transport-history-page [data-live-search-region="my-transport-history-results"] > .empty-state {
  box-sizing:border-box;min-height:108px;padding:14px;
  background:var(--ui-surface,#fff);
  border-radius:var(--ui-radius-xl,18px);
}


/* R91 V2: TODAY link must not enlarge the shared Hero heading row. */
@media (min-width: 641px) {
  html.aic-layout-refactor .dashboard-page
  .r87-driver-hero--dashboard .r87-today-link {
    position: relative;
    box-sizing: border-box;
    margin-block: 0;
    padding-block: 0;
    line-height: 1;
    height: 44px;
    min-height: 44px;
  }

  html.aic-layout-refactor .dashboard-page
  .r87-driver-hero--dashboard .r87-today-link::before {
    content: none;
  }
}

/* Visible control: 38px; actual invisible hit target: 44px. */
@media (min-width: 721px) {
  html.aic-layout-refactor .dashboard-page
  .r87-driver-hero--dashboard .r87-today-link {
    height: 38px;
    min-height: 38px;
  }

  html.aic-layout-refactor .dashboard-page
  .r87-driver-hero--dashboard .r87-today-link::before {
    content: "";
    position: absolute;
    inset: auto 0 auto 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
}

/* Only the transport history's live-search empty result is dashed. */
html.aic-layout-refactor .transport-history-page
[data-live-search-region="my-transport-history-results"] > .empty-state {
  border: 1px dashed var(--line, #e5e7eb);
}
