/* R71 FIX2: My transport/mobile shell visual contract. Loaded after R71.
   Never broadens a route's Pundit permissions or changes persisted records. */

/* A driver or an authorized staff member viewing My uses the same bottom
   navigation. The management sidebar remains untouched on management pages. */
@media (max-width:1024px) {
  html.aic-layout-refactor body.aic-driver-mobile-nav .layout-sidebar-shell {
    display:none !important;
  }
  html.aic-layout-refactor body.aic-driver-mobile-nav .dashboard-sidebar-toggle {
    display:none !important;
  }
  html.aic-layout-refactor body.aic-driver-mobile-nav .driver-mobile-nav {
    display:grid;
  }
  html.aic-layout-refactor body.aic-driver-mobile-nav main.main-content {
    margin-left:calc(var(--page-pad-x) + var(--safe-left));
    width:calc(100% - (var(--page-pad-x) * 2) - var(--safe-left) - var(--safe-right));
    transition:none;
  }
  html.aic-layout-refactor body.aic-driver-mobile-nav main.main-content .ui-hero__top {
    padding-inline-end:0;
  }
}

/* Only the list's own empty state and actual cards are surfaces. */
html.aic-layout-refactor .transport-history-page .mypage__grid {
  background:transparent;
  border:0;
  box-shadow:none;
  padding:0;
  border-radius:0;
}
html.aic-layout-refactor .transport-history-page .empty-state {
  border:1px solid var(--ui-color-border, #e5e7eb);
  border-radius:var(--ui-radius-xl, 18px);
  background:var(--ui-surface, #fff);
}
/* One dotted line, balanced heading-to-rule and rule-to-filter spacing. */
html.aic-layout-refactor .transport-history-page .ui-hero {
  --ui-hero-heading-row-size:30px;
}
html.aic-layout-refactor .transport-history-page .ui-hero__top {
  grid-template-rows:minmax(30px,auto);
}
html.aic-layout-refactor .transport-history-page .ui-hero__title-row { min-height:30px; }
html.aic-layout-refactor .transport-history-page .ui-hero__context {
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed var(--ui-color-border-strong);
}
html.aic-layout-refactor .transport-history-page .ui-hero__context .hero-filter {
  margin:0;
  padding:0;
  border:0;
}

/* Dashboard heading sits directly on the muted canvas; only the list is white.
   Override the earlier FIX4 stylesheet without modifying unrelated cards. */
html.aic-layout-refactor .dashboard-page .card.card--full {
  background:transparent;
  border:0;
  box-shadow:none;
  padding:0;
  border-radius:0;
}
html.aic-layout-refactor .dashboard-page .card.card--full > .card__head {
  background:transparent;
  border:0;
  box-shadow:none;
}
html.aic-layout-refactor .dashboard-page .card.card--full > .empty-state {
  background:var(--ui-surface, #fff);
  border:1px solid var(--ui-color-border, #e5e7eb);
  border-radius:var(--ui-radius-xl, 18px);
  padding:18px;
}

/* Portal: the calendar is relocated directly under body while My history
   is active, outside the hero's sizing and scrollbar clipping context. */
html.aic-layout-refactor body > #transportHistoryPeriodPanel.period-picker-modal {
  position:fixed;
  inset:0 auto auto 0;
  width:100vw;
  max-width:none;
  height:100dvh;
  box-sizing:border-box;
  display:grid;
  place-items:center;
  padding:calc(18px + env(safe-area-inset-top, 0px))
    calc(14px + env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    calc(14px + env(safe-area-inset-left, 0px));
  margin:0;
  z-index:12000;
  overflow:visible;
  color:var(--ui-color-text, #111827);
}
html.aic-layout-refactor body > #transportHistoryPeriodPanel[hidden] { display:none !important; }
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker-modal__backdrop {
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.52);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker-modal__dialog {
  max-width:520px;
  max-height:min(92dvh,760px);
  background:var(--ui-surface, #fff);
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker-modal__close {
  min-width:44px;
  min-height:44px;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  color:var(--ui-color-text, #111827);
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker-modal__close:focus-visible {
  outline:2px solid #2563eb;
  outline-offset:-3px;
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__quick {
  grid-template-columns:repeat(2,minmax(0,1fr));
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__summary {
  background:#f8fafc;
  color:#1f2937;
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__day.is-in-range {
  background:#eaf2ff;
  color:#17365d;
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__day.is-selected {
  background:#1e3a5f;
  color:#fff;
  border-color:#1e3a5f;
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__footer-btn--clear {
  background:#fff;
  color:#1f2937;
  border-color:#dbe4f2;
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__footer-btn--apply {
  background:#1e3a5f;
  color:#fff;
  border-color:#1e3a5f;
}
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__footer-btn:focus-visible,
html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker__day:focus-visible {
  outline:2px solid #2563eb;
  outline-offset:2px;
}
@media (max-width:640px) {
  html.aic-layout-refactor body > #transportHistoryPeriodPanel.period-picker-modal {
    align-items:end;
    padding:calc(10px + env(safe-area-inset-top, 0px))
      calc(10px + env(safe-area-inset-right, 0px))
      calc(10px + env(safe-area-inset-bottom, 0px))
      calc(10px + env(safe-area-inset-left, 0px));
  }
  html.aic-layout-refactor #transportHistoryPeriodPanel .period-picker-modal__dialog {
    max-height:88dvh;
  }
}
