/* ============================================================================
   «Новое отправление» — pages/booking.js only
   ============================================================================
   The shared vocabulary (.cab-page, .cab-note, .cab-kv, .cab-sticky-actions …)
   is cabinet.css; the controls are the office's. What is here is the page's
   own furniture — the two-card choice at each end, the collection day's
   tiles, the content-type segments, a piece line as a card, the price rail and
   the notes that say why a booking was refused — and one deliberate override: on a
   phone every control on this page is 44px tall and set at 16px, because it
   is the one long form a customer fills in with a thumb, and iOS zooms the
   whole page into any field set smaller than 16px.
   Colours are tokens only, so the dark theme needs nothing of its own.
   ========================================================================== */

/* ── Layout: the form, and the price beside it from 900px ────────────────── */

.cab-booking-layout {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1fr);
}
.cab-booking-main, .cab-booking-rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (min-width: 900px) {
  .cab-booking-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  /* Under the 60px header, and scrolling inside itself if a long breakdown
     outgrows the window rather than pushing the button off the screen. */
  .cab-booking-rail {
    position: sticky; top: 76px;
    max-height: calc(100dvh - 92px); overflow-y: auto;
  }
}

/* One set of actions per layout: in the rail on a wide screen, in the bar
   that rides at the foot of a phone. */
.cab-booking-actions--rail { display: none; }
@media (min-width: 900px) {
  .cab-booking-actions--rail { display: flex; }
  .cab-booking-actions--rail > .btn { width: 100%; }
  .cab-booking-actions--bar { display: none; }
}

.cab-booking-actions--bar { align-items: center; flex-wrap: nowrap; }
.cab-booking-actions__sum { display: flex; flex-direction: column; min-width: 0; margin-right: auto; line-height: 1.2; }
.cab-booking-actions__label { font-size: 12px; font-weight: 600; color: var(--text-3); }
.cab-booking-actions__value {
  font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap;
  min-height: 22px; display: flex; align-items: center;
  transition: opacity .15s;
}
.cab-booking-actions__value.is-stale { opacity: .45; }

/* ── Sections ────────────────────────────────────────────────────────────── */

.cab-booking-num {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-content: center; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 700;
}
.cab-booking-body { display: flex; flex-direction: column; gap: 16px; }

.cab-booking-draft { align-items: center; flex-wrap: wrap; }
.cab-booking-draft__text { flex: 1 1 220px; }

/* A note with a line of links under it: the account's standing up front, the
   refusal beside «Оформить», the price rail's refusal. */
.cab-booking-refusal__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cab-booking-refusal__text { margin: 0; }
.cab-booking-refusal__links { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-weight: 600; }
.cab-booking-refusal__links .link { overflow-wrap: anywhere; }

.cab-booking-place {
  display: flex; align-items: center; gap: 6px; margin: -8px 0 0;
  font-size: 13px; color: var(--text-3);
}
.cab-booking-book { display: flex; }

/* ── The two cards at each end ───────────────────────────────────────────── */

