/* The consumer's withdrawal function (client-withdraw.js): a bar at the top of the client's page while the 14 days run, and the sheet it opens. Uses the client page's tokens and
   client-order.css's fields (.ob-input, .ob-hint, .ob-err, the .ob-pre-r rows). */

/* ---- the bar ---------------------------------------------------------------------------------------------------------------------- */

.wd-bar[hidden] { display: none; }
/* the client page's header floats over the first screen's top; the bar leaves room for it, and the hero under it no longer needs to */
.wd-bar { padding-top: 4.5rem; }
main:has(.wd-bar:not([hidden])) .hero-in { padding-top: clamp(1.5rem, 3vw, 2.4rem); }
.wd-in { display: grid; gap: 0.9rem 1.6rem; align-items: center; padding: 1.15rem 1.25rem 1.25rem; background: var(--card-bg), var(--card-solid); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.wd-h { font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.01em; }
.wd-t { margin-top: 0.25rem; max-width: 40rem; color: var(--ink-2); text-wrap: pretty; }
.wd-left { justify-self: start; padding: 0.3rem 0.85rem; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink); font-family: var(--mono); font-size: 0.875rem; font-weight: 400; letter-spacing: -0.02em; white-space: nowrap; }
.wd-open { min-height: 3rem; padding: 0 1.5rem; background: var(--blue); color: var(--on-blue); border: 0; border-radius: 999px; font-size: 1.0625rem; font-weight: 600; box-shadow: 0 6px 18px rgba(59, 100, 232, 0.3); transition: transform 0.12s ease-out; }
@media (hover: hover) and (pointer: fine) { .wd-open:hover { background: var(--blue-hover); } }
.wd-open:active { transform: scale(0.98); }
.wd-bar[data-last="1"] .wd-in { background: var(--amber-wash); border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
.wd-bar[data-last="1"] .wd-left { border-color: var(--amber); color: var(--amber); font-weight: 700; }
@media (min-width: 760px) {
  .wd-in { grid-template-columns: minmax(0, 1fr) auto auto; padding: 1.1rem 1.4rem; }
  .wd-left { justify-self: end; }
}
@media (max-width: 759px) { .wd-open { width: 100%; } }

/* ---- the sheet: from the bottom on a phone, a card in the middle on a wide screen --------------------------------------------------- */

html:has(.wd-dlg[open]) { overflow: hidden; }
.wd-dlg { width: min(100%, 34rem); max-width: 100%; max-height: min(92dvh, 48rem); padding: 0; background: var(--card-solid); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-card); box-shadow: 0 28px 64px -18px rgba(0, 0, 0, 0.6); overflow: auto; overscroll-behavior: contain; }
.wd-dlg::backdrop { background: rgba(3, 6, 22, 0.6); }
.wd-dlg[open] { animation: wd-pop 0.2s cubic-bezier(0.23, 1, 0.32, 1); }
.wd-dlg[open]::backdrop { animation: wd-fade 0.2s ease-out; }
@keyframes wd-pop { from { opacity: 0; transform: translateY(0.8rem) scale(0.98); } }
@keyframes wd-rise { from { transform: translateY(40%); } }
@keyframes wd-fade { from { opacity: 0; } }
@media (max-width: 639px) {
  .wd-dlg { width: 100%; max-height: 92dvh; margin: auto 0 0; border-width: 1px 0 0; border-radius: var(--r-card) var(--r-card) 0 0; }
  .wd-dlg[open] { animation-name: wd-rise; }
}
@media (prefers-reduced-motion: reduce) { .wd-dlg[open], .wd-dlg[open]::backdrop, .wd-open { animation: none; transition: none; } }
.wd-form { padding: 1.5rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .wd-form { padding: 1.8rem 1.8rem 1.6rem; } }
.wd-dh { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.02em; }
.wd-dh:focus { outline: none; }
.wd-done-h { display: flex; align-items: center; gap: 0.7rem; }
.wd-done-h .mk { width: 0.7rem; height: 0.7rem; --mk: var(--lamp); }
.wd-lead { margin-top: 0.5rem; color: var(--ink-2); text-wrap: pretty; }
.wd-sub { margin-top: 1.4rem; font-size: 1.0625rem; font-weight: 620; }
.wd-c { margin-top: 0.3rem; }
.wd-c .ob-pre-r { grid-template-columns: 6.8rem minmax(0, 1fr); gap: 0.1rem 0.9rem; padding: 0.55rem 0; }
.wd-c .ob-pre-r dt { padding-top: 0.15rem; }
.wd-field--first { margin-top: 1.2rem; }
.wd-c .ob-pre-r:first-child { padding-top: 0.4rem; }
.wd-field { margin-top: 1.1rem; }
.wd-field label { display: block; margin-bottom: 0.45rem; font-size: 0.9375rem; font-weight: 500; color: var(--ink-2); }
.wd-effect { margin-top: 0.4rem; padding: 0.2rem 1rem 0.9rem; background: var(--sheet-2); border: 1px solid var(--line-2); border-radius: 14px; }
.wd-effect .wd-sub { margin-top: 0.9rem; }
.wd-effect-l { display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.wd-effect-l li { position: relative; padding-left: 1.4rem; text-wrap: pretty; }
.wd-effect-l li::before { content: ""; position: absolute; left: 0.2rem; top: 0.62em; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--ink-3); }
.wd-done-l { margin-top: 1rem; }
.wd-acts { display: grid; gap: 0.6rem; margin-top: 1.4rem; }
.wd-confirm, .wd-back { min-height: 3rem; padding: 0.55rem 1.4rem; border-radius: 999px; font-size: 1.0625rem; font-weight: 600; line-height: 1.2; transition: transform 0.12s ease-out; }
.wd-confirm { background: var(--ember); color: var(--on-state); border: 0; }
.wd-back { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.wd-confirm:active:not(:disabled), .wd-back:active { transform: scale(0.98); }
.wd-confirm:disabled { opacity: 0.6; cursor: progress; }
@media (hover: hover) and (pointer: fine) { .wd-confirm:hover:not(:disabled) { filter: brightness(1.08); } .wd-back:hover { border-color: var(--blue-lit); } }
@media (min-width: 640px) { .wd-acts { grid-auto-flow: column; justify-content: start; } }
.wd-confirm:focus-visible, .wd-back:focus-visible, .wd-open:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
/* the two buttons stay in reach while the sheet scrolls */
.wd-acts { position: sticky; bottom: 0; margin: 1.2rem -1.3rem calc(-1.4rem - env(safe-area-inset-bottom)); padding: 1.1rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--card-solid) 0.9rem); }
@media (min-width: 640px) { .wd-acts { margin: 1.2rem -1.8rem -1.6rem; padding: 1.1rem 1.8rem 1.6rem; } }
