/* Selected reference: designs/Кабинет пассажира 787.dc.html, frames 2a and mobile 2.
   Load after final-787.css and the shared theme. Existing controls/data stay in place. */
body.design-787.role-passenger #passenger-shell {
  min-width: 0;
}

body.design-787.role-passenger :is(.booking-card, .booking-summary, .booking-route-map, .trip-card, .dialog-directory) {
  border-radius: 14px;
  box-shadow: none;
}

body.design-787.role-passenger .booking-ride-options label {
  background: #fff;
  border-radius: 14px;
}

body.design-787.role-passenger .booking-ride-options label:has(:checked) {
  border-color: #1f74bf;
  box-shadow: inset 0 0 0 1px #1f74bf;
  background: #fff;
}

/* Some engines move native radio focus with arrows without :focus-visible.
   Keep the focused card identifiable as well as the native input outline. */
body.design-787.role-passenger .booking-ride-options label:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

body.design-787.role-passenger :is(.ride-option-price, #quote-amount, #summary-count, #summary-time, #passenger-count) {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

body.design-787.role-passenger :is(.cabinet-main, .booking-review) :is(button, .button) {
  min-height: 44px;
  min-width: 44px;
}

body.design-787.role-passenger :is(.cabinet-main, .booking-review) :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
  font-size: 16px;
}

/* Field values do not inherit the semibold label; IDs and form controls stay intact. */
body.design-787.role-passenger .booking-form :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
  font-weight: 400;
}

body.design-787.role-passenger .booking-extras {
  align-items: start;
  gap: 12px;
  padding: 12px;
}

body.design-787.role-passenger .booking-extras > label {
  align-content: start;
  min-width: 0;
}

body.design-787.role-passenger #trip-comment {
  min-height: 78px;
  line-height: 1.5;
  resize: vertical;
}

/* Empty decorative marks supplement, never replace, the origin/destination labels. */
body.design-787.role-passenger .endpoint-card > .booking-sheet-trigger {
  position: relative;
  padding-inline-start: 36px;
}

body.design-787.role-passenger .endpoint-card > .booking-sheet-trigger::before {
  content: "";
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  transform: translateY(-50%);
  pointer-events: none;
}

body.design-787.role-passenger .endpoint-card > [data-booking-sheet=destination]::before {
  border-radius: 2px;
  background: var(--orange);
}

body.design-787.role-passenger .endpoint-card > .booking-sheet-trigger strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.design-787.role-passenger .booking-favorites > summary {
  min-height: 44px;
}

/* In the desktop/tablet address dialog the menu participates in normal flow.
   Reset the absolute-dropdown offset inherited from app.css. */
@media (min-width: 600px) {
  body.design-787.role-passenger #booking-sheet-content .address-suggestion-menu {
    inset: auto;
    margin-top: 6px;
  }
}

@media (min-width: 1180px) {
  body.design-787.role-passenger #cabinet .cabinet-main {
    width: calc(100% - 56px);
    max-width: 1384px;
    margin: 24px auto 42px;
    padding: 0;
  }

  body.design-787.role-passenger .order-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 14px 24px;
    align-items: start;
  }

  body.design-787.role-passenger .booking-sidebar {
    position: sticky;
    top: 84px;
    width: 400px;
    display: grid;
    gap: 14px;
  }

  body.design-787.role-passenger .booking-route-map {
    min-height: 230px;
  }
}

/* One width for the page and the detached quote panel; no nested percentage shrink. */
@media (min-width: 600px) and (max-width: 1179px) {
  body.design-787.role-passenger #cabinet .cabinet-main {
    width: calc(100% - 40px) !important;
    max-width: 560px !important;
    margin: 22px auto 92px;
    padding: 0;
  }

  body.design-787.role-passenger #passenger-shell .app-page,
  body.design-787.role-passenger .dialog-directory,
  body.design-787.role-passenger .profile-workspace {
    width: 100% !important;
    max-width: 560px !important;
    margin-inline: auto !important;
  }

  body.design-787.role-passenger .booking-details {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 12px;
  }

  body.design-787.role-passenger .booking-details > .booking-card:not(.booking-pickup) {
    padding: 10px 12px;
  }

  body.design-787.role-passenger .booking-details .passenger-counter {
    margin-top: 6px;
    gap: 6px;
  }

  body.design-787.role-passenger .passenger-counter > :is(button, select) {
    flex: 0 0 46px;
    width: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
  }

  body.design-787.role-passenger #passenger-count {
    width: 46px;
    border-color: transparent;
    background: transparent;
  }

  body.design-787.role-passenger .booking-extras {
    grid-template-columns: minmax(0, 1fr);
  }

  body.design-787.role-passenger .booking-extras > label:last-child {
    grid-template-columns: minmax(90px, 1fr) minmax(0, 320px);
    align-items: center;
  }

  body.design-787.role-passenger .cabinet-main :is(button, .button) {
    min-height: 46px;
    min-width: 46px;
  }
}

