/*
  Venom components. Built only from tokens.css; no colour literals below this line except
  transparent/currentColor, so every component survives both themes.

  Class naming is flat (.btn, .btn-primary) so wave 2 can map each class to one React
  component without untangling descendant selectors.
*/

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  /* long hashes and addresses must never push the page sideways */
  overflow-wrap: anywhere;
}

img,
svg {
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  text-wrap: balance;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--fs-24);
  font-weight: var(--fw-bold);
}

h2 {
  font-size: var(--fs-18);
  font-weight: var(--fw-semibold);
}

h3 {
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
}

h4 {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
}

p {
  margin: 0;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Every hover lives under (hover: hover): iOS applies :hover on the first tap and keeps it
   until the next tap elsewhere, so a tapped chip or row stayed highlighted as if selected. */
@media (hover: hover) {
  a:hover {
    color: var(--accent-hover);
  }
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.num,
.tnum {
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.muted {
  color: var(--text-2);
}

.faint {
  color: var(--text-3);
}

.small {
  font-size: var(--fs-13);
}

.xsmall {
  font-size: var(--fs-12);
}

.lead {
  font-size: var(--fs-16);
  color: var(--text-2);
  max-width: 62ch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

.i-sm {
  width: 14px;
  height: 14px;
}

.i-lg {
  width: 24px;
  height: 24px;
}

/* ---------- layout helpers ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap, var(--s-4));
}

.row {
  display: flex;
  align-items: center;
  gap: var(--gap, var(--s-3));
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.row-nowrap {
  flex-wrap: nowrap;
  min-width: 0;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.grid {
  display: grid;
  gap: var(--gap, var(--s-4));
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr));
}

.divider {
  height: 1px;
  background: var(--divider);
  border: 0;
  margin: 0;
}

/* ---------- buttons ---------- */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--hit);
  padding: 0 var(--s-4);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-14);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

@media (hover: hover) {
  .btn:hover {
    --btn-bg: var(--surface-2);
    color: var(--btn-fg);
  }
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  --btn-bd: var(--accent);
}

@media (hover: hover) {
  .btn-primary:hover {
    --btn-bg: var(--accent-hover);
    --btn-bd: var(--accent-hover);
  }
}

.btn-secondary {
  --btn-bg: var(--accent-soft);
  --btn-fg: var(--accent-text);
  --btn-bd: transparent;
}

@media (hover: hover) {
  .btn-secondary:hover {
    --btn-bg: var(--accent-soft-2);
  }
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--text-2);
}

@media (hover: hover) {
  .btn-ghost:hover {
    --btn-bg: var(--surface-sunken);
  }
}

.btn-danger {
  --btn-bg: var(--surface);
  --btn-fg: var(--bad);
  --btn-bd: var(--border-strong);
}

@media (hover: hover) {
  .btn-danger:hover {
    --btn-bg: var(--bad-soft);
    --btn-bd: var(--bad);
  }
}

.btn-danger-solid {
  --btn-bg: var(--bad-solid);
  --btn-fg: var(--text-inverse);
  --btn-bd: var(--bad-solid);
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-sm {
  min-height: 32px;
  padding: 0 var(--s-3);
  font-size: var(--fs-13);
  border-radius: var(--r-xs);
}

.btn-lg {
  min-height: 52px;
  padding: 0 var(--s-6);
  font-size: var(--fs-16);
  border-radius: var(--r-md);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  min-height: var(--hit);
  width: var(--hit);
  padding: 0;
  /* a long title in the same header row squeezed the back button under 44 */
  flex: none;
}

.btn-group {
  display: flex;
  gap: var(--s-2);
  /* wrapped rows of small buttons: their 44 px hit boxes must not overlap */
  row-gap: var(--s-3);
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

/* ---------- forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.label {
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.hint {
  font-size: var(--fs-12);
  color: var(--text-3);
}

.error-text {
  font-size: var(--fs-12);
  color: var(--bad);
  display: flex;
  gap: var(--s-1);
  align-items: center;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-16);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

.input.is-invalid {
  border-color: var(--bad);
}

.input[readonly] {
  background: var(--surface-2);
}

/* amount inputs carry their asset code inside the box, so a bare number is never typed */
.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
}

.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

.input-group .input {
  border: 0;
  box-shadow: none;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.input-addon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--s-3);
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.input-addon-start {
  border-left: 0;
  border-right: 1px solid var(--border);
}

.code-input {
  display: flex;
  gap: var(--s-2);
}

.code-input .input {
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  text-align: center;
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  padding: 0;
  min-height: 56px;
}

.check {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.switch span {
  width: 100%;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  transition: background var(--t-fast);
  pointer-events: none;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--e-1);
  transition: transform var(--t-med) var(--ease);
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-sunken);
  border-radius: var(--r-sm);
  max-width: 100%;
  overflow-x: auto;
}

.segmented button,
.segmented a {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  padding: 6px var(--s-3);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.segmented .is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--e-1);
}

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-width: 0;
}

.card-pad {
  padding: var(--s-5);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}

.card-body {
  padding: var(--s-5);
}

.card-foot {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--divider);
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
}

.card-raised {
  border-color: transparent;
  box-shadow: var(--e-2);
}

