/* Android canon layer: TooWe Web/PWA follows Samsung Compose tokens (ui/theme/Theme.kt).
   Loaded last; `html body` prefix wins over page CSS and inline driver CSS. */
:root {
  --tw-canon-purple: #6f4cff;
  --tw-canon-ink: #0e132e;
  --tw-canon-muted: #5b6079;
  --tw-canon-line: #e6e8f2;
  --tw-canon-soft: #f3f1ff;
  --tw-canon-raised: #fbfaff;
  --tw-canon-radius: 16px;
  --tw-canon-control: 52px;
  --tw-ink: var(--tw-canon-ink);
  --tw-muted: var(--tw-canon-muted);
  --tw-purple: var(--tw-canon-purple);
  --dx-ink: var(--tw-canon-ink);
  --dx-muted: var(--tw-canon-muted);
  --dx-primary: var(--tw-canon-purple);
  --dx-line: var(--tw-canon-line);
}

html body { color: var(--tw-canon-ink); background: #fff; line-height: 1.4; }
html body p, html body li, html body small { line-height: 1.4; }
html body .muted, html body .tw-muted, html body .hint, html body small { color: var(--tw-canon-muted); }

/* Primary: purple, white text, 52px, radius 16 (PrimaryButton) */
html body .tw-c-button,
html body .tw-c-primary-button,
html body a.tw-c-primary-button,
html body a.tw-c-primary-button:visited,
html body button.tw-c-primary-button,
html body .tw-history-empty a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tw-canon-control); padding: 0 20px; box-sizing: border-box;
  border-radius: var(--tw-canon-radius); border: 0;
  background: var(--tw-canon-purple); color: #fff;
  font-family: inherit; font-size: 17px; line-height: 22px; font-weight: 600; text-align: center; text-decoration: none;
  white-space: normal; overflow-wrap: anywhere;
}
html body .tw-c-primary-button[disabled],
html body .tw-c-primary-button[aria-disabled="true"] { background: rgba(107,112,138,.35); color: #fff; }

/* Secondary: outlined 1px line, ink text (SecondaryButton) */
html body .tw-c-secondary-button,
html body .tw-c-secondary-button.tw-button.secondary,
html body a.tw-c-secondary-button:visited {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tw-canon-control); padding: 0 20px; box-sizing: border-box;
  border-radius: var(--tw-canon-radius); border: 1px solid var(--tw-canon-line);
  background: #fff; color: var(--tw-canon-ink);
  font-family: inherit; font-size: 17px; line-height: 22px; font-weight: 600; text-decoration: none; box-shadow: none;
}
html body .tw-c-text-button, html body .tw-c-text-button:visited {
  background: transparent; color: var(--tw-canon-purple); font-weight: 600; min-height: 48px; border: 0; padding: 0 12px;
}
html body .tw-c-text-button .tw-c-button-label { color: inherit; }
html body .tw-c-primary-button .tw-c-button-label, html body .tw-c-secondary-button .tw-c-button-label { color: inherit; }

