@layer m1-foundation {
  /* Tokens now live in m1-tokens.css (single owner). */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  html {
    color-scheme: light;
    background: var(--m1-canvas);
  }
  body.m1-app {
    min-width: 0;
    margin: 0;
    color: var(--m1-ink);
    background-color: var(--m1-canvas);
    /* A very low-contrast square grid on the canvas only.
     *
     * Two repeating linear gradients rather than an image: the GPU paints them
     * as a background layer at no layout cost and there is nothing to
     * download. The lines are one pixel of a desaturated steel blue at about
     * 3.5% alpha over warm ivory -- visible as structure in the breathing
     * space, invisible behind a card, and never behind text: every data and
     * form surface in this application is opaque and sits above it.
     *
     * Withdrawn entirely when the reader has asked for more contrast or less
     * transparency, and in print. */
    background-image:
      linear-gradient(to right, var(--m1-canvas-grid) 1px, transparent 1px),
      linear-gradient(to bottom, var(--m1-canvas-grid) 1px, transparent 1px);
    background-size: var(--m1-canvas-grid-size) var(--m1-canvas-grid-size);
    background-position: center top;
    background-attachment: fixed;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  body.m1-app.has-open-menu {
    overflow: hidden;
  }
  body.m1-app main {
    display: block;
    width: 100%;
    min-height: calc(100vh - 72px);
  }
  body.m1-app h1,
  body.m1-app h2,
  body.m1-app h3,
  body.m1-app h4,
  body.m1-app p {
    margin-top: 0;
  }
  body.m1-app h1,
  body.m1-app h2,
  body.m1-app h3,
  body.m1-app h4 {
    color: var(--m1-ink);
    font-weight: 650;
    letter-spacing: -.028em;
    line-height: 1.15;
  }
  body.m1-app a {
    color: inherit;
    text-underline-offset: .18em;
  }
  body.m1-app img,
  body.m1-app svg {
    display: block;
    max-width: 100%;
  }
  body.m1-app button,
  body.m1-app input,
  body.m1-app select,
  body.m1-app textarea {
    font: inherit;
  }
  .m1-dialog {
    width: min(calc(100% - 2rem), 30rem);
    padding: 0;
    color: var(--m1-ink);
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-md);
    box-shadow: var(--m1-shadow-md);
  }
  .m1-dialog::backdrop {
    background: rgba(10, 17, 29, .62);
    backdrop-filter: blur(2px);
  }
  .m1-dialog__panel {
    padding: 1.75rem;
  }
  .m1-dialog h2 {
    margin: .35rem 0 .65rem;
    font-size: 1.55rem;
  }
  .m1-dialog p {
    margin: 0;
    color: var(--m1-ink-muted);
  }
  .m1-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1.5rem;
  }
  .page-shell {
    width: min(100% - 40px, var(--m1-content));
    margin-inline: auto;
    padding-block: 52px 84px;
  }
  .page-shell--narrow {
    max-width: var(--m1-reading);
  }
  .page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--m1-space-6);
    margin-bottom: var(--m1-space-10);
  }
  .page-header__copy {
    min-width: 0;
  }
  .eyebrow {
    display: block;
    margin-bottom: .45rem;
    color: var(--m1-business-accent-strong);
    font-size: .75rem;
    font-weight: 720;
    letter-spacing: .135em;
    text-transform: uppercase;
  }
  .page-header h1 {
    margin-bottom: .45rem;
    font-size: clamp(2rem, 4vw, 3.15rem);
  }
  .page-header p {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--m1-ink-muted);
  }
  .page-header__actions {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: .65rem;
  }
  .button,
  body.m1-app .btn {
    display: inline-flex;
    /* One owner for control height: the token. This used to hard-code 46px,
       which quietly beat the design system on every screen. */
    min-height: var(--control-md);
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem 1rem;
    border: 1px solid var(--m1-button-primary-border);
    border-radius: var(--m1-radius-sm);
    background: var(--m1-button-primary-bg);
    color: var(--m1-button-primary-text);
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
  }
  .button:hover,
  body.m1-app .btn:hover {
    background: var(--m1-navy-soft);
    transform: translateY(-1px);
  }
  .button:disabled,
  body.m1-app .btn:disabled {
    cursor: not-allowed;
    opacity: .58;
    transform: none;
  }
  .button--secondary,
  body.m1-app .btn-secondary {
    border-color: var(--m1-button-secondary-border);
    background: var(--m1-button-secondary-bg);
    color: var(--m1-button-secondary-text);
  }
  .button--secondary:hover,
  body.m1-app .btn-secondary:hover {
    border-color: var(--m1-border-strong);
    background: var(--m1-surface-soft);
  }
  .button--success {
    background: var(--m1-success);
    border-color: var(--m1-success);
    color: #fff;
  }
  .button--success:hover {
    background: #105d48;
    border-color: #105d48;
  }
  .button--danger {
    border-color: var(--m1-button-danger-border);
    background: var(--m1-button-secondary-bg);
    color: var(--m1-button-danger-text);
  }
  .button--danger:hover {
    background: var(--m1-danger-soft);
  }
  .button--quiet {
    border-color: transparent;
    background: transparent;
    color: var(--m1-button-quiet-text);
  }
  .button--small {
    min-height: var(--control-quiet);
    padding: .4rem .8rem;
    font-size: .82rem;
  }
  .button--wide {
    width: 100%;
  }
  /* Link buttons must keep the component color instead of inheriting anchor text. */
  body.m1-app a.button {
    color: var(--m1-button-primary-text);
  }
  body.m1-app a.button--secondary {
    color: var(--m1-button-secondary-text);
  }
  body.m1-app a.button--success {
    color: #fff;
  }
  body.m1-app a.button--danger {
    color: var(--m1-button-danger-text);
  }
  body.m1-app a.button--quiet {
    color: var(--m1-button-quiet-text);
  }
  .icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-sm);
    background: var(--m1-surface);
    color: var(--m1-ink);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
  }
  .surface {
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-md);
    background: var(--m1-surface);
    box-shadow: var(--m1-shadow-sm);
  }
  .surface__header {
    padding: 1.55rem 1.65rem;
    border-bottom: 1px solid var(--m1-border);
  }
  .surface__header h2,
  .surface__header h3 {
    margin-bottom: .3rem;
  }
  .surface__header p {
    margin-bottom: 0;
    color: var(--m1-ink-muted);
  }
  .surface__body {
    padding: 1.65rem;
  }
  /* ------------------------------------------------------------------ *
  * STATUS COMPONENT — single owner.
  * Every surface (customer, staff, guest, driver, secondary pages) uses
  * .status-badge/.status-dot with a `--<status>` modifier. Previously this
  * component was defined twice, and the copy that covered all seven
  * lifecycle states lived in a page module, so any page that did not load
  * that module rendered Confirmed, No-show and Not-covered in the wrong
  * colour. It is defined here, in an always-loaded layer, exactly once.
  * ------------------------------------------------------------------ */
  .status-badge,
  body.m1-app .badge {
    display: inline-flex;
    min-height: 1.55rem;
    align-items: center;
    gap: .35rem;
    padding: .2rem .46rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface-subtle);
    color: var(--color-text-muted);
    font-size: .63rem;
    font-weight: 760;
    line-height: 1;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .status-badge::before,
  body.m1-app .badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
  }
  .status-badge--pending {
    border-color: var(--color-warning-border);
    background: var(--color-warning-soft);
    color: var(--color-warning-text);
  }
  .status-badge--confirmed {
    border-color: var(--color-success-border);
    background: var(--color-success-soft);
    color: var(--color-success-text);
  }
  .status-badge--trip_completed {
    border-color: var(--color-info-border);
    background: var(--color-info-soft);
    color: var(--color-info-text);
  }
  .status-badge--cancelled,
  .status-badge--cancelled_full_charge,
  .status-badge--customer_no_show,
  .status-badge--trip_not_covered {
    border-color: var(--color-danger-border);
    background: var(--color-danger-soft);
    color: var(--color-danger-text);
  }
  /* Chicago is the only operating timezone, but a reservation page is the one
     an executive forwards, so every schedule states the zone rather than
     assuming it. Shared primitive: confirmation, detail and guest pages. */
  .trip-hero__zone {
    margin-left: .28em;
    color: var(--m1-ink-muted);
    font-size: .5em;
    font-weight: 700;
    letter-spacing: .06em;
    vertical-align: .35em;
  }

  .status-dot {
    width: .6rem;
    height: .6rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--color-info);
  }
  .status-dot--pending {
    background: var(--color-warning);
  }
  .status-dot--confirmed {
    background: var(--m1-success);
  }
  .status-dot--trip_completed {
    background: var(--m1-info);
  }
  .status-dot--cancelled,
  .status-dot--cancelled_full_charge,
  .status-dot--customer_no_show,
  .status-dot--trip_not_covered {
    background: var(--m1-danger);
  }
  .alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1rem;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-sm);
    background: var(--m1-surface-soft);
    color: var(--m1-ink);
  }
  .alert p:last-child {
    margin-bottom: 0;
  }
  .alert--info {
    border-color: #b9d5e8;
    background: var(--m1-info-soft);
    color: #1d4f77;
  }
  .alert--warning,
  .alert-warning {
    border-color: #e8d49d;
    background: var(--m1-warning-soft);
    color: #6f470d;
  }
  .alert--success {
    border-color: #acd4c3;
    background: var(--m1-success-soft);
    color: #0f5f48;
  }
  .alert--danger {
    border-color: #e6b9b9;
    background: var(--m1-danger-soft);
    color: #842d2d;
  }
  .field {
    display: grid;
    gap: .45rem;
    min-width: 0;
  }
  .field__label,
  body.m1-app .form-label {
    color: var(--m1-ink);
    font-size: .82rem;
    font-weight: 700;
  }
  .field__hint {
    color: var(--m1-ink-muted);
    font-size: .78rem;
    line-height: 1.45;
  }
  .field__error,
  body.m1-app .form-error {
    color: var(--m1-danger);
    font-size: .8rem;
    font-weight: 650;
  }
  .field__status {
    display: block;
    min-block-size: 2.35em;
    color: var(--m1-ink-muted);
    font-size: .78rem;
    line-height: 1.45;
  }
  .field__status.is-error {
    color: var(--m1-danger);
    font-weight: 680;
  }
  .field > .field__hint:has(+ .field__error),
  .location-field > [data-location-hint]:has(+ .field__error) {
    display: none;
  }
  .field > .field__error,
  .location-field > .field__error {
    min-block-size: 2.35em;
    line-height: 1.45;
  }
  .field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem 1.25rem;
  }
  .field--full {
    grid-column: 1 / -1;
  }
  body.m1-app .form-input,
  body.m1-app .form-select,
  body.m1-app .form-textarea,
  body.m1-app input[type="text"],
  body.m1-app input[type="email"],
  body.m1-app input[type="tel"],
  body.m1-app input[type="number"],
  body.m1-app input[type="password"],
  body.m1-app select,
  body.m1-app textarea,
  body.m1-app .m1-datetime-trigger {
    width: 100%;
    min-width: 0;
    min-height: var(--control-lg);
    padding: .55rem .75rem;
    border: 1px solid var(--m1-border-strong);
    border-radius: var(--m1-radius-sm);
    background: var(--m1-surface);
    color: var(--m1-ink);
    box-shadow: none;
  }
  /* A select a combobox has taken over is not a control the operator sees;
     the app-wide control sizing above must not keep a 46px box alive behind
     the picker. Stated here because this layer is what sets that height. */
  body.m1-app .m1-combobox select {
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
  }
  body.m1-app textarea,
  body.m1-app .form-textarea {
    min-height: 104px;
    resize: vertical;
  }
  body.m1-app input::placeholder,
  body.m1-app textarea::placeholder {
    color: #9299a3;
    opacity: 1;
  }
  body.m1-app input:hover,
  body.m1-app select:hover,
  body.m1-app textarea:hover,
  body.m1-app .m1-datetime-trigger:hover {
    border-color: #949eab;
  }
  body.m1-app :focus-visible {
    outline: 3px solid color-mix(in srgb, var(--m1-focus) 34%, transparent);
    outline-offset: 2px;
  }
  body.m1-app input:focus,
  body.m1-app select:focus,
  body.m1-app textarea:focus,
  body.m1-app .m1-datetime-trigger:focus {
    border-color: var(--m1-focus);
    outline: 3px solid color-mix(in srgb, var(--m1-focus) 18%, transparent);
  }
  .checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
  }
  .checkbox-row input {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: .1rem;
    accent-color: var(--m1-navy);
  }
  .checkbox-row strong {
    display: block;
    margin-bottom: .15rem;
    font-size: .88rem;
  }
  .checkbox-row span {
    color: var(--m1-ink-muted);
    font-size: .78rem;
  }
  .segmented-control {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--m1-border);
    border-radius: var(--m1-radius-sm);
    background: var(--m1-surface-strong);
  }
  .segmented-control button {
    min-height: 36px;
    padding: .45rem .75rem;
    border: 0;
    border-radius: calc(var(--m1-radius-sm) - 2px);
    background: transparent;
    color: var(--m1-ink-muted);
    font-size: .82rem;
    font-weight: 740;
    cursor: pointer;
  }
  .segmented-control button.is-active,
  .segmented-control button[aria-pressed="true"] {
    background: var(--m1-surface);
    color: var(--m1-ink);
    box-shadow: 0 1px 4px rgba(16, 24, 39, .12);
  }
  .segmented-control button:disabled {
    cursor: not-allowed;
    opacity: .55;
  }
  .empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
  }
  .empty-state h2,
  .empty-state h3 {
    margin-bottom: .4rem;
  }
  .empty-state p {
    max-width: 520px;
    margin: 0 auto 1rem;
    color: var(--m1-ink-muted);
  }
  .data-list {
    display: grid;
    margin: 0;
  }
  .data-list__row {
    display: grid;
    grid-template-columns: minmax(130px, .42fr) minmax(0, 1fr);
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--m1-border);
  }
  .data-list__row:last-child {
    border-bottom: 0;
  }
  .data-list dt {
    color: var(--m1-ink-muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
  }
  .data-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
  }
  .u-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  [hidden] {
    display: none !important;
  }
  /* 2026.09.01.3 — shared premium page rhythm beyond the booking funnel. */
  body.m1-app.m1-app--public:not(.booking-form-page--luxury) main {
    background: var(--m1-canvas);
  }
  body.m1-app .surface {
    border-color: var(--m1-border);
    box-shadow: var(--m1-shadow-sm);
  }
  body.m1-app .page-header h1 {
    font-weight: 610;
    letter-spacing: -.045em;
  }
  body.m1-app .page-header p {
    line-height: 1.72;
  }
  /* Phone geometry below 760px is owned by m1-mobile-density.css (final layer).
  Only the reflow rules that layer does not express stay here. */
  @media (max-width: 760px) {
    .page-header {
      align-items: flex-start;
      flex-direction: column;
    }
    .page-header h1 {
      font-size: clamp(1.85rem, 10vw, 2.45rem);
    }
    .page-header__actions {
      width: 100%;
    }
    .page-header__actions .button,
    .page-header__actions .btn {
      flex: 1 1 auto;
    }
    .field-grid {
      grid-template-columns: minmax(0, 1fr);
    }
    .data-list__row {
      grid-template-columns: 1fr;
      gap: .25rem;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      transition-duration: .01ms !important;
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
    }
  }
}