.card-sunken {
  background: var(--surface-2);
  border-color: var(--divider);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

@media (hover: hover) {
  .card-link:hover {
    color: inherit;
    border-color: var(--border-strong);
    box-shadow: var(--e-1);
  }
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* ---------- chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

@media (hover: hover) {
  .chip:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

.chip.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.chip-static {
  cursor: default;
  background: var(--surface-2);
  border-color: var(--border);
}

.chips {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ---------- badges: one tone per meaning, every status mapped below ---------- */

.badge {
  --b-fg: var(--muted);
  --b-bg: var(--muted-soft);
  --b-dot: var(--muted-solid);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 7px;
  border-radius: var(--r-pill);
  background: var(--b-bg);
  color: var(--b-fg);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  line-height: 18px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--b-dot);
  flex: none;
}

.badge-plain::before {
  display: none;
}

.badge-lg {
  font-size: var(--fs-13);
  padding: 4px 10px 4px 9px;
}

.tone-ok {
  --b-fg: var(--ok);
  --b-bg: var(--ok-soft);
  --b-dot: var(--ok-solid);
}

.tone-warn {
  --b-fg: var(--warn);
  --b-bg: var(--warn-soft);
  --b-dot: var(--warn-solid);
}

.tone-bad {
  --b-fg: var(--bad);
  --b-bg: var(--bad-soft);
  --b-dot: var(--bad-solid);
}

.tone-info {
  --b-fg: var(--info);
  --b-bg: var(--info-soft);
  --b-dot: var(--info-solid);
}

.tone-wait {
  --b-fg: var(--wait);
  --b-bg: var(--wait-soft);
  --b-dot: var(--wait-solid);
}

.tone-accent {
  --b-fg: var(--accent-text);
  --b-bg: var(--accent-soft);
  --b-dot: var(--accent);
}

/*
  Status → tone. Money that is moving is "wait" (violet), money that is safe but not yet
  final is "info" (blue), final and good is "ok", returned is "accent" so a refund reads
  as resolved rather than as an error, and only a real problem is "bad".
*/
.st-quoted,
.st-draft,
.st-scheduled {
  --b-fg: var(--muted);
  --b-bg: var(--muted-soft);
  --b-dot: var(--muted-solid);
}

.st-awaiting-payment,
.st-awaiting-approval,
.st-pending,
.st-signing,
.st-confirming,
.st-settling,
.st-refunding,
.st-running {
  --b-fg: var(--wait);
  --b-bg: var(--wait-soft);
  --b-dot: var(--wait-solid);
}

.st-escrowed,
.st-supplier-order,
.st-ticketed,
.st-on-request,
.st-in-transit {
  --b-fg: var(--info);
  --b-bg: var(--info-soft);
  --b-dot: var(--info-solid);
}

.st-released,
.st-booked,
.st-paid,
.st-confirmed,
.st-settled,
.st-matched,
.st-active,
.st-executed,
.st-completed,
.st-verified,
.st-connected {
  --b-fg: var(--ok);
  --b-bg: var(--ok-soft);
  --b-dot: var(--ok-solid);
}

.st-refunded,
.st-resolved,
.st-reversed {
  --b-fg: var(--accent-text);
  --b-bg: var(--accent-soft);
  --b-dot: var(--accent);
}

.st-expired,
.st-cancelled,
.st-revoked,
.st-skipped,
.st-disconnected,
.st-coming-soon {
  --b-fg: var(--muted);
  --b-bg: var(--muted-soft);
  --b-dot: var(--muted-solid);
}

.st-low,
.st-needs-review,
.st-partial,
.st-expiring {
  --b-fg: var(--warn);
  --b-bg: var(--warn-soft);
  --b-dot: var(--warn-solid);
}

.st-failed,
.st-break,
.st-rejected,
.st-unmatched,
.st-over-limit {
  --b-fg: var(--bad);
  --b-bg: var(--bad-soft);
  --b-dot: var(--bad-solid);
}

/* moving states pulse so "live" is visible without reading */
.badge.is-live::before {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

/* ---------- money: amount + asset + network, never a bare number ---------- */

.money {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: var(--fw-semibold);
}

.money .amt {
  letter-spacing: -0.01em;
}

/* digits beyond cents stay visible but quiet: the value is exact, the eye reads cents */
.money .tail {
  color: var(--text-3);
  font-weight: var(--fw-regular);
}

.money .cur {
  font-size: 0.72em;
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.money-xl {
  font-size: var(--fs-38);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: 1.1;
}

.money-xl .cur {
  font-size: var(--fs-16);
}

.money-lg {
  font-size: var(--fs-24);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
}

.money-lg .cur {
  font-size: var(--fs-13);
}

.money-neg .amt {
  color: var(--text);
}

.money-in .amt {
  color: var(--ok);
}

.net {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  letter-spacing: 0.03em;
  line-height: 16px;
  white-space: nowrap;
  vertical-align: 0.1em;
  font-variant-numeric: normal;
}

.net-tron {
  color: var(--net-tron);
  background: var(--net-tron-soft);
}

.net-eth {
  color: var(--net-eth);
  background: var(--net-eth-soft);
}

.net-venom {
  color: var(--net-venom);
  background: var(--net-venom-soft);
}

.net-fiat {
  color: var(--muted);
  background: var(--muted-soft);
}

.asset-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: var(--fw-bold);
  flex: none;
  position: relative;
}

.asset-icon.usdt {
  background: var(--asset-usdt);
}

.asset-icon.usdc {
  background: var(--asset-usdc);
}

.asset-icon.venom {
  background: var(--asset-venom);
}

.asset-icon.trx {
  background: var(--net-tron);
}

.asset-icon.eth {
  background: var(--net-eth);
}

.asset-icon.usd {
  background: var(--muted);
}

/* small network pip on the asset icon: USDT on Tron is not USDT on Ethereum */
.asset-icon[data-net]::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.asset-icon[data-net="tron"]::after {
  background: var(--net-tron);
}

.asset-icon[data-net="eth"]::after {
  background: var(--net-eth);
}

.asset-icon[data-net="venom"]::after {
  background: var(--net-venom);
}

/* line items: label left, money right, totals separated by a heavier rule */
.lines {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: 0;
}

.line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
}

.line dt,
.line .k {
  color: var(--text-2);
  min-width: 0;
}

.line dd,
.line .v {
  margin: 0;
  text-align: right;
}

.line-total {
  padding-top: var(--s-3);
  margin-top: var(--s-1);
  border-top: 1px solid var(--border);
  font-size: var(--fs-16);
}

.line-total dt,
.line-total .k {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

/* ---------- addresses and hashes ---------- */

.addr {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
  padding: 2px 2px 2px 8px;
  border-radius: var(--r-xs);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}

/* truncation is in the markup (head…tail) so both ends stay checkable against the wallet */
.addr .addr-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.addr .addr-label {
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  margin-right: 4px;
}

.copy {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex: none;
}

@media (hover: hover) {
  .copy:hover {
    background: var(--surface);
    color: var(--text);
  }
}

.copy.is-copied {
  color: var(--ok);
}

.addr-full {
  display: block;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  line-height: 1.6;
  word-break: break-all;
}

/* first and last characters emphasised: the part people actually compare */
.addr-full b {
  font-weight: var(--fw-bold);
  color: var(--accent-text);
}

.verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ok);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
}

.table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 10px var(--s-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 11px var(--s-3);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: 0;
}

@media (hover: hover) {
  .table tbody tr:hover td {
    background: var(--surface-2);
  }
}

.table .r {
  text-align: right;
}

.table .wrap {
  white-space: normal;
  min-width: 200px;
}

.table tfoot td {
  font-weight: var(--fw-semibold);
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
  background: var(--surface-2);
}

.table tr.is-selected td {
  background: var(--accent-soft);
}

.table a {
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.table-compact td {
  padding: 7px var(--s-3);
}

.dr {
  color: var(--text);
}

.cr {
  color: var(--text-2);
}

/* ---------- key/value lists ---------- */

.kv {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: var(--s-2) var(--s-5);
  margin: 0;
  font-size: var(--fs-13);
}

.kv dt {
  color: var(--text-3);
}

.kv dd {
  margin: 0;
  min-width: 0;
}

/* ---------- alerts and toasts ---------- */

.alert {
  --a-fg: var(--info);
  --a-bg: var(--info-soft);
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--a-bg);
  color: var(--text);
  font-size: var(--fs-13);
}

.alert > .i {
  color: var(--a-fg);
  margin-top: 1px;
}

.alert strong {
  color: var(--text);
}

.alert-ok {
  --a-fg: var(--ok);
  --a-bg: var(--ok-soft);
}

.alert-warn {
  --a-fg: var(--warn);
  --a-bg: var(--warn-soft);
}

.alert-bad {
  --a-fg: var(--bad);
  --a-bg: var(--bad-soft);
}

.alert-accent {
  --a-fg: var(--accent-text);
  --a-bg: var(--accent-soft);
}

.toast {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  max-width: 420px;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--e-3);
  font-size: var(--fs-14);
}

.toast .i {
  color: var(--ok-solid);
}

.toast .link-btn {
  color: var(--bg);
  text-decoration: underline;
  margin-left: auto;
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-6) + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 60;
  width: calc(100% - 32px);
  max-width: 420px;
}