@media (max-width: 1179px) {
  body.design-787.role-passenger {
    --passenger-safe-area-bottom: env(safe-area-inset-bottom, 0px);
    /* At 1100px navigation moves into the header; the quote needs no bottom rail. */
    --passenger-summary-bottom: calc(12px + var(--passenger-safe-area-bottom));
  }

  body.design-787.role-passenger .order-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  body.design-787.role-passenger .booking-sidebar {
    display: contents;
  }

  body.design-787.role-passenger :is(.booking-heading, .booking-form, .booking-route-map) {
    width: 100%;
  }

  body.design-787.role-passenger .booking-heading h2 {
    font-size: 20px;
  }

  body.design-787.role-passenger #passenger-shell .app-page[data-page=home] {
    padding-bottom: 220px;
  }

  body.design-787.role-passenger #booking-inputs {
    gap: 12px;
  }

  body.design-787.role-passenger .booking-addresses {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    border: 1px solid var(--design-border);
    border-radius: 14px;
    /* Inline DaData suggestions on tablets must escape the address card. */
    overflow: visible;
    background: #fff;
  }

  body.design-787.role-passenger .booking-addresses .endpoint-card {
    border: 0;
    border-radius: 0;
  }

  body.design-787.role-passenger .booking-addresses .endpoint-card:first-child {
    border-radius: 14px 14px 0 0;
  }

  body.design-787.role-passenger .booking-addresses .endpoint-card:last-child {
    border-radius: 0 0 14px 14px;
  }

  body.design-787.role-passenger .booking-addresses .endpoint-card + .endpoint-card {
    border-top: 1px solid var(--design-border);
  }

  body.design-787.role-passenger .booking-addresses .booking-sheet-trigger {
    border-radius: 0;
  }

  body.design-787.role-passenger .booking-summary {
    position: fixed;
    z-index: 110;
    bottom: var(--passenger-summary-bottom);
    left: 50%;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 36px));
    max-height: calc(var(--app-vh, 1vh) * 45);max-height: 45dvh;
    overflow-y: auto;
    padding: 8px 14px;
    grid-template-columns: minmax(0, 1fr) minmax(124px, .6fr);
    gap: 0 14px;
    box-shadow: 0 -2px 16px rgb(20 43 68 / 6%);
  }

  body.design-787.role-passenger .booking-summary h3,
  body.design-787.role-passenger .booking-summary .booking-summary-details {
    display: none;
  }

  body.design-787.role-passenger .booking-total {
    grid-column: 1;
    grid-row: 1;
    display: block;
    padding: 0;
    border: 0;
  }

  body.design-787.role-passenger .booking-total > span {
    display: none;
  }

  body.design-787.role-passenger #quote-details {
    grid-column: 1;
    grid-row: 2;
  }

  body.design-787.role-passenger #confirm-trip {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    min-height: 50px;
  }

  /* Real quote limitations and errors remain readable next to the amount. */
  body.design-787.role-passenger :is(#quote-explanation, #quote-expiry, #trip-error, #trip-coverage-support) {
    grid-column: 1 / -1;
    font-size: 12px;
  }

  body.design-787.role-passenger :is(#quote-explanation, #quote-expiry):not(:empty) {
    display: block;
  }

  body.design-787.role-passenger .booking-ride-options {
    grid-template-columns: minmax(0, 1fr);
  }

  body.design-787.role-passenger .booking-ride-options label {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) max-content;
    align-items: center;
    gap: 8px;
    padding: 12px;
    min-height: 64px;
  }

  body.design-787.role-passenger .booking-ride-options input {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }

  body.design-787.role-passenger .ride-option-main {
    grid-column: 2;
    grid-row: 1;
    gap: 3px;
  }

  body.design-787.role-passenger .ride-option-main small {
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  body.design-787.role-passenger .ride-option-price {
    grid-column: 3;
    grid-row: 1;
    display: grid;
    min-width: 0;
    gap: 2px;
    text-align: right;
    font-size: 18px;
    line-height: 1.25;
  }

  body.design-787.role-passenger .ride-option-price small {
    line-height: 1.4;
  }

  body.design-787.role-passenger.keyboard-open .booking-summary {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    transform: none;
    box-shadow: none;
  }
}

/* Keep recalculation in the form; the fixed rail contains the quote and order action. */
body.design-787.role-passenger .booking-price-action {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

body.design-787.role-passenger .booking-price-action #calculate-trip {
  width: 100%;
  min-height: 46px;
  text-align: center;
}