/* Support chat CTA: white on purple, PrimaryButton metrics */
html body .tw-support-chat-card > a, html body .tw-support-chat-card > a:visited {
  display: flex; align-items: center; justify-content: center; min-height: var(--tw-canon-control);
  border-radius: var(--tw-canon-radius); background: var(--tw-canon-purple); color: #fff; font-family: inherit; font-size: 17px; line-height: 22px; font-weight: 600; text-decoration: none;
}
html body .tw-support-chat-card h2 span { color: #0b7a3e; }

/* Muted text meets 4.5:1 on white */
html body em, html body .dx-readiness-progress small, html body .tw-empty p, html body .dx-page p { color: var(--tw-canon-muted); }

/* Cards and chips */
html body .tw-c-card, html body .tw-card, html body .dx-card {
  background: #fff; border: 1px solid var(--tw-canon-line); border-radius: var(--tw-canon-radius); padding: 14px;
}
html body .tw-chip, html body .dx-chip { border-radius: 999px; padding: 6px 12px; font-size: 13px; line-height: 18px; }

/* Trips section tabs: scroll inside own row, no default underline */
html body .tw-trips-tabs { overflow-x: auto; scrollbar-width: none; border: 0; gap: 6px; margin-left: 0; margin-right: 0; padding: 2px 0 6px; }
html body hr { border: 0; border-top: 1px solid var(--tw-canon-line); height: 0; }
html body .tw-trips-tabs::-webkit-scrollbar { display: none; }
html body .tw-trips-tabs__tab { text-decoration: none; white-space: nowrap; padding: 0 12px; font-size: 14px; flex: 1 1 auto; justify-content: center; }

/* Content never sits under the bottom navigation or the safe area */
html body .tw-plain-app, html body main.tw-shell { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }

/* Notification-sound banner is dismissable content, never an overlay */
html body .tw-sound-banner { position: static; left: auto; right: auto; bottom: auto; margin: 8px 16px calc(120px + env(safe-area-inset-bottom, 0px)); box-shadow: none; border-color: var(--tw-canon-line); color: var(--tw-canon-ink); }

/* Top bar icons: Ink, 24px stroke legible */
html body .twn-topbar__control { color: var(--tw-canon-ink); }

/* Filter chips share the pill metrics of the section tabs; no default nav underline */
html body .tw-history-filters { border: 0; gap: 6px; flex-wrap: wrap; }
html body .tw-history-filters a { min-height: 40px; padding: 0 10px; border-radius: 999px; font-size: 13px; line-height: 18px; font-weight: 600; }

/* Documents / fiscal lists: one card per topic with canonical rhythm */
html body .tw-card + .tw-card { margin-top: 12px; }
html body .tw-card > h1 { font-size: 24px; line-height: 30px; font-weight: 700; margin: 0 0 8px; }
html body .tw-card > h2 { font-size: 17px; line-height: 22px; font-weight: 600; margin: 0 0 8px; }
html body .tw-card ul:not([class]) { margin: 0; padding-left: 18px; font-size: 15px; line-height: 21px; color: var(--tw-canon-muted); }
html body .tw-card .tw-card-line { margin: 0; font-size: 15px; line-height: 21px; color: var(--tw-canon-muted); }

/* Payments empty-state CTA: PrimaryButton */
html body .tw-payment-empty a, html body .tw-payment-empty a:visited {
  min-height: var(--tw-canon-control); border-radius: var(--tw-canon-radius); background: var(--tw-canon-purple); color: #fff;
  font-size: 17px; line-height: 22px; font-weight: 600; padding: 0 20px;
}

/* Screen titles: headlineSmall 24/30 (Android), never display-size */
html body main h1:not(.tw-home *) { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: 0; overflow-wrap: break-word; }
html body main h2:not(.tw-home *) { font-size: 17px; line-height: 22px; font-weight: 600; }

/* Profile edit action = SecondaryButton (line border, ink text) */
html body .tw-profile-edit, html body .tw-profile-edit:visited {
  min-height: var(--tw-canon-control); border: 1px solid var(--tw-canon-line); border-radius: var(--tw-canon-radius);
  background: #fff; color: var(--tw-canon-ink); font-size: 17px; line-height: 22px; font-weight: 600; box-shadow: none;
}
html body .tw-profile-edit svg { color: var(--tw-canon-ink); }

/* Address-state region renders nothing (no empty bordered strip) until a state is shown */
html body .tw-passenger-search-address-states:not(:has(> :not([hidden]))) { display: none; }

/* Remaining muted captions meet 4.5:1 */
html body .tw-profile-contact em, html body .dx-home p, html body .tw-c-empty-state p { color: var(--tw-canon-muted); }

html body a.tw-c-primary-button, html body .tw-history-empty a, html body .tw-history-empty a:visited, html body .tw-history-empty a:hover { text-decoration: none; }

/* =====================================================================================================================
   UX closure v2 (Web/PWA, all users) -- address fields, seats/price row, comfort 2x2, scroll clearance, driver actions.
   Visual rules only: geocoding, address matching, Geo/PIN confirmation and pricing rules are untouched.
   ===================================================================================================================== */

/* Address fields: the focus state is a quiet border on the field row, never a bright ring around the inner input. */
html body .tw-home-search-card input:focus,
html body .tw-home-search-card input:focus-visible,
html body .tw-c-search-field input:focus,
html body .tw-c-search-field input:focus-visible {
  outline: none;
  box-shadow: none;
}
html body .tw-home-search-card:focus-within {
  border-color: rgba(111, 76, 255, .38);
  box-shadow: none;
}

/* Suggestions: no tinted purple wrapper; neutral 1px cards, a soft tint only on hover / keyboard focus. */
html body .tw-passenger-search-address-state:has(.tw-c-search-suggestion):not([data-address-state="needs-selection"]):not([data-address-state="unresolved"]) {
  padding: 0;
  border: 0;
  background: transparent;
}
html body .tw-passenger-search-address-state .tw-c-search-suggestion {
  border: 1px solid var(--tw-canon-line);
  background: #fff;
  box-shadow: none;
}
html body .tw-passenger-search-address-state .tw-c-search-suggestion:hover { background: var(--tw-canon-raised); }
html body .tw-passenger-search-address-state .tw-c-search-suggestion:focus-visible {
  outline: 2px solid rgba(111, 76, 255, .4);
  outline-offset: 1px;
  background: var(--tw-canon-soft);
}

/* Seats and price never share a row on phones: the stepper keeps its controls, the price field gets its own full-width row. */
@media (max-width: 480px) {
  html body .tw-passenger-search-filter-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
html body .tw-passenger-search-filter-grid > * { min-width: 0; }
html body .tw-search-stepper { min-width: 0; flex-wrap: nowrap; }
html body .tw-search-stepper .tw-detail-stepper__control { flex: 0 0 auto; gap: 4px; }
/* round 44px +/- controls (the global button rule had turned them into wide purple pills) */
html body .tw-search-stepper button {
  flex: 0 0 44px; width: 44px !important; height: 44px !important; min-height: 44px !important; padding: 0 !important; border: 0 !important;
  border-radius: 50% !important; background: #f3f1ff !important; color: var(--tw-canon-purple) !important; box-shadow: none !important;
  font-size: 22px; line-height: 1; font-weight: 700;
}
html body .tw-search-stepper input[type="number"] {
  flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; padding: 0; border: 0; background: transparent;
  text-align: center; font-size: 18px; font-weight: 800;
}
/* price: the label card is the box; the input inside it has no second border or ring */
html body .tw-passenger-search-filter-grid label[data-price-field] input {
  width: 100%; min-width: 0; height: auto; min-height: 0; padding: 0; border: 0; background: transparent;
  box-shadow: none; outline: none; font-variant-numeric: tabular-nums;
}
html body .tw-passenger-search-filter-grid label[data-price-field]:focus-within {
  border-color: rgba(111, 76, 255, .38); box-shadow: none;
}

/* Comfort options stay a compact 2x2 at every phone width (the old <=340px single column left large empty gaps). */
html body .tw-passenger-search-chip-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 340px) {
  html body .tw-passenger-search-chip-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
html body .tw-passenger-search-chip {
  margin: 0;                                                  /* a stray label margin (12px 0 6px) was stretching the grid rows */
  min-height: 44px;
  padding: 8px 10px;
  gap: 7px;
  font-size: 13px;
  line-height: 16px;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The floating navigation never hides a focused or scrolled-to control. */
html { scroll-padding-bottom: calc(var(--tw-bottom-nav-content-offset, 112px) + 24px + env(safe-area-inset-bottom, 0px)); }

/* Driver incoming order: both actions on one line each, at any phone width. */
html body .dx-decision { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 10px; }
html body .dx-decision .tw-driver-found-action,
html body .dx-decision .tw-c-button {
  white-space: nowrap;
  padding: 0 10px;
  font-size: 15px;
  line-height: 20px;
}
@media (max-height: 720px) {
  html body .dx-city-sheet-geo-context { display: none; }     /* keep the order readable on short phones */
}

/* Payment card (acquiring/demo): each note on its own line */
html body .tw-acq-card small { display: block; margin-top: 4px; }

/* Профиль → Способы оплаты: default method (Passenger) */
html body .tw-payment-pref { display: grid; gap: 10px; }
html body .tw-payment-pref form { display: grid; gap: 10px; }
html body .tw-payment-pref__option { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border: 1px solid var(--tw-canon-line, #e6e8f2); border-radius: 16px; background: #fff; }
html body .tw-payment-pref__option[data-available="false"] { background: #f7f7fb; color: var(--tw-canon-muted, #5b6079); }
html body .tw-payment-pref__option input { flex: 0 0 22px; width: 22px; height: 22px; margin: 0; }
html body .tw-payment-pref__option:has(input:checked) { border-color: rgba(111, 76, 255, .55); background: var(--tw-canon-soft, #f3f1ff); }
html body .tw-payment-pref__option span { display: grid; gap: 2px; min-width: 0; }
html body .tw-payment-pref__soon { display: block; margin: 0; }

/* Driver «История и отчёты» (Web/PWA); same tokens as the Android canon */
html body .tw-report { display: grid; gap: 12px; padding-bottom: 8px; }
html body .tw-report__head { display: flex; align-items: center; gap: 10px; }
html body .tw-report__head h1 { margin: 0; }
html body .tw-report__back { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--tw-canon-line); border-radius: 50%; text-decoration: none; color: var(--tw-canon-ink); }
html body .tw-report-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
html body .tw-report-tab { display: grid; place-items: center; min-height: 44px; padding: 0 6px; border: 1px solid var(--tw-canon-line); border-radius: 999px; background: #fff; color: var(--tw-canon-ink); font-size: 14px; font-weight: 600; text-decoration: none; text-align: center; }
html body .tw-report-tab.is-active { border-color: rgba(111, 76, 255, .55); background: var(--tw-canon-soft); color: var(--tw-canon-purple); }
html body .tw-report-custom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; }
html body .tw-report-custom label { display: grid; gap: 4px; font-size: 12px; color: var(--tw-canon-muted); min-width: 0; }
html body .tw-report-custom input { min-width: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--tw-canon-line); border-radius: 14px; background: #fff; font: inherit; color: var(--tw-canon-ink); }
html body .tw-report-custom button { grid-column: 1 / -1; }
html body .tw-report-period { margin: 0; font-size: 13px; color: var(--tw-canon-muted); }
html body .tw-report-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html body .tw-report-stat { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--tw-canon-line); border-radius: 16px; background: #fff; min-width: 0; }
html body .tw-report-stat small { color: var(--tw-canon-muted); font-size: 12px; }
html body .tw-report-stat strong { font-size: 17px; overflow-wrap: anywhere; }
html body .tw-report-exports { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
html body .tw-report-exports .tw-c-button { min-height: 48px; padding: 0 8px; font-size: 14px; white-space: nowrap; }
html body .tw-report-list { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; }
html body .tw-report-trip { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--tw-canon-line); border-radius: 16px; background: #fff; min-width: 0; }
html body .tw-report-trip__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
html body .tw-report-trip__route { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
html body .tw-report-trip dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin: 0; }
html body .tw-report-trip dl div { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; }
html body .tw-report-trip dt { color: var(--tw-canon-muted); }
html body .tw-report-trip dd { margin: 0; text-align: right; }
html body .tw-report-trip__status { margin: 0; font-size: 12px; color: var(--tw-canon-muted); }
html body .tw-report-error { margin: 0; padding: 10px 12px; border-radius: 14px; background: #fff3f3; color: #b3261e; font-size: 14px; }
html body .tw-report-notice { font-size: 12px; }
html body .tw-report-incomplete { margin: 0; padding: 10px 12px; border-radius: 14px; background: #fff8e6; color: #7a5200; font-size: 13px; }
html body .tw-report-trip.is-incomplete { border-style: dashed; background: #fffdf5; }