/* ---------- sheets and modals ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 40;
}

.sheet {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--e-3);
  padding: var(--s-2) max(var(--s-5), var(--safe-right)) calc(var(--s-6) + var(--safe-bottom))
    max(var(--s-5), var(--safe-left));
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  margin: 0 auto var(--s-4);
}

/* The home-indicator inset is a border, not padding: a docked sheet scrolls, and padding
   scrolls with the content, so its last rows would pass under the indicator. */
.sheet-docked {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: var(--s-6);
  border-bottom: var(--safe-bottom) solid var(--surface);
  z-index: 50;
  max-height: 92vh;
  /* a sheet that reaches the status bar cannot be dragged down or read at its top */
  max-height: min(92dvh, calc(var(--app-h, 100dvh) - var(--safe-top) - var(--s-4)));
  overscroll-behavior-y: contain;
  overflow-y: auto;
  max-width: 560px;
  margin: 0 auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--e-3);
  width: min(100%, 520px);
}

.modal-head {
  padding: var(--s-5) var(--s-5) 0;
}

.modal-body {
  padding: var(--s-4) var(--s-5);
}

.modal-foot {
  padding: 0 var(--s-5) var(--s-5);
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------- stepper (onboarding) ---------- */

.stepper {
  display: flex;
  gap: var(--s-2);
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.stepper li {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
}

.stepper li::before {
  content: "";
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--border);
}

.stepper li.is-done::before,
.stepper li.is-current::before {
  background: var(--accent);
}

.stepper li.is-current {
  color: var(--text);
}

.stepper li.is-done {
  color: var(--text-2);
}

/* ---------- timeline (booking lifecycle, settlement progress) ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.tl-item {
  --dot: var(--border-strong);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--s-3);
  position: relative;
  padding-bottom: var(--s-4);
}

.tl-item::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--divider);
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item:last-child::before {
  display: none;
}

.tl-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--dot);
  color: var(--dot);
  position: relative;
  z-index: 1;
}

.tl-dot .i {
  width: 13px;
  height: 13px;
  stroke-width: 2.5;
}

.tl-item.is-done {
  --dot: var(--ok-solid);
}

.tl-item.is-done::before {
  background: var(--ok-solid);
  opacity: 0.45;
}

.tl-item.is-done .tl-dot {
  background: var(--ok-solid);
  color: var(--text-inverse);
}

.tl-item.is-current {
  --dot: var(--wait-solid);
}

.tl-item.is-current .tl-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wait-solid);
  animation: pulse 1.4s ease-in-out infinite;
}

.tl-item.is-refund {
  --dot: var(--accent);
}

.tl-item.is-refund .tl-dot {
  background: var(--accent);
  color: var(--on-accent);
}

.tl-item.is-failed {
  --dot: var(--bad-solid);
}

.tl-item.is-failed .tl-dot {
  background: var(--bad-solid);
  color: var(--text-inverse);
}

.tl-item.is-skipped {
  opacity: 0.5;
}

.tl-title {
  font-weight: var(--fw-semibold);
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
  flex-wrap: wrap;
  min-height: 24px;
  padding-top: 2px;
}

.tl-time {
  font-size: var(--fs-12);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-regular);
}

.tl-meta {
  font-size: var(--fs-13);
  color: var(--text-2);
  margin-top: 2px;
}

/* ---------- meters (limits, float levels) ---------- */

.meter {
  --v: 0%;
  --mark: none;
  position: relative;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  overflow: hidden;
}

.meter::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--v);
  background: var(--accent);
  border-radius: var(--r-pill);
}

.meter.is-warn::before {
  background: var(--warn-solid);
}

.meter.is-bad::before {
  background: var(--bad-solid);
}

/* a pending charge shown as a hatched segment after what is already spent */
.meter-pending {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    135deg,
    var(--wait-solid) 0 4px,
    transparent 4px 7px
  );
  opacity: 0.7;
}

.meter-lg {
  height: 12px;
}

.meter-caption {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-12);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

