/* Commerce module additions (cart, checkout, sign-in, account center). Uses the tokens in site.css. */

/* server messages */
.flash { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; padding: 12px 14px; border-radius: var(--r-sm, 6px); font-size: 14px; line-height: 1.45; border: 1px solid transparent; }
.flash > svg.i { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.flash ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.flash-err { background: var(--error-soft); border-color: rgba(194, 52, 31, .25); color: #7d2113; }
.flash-err > svg.i { color: var(--error); }
.flash-ok { background: var(--success-soft); border-color: rgba(24, 121, 78, .25); color: #0f4f33; }
.flash-ok > svg.i { color: var(--success); }
.flash-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.flash-info > svg.i { color: var(--accent); }
.acct-main > .flash { margin-bottom: 0; }

/* honeypot */
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* not built yet: OAuth, sign-in links */
.soon { margin-left: 8px; padding: 1px 6px; border-radius: 3px; background: var(--surface-alt); color: var(--text-tertiary); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
[data-soon][aria-disabled="true"] { cursor: not-allowed; opacity: .88; }
.btn[data-soon] { flex-wrap: wrap; white-space: normal; height: auto; min-height: 48px; row-gap: 2px; min-width: 0; max-width: 100%; }
@media (max-width: 479px) { .btn[data-soon] .soon { margin-left: 4px; font-size: 10px; } }

.inline-form { display: inline; margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.acct-out-form { margin: 0; }
button.acct-out { background: none; border: 0; cursor: pointer; text-decoration: underline; font: inherit; font-size: 13px; text-align: left; }
.o-st.is-wait { color: var(--warning); }
.btn.is-disabled, .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.btn-primary[data-to-checkout][aria-disabled="true"] { pointer-events: auto; cursor: not-allowed; }
.b-muted, .stat-row b.muted-b { color: var(--text-tertiary); }
.empty-note { padding: 18px 20px; border: 1px dashed var(--border); border-radius: var(--r-md, 8px); color: var(--text-secondary); font-size: 14px; }
.form-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.addr-form, .set-form, .tax-form { display: grid; gap: 16px; }
.tax-form .file-pick { max-width: 420px; }
.on-file { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--success); margin: 6px 0 0; }
.on-file svg.i { width: 16px; height: 16px; }
.co-create { margin-top: 12px; }
.co-done h1 { margin: 0; }
.co-done p { margin: 0; max-width: 60ch; }
.co-done-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.co-confirm-meta { width: 100%; margin: 4px 0; }
.co-addr { font-style: normal; line-height: 1.6; color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }
.co-sum-body > h2 { margin: 0; }
.track-solo { margin-top: 4px; border-top: 0; padding-top: 0; }
.track-result { display: grid; gap: 14px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-soft); }

.again p a, .od-item p a { color: inherit; text-decoration: none; }
.again p a:hover, .od-item p a:hover { color: var(--accent); text-decoration: underline; }

/* printable proforma invoice */
.invoice { display: grid; gap: 20px; padding-block: 32px 48px; max-width: 960px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.inv-meta { text-align: right; }
.inv-meta h1, .inv-meta p { margin: 0 0 4px; }
.inv-sum { max-width: 360px; margin-left: auto; width: 100%; }
@media print { .no-print, .ph-tag { display: none !important; } .invoice { padding: 0; } }
@media (max-width: 599px) { .inv-meta { text-align: left; } }

/* ================= checkout, round 2 (friction cuts) ================= */
/* native selects: autofill can set them, phones open their own picker */
.select { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737A83' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; cursor: pointer; text-overflow: ellipsis; }
.select:invalid, .select option[value=""] { color: var(--text-tertiary); }
.select option { color: var(--text); }
.field.has-err .input, .field.has-err .select { border-color: var(--error); }
.field.has-err .input:focus { box-shadow: 0 0 0 3px rgba(194, 52, 31, .15); }

.co-signin .dot { margin: 0 6px; color: var(--text-tertiary); }
.co-restored { display: flex; align-items: center; gap: 8px; margin: -6px 0 0; font-size: 13px; color: var(--text-secondary); }
.co-restored svg.i { width: 16px; height: 16px; color: var(--accent); flex: none; }
.co-restored .link-btn { margin-left: auto; min-height: 36px; font-size: 13px; font-weight: 600; }

/* summary cards with "Change" (signed-in buyers) */
.co-card { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.co-card > summary { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; cursor: pointer; list-style: none; }
.co-card > summary::-webkit-details-marker { display: none; }
.co-card > summary > svg.i { width: 18px; height: 18px; flex: none; color: var(--text-secondary); }
.co-card-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.co-card-main b { font-size: 14.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.co-card-main small { font-size: 13px; line-height: 1.4; color: var(--text-tertiary); }
.co-change { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; font-size: 14px; font-weight: 600; color: var(--accent); }
.co-change::after { content: "Change"; }
.co-card[open] .co-change { color: var(--text-secondary); }
.co-card[open] .co-change::after { content: "Done"; }
.co-card[open] > summary { border-bottom: 1px solid var(--border-soft); }
.co-card-edit { padding: 16px 14px; }
.co-card:hover:not([open]) { border-color: var(--border-hover); }
.co-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* saved addresses as radio cards; the new-address form folds away while one is chosen */
.co-addrs { border: 0; margin: 0; padding: 0; min-width: 0; }
.co-addrs .seg-box { font-weight: 600; }
.co-addrs .seg-box small { line-height: 1.45; }
.co-newaddr.is-folded,
.co-addrs:has(input[name=saved_addr]:not([value=new]):checked) ~ .co-newaddr { display: none; }
.co-addrs:has(input[value=new]:checked) ~ .co-newaddr { display: block; }
.co-newaddr { padding-top: 2px; }

/* state + postcode share one row, also on phones (short values) */
.co-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; }
.co-pair > .field[hidden] { display: none; }
@media (min-width: 640px) { .co-pair { gap: 14px 16px; } }

/* PO number + notes folded */
.co-more { border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.co-more > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; color: var(--accent); }
.co-more > summary::-webkit-details-marker { display: none; }
.co-more > summary svg.i { width: 16px; height: 16px; transition: transform .15s var(--ease); }
.co-more[open] > summary svg.i { transform: rotate(45deg); }
.co-more > .co-grid { padding-bottom: 16px; }
.co-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.co-review .check { align-items: flex-start; line-height: 1.45; }
.co-review .check input { margin-top: 1px; }
.co-save { display: grid; gap: 12px; padding: 14px; border-radius: var(--r-sm); background: var(--surface-alt); }
.co-save .co-create { margin-top: 0; }
.co-place-row { display: grid; gap: 10px; }
.co-place-row .sum-fine { max-width: 62ch; }

/* order summary count; trust lines placed under the form on phones, in the side column on desktop */
.co-sum summary .co-sum-n { margin-left: 6px; font-size: 13px; font-weight: 500; color: var(--text-tertiary); }
.co-assure-m { display: none; }
@media (max-width: 1023px) {
  .co-assure-d { display: none; }
  .co-assure-m { display: grid; padding: 4px 4px 0; }
}

/* mobile sticky bar: total + Place order once the summary has scrolled away */
.co-bar { display: none; }
@media (max-width: 1023px) {
  .co-bar:not([hidden]) { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px -16px rgba(var(--ink-rgb), .3); animation: coBarIn .18s var(--ease); }
  .co-bar-sum { display: grid; font-variant-numeric: tabular-nums; }
  .co-bar-sum b { font-size: 17px; font-weight: 700; color: var(--text); }
  .co-bar-sum small { font-size: 12px; color: var(--text-tertiary); }
  .co-bar .btn { min-width: 170px; }
  body.has-co-bar .co-footer { padding-bottom: 76px; }
}
@keyframes coBarIn { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .co-bar:not([hidden]) { animation: none; } }

/* forgot / reset password */
@media (min-width: 900px) { .auth-grid.auth-narrow { grid-template-columns: minmax(0, 480px); } }
.auth-card .lead.small { margin: -8px 0 0; font-size: 14.5px; color: var(--text-secondary); }
.auth-alt { margin: 0; }
.auth-done { display: grid; gap: 14px; justify-items: start; }
.auth-done > svg.i { width: 36px; height: 36px; color: var(--success); }
.auth-done h1, .auth-done p { margin: 0; }
.auth-done .btn { margin-top: 4px; }


/* order confirmation: next steps, account from a guest order */
.co-done .flash { margin: 0; width: 100%; }
.co-next-h { margin: 6px 0 0; }
.co-next { counter-reset: nx; display: grid; gap: 0; width: 100%; margin: 0; padding: 0; list-style: none; }
.co-next li { counter-increment: nx; position: relative; display: grid; gap: 2px; padding: 0 0 16px 40px; font-size: 14px; line-height: 1.45; }
.co-next li::before { content: counter(nx); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.co-next li:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 29px; bottom: 3px; width: 1px; background: var(--accent-line); }
.co-next li:last-child { padding-bottom: 0; }
.co-next b { color: var(--text); font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.co-next span { color: var(--text-secondary); }
.co-acct { gap: 12px; }
.co-acct h2, .co-acct p { margin: 0; }
.co-acct > p { font-size: 14px; color: var(--text-secondary); max-width: 62ch; }
.co-acct-form { display: grid; gap: 12px; justify-items: start; max-width: 420px; }
.co-acct-form .field { width: 100%; }
@media (max-width: 599px) { .co-done { padding: 22px 18px; } .co-acct-form .btn, .co-done-acts .btn { width: 100%; } }
@media (max-width: 479px) { .co-card > summary > svg.i { display: none; } .co-card > summary { gap: 8px; padding: 10px 12px; } }
/* confirmation: the message first on phones, summary lines without thumbnails */
@media (max-width: 1023px) { .co-page-done .co-side { order: 0; } }
.co-lines-text li { grid-template-columns: minmax(0, 1fr) auto; padding-left: 30px; }
.co-lines-text .q { left: 0; top: 2px; }
.co-lines-text p { white-space: normal; }
.co-confirm-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 899px) { .co-confirm-meta div:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 900px) { .co-confirm-meta { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.co-page-done .co-sum-body, .co-page-pay .co-sum-body { padding-top: 18px; }

/* ---- pay page (/checkout/pay/{no}): the order is placed, this takes the money ---- */
.co-page-pay .co-form { display: grid; gap: 16px; align-content: start; }
.pay-held { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-alt); color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.pay-held svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--text-tertiary); }
.pay-held b { color: var(--text); font-weight: 600; }
/* Google Pay / Apple Pay above the tabs (pay.js shows them where they work) */
.pay-express { display: grid; gap: 8px; margin-bottom: 4px; }
.pay-express[hidden], .pay-express-btn[hidden] { display: none; }
.pay-express-btn { height: 48px; }
.pay-express-btn > div, .pay-express-btn button { width: 100%; height: 48px; }
.pay-express-btn apple-pay-button { display: block; --apple-pay-button-width: 100%; --apple-pay-button-height: 48px; --apple-pay-button-border-radius: 8px; }
.pay-or { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; color: var(--text-tertiary); font-size: 13px; }
.pay-or::before, .pay-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pay-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-tabs form { display: contents; }
.pay-tab { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; min-height: 56px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: 600 15px/1.2 var(--font-body); cursor: pointer; }
.pay-tab svg { width: 18px; height: 18px; }
.pay-tab small { flex-basis: 100%; text-align: center; font-weight: 500; font-size: 12.5px; color: var(--text-tertiary); }
.pay-tab:hover { border-color: var(--border-hover); }
.pay-tab.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.pay-tab.is-on small { color: var(--accent); }
.pay-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pay-panel { display: grid; gap: 12px; }
.pay-panel.is-busy { opacity: .5; pointer-events: none; }
.pay-panel .hint { margin: 0; }
.pay-buttons { min-height: 45px; }
.pay-buttons[hidden] { display: none; }
.pay-card { display: grid; gap: 4px; }
.pay-card .field { margin: 0; }
.pay-card label { display: block; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; }
.pay-hosted { min-height: 50px; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-go { width: 100%; justify-content: center; margin-top: 4px; }
.btn-paypal { background: #FFC439; border-color: #FFC439; color: #111; font-weight: 700; }
.btn-paypal:hover { background: #F2BA36; border-color: #F2BA36; }
.co-page-pay .sum-fine { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.co-page-pay .sum-fine svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--text-tertiary); }
.pay-wait { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; text-align: center;
  background: rgba(255, 255, 255, .92); }
.pay-wait[hidden] { display: none; }
.pay-wait b { font-size: 17px; }
.pay-wait span:last-child { color: var(--text-secondary); font-size: 14px; }
.spinner { width: 32px; height: 32px; margin-bottom: 8px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: pay-spin .8s linear infinite; }
@keyframes pay-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
/* on phones the pay buttons come first: the total is on the tabs and in the button */
@media (max-width: 1023px) { .co-page-pay .co-side { order: 2; } }
.pay-buttons:empty { display: none; }
.pay-panel .hint { font-size: 13.5px; color: var(--text-secondary); }


/* ================= sign-in (owner 2026-11-12: email -> password or emailed code) ================= */
.signin { gap: 20px; }
.auth-head { display: grid; gap: 8px; }
.auth-head h1 { margin: 0; }
.auth-head .lead.small { margin: 0; max-width: 46ch; }
.auth-email { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.auth-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; padding: 10px 14px; border: 1px solid var(--border-soft, var(--border)); border-radius: 8px; background: var(--surface-alt); font-size: 15px; }
.auth-who .link { margin-left: auto; font-size: 14px; font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.input-lg { min-height: 52px; font-size: 16px; padding: 12px 14px; }
.input-code { min-height: 64px; padding: 10px 12px 10px calc(12px + .5em); font: 600 28px/1 var(--font-mono); letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.input-code::placeholder { letter-spacing: .5em; }
.signin .field .hint { margin-top: 6px; }
.auth-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }
.auth-note > svg.i { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--text-tertiary); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; font-size: 14px; }
.auth-links .link, .auth-links .link-btn { min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.auth-links .link-btn { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.auth-track { gap: 12px; padding: 20px 24px; }
.auth-track h2 { margin: 0; }
.signin .or { margin: 0; }
.signin form.auth-form + .or { margin-top: -2px; }
@media (min-width: 900px) { .auth-grid.auth-narrow { margin-top: 32px; } }
@media (max-width: 599px) {
  .auth-card.signin, .auth-track { padding: 20px 16px; }
  .input-code { font-size: 26px; letter-spacing: .42em; }
}
/* /wholesale-account: the sign-in card in place of the old three-step form */
.apply-card { align-self: start; }
@media (min-width: 900px) { .apply-grid.apply-signin { grid-template-columns: minmax(0, 580px) 360px; justify-content: start; } }

/* account: optional password card, business details on the settings page */
.pw-card { display: grid; gap: 14px; border-color: var(--accent-line); }
.pw-card-head { display: grid; gap: 4px; }
.pw-card-head h2, .pw-card-head p { margin: 0; }
.pw-card-head .muted { font-weight: 400; font-size: .85em; }
.pw-card-form { display: grid; gap: 12px; max-width: 440px; }
.pw-card-form .field { margin: 0; }
.set-biz { border: 0; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--border-soft, var(--border)); display: grid; gap: 12px; min-width: 0; }
.set-biz legend { float: left; width: 100%; padding: 0; margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.set-biz legend .muted { font-weight: 400; }
.set-biz > p { margin: 0; }
