@layer m1-system {
/* M1 System — the design language layer (app/docs/DESIGN_LANGUAGE.md).
 *
 * Sits after every page module (page, m1-booking) and before the phone
 * geometry layer in the manifest (m1-tokens.css), so the type roles, page
 * header, card, control and sticky-action rules below are stated once and
 * hold on every page without !important. Values come only from the role
 * tokens in m1-tokens.css; when this file needs a number that is not a
 * token, it is a 4px-scale value.
 */

  /* ---------------------------------------------------------------- *
   * 1. Type roles
   * ---------------------------------------------------------------- */
  body.m1-app {
    font-family: var(--font-sans);
    font-size: var(--m1-fs-body);
    line-height: var(--m1-lh-body);
    letter-spacing: 0;
  }
  body.m1-app h1,
  body.m1-app h2,
  body.m1-app h3,
  body.m1-app h4 {
    letter-spacing: 0;
  }
  /* display: the page h1, one per page. Every page module used to set its
     own (23px to 92px); this is the only declaration that now matters. */
  body.m1-app main h1 {
    margin: 0 0 4px;
    font-size: var(--m1-fs-display);
    font-weight: 650;
    line-height: var(--m1-lh-display);
    letter-spacing: -.015em;
    text-wrap: balance;
  }
  /* The home hero is the single marketing exception. */
  body.m1-app main .hero h1 {
    font-size: var(--m1-fs-hero);
    line-height: var(--m1-lh-hero);
    letter-spacing: -.02em;
  }
  /* title: card / section headings. */
  body.m1-app main h2 {
    font-size: var(--m1-fs-title);
    font-weight: 600;
    line-height: var(--m1-lh-title);
  }
  body.m1-app main h3 {
    font-size: var(--m1-fs-body);
    font-weight: 600;
    line-height: var(--m1-lh-body);
  }
  /* heading: the one major region title on a list page. */
  body.m1-app .m1-worklist-heading h2 {
    font-size: var(--m1-fs-heading);
    line-height: var(--m1-lh-heading);
  }

  /* Overlines are data, not decoration: caption, sentence case, muted.
     A label that only repeats the heading after it is not rendered. */
  body.m1-app .eyebrow,
  body.m1-app .page-eyebrow,
  body.m1-app .booking-concierge__eyebrow {
    display: block;
    margin: 0 0 4px;
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    font-weight: 500;
    line-height: var(--m1-lh-caption);
    letter-spacing: 0;
    text-transform: none;
  }
  body.m1-app main .eyebrow:has(+ h2),
  body.m1-app main .eyebrow:has(+ h3),
  body.m1-app .booking-page-header .eyebrow,
  body.m1-app .auth-card > .page-eyebrow {
    display: none;
  }

  /* Labels and terms: sentence case, label/caption role. */
  body.m1-app dt,
  body.m1-app .data-list dt,
  body.m1-app .detail-data dt,
  body.m1-app .sidebar-section dt,
  body.m1-app .review-grid dt,
  body.m1-app .staff-summary__list dt,
  body.m1-app .booking-concierge__summary dt,
  body.m1-app .confirmation-summary dt,
  body.m1-app .driver-trip-card dt,
  body.m1-app .detail-route small,
  body.m1-app .decision-route small,
  body.m1-app .driver-trip-card small,
  body.m1-app .contact-aside small,
  body.m1-app .trip-notes span,
  body.m1-app .reference-band > span,
  body.m1-app .confirmation-route span,
  body.m1-app .confirmation-return > span:first-child,
  body.m1-app .staff-summary__title,
  body.m1-app .m1-worklist__head,
  body.m1-app .m1-snap-carousel__hint,
  body.m1-app .m1-footer__heading,
  body.m1-app .booking-shell--luxury .passenger-field > .field__label,
  body.m1-app .booking-shell--luxury .booking-progress strong,
  body.m1-app .reservation-item__return > span:first-child {
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    font-weight: 500;
    line-height: var(--m1-lh-caption);
    letter-spacing: 0;
    text-transform: none;
  }
  body.m1-app .booking-shell--luxury .passenger-field > .field__label {
    color: var(--m1-ink);
    font-size: var(--m1-fs-label);
    line-height: var(--m1-lh-label);
  }
  body.m1-app dd {
    font-size: var(--m1-fs-body);
    line-height: var(--m1-lh-body);
  }
  body.m1-app main th {
    letter-spacing: 0;
    text-transform: none;
  }
  /* Small markers that were uppercase badges become micro, sentence case. */
  body.m1-app .new-marker,
  body.m1-app .m1-worklist__updated,
  body.m1-app .request-item__status {
    font-size: var(--m1-fs-micro);
    font-weight: 600;
    line-height: var(--m1-lh-micro);
    letter-spacing: 0;
    text-transform: none;
  }
  /* Data numbers. */
  body.m1-app time,
  body.m1-app .status-index strong,
  body.m1-app .m1-worklist__cell--schedule strong {
    font-variant-numeric: tabular-nums;
  }

  /* ---------------------------------------------------------------- *
   * 2. Page frame and the page header pattern
   * ---------------------------------------------------------------- */
  body.m1-app .page-shell {
    width: min(100% - var(--m1-gutter) * 2, var(--m1-content));
    padding-block: var(--m1-page-top) 48px;
  }
  body.m1-app .page-shell--narrow {
    width: min(100% - var(--m1-gutter) * 2, var(--m1-reading));
  }
  body.m1-app .page-header,
  body.m1-app .booking-page-header,
  body.m1-app .detail-header,
  body.m1-app .reading-header,
  body.m1-app .driver-page-title {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    min-height: 0;
    margin: 0 0 var(--m1-card-pad);
    padding: 0;
    border: 0;
    background: none;
  }
  /* Header grid: the h1 and the page's one action share a row; the intro
     line runs full width beneath them instead of being squeezed beside the
     button. The copy wrapper dissolves (display: contents) so its children
     join the grid without a markup change on every page. */
  body.m1-app .page-header,
  body.m1-app .booking-page-header,
  body.m1-app .detail-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 16px;
  }
  body.m1-app .page-header > div:first-child,
  body.m1-app .page-header__copy,
  body.m1-app .booking-page-header > div:first-child,
  body.m1-app .detail-header > div:first-child {
    display: contents;
  }
  body.m1-app :is(.page-header, .booking-page-header, .detail-header) :is(.eyebrow, p) {
    grid-column: 1 / -1;
  }
  body.m1-app :is(.page-header, .booking-page-header, .detail-header) h1 {
    grid-column: 1;
    margin: 0;
  }
  body.m1-app :is(.page-header, .booking-page-header, .detail-header) > :is(.button, .page-header__actions, .status-badge) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  body.m1-app :is(.page-header, .booking-page-header, .detail-header):has(.eyebrow:not([hidden])) > :is(.button, .page-header__actions, .status-badge) {
    grid-row: 2;
  }
  /* The wizard's "Back to reservations" is a back link above the title. */
  body.m1-app .booking-page-header.booking-page-header:is(*, :has(.eyebrow:not([hidden]))) > a.button.button {
    grid-column: 1 / -1;
    grid-row: 1;
    border: 0;
    background: none;
    box-shadow: none;
    justify-self: start;
    min-height: 44px;
    margin: -8px 0 4px;
    padding: 0;
    color: var(--m1-business-accent-strong);
    font-size: var(--m1-fs-label);
    font-weight: 500;
  }
  body.m1-app .booking-page-header > a.button::before {
    content: "\2190";
    margin-inline-end: 8px;
  }
  /* The intro line: caption on phones, body on desktop, one measure. */
  body.m1-app .page-header p,
  body.m1-app .booking-page-header p,
  body.m1-app .detail-header p,
  body.m1-app .reading-header p,
  body.m1-app .driver-page-title p,
  body.m1-app .confirmation-header p {
    max-width: 60ch;
    margin: 0;
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-body);
    line-height: var(--m1-lh-body);
  }
  body.m1-app .page-header__actions {
    width: auto;
    flex: none;
  }
  body.m1-app .page-header__actions .button,
  body.m1-app .page-header > .button {
    flex: none;
  }
  /* Back link: one component on every page that has a parent. */
  body.m1-app .back-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    margin: -8px 0 4px;
    color: var(--m1-business-accent-strong);
    font-size: var(--m1-fs-label);
    font-weight: 500;
    line-height: var(--m1-lh-label);
    text-decoration: none;
  }
  body.m1-app .back-link:hover {
    color: var(--m1-ink);
    text-decoration: underline;
  }
  @media (max-width: 760px) {
    body.m1-app .page-header p,
    body.m1-app .booking-page-header p,
    body.m1-app .detail-header p,
    body.m1-app .reading-header p,
    body.m1-app .driver-page-title p,
    body.m1-app .confirmation-header p {
      font-size: var(--m1-fs-caption);
      line-height: var(--m1-lh-caption);
    }
  }

  /* ---------------------------------------------------------------- *
   * 3. Surfaces: cards are flat, hairline, 12px, 16/24 padding
   * ---------------------------------------------------------------- */
  body.m1-app .surface,
  body.m1-app .card,
  body.m1-app .detail-section,
  body.m1-app .trip-hero,
  body.m1-app .next-trip,
  body.m1-app .sidebar-section,
  body.m1-app .action-panel,
  body.m1-app .workspace-overview,
  body.m1-app .status-index,
  body.m1-app .staff-row,
  body.m1-app .staff-summary,
  body.m1-app .linked-trip,
  body.m1-app .guest-help,
  body.m1-app .driver-card,
  body.m1-app .driver-trip-card,
  body.m1-app .confirmation-summary,
  body.m1-app .next-steps,
  body.m1-app .m1-worklist,
  body.m1-app .reservation-list,
  body.m1-app .today-strip,
  body.m1-app .booking-section,
  body.m1-app .m1-previous-site {
    border-color: var(--m1-border);
    border-radius: var(--m1-radius-md);
    box-shadow: none;
  }
  body.m1-app .detail-section,
  body.m1-app .sidebar-section,
  body.m1-app .action-panel,
  body.m1-app .surface__body,
  body.m1-app .surface__header {
    padding: var(--m1-card-pad);
  }
  body.m1-app .trip-hero > header,
  body.m1-app .detail-section header,
  body.m1-app .surface__header,
  body.m1-app .booking-section__header {
    background: none;
  }
  body.m1-app .trip-hero {
    padding: var(--m1-card-pad);
  }
  body.m1-app .trip-hero > header {
    margin: 0;
    padding: 0 0 12px;
  }
  body.m1-app .detail-section header h2,
  body.m1-app .sidebar-section h2,
  body.m1-app .action-panel h2,
  body.m1-app .surface__header h2,
  body.m1-app .booking-section__header h2,
  body.m1-app .confirmation-summary h2,
  body.m1-app .next-steps h2,
  body.m1-app .guest-help h2,
  body.m1-app .linked-trip h2 {
    margin: 0;
    font-size: var(--m1-fs-title);
    line-height: var(--m1-lh-title);
  }
  /* Schedule figures are titles, not displays. */
  body.m1-app .trip-hero > header h2,
  body.m1-app .trip-hero > header time,
  body.m1-app .next-trip strong {
    font-size: var(--m1-fs-heading);
    font-weight: 600;
    line-height: var(--m1-lh-heading);
    letter-spacing: -.01em;
  }
  body.m1-app .detail-route strong,
  body.m1-app .detail-route p {
    font-size: var(--m1-fs-body);
    font-weight: 600;
    line-height: var(--m1-lh-body);
  }
  body.m1-app .detail-section + .detail-section,
  body.m1-app .trip-hero + .detail-section {
    margin-top: var(--m1-section-gap);
  }

  /* Alerts / attention rows: tint carries the meaning, no extra weight. */
  body.m1-app .alert,
  body.m1-app .attention-row,
  body.m1-app .status-statement {
    padding: 12px 16px;
    border-radius: var(--m1-radius-md);
    box-shadow: none;
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  body.m1-app .alert strong,
  body.m1-app .attention-row h2,
  body.m1-app .status-statement h2 {
    font-size: var(--m1-fs-label);
    font-weight: 600;
    line-height: var(--m1-lh-label);
    margin: 0;
  }
  body.m1-app .alert p,
  body.m1-app .attention-row p,
  body.m1-app .status-statement p {
    margin: 0;
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  /* Attention row: dot + copy on the left, the action on the right, on
     every width -- the action never drops onto a line of its own. */
  body.m1-app .attention-row {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  body.m1-app .attention-row > div {
    flex: 1 1 auto;
    min-width: 0;
    align-items: flex-start;
    gap: 12px;
  }
  body.m1-app .attention-row .status-dot {
    margin-top: 6px;
  }
  body.m1-app .attention-row > .button {
    flex: none;
  }
  body.m1-app .attention-row + .attention-row,
  body.m1-app .attention-row + .workspace-overview {
    margin-top: 8px;
  }

  /* Empty states. */
  body.m1-app .empty-state {
    padding: 32px var(--m1-card-pad);
    text-align: center;
  }
  body.m1-app .empty-state h2 {
    font-size: var(--m1-fs-title);
    line-height: var(--m1-lh-title);
  }
  body.m1-app .empty-state p {
    margin-inline: auto;
    color: var(--m1-ink-muted);
  }

  /* ---------------------------------------------------------------- *
   * 4. Controls
   * ---------------------------------------------------------------- */
  body.m1-app .button,
  body.m1-app .btn {
    padding-inline: 16px;
    border-radius: var(--m1-radius-sm);
    font-size: var(--m1-fs-body);
    font-weight: 600;
    letter-spacing: 0;
    transform: none;
  }
  body.m1-app .button--small {
    padding-inline: 12px;
    font-size: var(--m1-fs-label);
  }
  body.m1-app .field__label,
  body.m1-app .form-label,
  body.m1-app label.field__label {
    font-size: var(--m1-fs-label);
    font-weight: 500;
    line-height: var(--m1-lh-label);
    letter-spacing: 0;
    text-transform: none;
  }
  body.m1-app .field__optional {
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    font-weight: 400;
  }
  body.m1-app .field__hint,
  body.m1-app .field__status,
  body.m1-app .field__error {
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  body.m1-app input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  body.m1-app select,
  body.m1-app textarea,
  body.m1-app .form-input,
  body.m1-app .form-select {
    border-color: var(--m1-control-border);
    border-radius: var(--m1-radius-sm);
    font-size: var(--m1-fs-input);
  }
  /* Filter / period chips. */
  body.m1-app .m1-period-presets__link,
  body.m1-app .m1-filter-chips a,
  body.m1-app .m1-toolbar__filters {
    min-height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    font-size: var(--m1-fs-label);
    font-weight: 500;
    line-height: var(--m1-lh-label);
  }
  @media (pointer: coarse) {
    body.m1-app .button--small { min-height: 44px; }
    body.m1-app .m1-period-presets__link,
    body.m1-app .m1-toolbar__filters { min-height: 44px; }
  }
  @media (max-width: 900px) {
    body.m1-app input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
    body.m1-app select,
    body.m1-app .form-input,
    body.m1-app .form-select,
    body.m1-app .m1-datetime-trigger,
    body.m1-app .m1-select__trigger,
    body.m1-app .m1-combobox__input {
      min-height: 48px;
    }
  }

  /* ---------------------------------------------------------------- *
   * 5. ONE sticky action surface (DESIGN_LANGUAGE section 5)
   *    The bottom nav is hidden by m1-shell.css whenever one of these bars
   *    is on the page; the bar is flush to the bottom edge and the page
   *    gets matching bottom padding so nothing sits underneath it.
   * ---------------------------------------------------------------- */
  @media (max-width: 760px) {
    body.m1-app .booking-shell--luxury .booking-step .booking-section__footer,
    body.m1-app .staff-editor__footer,
    body.m1-app .booking-actions--sticky {
      position: fixed;
      z-index: 84;
      right: 0;
      bottom: 0;
      left: 0;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 8px;
      min-height: 0;
      margin: 0;
      padding: 12px calc(16px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
      border: 0;
      border-top: 1px solid var(--m1-border);
      border-radius: 0;
      background: var(--m1-surface);
      box-shadow: 0 -8px 24px -20px rgba(15, 23, 42, .35);
      transition: none;
    }
    body.m1-app .booking-shell--luxury .booking-step .booking-section__footer .button,
    body.m1-app .staff-editor__footer .button,
    body.m1-app .booking-actions--sticky .button {
      width: auto;
      min-height: 48px;
    }
    body.m1-app .booking-shell--luxury .booking-step .booking-section__footer .button:last-child,
    body.m1-app .booking-shell--luxury .booking-step .booking-section__footer .booking-primary-action,
    body.m1-app .staff-editor__footer .button:last-child,
    body.m1-app .booking-actions--sticky .button:last-child {
      flex: 1 1 auto;
    }
    body.m1-app:has(.booking-section__footer, .staff-editor__footer, .booking-actions--sticky) {
      padding-bottom: calc(var(--m1-action-bar-height) + env(safe-area-inset-bottom) + 16px);
    }
    html:has(.booking-section__footer, .staff-editor__footer) {
      scroll-padding-bottom: calc(var(--m1-action-bar-height) + env(safe-area-inset-bottom) + 24px);
    }
  }

  /* ---------------------------------------------------------------- *
   * 6. Page-specific corrections to the shared pattern
   * ---------------------------------------------------------------- */
  /* Status badge never stretches (driver page rendered it full width). */
  body.m1-app .detail-header .status-badge,
  body.m1-app .driver-page-title .status-badge {
    flex: none;
  }
  /* Dashboard overview: next trip + counts read as one calm card. */
  body.m1-app .status-index span {
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  body.m1-app .status-index strong {
    font-size: var(--m1-fs-title);
    font-weight: 600;
    line-height: var(--m1-lh-title);
  }
  body.m1-app .next-trip p {
    font-size: var(--m1-fs-body);
    line-height: var(--m1-lh-body);
  }
  body.m1-app .next-trip > span:last-child {
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
  }
  /* Auth: one card, one display size. */
  body.m1-app .auth-header h1,
  body.m1-app .auth-card > h1 {
    font-size: var(--m1-fs-display);
    line-height: var(--m1-lh-display);
  }
  /* Wizard: the progress rail is a caption row, not a second headline. */
  body.m1-app .booking-progress span {
    font-size: var(--m1-fs-caption);
  }
  body.m1-app .booking-section__index {
    font-size: var(--m1-fs-caption);
  }

  body.m1-app .booking-section__header p,
  body.m1-app .booking-context-copy,
  body.m1-app .booking-context-copy span,
  body.m1-app .booking-context-copy small {
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  /* Staff editor: the header no longer has an action column. */
  body.m1-app .staff-summary__actions {
    display: grid;
    gap: 8px;
  }
  @media (max-width: 1023px) {
    body.m1-app .staff-summary__actions {
      display: none;
    }
  }
  /* Account aside: secondary destinations as one wrapping row of quiet links. */
  body.m1-app .settings-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
  }
  /* Guest / passenger ride aside: the account card reads as body copy. */
  body.m1-app.guest-status-page .sidebar-section p {
    margin: 8px 0 12px;
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  /* Card title -> first control: the stack-inside-a-card step (12). */
  body.m1-app .action-panel > h2 + .action-panel__buttons,
  body.m1-app .action-panel > .eyebrow + h2 + .action-panel__buttons {
    margin-top: 12px;
  }
  /* Detail aside: "Share ride with passenger" body matches the other disclosures. */
  body.m1-app .ride-share > div {
    display: grid;
    gap: 12px;
    padding: 16px 20px 20px;
  }
  body.m1-app .ride-share > div > p,
  body.m1-app .ride-share [data-ride-link-status] {
    margin: 8px 0 0;
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  /* Tap targets (UAT r6 D3): every touch control is at least 44px
     (--m1-mobile-icon-target), on its own box rather than by padding tricks. */
  body.m1-app .segmented-control button {
    min-height: var(--m1-mobile-icon-target);
  }
  body.m1-app .review-grid header button {
    min-width: var(--m1-mobile-icon-target);
    min-height: var(--m1-mobile-icon-target);
    padding-inline: 8px;
  }
  body.m1-app .m1-combobox__toggle {
    inset-inline-end: 0;
    width: var(--m1-mobile-icon-target);
    height: var(--m1-mobile-icon-target);
    min-height: var(--m1-mobile-icon-target);
  }
  body.m1-app .m1-combobox__input {
    padding-inline-end: var(--m1-mobile-icon-target);
  }
  body.m1-app .toast__close {
    width: var(--m1-mobile-icon-target);
    height: var(--m1-mobile-icon-target);
  }
  body.m1-app .passenger-item__meta > a {
    display: inline-flex;
    align-items: center;
    min-height: var(--m1-mobile-icon-target);
  }
}

/* ---------------------------------------------------------------- *
 * Staff Reservations list (ops-simplify): one summary line, one
 * visible filter row, cards with every journey fact and direct actions.
 * ---------------------------------------------------------------- */
@layer m1-system {
  body.m1-app .ops-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 24px;
  }
  body.m1-app .ops-summary a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-sm);
    background: var(--m1-surface);
    color: var(--m1-ink);
    font-size: var(--m1-fs-label);
    line-height: var(--m1-lh-label);
    font-weight: 500;
    text-decoration: none;
  }
  body.m1-app .ops-summary__stat strong {
    font-size: var(--m1-fs-title);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }
  body.m1-app .ops-summary a[aria-current="page"] {
    border-color: var(--m1-navy);
    box-shadow: inset 0 0 0 1px var(--m1-navy);
  }
  body.m1-app .ops-summary a.ops-summary__alert {
    border-color: transparent;
    background: var(--m1-business-accent-soft);
  }
  body.m1-app .ops-summary a.ops-summary__alert--warning {
    background: var(--m1-warning-soft);
    color: var(--m1-warning);
  }
  body.m1-app .ops-summary a.ops-summary__archived {
    margin-inline-start: auto;
    border-color: transparent;
    background: transparent;
    color: var(--m1-ink-muted);
  }

  /* Filters: date presets + one row of controls, always visible. */
  body.m1-app .ops-filters {
    display: grid;
    gap: 12px;
    margin: 0 0 16px;
  }
  body.m1-app .ops-filters__dates {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }
  body.m1-app .ops-filters .m1-period-presets { margin: 0; gap: 8px; }
  body.m1-app .ops-filters .m1-period-presets__link[aria-current="true"] {
    background: var(--m1-navy);
    border-color: var(--m1-navy);
    color: #fff;
  }
  body.m1-app .ops-filters__range > summary {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--m1-control-border);
    border-radius: 999px;
    background: var(--m1-surface);
    font-size: var(--m1-fs-label);
    font-weight: 500;
    cursor: pointer;
    list-style: none;
  }
  body.m1-app .ops-filters__range > summary::-webkit-details-marker { display: none; }
  body.m1-app .ops-filters__range { position: relative; }
  body.m1-app .ops-filters__range > summary { min-height: 44px; border-radius: var(--m1-radius-sm); white-space: nowrap; }
  body.m1-app .ops-filters__range[open] > summary { border-color: var(--m1-navy); }
  body.m1-app .ops-filters__range-fields {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    grid-template-columns: repeat(2, 10rem);
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-lg, 16px);
    background: var(--m1-surface);
    box-shadow: 0 12px 32px rgba(18, 25, 39, .14);
  }
  body.m1-app .ops-filters__row {
    display: grid;
    grid-template-columns: minmax(14rem, 1.6fr) minmax(9rem, .8fr) minmax(8rem, .7fr) minmax(11rem, 1fr) auto auto;
    gap: 8px;
    align-items: center;
  }
  body.m1-app .ops-filters__row > * { min-width: 0; }
  body.m1-app .ops-filters__apply { min-height: 44px; }

  /* Cards: one per reservation, soonest first. */
  body.m1-app .ops-list {
    display: grid;
    gap: 12px;
  }
  body.m1-app .ops-card {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    grid-template-areas:
      "head    who"
      "head    service"
      "journey journey"
      "leg     leg"
      "actions actions";
    column-gap: 24px;
    row-gap: 8px;
    padding: 20px 24px;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-md);
    background: var(--m1-surface);
  }
  body.m1-app .ops-card[data-updated="true"] { box-shadow: inset 3px 0 0 var(--m1-business-accent-strong); }
  body.m1-app .ops-card__head {
    grid-area: head;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  body.m1-app .ops-card__when { display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
  body.m1-app .ops-card__when strong { font-size: var(--m1-fs-title); line-height: var(--m1-lh-title); font-weight: 650; }
  body.m1-app .ops-card__when span { color: var(--m1-ink-muted); font-size: var(--m1-fs-caption); line-height: var(--m1-lh-caption); }
  body.m1-app .ops-card__when .ops-card__soon { color: var(--m1-warning); font-weight: 600; }
  body.m1-app .ops-card__who { grid-area: who; min-width: 0; }
  body.m1-app .ops-card__name {
    margin: 0;
    font-size: var(--m1-fs-title);
    line-height: var(--m1-lh-title);
    font-weight: 600;
  }
  body.m1-app .ops-card__name a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-block: -10px;
    color: var(--m1-ink);
    text-decoration: none;
  }
  body.m1-app .ops-card__name a:hover { text-decoration: underline; }
  body.m1-app .ops-card__contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    row-gap: 0;
    margin: 0;
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  body.m1-app .ops-card__contact a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-block: -10px;
    color: var(--m1-business-accent-strong);
    font-size: var(--m1-fs-body);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  body.m1-app .ops-card__ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
  body.m1-app .ops-card__service {
    grid-area: service;
    margin: 0;
    font-size: var(--m1-fs-label);
    line-height: var(--m1-lh-label);
  }
  body.m1-app .ops-card__journey {
    grid-area: journey;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, .9fr);
    gap: 8px 24px;
    margin: 4px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--m1-border);
  }
  body.m1-app .ops-card__journey div { min-width: 0; }
  body.m1-app .ops-card__journey dt {
    color: var(--m1-ink-muted);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
    font-weight: 500;
  }
  body.m1-app .ops-card__journey dd {
    margin: 0;
    font-size: var(--m1-fs-body);
    line-height: var(--m1-lh-body);
    overflow-wrap: anywhere;
  }
  body.m1-app .ops-card__needs { color: var(--m1-warning); font-weight: 600; }
  body.m1-app .ops-card__leg {
    grid-area: leg;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 0;
    padding: 8px 12px;
    border-radius: var(--m1-radius-sm);
    background: var(--m1-surface-soft);
    font-size: var(--m1-fs-caption);
    line-height: var(--m1-lh-caption);
  }
  body.m1-app .ops-card__leg .m1-worklist__linked {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--m1-ink);
    font-size: var(--m1-fs-caption);
    font-weight: 600;
  }
  body.m1-app .ops-card__actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
  }
  body.m1-app .ops-card__actions form { margin: 0; }
  body.m1-app .ops-card__actions .button { min-height: 44px; }
  body.m1-app .ops-card__actions .ops-card__remove { margin-inline-start: auto; }

  @media (max-width: 899px) {
    body.m1-app .ops-summary {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      margin-bottom: 16px;
    }
    body.m1-app .ops-summary a { padding: 4px 8px; }
    body.m1-app .ops-summary a.ops-summary__stat {
      flex-direction: column;
      justify-content: center;
      gap: 0;
      text-align: center;
      font-size: var(--m1-fs-caption);
      line-height: var(--m1-lh-caption);
    }
    body.m1-app .ops-summary a.ops-summary__alert { grid-column: span 2; padding: 4px 12px; font-size: var(--m1-fs-caption); }
    body.m1-app .ops-summary a.ops-summary__archived { grid-column: 1 / -1; justify-content: flex-end; margin: -4px 0 -8px; }
    body.m1-app .ops-filters__row { display: flex; flex-wrap: wrap; }
    body.m1-app .ops-filters__search { flex: 1 1 100%; }
    body.m1-app .ops-filters__field { flex: 1 1 40%; }
    body.m1-app .ops-filters__field--wide { flex: 1 1 40%; }
    body.m1-app .ops-filters .m1-period-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 4px; }
    body.m1-app .ops-filters .m1-period-presets__link { justify-content: center; padding: 0 4px; font-size: var(--m1-fs-caption); white-space: nowrap; }
    body.m1-app .ops-filters__range-fields { grid-template-columns: repeat(2, minmax(0, 9.5rem)); }
    body.m1-app .ops-filters__apply { flex: 0 0 auto; }
    body.m1-app .ops-card {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas: "head" "who" "service" "journey" "leg" "actions";
      padding: 16px;
    }
    body.m1-app .ops-card__head { flex-direction: row; justify-content: space-between; align-items: center; }
    body.m1-app .ops-card__when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
    body.m1-app .ops-card__journey { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    body.m1-app .ops-card__journey div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 8px; }
    body.m1-app .ops-card__actions .button { flex: 1 1 auto; }
    body.m1-app .ops-card__actions form { display: flex; flex: 1 1 auto; }
    body.m1-app .ops-card__actions .ops-card__remove { margin-inline-start: 0; flex-basis: 100%; }
  }
}
@layer m1-system {
  body.m1-app .ops-card__journey .ops-card__stops { grid-column: 1 / -1; }
}
@media (max-width: 899px) {
  @layer m1-system {
    body.m1-app .ops-filters .m1-period-presets__link,
    body.m1-app .ops-filters__range > summary { min-height: 44px; }
  }
}