/* ---------- stat tiles ---------- */

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-4) var(--s-5);
  min-width: 0;
}

.stat-label {
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.stat-sub {
  font-size: var(--fs-12);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- avatars and list rows ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-13);
  font-weight: var(--fw-bold);
  flex: none;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: var(--fs-11);
}

.avatar-child {
  background: var(--warn-soft);
  color: var(--warn);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--divider);
  min-width: 0;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row .grow > * {
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-pad .list-row {
  padding-left: var(--s-5);
  padding-right: var(--s-5);
}

/* ---------- QR (drawn as SVG by the page) ---------- */

.qr {
  display: grid;
  place-items: center;
  padding: var(--s-3);
  background: #ffffff; /* QR codes must stay dark-on-white in both themes to scan */
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
}

.qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- countdown ring ---------- */

.countdown {
  display: inline-flex;
  flex: none;
  white-space: nowrap;
  align-items: center;
  gap: var(--s-2);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}

.ring {
  --p: 60;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: conic-gradient(var(--wait-solid) calc(var(--p) * 1%), var(--surface-sunken) 0);
  -webkit-mask: radial-gradient(circle 6px, transparent 98%, #000 100%);
  mask: radial-gradient(circle 6px, transparent 98%, #000 100%);
  flex: none;
}

/* ---------- spinner ---------- */

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--wait-soft);
  border-top-color: var(--wait-solid);
  animation: spin 0.9s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: var(--s-5);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs a,
.tabs button {
  min-width: var(--hit);
  padding: var(--s-3) 0;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.tabs .is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  color: var(--text-2);
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

.count-bad {
  background: var(--bad-solid);
  color: var(--text-inverse);
}

/* ---------- empty state ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-5);
  color: var(--text-2);
}

/* =====================================================================
   App shells
   ===================================================================== */

/* design-review strip injected by ui.js: outside the product, so it must look like tooling */
.design-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 6px var(--s-4);
  background: var(--surface-sunken);
  border-bottom: 1px dashed var(--border-strong);
  font-size: var(--fs-12);
  color: var(--text-3);
  flex-wrap: wrap;
  flex: none;
  /* first thing on the screen when present, so it, not the app header, takes the top inset */
  padding-top: max(6px, var(--safe-top));
  padding-inline: max(var(--s-4), var(--safe-left)) max(var(--s-4), var(--safe-right));
}

.design-bar ~ .app .app-head {
  padding-top: var(--s-2);
}

.design-bar ~ .wallet .wallet-top {
  padding-top: var(--s-4);
}

.design-bar a {
  color: var(--text-2);
}

.design-bar button {
  margin-left: auto;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--r-pill);
  font: inherit;
  padding: 2px 10px;
  cursor: pointer;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-18);
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand small {
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
  letter-spacing: 0;
}

/* ---------- web (user app) ---------- */

.web {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.web-side {
  display: none;
}

.web-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

.web-top {
  position: sticky;
  top: var(--safe-top);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--topbar-h);
  padding: var(--s-2) var(--s-4);
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}

.web-top h1 {
  font-size: var(--fs-18);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-content {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.web-content-narrow {
  max-width: 560px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.tabbar a.is-active {
  color: var(--accent-text);
}

.tabbar .i {
  width: 22px;
  height: 22px;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--hit);
  padding: 9px var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

@media (hover: hover) {
  .nav a:hover {
    background: var(--surface-sunken);
    color: var(--text);
  }
}

.nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.nav .count {
  margin-left: auto;
}

.nav-label {
  padding: var(--s-4) var(--s-3) var(--s-1);
}

@media (min-width: 960px) {
  .web {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .web-side {
    display: flex;
    flex-direction: column;
    gap: var(--s-6);
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: var(--s-5) var(--s-4);
    border-right: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
  }

  .web-side-foot {
    margin-top: auto;
  }

  .web-main {
    padding-bottom: 0;
  }

  .tabbar {
    display: none;
  }

  .web-top {
    padding: var(--s-3) var(--s-7);
  }

  .web-content {
    padding: var(--s-7) var(--s-7) var(--s-9);
  }

  .hide-desktop {
    display: none !important;
  }
}

@media (max-width: 959.98px) {
  .hide-mobile {
    display: none !important;
  }
}

/* ---------- chat ---------- */

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

.chat-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-context {
  display: none;
}

@media (min-width: 1240px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .chat-context {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    padding: var(--s-6) var(--s-5);
    border-left: 1px solid var(--border);
    background: var(--surface-2);
  }
}

.thread {
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  flex: 1 1 auto;
}

.day-sep {
  align-self: center;
  font-size: var(--fs-12);
  color: var(--text-3);
  font-weight: var(--fw-semibold);
}

.msg {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-width: 100%;
  min-width: 0;
}

.msg-user {
  align-self: flex-end;
  align-items: flex-end;
  max-width: min(86%, 520px);
}

.bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: var(--fs-16);
  line-height: 1.45;
}

.msg-user .bubble {
  background: var(--accent);
  color: var(--on-accent);
  border-bottom-right-radius: 6px;
}

.msg-agent .bubble {
  padding: 0;
  color: var(--text);
}

.msg-agent .bubble p + p {
  margin-top: var(--s-2);
}

.msg-meta {
  font-size: var(--fs-11);
  color: var(--text-3);
}

.from-profile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--fs-12);
  color: var(--text-2);
}

.composer {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 10;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: var(--s-3) var(--s-4) var(--s-4);
}

@media (min-width: 960px) {
  .composer {
    bottom: 0;
  }
}

.composer-box {
  max-width: var(--chat-max);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  padding: 6px 6px 6px var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--e-2);
}

.composer-box textarea {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-16);
  padding: 11px 0;
  min-height: var(--hit);
  max-height: 140px;
}

.composer-box textarea:focus {
  outline: none;
}

.composer-send {
  width: var(--hit);
  height: var(--hit);
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.suggestions {
  max-width: var(--chat-max);
  margin: 0 auto var(--s-2);
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
}

/* option cards: scroll sideways on phones, grid on desktop; price is for the whole party */
.options {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 82%);
  gap: var(--s-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--s-4);
  padding-bottom: var(--s-2);
  margin-inline: calc(var(--s-4) * -1);
  padding-inline: var(--s-4);
  scrollbar-width: thin;
}

