/* Shared by the host, guest, public menu and owner desk. Route styles load on demand. */
@media screen and (max-width: 700px), screen and (hover: none) and (pointer: coarse) {
  html:root {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-block-end: calc(var(--byo-bottom-inset, 0px) + 1rem);
  }

  body :is(.shell, .entry-shell, .guide-stage, .guide-shell, .guide-card, .dialog-body),
  body.marketing-body, body.platform-admin-v2 {
    min-inline-size: 0;
    overflow-wrap: anywhere;
  }

  /* An unbroken address, a translated label or a long name must also fit in a flex/grid track. */
  .shell :is(.guide-choice, .guide-recap dd, .guide-history button, .activity-ticket > div,
             .review-checks > div > *, .grid > *, .summary > *, .card, .section-head > *,
             .nav button > span, .journey-dots small),
  #dialog-root :is(.dialog-head h2, .form-grid > *, .plain-row > *) {
    min-inline-size: 0;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
  }
  .shell .guide-choices.occasions {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  }
  .shell .guide-choice > span:last-child { min-inline-size: 0; }
  .shell .guide-recap > div {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) auto;
  }
  .shell .guide-history button { white-space: normal; }
  .shell .deck { touch-action: pan-x pan-y pinch-zoom; }

  /* Keep editable text large enough on focus, independently of the smaller navigation labels. */
  body :is(input, select, textarea):not([type=checkbox], [type=radio], [type=range], [type=file], .otp-field, .entry-code) {
    font-size: max(16px, 1rem) !important;
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  body :is(.entry-form .entry-code, .login .otp-field) { font-size: max(16px, 1.5rem) !important; }

  /* Keeping the tray in flow lets the user scroll from the field to Continue, even in landscape. */
  body .shell:has(.wizard-bottom.guide-footer), body .entry-shell {
    padding-block-end: calc(1rem + max(env(safe-area-inset-bottom, 0px), var(--byo-bottom-inset, 0px)));
  }
  .shell .wizard-bottom.guide-footer {
    position: static;
    transform: none;
    inline-size: 100%;
    max-inline-size: 43rem;
    margin: 1rem auto 0;
    flex-wrap: wrap;
    align-items: stretch;
    gap: .5rem;
  }
  .shell .wizard-bottom.guide-footer .btn,
  #dialog-root .dialog-footer .btn {
    min-inline-size: 44px;
    max-inline-size: 100%;
    min-block-size: 46px;
    white-space: normal;
    overflow-wrap: anywhere;
    font-family: var(--font-app, inherit);
    line-height: 1.35;
  }
  .shell .wizard-bottom.guide-footer :is([data-action="setup-back"], [data-action="setup-skip"]),
  #dialog-root .dialog-footer [data-action="close"] {
    font-size: .8125rem;
    font-weight: 600;
    padding-inline: .7rem;
  }
  .shell .wizard-bottom.guide-footer [data-action="setup-skip"] { max-width: 100%; }
  .shell .wizard-bottom.guide-footer .btn.primary {
    font-size: .9375rem;
    flex: 1 1 8rem;
  }

  /* Open sheets fit the portion of the screen above the keyboard, including an iOS viewport pan. */
  #dialog-root dialog[open] {
    bottom: var(--byo-bottom-inset, 0px);
    max-height: calc(var(--byo-visible-height, 100dvh) - .75rem);
    max-inline-size: 100%;
    scroll-padding-block: .75rem;
  }
  #dialog-root .dialog-footer { position: static; flex-wrap: wrap; }
  html.byo-field-focused :is(.share-toolbar, .report-actions) { position: static; }

  html:has(.shell .nav) {
    scroll-padding-block-end: calc(7rem + var(--byo-bottom-inset, 0px));
  }
  body .shell:has(.nav) {
    padding-block-end: calc(7.5rem + max(env(safe-area-inset-bottom, 0px), var(--byo-bottom-inset, 0px)));
  }
  body .shell .nav {
    bottom: calc(.5rem + max(env(safe-area-inset-bottom, 0px), var(--byo-bottom-inset, 0px)));
  }
  body .shell nav.nav button, .shell .journey-dots.guide-timeline small {
    font-family: var(--font-app, inherit);
    font-size: .75rem;
    font-weight: 550;
    line-height: 1.35;
    letter-spacing: normal;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body .shell nav.nav button.active,
  .shell .journey-dots.guide-timeline [aria-current="step"] small { font-weight: 700; }
  .shell.large-text .wizard-bottom.guide-footer :is([data-action="setup-back"], [data-action="setup-skip"]),
  body:has(.shell.large-text) #dialog-root .dialog-footer [data-action="close"] { font-size: 1rem; }
  .shell.large-text .wizard-bottom.guide-footer .btn.primary { font-size: 1.0625rem; }
  body .shell.large-text nav.nav button, .shell.large-text .journey-dots.guide-timeline small { font-size: .875rem; }

  body.platform-admin-v2 .pa-content main {
    padding-block-end: calc(3.75rem + var(--byo-bottom-inset, 0px));
  }
  body.platform-admin-v2 .pa-sidebar { min-inline-size: 0; }
  body.platform-admin-v2 .pa-sidebar nav button {
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.4;
  }
}

/* Keep each stage name legible across two rows on the narrowest handsets. */
@media screen and (max-width: 360px) {
  .shell .journey-dots.guide-timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: .55rem; }
  .shell .guide-timeline button:nth-child(4)::before { display: none; }
}

@media screen and (max-width: 780px) {
  body.marketing-body .marketing-menu, body.marketing-body .marketing-nav a {
    font-family: inherit;
    font-size: .875rem;
    font-weight: 650;
    line-height: 1.4;
    min-block-size: 44px;
    min-inline-size: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.marketing-body .marketing-nav.is-open { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
