/* The money screens: buy box, order page, Your orders, Your sales, Getting paid (v0.5.0, reworked v0.5.2).
   site.css tokens only. Lit (the accent) means "you have something to do"; green is done, red refunded, blue on its way.
   Kept apart from site.css so the listing and sell screens merge cleanly. */
:root { --ease-out: cubic-bezier(.22, 1, .36, 1); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.money-page > h1 { margin-bottom: var(--s5); }
.money-page > h2 { margin: var(--s7) 0 var(--s3); }
.money-page > .notice-plain, .money-page > .errors { max-width: 40rem; margin: 0 0 var(--s4); }
.amt, .sum dd, .ledger dd { font-variant-numeric: tabular-nums; }
.trk { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .875em; font-variant-numeric: tabular-nums; }
.tag .icon { width: 1rem; height: 1rem; }
.tag.bad { color: var(--bad); }
.tag.go { color: var(--teal-text); }
.tag.due { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.free-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.empty .lead { margin-top: 0; }
h2 .count { display: inline-grid; place-items: center; min-width: 1.75em; height: 1.75em; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: .8em; margin-left: var(--s2); font-variant-numeric: tabular-nums; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }

/* ---------- Buy box (listing) ---------- */
.buybox { display: grid; gap: var(--s3); margin-top: var(--s4); }
.buy-form { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s3); align-items: end; margin: 0; }
.buy-form .pk-label { grid-column: 1 / -1; margin: 0; }
.buy-form .buy-qty { min-height: 52px; min-width: 5.5rem; }
.buy-form > input[type="hidden"] + .buy-now, .buy-form .buy-now:only-of-type { grid-column: 1 / -1; }
.buy-now { width: 100%; justify-content: center; }
.buy-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); color: var(--muted); font-size: .9375rem; }
.buy-facts li { display: grid; grid-template-columns: 1.25rem 1fr; gap: var(--s2); align-items: start; }
.buy-facts .icon { width: 1.25rem; height: 1.25rem; margin-top: .1rem; color: var(--ink); }
.buy-facts .free .icon { color: var(--good); }
.buy-facts strong { color: var(--ink); }
.fee-note { margin: 0; color: var(--muted); font-size: .95rem; }
.fee-note .tag { margin-right: var(--s2); }

/* ---------- Order page ---------- */
.order-head { max-width: 44rem; margin-bottom: var(--s6); }
.order-ref { margin: 0 0 var(--s3); color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.order-headline { display: flex; align-items: center; gap: var(--s3); }
.order-headline h1 { margin: 0; text-wrap: balance; }
.order-head .lead { margin: var(--s3) 0 var(--s4); max-width: 38rem; }
.order-head > :last-child { margin-bottom: 0; }
.order-mark { flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.order-mark .icon { width: 26px; height: 26px; }
.order-mark.ok { background: color-mix(in srgb, var(--good) 13%, var(--surface)); border-color: transparent; color: var(--good); }
.order-mark.go { background: color-mix(in srgb, var(--teal) 11%, var(--surface)); border-color: transparent; color: var(--teal-text); }
.order-mark.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.order-mark.due { background: var(--accent); border-color: transparent; color: var(--on-accent); }
/* The one moment: the tick draws itself when a buyer lands here having just paid. */
.order-mark.draw path { stroke-dasharray: 22; stroke-dashoffset: 22; animation: q-draw .6s var(--ease-out) .15s forwards; }
@keyframes q-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .order-mark.draw path { animation: none; stroke-dashoffset: 0; } }

.order-grid { display: grid; gap: var(--s5); align-items: start; }
@media (min-width: 56rem) { .order-grid { grid-template-columns: minmax(0, 1fr) 19rem; gap: var(--s6); } }
.order-card { border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s5); background: var(--surface); }
.order-item { margin: 0; font-size: 1.25rem; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.order-sub { margin: var(--s1) 0 0; color: var(--muted); }
.order-card form { margin: var(--s5) 0 0; }

.track { list-style: none; margin: var(--s5) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.track li { position: relative; display: grid; gap: 2px; align-content: start; padding: 28px var(--s2) 0 0; }
.track li::before { content: ""; position: absolute; top: 0; left: 0; z-index: 1; width: 18px; height: 18px; box-sizing: border-box;
  border-radius: 50%; border: 2px solid var(--line); background: var(--field); }
.track li::after { content: ""; position: absolute; top: 8px; left: 18px; right: 0; height: 2px; background: var(--line); }
.track li:last-child::after { display: none; }
.track li.done::before { background: var(--good); border-color: var(--good); }
.track li.done::after { background: var(--good); }
.track li.now::before { background: var(--accent); border-color: var(--on-accent); }
.track b { color: var(--muted); }
.track li.done b, .track li.now b { color: var(--ink); }
.track small { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }

.sum { margin: var(--s5) 0 0; padding-top: var(--s4); border-top: 1px solid var(--line); display: grid; gap: var(--s2); max-width: 26rem; }
.sum div { display: flex; justify-content: space-between; gap: var(--s4); }
.sum dt, .sum dd { margin: 0; }
.sum dt { color: var(--muted); }
.sum .total { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s1); font-weight: 700; font-size: 1.125rem; }
.sum .total dt { color: var(--ink); }

.order-side { display: grid; gap: var(--s5); }
.side-block h2 { margin: 0 0 var(--s2); font-family: var(--text); font-size: 1rem; font-weight: 700; }
.side-block p { margin: 0; }
.side-block p > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
.ship-to { font-style: normal; line-height: 1.5; padding: var(--s3) var(--s4); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--r2); }
.guarantee { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); align-items: start; color: var(--muted); }
.guarantee .icon { color: var(--good); }
.side-links { display: flex; flex-wrap: wrap; gap: 0 var(--s5); }
.side-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Your orders and Your sales: a ledger of hairline rows ---------- */
.order-list { list-style: none; margin: 0; padding: 0; max-width: 60rem; border-top: 1px solid var(--line); }
.order-row { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2) var(--s5); align-items: center;
  padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.order-main { display: grid; gap: 2px; align-content: center; min-width: 0; min-height: 44px; color: inherit; text-decoration: none; border-radius: var(--r1); }