@media (min-width: 720px) {
  .options {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

.option {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-width: 0;
}

.option.is-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.option-media {
  aspect-ratio: 16 / 7;
  max-width: 100%;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: var(--s-3);
  color: var(--text-inverse);
}

.option-media .badge {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
}

.option-body {
  padding: var(--s-3) var(--s-4) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1 1 auto;
}

.option-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-14);
  line-height: 1.3;
}

.option-facts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--fs-12);
  color: var(--text-2);
}

.option-facts span {
  display: flex;
  gap: 6px;
  align-items: center;
}

.option-price {
  margin-top: auto;
  padding-top: var(--s-2);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  border-top: 1px solid var(--divider);
}

/*
  Hotel photography is not ours to ship, so option media uses tonal scenes per destination
  type. Wave 2 swaps these for the supplier's images; the gradient stays as the loading state.
*/
.scene-city {
  background: linear-gradient(160deg, #2b5c7a 0%, #6b9bb5 45%, #e8b27a 100%);
}

.scene-sea {
  background: linear-gradient(170deg, #1c6f8c 0%, #4fb1c2 55%, #efd6a6 100%);
}

.scene-desert {
  background: linear-gradient(165deg, #9a5b2e 0%, #d69a5a 50%, #f1d7a8 100%);
}

.scene-dusk {
  background: linear-gradient(160deg, #2c2a54 0%, #7c4d7e 50%, #e59a6e 100%);
}

.scene-palm {
  background: linear-gradient(165deg, #0f5249 0%, #3c9a7c 55%, #d9e3a8 100%);
}

.option-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45), transparent 60%);
}

.option-media > * {
  position: relative;
  z-index: 1;
}

/* payment card: owned by the payment program, visually distinct from travel content */
.pay {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--e-1);
  min-width: 0;
}

.pay-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  flex-wrap: wrap;
}

.pay-head .badge {
  margin-left: auto;
}

.pay-body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.pay-foot {
  padding: var(--s-3) var(--s-4) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

/* money buttons name the amount, which runs long at 360 px; wrapping beats clipping it */
.pay-foot .btn {
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  padding-block: var(--s-2);
}

.pay-amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.pay-safe {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  font-size: var(--fs-12);
  color: var(--text-2);
}

.pay-safe .i {
  color: var(--accent-text);
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

/* ---------- wallet (simulated wallet app): a phone-width column on every screen ---------- */

.wallet {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

.wallet-frame {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

@media (min-width: 720px) {
  .wallet {
    padding: var(--s-7) var(--s-4);
    background: var(--surface-sunken);
  }

  .wallet-frame {
    min-height: 820px;
    border-radius: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--e-2);
    overflow: hidden;
  }
}

.wallet-top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: max(var(--s-4), var(--safe-top)) max(var(--s-4), var(--safe-right)) var(--s-4)
    max(var(--s-4), var(--safe-left));
}

.wallet-body {
  flex: 1 1 auto;
  padding: 0 max(var(--s-4), var(--safe-right)) var(--s-6) max(var(--s-4), var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.wallet-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  position: sticky;
  bottom: 0;
}

.wallet-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0;
  color: var(--text-3);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.wallet-nav a.is-active {
  color: var(--accent-text);
}

.wallet-nav .i {
  width: 22px;
  height: 22px;
}

/* inside the wallet frame a sheet docks to the frame, not the window */
.wallet-frame .scrim,
.wallet-frame .sheet-docked {
  position: absolute;
}

.wallet-frame .sheet-docked {
  max-height: calc(100% - var(--s-7));
}

/* with a sheet open the phone screen is fixed-height and the sheet scrolls, as on a device */
@media (max-width: 719.98px) {
  .wallet-frame.has-sheet {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .wallet-frame.has-sheet .wallet-body {
    overflow-y: auto;
  }
}

/* ---------- backoffice ---------- */

.bo {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.bo-side {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: max(var(--s-3), var(--safe-top)) max(var(--s-4), var(--safe-right)) var(--s-3)
    max(var(--s-4), var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}

/* on phones the nav becomes one scrolling strip so every section stays one tap away */
.bo-side .nav {
  flex-direction: row;
  overflow-x: auto;
  scrollbar-width: none;
  gap: var(--s-1);
}

.bo-side .nav a {
  white-space: nowrap;
  padding: 7px 10px;
  font-size: var(--fs-13);
}

.bo-side .nav-label,
.bo-side .bo-side-foot {
  display: none;
}

.bo-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.bo-top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--divider);
}

.bo-top h1 {
  font-size: var(--fs-20);
  flex: 1 1 auto;
  min-width: 0;
}

.bo-content {
  padding: var(--s-5) var(--s-4) var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  width: 100%;
  max-width: 1440px;
}

.crumbs {
  font-size: var(--fs-12);
  color: var(--text-3);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.crumbs a {
  color: var(--text-2);
  text-decoration: none;
}

.filters {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
}

.filters .input,
.filters .select {
  min-height: 36px;
  font-size: var(--fs-13);
  padding: 6px 10px;
  width: auto;
}

.filters .search {
  flex: 1 1 220px;
  min-width: 0;
}

.asof {
  font-size: var(--fs-12);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
  .bo {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .bo-side {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    padding: var(--s-5) var(--s-3);
    gap: var(--s-5);
  }

  .bo-side .nav {
    flex-direction: column;
    overflow: visible;
  }

  .bo-side .nav a {
    font-size: var(--fs-14);
    padding: 8px var(--s-3);
  }

  .bo-side .nav-label,
  .bo-side .bo-side-foot {
    display: block;
  }

  .bo-side-foot {
    margin-top: auto;
  }

  .bo-top {
    padding: var(--s-4) var(--s-7);
  }

  .bo-content {
    padding: var(--s-6) var(--s-7) var(--s-9);
  }
}

.split {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1100px) {
  .split {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }

  .split-even {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ---------- motion preference ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =====================================================================
   Tracking, planning and purchases from any program (#9).
   Appended, never edited above: the React port copies this file section by section.
   Every block is generic on purpose; a program sends data for it, never markup.
   ===================================================================== */

/* the tracked-item statuses of the program contract that had no tone yet */
.st-fulfilling,
.st-boarding {
  --b-fg: var(--wait);
  --b-bg: var(--wait-soft);
  --b-dot: var(--wait-solid);
}

.st-staging,
.st-check-in-open {
  --b-fg: var(--info);
  --b-bg: var(--info-soft);
  --b-dot: var(--info-solid);
}

.st-on-time,
.st-landed,
.st-healthy {
  --b-fg: var(--ok);
  --b-bg: var(--ok-soft);
  --b-dot: var(--ok-solid);
}

/* late or changed is a warning, not an error: the trip still happens and the person may act */
.st-delayed,
.st-changed,
.st-degraded {
  --b-fg: var(--warn);
  --b-bg: var(--warn-soft);
  --b-dot: var(--warn-solid);
}

/* ---------- kind icon: tells a trip from an eSIM in a mixed list before any text is read ---------- */

.kind-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-text);
  flex: none;
}

.kind-icon .i {
  width: 22px;
  height: 22px;
}

.kind-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
}

.kind-icon-sm .i {
  width: 18px;
  height: 18px;
}

/* ---------- status card: a live item (flight, ride, delivery) with a route and key facts ---------- */

.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-width: 0;
}

.status-card.is-attention {
  border-color: var(--warn-solid);
}

.status-card-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  flex-wrap: wrap;
}

.status-card-head .badge {
  margin-left: auto;
}

.status-card-body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.status-card-foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--divider);
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--fs-12);
  color: var(--text-3);
}

.route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--s-3);
  align-items: center;
}