.cab-booking-choice { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cab-booking-choice__card {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  min-height: 64px; padding: 12px;
  border: 1.5px solid var(--border-2); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.cab-booking-choice__card:hover { border-color: var(--border-strong); }
.cab-booking-choice__card.is-active {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.cab-booking-choice__card:has(.cab-booking-choice__input:focus-visible) { box-shadow: var(--ring); }
.cab-booking-choice__card.is-active:has(.cab-booking-choice__input:focus-visible) {
  box-shadow: inset 0 0 0 1px var(--brand), var(--ring);
}

/* Visually hidden, still in the tab order and still announced as a radio. */
.cab-booking-choice__input {
  position: absolute; width: 1px; height: 1px; margin: 0;
  opacity: 0; pointer-events: none;
}

.cab-booking-choice__icon {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-content: center; border-radius: var(--r-md);
  background: var(--surface-3); color: var(--text-3);
  transition: background .15s, color .15s;
}
.cab-booking-choice__card.is-active .cab-booking-choice__icon { background: var(--brand); color: #fff; }
.cab-booking-choice__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cab-booking-choice__title { font-size: 14px; font-weight: 650; line-height: 1.3; }
.cab-booking-choice__sub { font-size: 12.5px; line-height: 1.35; color: var(--text-3); }

/* On a phone two cards share 311px: the icon goes above the words, so the
   title keeps the card's whole width instead of breaking after one word. */
@media (max-width: 520px) {
  .cab-booking-choice .cab-booking-choice__card { flex-direction: column; gap: 8px; }
}
@media (max-width: 340px) {
  .cab-booking-choice { grid-template-columns: minmax(0, 1fr); }
}

.cab-booking-services { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .cab-booking-services { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── The collection day ──────────────────────────────────────────────────────
   Seven tiles: four to a row on a phone, so the week is two rows rather than a
   strip that scrolls sideways out of sight, and all seven from 520px. The look
   is the pickups form's, since it is the same question on the same site. */

.cab-booking-when { gap: 8px; }
.cab-booking-when > .field__label { margin: 0; }
.cab-booking-days { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 520px) { .cab-booking-days { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

.cab-booking-day {
  min-width: 0; min-height: 56px; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: var(--r-md); border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.cab-booking-day:hover { background: var(--surface-2); }
.cab-booking-day:focus-visible { outline: none; box-shadow: var(--ring); }
.cab-booking-day__top { font-size: 13px; font-weight: 650; white-space: nowrap; }
.cab-booking-day__bottom { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.cab-booking-day.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.cab-booking-day.is-active .cab-booking-day__bottom { color: color-mix(in srgb, #fff 85%, transparent); }
.cab-booking-day:disabled { opacity: .45; cursor: not-allowed; background: var(--surface-2); }

.cab-booking-hint { margin: 0; font-size: 12.5px; color: var(--text-3); }

/* ── Content type, as segments ───────────────────────────────────────────── */

.cab-booking-seg {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: var(--r-lg); background: var(--surface-3);
}
.cab-booking-seg__item {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 8px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 600; color: var(--text-3); text-align: center;
  cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.cab-booking-seg__item:hover { color: var(--text); }
.cab-booking-seg__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.cab-booking-seg__item.is-active svg { color: var(--brand); }
.cab-booking-seg__item:has(.cab-booking-choice__input:focus-visible) { box-shadow: var(--ring); }
/* Three segments on a 311px card are ~98px each: «Документы» fits, the icon
   beside it does not, and a one-word label cannot wrap to make room. */
@media (max-width: 420px) {
  .cab-booking-seg__item { padding: 0 4px; }
  .cab-booking-seg__item svg { display: none; }
}

/* ── Piece lines ─────────────────────────────────────────────────────────── */

.cab-booking-pieces { display: flex; flex-direction: column; gap: 10px; }
.cab-booking-piece {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.cab-booking-piece__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.cab-booking-piece__title { font-size: 13.5px; font-weight: 650; }
.cab-booking-piece__grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cab-booking-piece__pack { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .cab-booking-piece__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr); }
  .cab-booking-piece__pack { grid-column: auto; }
}
.cab-booking-piece__sum { margin: -2px 0 0; font-size: 12.5px; color: var(--text-3); }

.cab-booking-icon-btn { color: var(--text-3); }
.cab-booking-icon-btn:hover { color: var(--danger); }

/* A text button that still meets the thumb: the words are small, the target is not. */
.cab-booking-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  min-height: 36px; padding: 0 2px; border: 0; background: none;
  color: var(--brand); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.cab-booking-link:hover { text-decoration: underline; }
.cab-booking-link:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.cab-booking-dims { display: flex; flex-direction: column; gap: 6px; }
.cab-booking-dims__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cab-booking-dims__row {
  display: grid; align-items: center; gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
}
.cab-booking-dims__x { color: var(--text-4); font-size: 14px; }

.cab-booking-pieces-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: -4px; }
.cab-booking-pieces-foot .cab-muted { font-size: 13px; }
.cab-booking-pieces-error { margin-top: -8px; }
.cab-booking-pieces-error .field__error { font-size: 12.5px; }

/* ── Options ─────────────────────────────────────────────────────────────── */

.cab-booking-opts { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.cab-booking-opt { display: flex; flex-direction: column; gap: 8px; }
.cab-booking-opt > .switch { min-height: 40px; }
/* Under the toggle's words, past the 36px track and its 9px gap. */
.cab-booking-opt__hint { margin: -8px 0 0 45px; font-size: 12.5px; color: var(--text-3); }

/* ── The price ───────────────────────────────────────────────────────────── */

.cab-booking-price__body { display: flex; flex-direction: column; gap: 12px; }
.cab-booking-total {
  margin: 0; font-size: 30px; line-height: 1.1; font-weight: 750; letter-spacing: -.03em;
  transition: opacity .15s;
}
.cab-booking-total.is-stale { opacity: .45; }
.cab-booking-eta { font-size: 13.5px; }

.cab-booking-lines { border-top: 1px solid var(--border); }
.cab-booking-lines > summary {
  display: flex; align-items: center; min-height: 44px;
  font-size: 13.5px; font-weight: 600; color: var(--brand); cursor: pointer;
  list-style: none;
}
.cab-booking-lines > summary::-webkit-details-marker { display: none; }
.cab-booking-lines > summary::after {
  content: ''; width: 7px; height: 7px; margin-left: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.cab-booking-lines[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.cab-booking-lines > summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.cab-booking-lines .stat-row { font-size: 13px; }

/* ── Thumb-sized controls on a phone ─────────────────────────────────────── */

@media (max-width: 899px) {
  .cab-booking-page .input,
  .cab-booking-page .select,
  .cab-booking-page .textarea { font-size: 16px; }
  .cab-booking-page .input,
  .cab-booking-page .select { height: 44px; }
  .cab-booking-page .btn { min-height: 44px; }
  .cab-booking-page .btn--icon { min-width: 44px; }
  .cab-booking-page .btn--sm { min-height: 40px; }
  .cab-booking-page .field__label { font-size: 13px; }
}

/* The courier card when it leads to the courier form rather than choosing a
   mode here: a way somewhere, drawn like its neighbour so the pair still reads
   as the two ways a parcel starts its journey. */
.cab-booking-choice__card--link { text-decoration: none; color: inherit; }
.cab-booking-choice__card--link .cab-booking-choice__title { display: inline-flex; align-items: center; gap: 4px; }
.cab-booking-choice__card--link:hover { border-color: var(--brand-border); }
