/* Pay with (site/paywith.js): the module under the order card's amount, in place of the Pay with USDG / Pay with ETH
   pills. One select-style control: a closed trigger showing the holding paying (its logo with the chain's mark, symbol,
   chain, dollar value and balance, a chevron), and a panel below it (a sheet from the foot of a phone) with a search field
   and the holdings grouped by chain, the chosen one ticked in the brand's orange; what cannot pay here is dimmed with its
   reason. The card's own tokens (pro.css, rh.css, dark.css): 12px radius, hairlines, the orange for the chosen state and
   the focus ring alone. A route on its way sits above the control (and on the done screen). */
.opw { margin-top: 12px; }
.opw[hidden] { display: none; }
.pw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pw-head > span:first-child { font: 650 13px var(--ui); letter-spacing: .02em; color: var(--text-3); text-transform: uppercase; }
.pw-refresh { min-height: 28px; padding: 0 2px; border: 0; background: none; font: 600 13px var(--ui); color: var(--act-ink); cursor: pointer; }
.pw-refresh:disabled { color: var(--text-3); cursor: default; }

/* The control. */
.pw-dd { position: relative; }
.pw-dd[hidden] { display: none; }
.pw-trig { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 16px; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); text-align: left; color: var(--ink); cursor: pointer; transition: border-color .15s, transform .12s, background .15s; -webkit-tap-highlight-color: transparent; }
.pw-trig:hover:not(:disabled), .pw-trig[aria-expanded="true"] { border-color: var(--ink); }
.pw-trig:active:not(:disabled) { transform: scale(.98); }
.pw-trig:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }
.pw-trig:disabled { cursor: default; color: var(--text-3); }
.pw-trig .pw-mark, .pw-trig .pw-mark img, .pw-trig .pw-tok { width: 28px; height: 28px; }
.pw-trig .pw-mark { margin: 0 4px; }
.pw-chev { color: var(--text-3); transition: transform .2s cubic-bezier(.2, .7, .1, 1); }
.pw-trig[aria-expanded="true"] .pw-chev { transform: rotate(180deg); }

/* A token's face: its logo, never stretched, in a hairline ring; a letter on a tint of its own without one; the chain's
   two letters over its corner. */