body.design-787.role-passenger .booking-price-action .booking-payment-note {
  display: block;
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* One geometry contract for the fixed rail and quote offset, including safe area.
   The real symbol/short label fit within 46px; rem minima also allow larger text. */
@media (max-width: 1099px) {
  body.design-787.role-passenger {
    --passenger-nav-control-height: max(46px, 2.875rem);
    --passenger-nav-height: calc(var(--passenger-nav-control-height) + 14px + var(--passenger-safe-area-bottom));
    --passenger-summary-bottom: var(--passenger-nav-height);
  }

  body.design-787.role-passenger #bottom-nav {
    box-sizing: border-box;
    bottom: 0;
    height: var(--passenger-nav-height);
    min-height: var(--passenger-nav-height);
    padding: 6px 8px calc(6px + var(--passenger-safe-area-bottom));
    border-width: 1px;
    align-items: stretch;
  }

  body.design-787.role-passenger #bottom-nav button {
    box-sizing: border-box;
    height: var(--passenger-nav-control-height);
    min-height: var(--passenger-nav-control-height);
    padding: 2px;
    gap: 3px;
  }

  body.design-787.role-passenger #bottom-nav .nav-symbol {
    font-size: max(22px, 1.375rem);
    line-height: 1;
  }

  body.design-787.role-passenger #bottom-nav .nav-label {
    line-height: max(15px, .9375rem);
  }

  body.design-787.role-passenger #bottom-nav .nav-label::after {
    font-size: max(12px, .75rem);
    line-height: inherit;
  }
}

@media (min-width: 600px) and (max-width: 1179px) {
  body.design-787.role-passenger #calculate-trip {
    min-height: 46px;
  }
}

@media (max-width: 599px) {
  body.design-787.role-passenger #cabinet .cabinet-main {
    width: 100%;
    margin: 0;
    padding: 14px 18px 92px;
  }

  body.design-787.role-passenger #booking-inputs {
    gap: 10px;
  }

  body.design-787.role-passenger .direction-tabs {
    gap: 8px;
  }

  body.design-787.role-passenger .direction-tabs button {
    border-radius: 10px;
    min-height: 44px;
    font-size: 12px;
  }

  body.design-787.role-passenger .booking-details {
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 10px;
  }

  body.design-787.role-passenger .booking-details > .booking-card {
    min-height: 0;
    padding: 10px 8px;
  }

  body.design-787.role-passenger .booking-details > .booking-pickup {
    padding: 0;
  }

  body.design-787.role-passenger .booking-details .passenger-counter {
    gap: 4px;
    margin-top: 6px;
  }

  body.design-787.role-passenger .passenger-counter > :is(button, select) {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding-inline: 0;
  }

  body.design-787.role-passenger #passenger-count {
    width: 44px;
    border-color: transparent;
    background: transparent;
  }

  body.design-787.role-passenger .booking-extras > label:last-child {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
  }

  body.design-787.role-passenger .booking-sheet-trigger {
    min-height: 70px;
    padding: 11px 16px;
  }

  body.design-787.role-passenger .ride-option-main strong {
    font-size: 14px;
  }

  body.design-787.role-passenger .ride-option-main em,
  body.design-787.role-passenger .ride-option-price small {
    font-size: 12px;
  }
}

/* Separate the choices for this exact trip; retain native buttons and text. */
body.design-787.role-passenger .trip-history-detail > .shared-match-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 12px;
}

body.design-787.role-passenger .trip-history-detail > .shared-match-options:empty {
  display: none;
}

body.design-787.role-passenger .trip-history-detail > .shared-match-options > p {
  margin: 0;
}

body.design-787.role-passenger .trip-history-detail > .shared-match-options > button {
  width: 100%;
  min-width: 0;
}

/* Four history metrics use equal tiles instead of an orphan full-width tile. */
body.design-787.role-passenger #passenger-trip-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.design-787.role-passenger #passenger-trip-stats > article {
  min-width: 0;
  min-height: 132px;
  align-content: center;
}

body.design-787.role-passenger #passenger-trip-stats > article:last-child {
  grid-column: auto;
}

@media (min-width: 1100px) {
  body.design-787.role-passenger #passenger-trip-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Keep profile navigation ahead of the pane across the narrow tablet breakpoint. */
@media (min-width: 600px) and (max-width: 759px) {
  body.design-787 .profile-workspace > .profile-menu {
    order: 0;
  }
}

/* Short subpages must not collapse the page while the mobile menu is replaced. */
@media (max-width: 599px) {
  body.design-787 .profile-workspace {
    min-height: calc(calc(var(--app-vh, 1vh) * 100) - 140px);min-height: calc(100dvh - 140px);
  }
}

/* At 320px the price belongs below the ride description, with room for both labels. */
@media (max-width: 359px) {
  body.design-787.role-passenger .booking-ride-options label {
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: start;
  }

  body.design-787.role-passenger .ride-option-price {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    text-align: left;
  }
}