.route-end {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.route-end:last-child {
  align-items: flex-end;
  text-align: right;
}

.route-time {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.route-time.is-late {
  color: var(--warn);
}

/* the old time stays, struck through: people check a new time against the one they remember */
.route-was {
  font-size: var(--fs-12);
  color: var(--text-3);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.route-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 72px;
  font-size: var(--fs-12);
  color: var(--text-3);
}

.route-track {
  --p: 50%;
  position: relative;
  width: 100%;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

/* with a progress value the track shows how far the item has come, e.g. a flight in the air */
.route-track.has-progress::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p);
  border-radius: inherit;
  background: var(--accent);
}

.route-track .i {
  position: absolute;
  top: 50%;
  left: var(--p);
  transform: translate(-50%, -50%);
  width: 20px;
  padding: 0 2px;
  background: var(--surface);
  color: var(--text-2);
}

.route-track.has-progress .i {
  color: var(--accent-text);
}

/* key facts as tiles: gate, terminal, data left. They wrap rather than shrink the values */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 104px), 1fr));
  gap: var(--s-2);
  margin: 0;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.fact dt {
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
}

.fact dd {
  margin: 0;
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.fact small {
  display: block;
  font-size: var(--fs-11);
  font-weight: var(--fw-regular);
  color: var(--text-3);
}

.fact.is-changed {
  background: var(--warn-soft);
  box-shadow: inset 0 0 0 1px var(--warn-solid);
}

/* ---------- agenda: a timeline keyed by local time, grouped by day ---------- */

.agenda {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.agenda-day {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.agenda-day-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--divider);
}

.agenda-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.agenda-item {
  --dot: var(--border-strong);
  position: relative;
  display: grid;
  grid-template-columns: 48px 24px minmax(0, 1fr);
  gap: var(--s-3);
  padding-bottom: var(--s-4);
}

.agenda-item::before {
  content: "";
  position: absolute;
  left: calc(48px + var(--s-3) + 11px);
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--divider);
}

.agenda-item:last-child {
  padding-bottom: 0;
}

.agenda-item:last-child::before {
  display: none;
}

.agenda-time {
  padding-top: 3px;
  text-align: right;
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

.agenda-time small {
  display: block;
  font-size: var(--fs-11);
  font-weight: var(--fw-regular);
  color: var(--text-3);
}

.agenda-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--dot);
  background: var(--surface);
  color: var(--dot);
}

.agenda-dot .i {
  width: 13px;
  height: 13px;
  stroke-width: 2.25;
}

.agenda-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 2px;
}

.agenda-title {
  font-weight: var(--fw-semibold);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: baseline;
}

.agenda-meta {
  font-size: var(--fs-13);
  color: var(--text-2);
}

.agenda-item.is-booked {
  --dot: var(--accent);
}

.agenda-item.is-done {
  --dot: var(--ok-solid);
}

.agenda-item.is-done .agenda-dot {
  background: var(--ok-solid);
  color: var(--text-inverse);
}

.agenda-item.is-now {
  --dot: var(--wait-solid);
}

.agenda-item.is-now .agenda-dot {
  box-shadow: 0 0 0 4px var(--wait-soft);
}

.agenda-item.is-attention {
  --dot: var(--warn-solid);
}

/* dashed: a suggestion (a taxi, a time to leave), not something anyone booked or paid for */
.agenda-item.is-suggested .agenda-dot {
  border-style: dashed;
  color: var(--text-3);
}

.agenda-item.is-suggested .agenda-title {
  font-weight: var(--fw-medium);
  color: var(--text-2);
}

/* ---------- choices: one decision, with the money consequence of each answer ---------- */