.pw-mark { position: relative; flex: none; width: 24px; height: 24px; }
.pw-mark img, .pw-tok { display: grid; place-items: center; box-sizing: border-box; width: 24px; height: 24px; border-radius: 50%; background: var(--sunk); object-fit: cover; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.pw-tok { background: hsl(var(--pw-h, 30) 32% 91%); color: hsl(var(--pw-h, 30) 38% 34%); font: 700 12px var(--ui); font-style: normal; }
.pw-trig .pw-tok { font-size: 14px; }
.pw-chain { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; overflow: hidden; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1.5px var(--surface); font: 700 6.5px/1 var(--ui); letter-spacing: .01em; color: #fff; font-style: normal; }
/* The chain's icon fills its badge whatever the logo rules above say of images (they outrank a plain .pw-chain img). */
.pw-mark .pw-chain img, .pw-trig .pw-mark .pw-chain img, .pw-mark .pw-chain svg, .pw-trig .pw-mark .pw-chain svg { display: block; width: 100%; height: 100%; margin: 0; border: 0; border-radius: 50%; background: none; box-shadow: none; object-fit: cover; }
.pw-mark .pw-chain img, .pw-trig .pw-mark .pw-chain img { transform: scale(1.12); }   /* no tile edge shows in the disc */
/* A mark whose official shape is a square (Base's symbol) keeps it: 2px corners, the same ring, no clip, no scale. */
.pw-chain.pw-sq { border-radius: 2px; }
.pw-mark .pw-chain.pw-sq img, .pw-trig .pw-mark .pw-chain.pw-sq img { border-radius: 2px; transform: none; object-fit: contain; }
/* A mark on a clear or black ground sits whole in a white disc with a white ring, so it reads on both themes. */
.pw-chain.pw-wh { background: #fff !important; box-shadow: 0 0 0 1.5px #fff; }
.pw-mark .pw-chain.pw-wh img, .pw-trig .pw-mark .pw-chain.pw-wh img { transform: none; object-fit: contain; padding: 1px; box-sizing: border-box; }
.pw-trig .pw-chain { width: 15px; height: 15px; font-size: 7px; }
.pw-name { display: grid; gap: 1px; min-width: 0; }
.pw-name b { font: 600 15px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-name small, .pw-amt small { font: 500 12.5px var(--ui); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-amt { display: grid; gap: 1px; justify-items: end; min-width: 0; font-variant-numeric: tabular-nums; }
.pw-amt b { font: 600 15px var(--ui); font-variant-numeric: tabular-nums; animation: pw-in .18s ease-out; }
@keyframes pw-in { from { opacity: 0; } }

/* The panel: 8px under the trigger (above it when there is no room below), the card's border, a soft shadow, in with a short
   rise; --pw-room is the room it has (paywith.js open), 440px at most, its options scrolling within it. */
.pw-panel { position: absolute; z-index: 24; left: 0; right: 0; top: calc(100% + 8px); padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 32px rgba(0, 0, 0, .12); animation: pw-open .14s ease-out; }
/* The 8px between the trigger and the panel shows the card alone. */
.pw-panel::before { content: ""; position: absolute; left: -1px; right: -1px; top: -9px; height: 9px; background: var(--surface); }
.pw-panel.up { top: auto; bottom: calc(100% + 8px); animation-name: pw-open-up; }
.pw-panel.up::before { top: auto; bottom: -9px; }
.pw-notes.veiled { visibility: hidden; }
.pw-panel[hidden] { display: none; }
@keyframes pw-open { from { opacity: 0; transform: translateY(-4px); } }
@keyframes pw-open-up { from { opacity: 0; transform: translateY(4px); } }
.pw-grab { display: none; }
.pw-search { position: relative; display: block; margin-bottom: 6px; color: var(--text-3); }
.pw-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.pw-search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: 500 15px var(--ui); color: var(--ink); outline: 0; transition: border-color .15s; }
.pw-search input:focus { border-color: var(--act); box-shadow: 0 0 0 3px color-mix(in srgb, var(--act) 18%, transparent); }
.pw-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.pw-opts { position: relative; max-height: calc(var(--pw-room, 440px) - 80px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pw-opts::-webkit-scrollbar { width: 6px; }
.pw-opts::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--line-2); }
.pw-panel::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 8px; height: 28px; border-radius: 0 0 10px 10px; background: linear-gradient(to bottom, transparent, var(--surface)); opacity: 0; pointer-events: none; transition: opacity .15s; }
.pw-panel.more::after { opacity: 1; }
.pw-gh { padding: 10px 10px 4px; font: 650 11px var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.pw-group + .pw-group .pw-gh { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.pw-opt { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 18px; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; text-align: left; color: var(--ink); cursor: pointer; transition: background .12s; -webkit-tap-highlight-color: transparent; }
.pw-opt:hover:not([aria-disabled="true"]), .pw-opt.kb { background: var(--sunk); }
.pw-opt.on { background: color-mix(in srgb, var(--act) 7%, var(--surface)); }
.pw-opt.on:hover, .pw-opt.on.kb { background: color-mix(in srgb, var(--act) 11%, var(--surface)); }
.pw-opt:focus-visible { outline: 2px solid var(--act); outline-offset: -2px; }
.pw-opt .pw-mark { margin: 0 2px; }
.pw-opt .pw-name b, .pw-opt .pw-amt b { font-size: 14.5px; }
.pw-opt[aria-disabled="true"] { cursor: default; }
.pw-opt.off .pw-mark > img, .pw-opt.off .pw-mark > .pw-tok, .pw-opt.off .pw-chain, .pw-opt.off .pw-name, .pw-opt.off .pw-amt b { opacity: .45; }   /* the badge as dim as its logo */
.pw-opt.off .pw-amt small { color: var(--text-3); }
.pw-tick { grid-column: 4; color: var(--act); }
.pw-more { display: block; width: 100%; margin-top: 4px; min-height: 36px; padding: 0 10px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; font: 500 12.5px var(--ui); color: var(--text-3); text-align: left; cursor: pointer; }
.pw-more:hover { color: var(--act-ink); }
.pw-empty { padding: 18px 10px; font: 500 13.5px var(--ui); color: var(--text-3); text-align: center; }
.pw-note { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.pw-head + .pw-note, .pw-notes .pw-note:first-child { margin-top: 8px; }

/* Three quiet rows while the balances on other chains are read: the same shape as a row, so nothing moves when they come. */
.pw-skel-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; }
.pw-skel-row i, .pw-skel-row span { display: block; border-radius: 999px; background: linear-gradient(90deg, var(--sunk) 25%, color-mix(in srgb, var(--sunk) 55%, var(--surface)) 50%, var(--sunk) 75%); background-size: 200% 100%; animation: pw-shimmer 1.4s linear infinite; }
.pw-skel-row i { width: 24px; height: 24px; margin: 0 2px; border-radius: 50%; }
.pw-skel-row span { height: 12px; width: 38%; }
.pw-skel-row span:last-child { width: 56px; justify-self: end; }
@keyframes pw-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* A route on its way (above the control, and on the done screen). */
.pw-run:empty { display: none; }
.pw-track { margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; background: var(--sunk); text-align: left; }
.pw-track p { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.pw-track p + p { margin-top: 4px; }
.pw-track .pw-state { font: 650 14.5px/1.4 var(--ui); color: var(--ink); }
.pw-track .pw-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.pw-track .pw-links a { font-weight: 600; color: var(--act-ink); text-decoration: none; }
.pw-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pw-act { min-height: 34px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font: 650 13px var(--ui); color: var(--ink); cursor: pointer; }
.pw-act.hot { border-color: var(--act); background: var(--act); color: #fff; }
.pw-act:disabled { opacity: .55; cursor: default; }
.opw-run { margin-top: 14px; }
.opw-run[hidden] { display: none; }
.opw-run .pw-track { margin-bottom: 0; }

/* On a phone the panel is a sheet from the foot of the screen, over a blurred veil. */
.pw-veil { display: none; }
@media (max-width: 480px) {
  .pw-trig { grid-template-columns: 36px minmax(0, 1fr) auto 16px; gap: 10px; padding: 10px 12px; }
  .pw-veil { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .3); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: pw-veil .2s ease-out; }
  .pw-veil[hidden] { display: none; }
  @keyframes pw-veil { from { opacity: 0; } }
  .pw-panel, .pw-panel.up { position: fixed; z-index: 71; left: 0; right: 0; top: auto; bottom: 0; max-height: 80vh; padding: 6px 12px calc(12px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-bottom: 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .18); animation: pw-up .2s cubic-bezier(.2, .7, .1, 1); }
  @keyframes pw-up { from { transform: translateY(100%); } }
  .pw-grab { display: block; width: 36px; height: 4px; margin: 6px auto 12px; border-radius: 2px; background: var(--line-2); }
  .pw-opts { max-height: calc(80vh - 110px); }
  .pw-panel::after { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}
:root[data-theme="dark"] .pw-trig { background: var(--surface); }
:root[data-theme="dark"] .pw-trig:hover:not(:disabled), :root[data-theme="dark"] .pw-trig[aria-expanded="true"] { border-color: var(--text-3); }
:root[data-theme="dark"] .pw-panel { box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .pw-tok { background: hsl(var(--pw-h, 30) 22% 22%); color: hsl(var(--pw-h, 30) 40% 78%); }
:root[data-theme="dark"] .pw-mark img, :root[data-theme="dark"] .pw-tok { box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 12%, transparent); }
:root[data-theme="dark"] .pw-opt.on { background: color-mix(in srgb, var(--act) 12%, var(--surface)); }
:root[data-theme="dark"] .pw-opt.on:hover, :root[data-theme="dark"] .pw-opt.on.kb { background: color-mix(in srgb, var(--act) 17%, var(--surface)); }
:root[data-theme="dark"] .pw-veil { background: rgba(0, 0, 0, .5); }
@media (max-width: 480px) { .pw-panel::before { display: none; } }