@layer m1-foundation {
  /* Validation stability contract: status/help/error copy always owns reserved
  geometry before interaction, so validation never changes form shape. */
  body.m1-app .form-group > .m1-form-status,
  body.m1-app .field > .m1-form-status,
  body.m1-app .location-field > .m1-form-status,
  body.m1-app .service-choice-field > .m1-form-status {
    min-block-size: var(--m1-status-reserved-block, 2.9em);
    overflow-wrap: anywhere;
  }
  body.m1-app .form-group[aria-invalid="true"] > .m1-form-status,
  body.m1-app .field[aria-invalid="true"] > .m1-form-status,
  body.m1-app .location-field[aria-invalid="true"] > .m1-form-status,
  body.m1-app .service-choice-field[aria-invalid="true"] > .m1-form-status {
    color: var(--m1-danger);
  }
  @media (max-width: 520px) {
    body.m1-app .form-group > .m1-form-status,
    body.m1-app .field > .m1-form-status,
    body.m1-app .location-field > .m1-form-status {
      min-block-size: var(--m1-status-reserved-block, 4.35em);
    }
  }
}

@layer m1-foundation {
  /* The grid is decoration. Anyone who has asked their system for more
     contrast, or for less transparency, gets a plain canvas -- and so does
     paper. */
  @media (prefers-contrast: more) {
    body.m1-app {
      background-image: none;
    }
  }
  @media (prefers-reduced-transparency: reduce) {
    body.m1-app {
      background-image: none;
    }
  }
  @media print {
    body.m1-app {
      background-image: none;
    }
  }
}