.choices {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.choice {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

@media (hover: hover) {
  .choice:hover {
    border-color: var(--border-strong);
  }
}

.choice.is-selected,
.choice:has(> .choice-head input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.choice-head {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
}

.choice-head input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--accent);
}

/* the money line closes every choice so no answer can be picked without seeing what it costs */
.choice-money {
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
  font-size: var(--fs-13);
  color: var(--text-2);
}

/* ---------- compare: saved options side by side, one row per attribute ---------- */

/* on phones the attribute name spans the row above its values, so three columns still fit 360 px */
.compare {
  --cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 0 var(--s-3);
  font-size: var(--fs-13);
}

.compare-label {
  grid-column: 1 / -1;
  padding-top: var(--s-3);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.compare-head {
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
  font-weight: var(--fw-semibold);
  min-width: 0;
}

.compare-cell {
  padding: 4px 0 var(--s-3);
  border-bottom: 1px solid var(--divider);
  min-width: 0;
}

.compare-cell.is-best {
  color: var(--ok);
  font-weight: var(--fw-semibold);
}

.compare-cell.is-worse {
  color: var(--warn);
}

@media (min-width: 720px) {
  .compare {
    grid-template-columns: minmax(120px, 0.7fr) repeat(var(--cols), minmax(0, 1fr));
  }

  .compare-label {
    grid-column: auto;
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--divider);
  }

  .compare-head,
  .compare-cell {
    padding: var(--s-3) 0;
  }

  .compare-corner {
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 719.98px) {
  .compare-corner {
    display: none;
  }
}

/* ---------- notifications ---------- */

.notif {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: var(--s-1) var(--s-3);
  align-items: start;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--divider);
  color: inherit;
  text-decoration: none;
}

.notif:last-child {
  border-bottom: 0;
}

@media (hover: hover) {
  a.notif:hover {
    color: inherit;
    background: var(--surface-2);
  }
}

/* reads the tone-* variables, so a delay and a refund differ by colour as well as by icon */
.notif-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--b-bg, var(--muted-soft));
  color: var(--b-fg, var(--muted));
}

.notif-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notif-title {
  font-weight: var(--fw-semibold);
}

.notif-text {
  font-size: var(--fs-13);
  color: var(--text-2);
}

.notif-time {
  font-size: var(--fs-12);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 2px;
}

.notif.is-unread::before {
  content: "";
  position: absolute;
  left: 7px;
  top: calc(var(--s-4) + 15px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* on phones the time drops under the text instead of squeezing it */
@media (max-width: 479.98px) {
  .notif {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: var(--s-4);
  }

  .notif-time {
    grid-column: 2;
    padding-top: 0;
  }
}

/* =====================================================================
   Chat-first frame (#11). The chat is where the app opens and where every other screen
   returns to, so the user app is one phone-width column at every size: desktop only adds
   a "this trip" panel beside it, never a second layout. Appended, never edited above;
   .web, .web-side and .tabbar stay for the port but no user screen uses them any more.
   ===================================================================== */

/* The page itself never scrolls: the thread (or a manual screen's content) does, between a
   header and a composer that are plain flex rows. On an iPhone a scrolling document drags
   Safari's toolbar in and out, which changes the viewport height under a pinned composer,
   and rubber-bands the header away; a fixed-height frame keeps both where the thumb
   expects them. --app-h is the visual viewport, written by ui.js, so the frame also ends
   at the top of the on-screen keyboard; without script it is the dynamic viewport. */
body:has(> .app) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: var(--app-h, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
}

.app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  /* landscape: the notch and the rounded corners sit on the sides */
  padding-inline: var(--safe-left) var(--safe-right);
}

.app-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--chat-max);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-head,
.app-main .composer,
.ask-dock {
  flex: none;
}

.app-main > .thread,
.app-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* the end of the thread must not hand the swipe to the page or to Safari's back gesture */
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Once the column has a fixed height its flex children would shrink to fit it, and any
   child with overflow set (a card, a carousel, a segmented control) has no content floor,
   so it collapsed to a sliver instead of scrolling. */
.app-main > .thread > *,
.app-content > * {
  flex-shrink: 0;
}

/* without a tab bar the composer docks to the bottom edge itself */
.app-main .composer {
  bottom: 0;
  padding-bottom: calc(var(--s-4) + var(--safe-bottom));
}

/* the side panel is optional context; everything in it is also reachable from the chat */
.app-aside {
  display: none;
}

@media (min-width: 760px) {
  .app {
    background: var(--surface-sunken);
  }

  .app-main {
    border-inline: 1px solid var(--border);
  }
}

@media (min-width: 1024px) {
  .app-aside {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    flex: 0 0 300px;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: var(--s-6) var(--s-4) calc(var(--s-6) + var(--safe-bottom));
  }
}

/* ---------- compact header: context and a way back, never a navigation bar ---------- */

.app-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--topbar-h);
  padding: max(var(--s-2), var(--safe-top)) var(--s-3) var(--s-2);
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}

.app-head h1 {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-18);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-head .brand {
  margin-right: auto;
  font-size: var(--fs-16);
}

.app-head .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

/* what the conversation is about right now; one tap opens the object itself */
.ctx-chip {
  flex: 0 1 auto;
  min-width: 0;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--hit);
  padding: 5px var(--s-3) 5px 5px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

@media (hover: hover) {
  .ctx-chip:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }
}

.ctx-chip-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  flex: none;
}

.ctx-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.ctx-chip-text b,
.ctx-chip-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ctx-chip-text b {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
}

.ctx-chip-text span {
  font-size: var(--fs-12);
  color: var(--text-2);
}

/* unread marker on an icon button; the count lives in the aria-label */
.icon-dot {
  position: relative;
}

.icon-dot::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad-solid);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- the menu: the manual side path, one sheet instead of competing tabs ---------- */

.app-menu > summary {
  list-style: none;
}

.app-menu > summary::-webkit-details-marker {
  display: none;
}

.app-menu[open] > summary {
  --btn-bg: var(--surface-sunken);
}

/* anchored to the sticky header rather than the button, so it can never run off a 360 px screen */
.app-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: var(--s-2);
  width: min(320px, calc(100% - var(--s-4)));
  max-height: calc(100vh - var(--topbar-h) - var(--s-6));
  /* the header grows by the top inset, so the panel must shrink by it to keep its end on screen */
  max-height: calc(var(--app-h, 100dvh) - var(--topbar-h) - var(--safe-top) - var(--safe-bottom) - var(--s-6));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--e-3);
}

.app-menu-panel .eyebrow {
  padding: var(--s-1) var(--s-3) 0;
}

.app-menu-foot {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-1);
  padding: var(--s-3) var(--s-3) var(--s-1);
  border-top: 1px solid var(--divider);
}

/* ---------- manual screens: the same column, with the chat one tap away at the bottom ---------- */