.order-main:hover { text-decoration: none; }
.order-main:hover .order-title { text-decoration: underline; }
.order-main:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.order-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; text-decoration: none; }
a.order-title:hover { text-decoration: underline; }
.order-meta { color: var(--muted); font-size: .9375rem; }
.order-meta.payout { color: var(--ink); }
.order-meta.payout.out { color: var(--good); }
.order-state { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.amt { font-weight: 700; }
.order-act { margin: 0; }
.order-act .btn, .order-act > summary { min-height: 44px; }
@media (min-width: 48rem) {
  .order-row { grid-template-columns: minmax(0, 1fr) 17rem 8rem; }
  .order-state { grid-column: 2; }
  .order-act { grid-column: 3; justify-self: end; }
  .order-act .btn, .order-act > summary { min-width: 8rem; }
  .refund[open] { grid-column: 1 / -1; justify-self: stretch; }
}
@media (max-width: 47.99rem) { .order-act .btn, .order-act > summary { width: 100%; } }

.refund summary { list-style: none; cursor: pointer; }
.refund summary::-webkit-details-marker { display: none; }
.refund form { margin: var(--s3) 0 0; padding: var(--s4); gap: var(--s3); max-width: 30rem; background: var(--bad-bg); border-radius: var(--r2); }
.refund .btn.danger { background: var(--field); }

.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 40rem; margin: 0; border: 1px solid var(--line);
  border-radius: var(--r3); background: var(--surface); }
.ledger div { display: grid; gap: 2px; padding: var(--s3) var(--s4); min-width: 0; }
.ledger div + div { border-left: 1px solid var(--line); }
.ledger dt { color: var(--muted); font-size: .875rem; }
.ledger dd { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.375rem; line-height: 1.2; }

.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); max-width: 52rem; }
.post-card { max-width: none; display: grid; gap: var(--s4) var(--s6); padding: var(--s5); background: var(--notice); border-radius: var(--r3); scroll-margin-top: var(--s5); }
@media (min-width: 48rem) { .post-card { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); } }
.post-what { display: grid; gap: var(--s1); align-content: start; min-width: 0; }
.post-what a.order-title { display: flex; align-items: center; min-height: 44px; }
.post-what .ship-to { margin-top: var(--s3); font-size: 1.0625rem; justify-self: start; min-width: min(100%, 16rem); }
.post-form { margin: 0; gap: var(--s3); max-width: none; }
.post-form .btn { justify-self: stretch; }

.rules { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); align-items: start; max-width: 40rem; margin-top: var(--s6); color: var(--muted); }

/* ---------- Getting paid ---------- */
.pay-panel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); align-items: start; max-width: 40rem;
  margin-bottom: var(--s4); padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); }
.pay-panel h2 { margin: var(--s2) 0; }
.pay-panel p { margin: 0 0 var(--s4); }
.pay-panel form { margin: 0; }
.money-note { max-width: 38rem; margin-top: 0; color: var(--muted); }
.seller-kind fieldset { border: 0; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s3); max-width: 40rem; }
@media (min-width: 48rem) { .seller-kind fieldset { grid-template-columns: 1fr 1fr; } }
.kind-card { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); align-items: start; min-height: 44px; padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r2); background: var(--surface); cursor: pointer; }
.kind-card:hover { border-color: var(--muted); }
.kind-card:has(input:checked) { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal);
  background: color-mix(in srgb, var(--teal) 6%, var(--surface)); }
.kind-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.kind-card input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--teal); }
.kind-card b { display: block; }
.kind-card small { display: block; margin-top: var(--s1); color: var(--muted); font-size: .9375rem; }

@media (max-width: 600px) {
  .order-card, .post-card, .pay-panel { padding: var(--s4); }
  .order-mark { width: 40px; height: 40px; }
  .order-mark .icon { width: 22px; height: 22px; }
  .ledger dd { font-size: 1.125rem; }
  .ledger div { padding: var(--s3); }
}