/* Staff stat cards (owner preferred the old four-card summary). */
@layer m1-system {
  body.m1-app .ops-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 16px;
  }
  body.m1-app .ops-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 128px;
    padding: 20px 24px;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-md, 12px);
    background: var(--m1-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .05);
    color: var(--m1-ink);
    text-decoration: none;
  }
  body.m1-app a.ops-stat:hover { border-color: var(--m1-ink-muted); }
  body.m1-app .ops-stat[aria-current="page"] { border-color: var(--m1-navy); box-shadow: inset 0 0 0 1px var(--m1-navy); }
  body.m1-app .ops-stat__label { font-size: var(--m1-fs-label); line-height: var(--m1-lh-label); font-weight: 600; padding-inline-end: 32px; }
  body.m1-app .ops-stat__icon { position: absolute; top: 20px; inset-inline-end: 20px; width: 22px; height: 22px; fill: var(--m1-ink); }
  body.m1-app .ops-stat__value { font-size: 32px; line-height: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
  body.m1-app .ops-stat__value--text { font-size: var(--m1-fs-title); line-height: 28px; font-weight: 650; margin-top: 6px; }
  body.m1-app .ops-stat__value--empty { font-size: var(--m1-fs-title); line-height: 28px; font-weight: 400; color: var(--m1-ink-muted); margin-top: 6px; }
  body.m1-app .ops-stat__caption { margin-top: auto; font-size: var(--m1-fs-caption); line-height: var(--m1-lh-caption); color: var(--m1-ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.m1-app .ops-stats + .ops-summary:not(:has(.ops-summary__alert)) { margin-top: -8px; }
  @media (max-width: 899px) {
    body.m1-app .ops-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    body.m1-app .ops-stat { min-height: 112px; padding: 16px; }
    body.m1-app .ops-stat__icon { top: 16px; inset-inline-end: 16px; width: 20px; height: 20px; }
    body.m1-app .ops-stat__value { font-size: 28px; line-height: 36px; }
    body.m1-app .ops-stat__value--text, body.m1-app .ops-stat__value--empty { font-size: var(--m1-fs-body); line-height: 22px; }
    body.m1-app .ops-summary { display: flex; flex-wrap: wrap; }
    body.m1-app .ops-summary a.ops-summary__alert { grid-column: auto; }
    body.m1-app .ops-summary a.ops-summary__archived { margin-inline-start: auto; }
  }
}