.app-content {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: var(--s-5) var(--s-4) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

/* a two-column split was a desktop idea; in the column it reads top to bottom */
.app-content .split {
  grid-template-columns: minmax(0, 1fr);
}

.ask-dock {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: var(--s-3) var(--s-4) calc(var(--s-4) + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* looks like the composer on purpose: it is the composer, opened with this screen as context */
.ask-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 52px;
  padding: 6px 6px 6px var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--e-2);
  color: var(--text-3);
  font-size: var(--fs-16);
  text-decoration: none;
}

@media (hover: hover) {
  .ask-bar:hover {
    color: var(--text-2);
    border-color: var(--accent);
  }
}

.ask-bar > .i {
  color: var(--accent-text);
}

.ask-bar-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- chat moments ---------- */

/* an earlier moment folded to one line; the thread stays short without losing the history */
.recap {
  align-self: stretch;
  display: flex;
  gap: var(--s-2);
  align-items: center;
  min-width: 0;
  padding: var(--s-2) var(--s-3);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-13);
  text-decoration: none;
}

@media (hover: hover) {
  .recap:hover {
    color: var(--text);
  }
}

.recap > span {
  flex: 1 1 auto;
  min-width: 0;
}

/* how this chat was opened, a notification or a screen, so the first message has a reason */
.thread-origin {
  align-self: stretch;
  display: flex;
  gap: var(--s-2);
  align-items: center;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  background: var(--info-soft);
  color: var(--text);
  font-size: var(--fs-13);
}

.thread-origin > .i {
  color: var(--info);
}

.hello {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-4);
}

.hello .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.hello .brand-mark svg {
  width: 26px;
  height: 26px;
}

.hello h2 {
  font-size: var(--fs-24);
}

.promise {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
}

.promise > .i {
  color: var(--accent-text);
  margin-top: 2px;
}

/* who travels, as a checklist the user reads rather than a form they fill */
.party {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-width: 0;
}

.party-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--divider);
}

.party-row:last-child {
  border-bottom: 0;
}

.party-doc {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  font-size: var(--fs-12);
  color: var(--text-2);
}

.party-row .check-mark {
  color: var(--ok);
}

/* one-tap choice rows inside a card; the whole row is the target */
.pick {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.pick-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  width: 100%;
  padding: var(--s-3);
  border: 0;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.pick-row:last-child {
  border-bottom: 0;
}

@media (hover: hover) {
  .pick-row:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

.pick-row.is-selected {
  background: var(--accent-soft);
}

.pick-row.is-selected > .i {
  color: var(--accent-text);
}

.pick-row.is-disabled {
  cursor: default;
  opacity: 0.65;
}

.pick-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--muted);
  color: var(--text-inverse);
  font-size: var(--fs-13);
  font-weight: var(--fw-bold);
  flex: none;
}

/* the moment the user is in another app: what we wait for, and that it came back */
.handoff {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--wait-soft);
  min-width: 0;
}

.handoff.is-done {
  background: var(--ok-soft);
}

.handoff-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--wait);
  box-shadow: var(--e-1);
  flex: none;
}

.handoff.is-done .handoff-icon {
  color: var(--ok);
}

/* what a pre-filled message is about; removable, so the user can still ask something else */
.composer-context {
  max-width: var(--chat-max);
  margin: 0 auto var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  font-size: var(--fs-12);
  color: var(--text-2);
}

/* =====================================================================
   Touch (#24). The designs were checked as rectangles at phone widths; on an iPhone a
   finger needs 44 × 44 wherever it lands. Controls whose size is part of the density
   (chips, small buttons, text links) keep their look and get a larger invisible hit box;
   the others simply grew to --hit where they are defined.
   ===================================================================== */

/* A centred box at least --hit each way. A pseudo-element rather than padding, so the
   control draws exactly as before; a scroller holding these pads for the overhang, or it
   clips the box and gains a few pixels of accidental scroll. */
.btn-sm,
.chip:not(.chip-static),
.link-btn,
.copy,
.segmented > a,
.segmented > button,
.design-bar a,
.design-bar button {
  position: relative;
}

/* Positioned boxes are hit-tested above plain content; controls and the enlarged text
   links below are all positioned, so the later one wins where two hit boxes meet, and
   plain text never covers either. */
.btn,
.ctx-chip,
.recap,
.pick-row,
.ask-bar,
.composer-send,
.input,
.select,
.textarea {
  position: relative;
}

.btn-sm::before,
.chip:not(.chip-static)::before,
.link-btn::before,
.copy::before,
.segmented > a::before,
.segmented > button::before,
.design-bar a::before,
.design-bar button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100%, var(--hit));
  height: max(100%, var(--hit));
  transform: translate(-50%, -50%);
}

/* wrapped rows of chips: one row's overhang must not steal taps from the next */
.chips {
  row-gap: var(--s-3);
}

.suggestions {
  padding-block: 6px;
  margin-top: -6px;
  margin-bottom: 2px;
}

.segmented > a,
.segmented > button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
}

/* the switch is drawn 40 × 24; the real input is stretched over 44 × 44 around it, and a
   row that is only a label and a switch is as tall as that area, or stacked rows overlap */
.switch input {
  inset: -10px -2px;
}

label:has(> .switch) {
  min-height: var(--hit);
}

details > summary:not(.btn) {
  min-height: var(--hit);
  padding-block: 12px;
}

.recap,
.app-head .brand {
  min-height: var(--hit);
}

/* stacked address rows each with a copy button: at the old pitch the buttons' hit boxes
   overlapped, so the lower one took taps meant for the upper */
.line:has(.copy) {
  min-height: var(--hit);
}

/* A link inside a sentence cannot grow without reflowing the paragraph. Inline padding
   leaves the line box alone and the negative margins cancel it where the link is a flex
   item, so the tappable box reaches 44 while the text stays put. */
:where(a:not([class]):not(nav a, .tabs a), a.small, a.xsmall) {
  --link-pad: max(0px, calc((var(--hit) - 1em) / 2));
  position: relative;
  padding: var(--link-pad) 10px;
  margin: calc(var(--link-pad) * -1) -10px;
}

/* inputs are already 16 px; the backoffice filters were 13, and Safari zooms the page on
   focus into anything under 16 */
@media (pointer: coarse) {
  .filters .input,
  .filters .select {
    font-size: var(--fs-16);
  }
}
