/* Card shop: storefront styles. Colours live in :root so you can re-brand in one place. */
:root {
  --ink: #14202b;
  --muted: #5b6977;
  --paper: #f3f5f7;
  --surface: #ffffff;
  --line: #d9dfe5;
  --line-strong: #b9c3cc;
  --mat: #173b4b;        /* header band, like a playmat */
  --mat-ink: #eaf2f5;
  --mat-soft: #24566b;
  --gold: #f0b429;       /* primary actions */
  --gold-strong: #c98a0b;
  --gold-ink: #241800;
  --ok: #1d7445;
  --ok-bg: #e5f3ea;
  --bad: #b3261e;
  --bad-bg: #fbeaea;
  --warn-bg: #fff3d6;
  --ok-ink: #13502f;
  --bad-ink: #7d1913;
  --warn-ink: #5e4300;
  --low: #9a5b00;          /* "only a few left", warnings in text */
  --link: #24566b;
  --link-hover: #173b4b;
  --on-dark: #ffffff;      /* text on the header band and dark buttons */
  --field-bg: #ffffff;
  --soft: #edf1f4;         /* quiet buttons and badges */
  --chip-bg: #e6ebef;
  --chip-ink: #2c3b47;
  --hover: #e7ecf0;
  --hover-soft: #f5f7f9;
  --img-bg: #e4e9ee;       /* behind card pictures */
  --selected-bg: #f2f7f9;
  --info-bg: #e3ecff;
  --info-ink: #1d3f8f;
  --teal-bg: #dff2f4;
  --teal-ink: #0d5a63;
  --ok-line: #b6dcc4;
  --bad-line: #efc2bf;
  --disabled: #8aa1ac;
  --toast-bg: #14202b;
  --toast-ink: #ffffff;
  --toast-link: #f0b429;
  color-scheme: light;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1200px;
}

/* Dark mode: follows the device unless the visitor picks light or dark with the header button. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e4ebf0;
    --muted: #97a8b5;
    --paper: #0e161c;
    --surface: #16212a;
    --line: #26343f;
    --line-strong: #3a4c5a;
    --mat: #1b4557;
    --mat-ink: #eaf2f5;
    --mat-soft: #2b6680;
    --ok: #5fcf8f;
    --ok-bg: #12301f;
    --bad: #ff8a80;
    --bad-bg: #3b1715;
    --warn-bg: #352a0c;
    --ok-ink: #a6e9c0;
    --bad-ink: #ffc0ba;
    --warn-ink: #f5d98f;
    --low: #f2b45a;
    --link: #7cc3dc;
    --link-hover: #a9dcee;
    --field-bg: #0f1820;
    --soft: #22303b;
    --chip-bg: #24323d;
    --chip-ink: #d3dde5;
    --hover: #22303b;
    --hover-soft: #1c2832;
    --img-bg: #1b2731;
    --selected-bg: #173040;
    --info-bg: #1a2a4f;
    --info-ink: #b8ccff;
    --teal-bg: #0f3337;
    --teal-ink: #9fe1e9;
    --ok-line: #2c5a3f;
    --bad-line: #6a2c28;
    --disabled: #3c5260;
    --toast-bg: #e4ebf0;
    --toast-ink: #0e161c;
    --toast-link: #8a5a00;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e4ebf0;
  --muted: #97a8b5;
  --paper: #0e161c;
  --surface: #16212a;
  --line: #26343f;
  --line-strong: #3a4c5a;
  --mat: #1b4557;
  --mat-ink: #eaf2f5;
  --mat-soft: #2b6680;
  --ok: #5fcf8f;
  --ok-bg: #12301f;
  --bad: #ff8a80;
  --bad-bg: #3b1715;
  --warn-bg: #352a0c;
  --ok-ink: #a6e9c0;
  --bad-ink: #ffc0ba;
  --warn-ink: #f5d98f;
  --low: #f2b45a;
  --link: #7cc3dc;
  --link-hover: #a9dcee;
  --field-bg: #0f1820;
  --soft: #22303b;
  --chip-bg: #24323d;
  --chip-ink: #d3dde5;
  --hover: #22303b;
  --hover-soft: #1c2832;
  --img-bg: #1b2731;
  --selected-bg: #173040;
  --info-bg: #1a2a4f;
  --info-ink: #b8ccff;
  --teal-bg: #0f3337;
  --teal-ink: #9fe1e9;
  --ok-line: #2c5a3f;
  --bad-line: #6a2c28;
  --disabled: #3c5260;
  --toast-bg: #e4ebf0;
  --toast-ink: #0e161c;
  --toast-link: #8a5a00;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { min-width: 0; max-width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--gold-ink); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 1.25rem 16px 3rem; }
.narrow-wrap { max-width: 480px; }

/* ---------- header ---------- */
.topbar { background: var(--mat); color: var(--mat-ink); }
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 10px 16px;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand cart" "search search"; gap: 8px 12px; align-items: center;
}
.brand { grid-area: brand; color: var(--on-dark); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand:hover { color: var(--on-dark); }
.search { grid-area: search; display: flex; gap: 6px; }
.search input {
  flex: 1; min-width: 0; padding: .55rem .75rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--field-bg); color: var(--ink); font-size: 16px;
}
.search button {
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--mat-soft); background: var(--mat-soft);
  color: var(--on-dark); font-weight: 600; cursor: pointer;
}
.top-actions { grid-area: cart; display: flex; align-items: center; gap: 8px; }
.cart-link { color: var(--on-dark); text-decoration: none; font-weight: 650; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: .35rem .75rem; border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
}
.cart-link:hover { color: var(--on-dark); border-color: var(--on-dark); }
.cart-count {
  background: var(--gold); color: var(--gold-ink); border-radius: 999px; min-width: 1.5em; padding: 0 .4em;
  font-size: .8rem; font-weight: 800; text-align: center; line-height: 1.5;
}
@media (min-width: 760px) {
  .topbar { position: sticky; top: 0; z-index: 5; }
  .topbar-inner { grid-template-columns: auto 1fr auto; grid-template-areas: "brand search cart"; gap: 20px; padding: 12px 16px; }
  .search { max-width: 560px; }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.footer-inner { max-width: var(--wrap); margin: 0 auto; padding: 1.25rem 16px 2rem; display: flex; flex-wrap: wrap; gap: .75rem 2rem; justify-content: space-between; }
.footer-name { font-weight: 750; margin: 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 44px;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--gold); border-color: var(--gold-strong); color: var(--gold-ink); }
.btn.primary:hover { background: #f5c044; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 36px; padding: .4rem .75rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }

.field { display: block; }
.field > span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); }
.field > small { display: block; margin-top: .3rem; font-size: .82rem; line-height: 1.35; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field-bg); font-size: 16px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--mat-soft); outline: 2px solid rgba(36,86,107,.25); outline-offset: 0; }
.field.file input { font-size: .9rem; max-width: 100%; padding: .5rem 0; }
.field.narrow { max-width: 12rem; }
.check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--mat); }
.stack > * + * { margin-top: 1rem; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: .6rem .8rem; font-weight: 600; margin: 0; }
.notice { border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
.notice p:last-child { margin: 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- badges ---------- */
.rarity {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .02em; line-height: 1.5;
  padding: 0 .4rem; border-radius: 4px; background: var(--chip-bg); color: var(--chip-ink);
}
/* Foil rarities get a holo sheen — the one flourish on the page. */
.rarity.foil {
  background: linear-gradient(110deg, #ffd3e6 0%, #fff0b8 22%, #c9f2e2 45%, #cfe0ff 68%, #ead1ff 90%);
  color: #2a1d40; box-shadow: inset 0 0 0 1px rgba(70, 50, 120, .22);
}
.cond {
  display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1.5; padding: 0 .35rem;
  border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted);
}

/* ---------- shop layout ---------- */
.shop-layout { max-width: var(--wrap); margin: 0 auto; padding: 1rem 16px 3rem; display: grid; gap: 1.5rem; }
.sidebar { display: none; }
@media (min-width: 960px) {
  .shop-layout { grid-template-columns: 230px 1fr; padding-top: 1.5rem; }
  .sidebar { display: block; position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }
  .set-select { display: none; }
}
.side-title { font-size: .95rem; color: var(--muted); font-weight: 650; margin-bottom: .5rem; }
.setlist { list-style: none; margin: 0; padding: 0; }
.setlist a {
  display: grid; grid-template-columns: 1fr auto; column-gap: .5rem; padding: .45rem .6rem; border-radius: 8px;
  text-decoration: none; color: var(--ink);
}
.setlist a:hover { background: var(--hover); }
.setlist a.current { background: var(--mat); color: var(--on-dark); }
.set-code { font-weight: 700; font-size: .92rem; }
.set-name { grid-column: 1; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setlist a.current .set-name { color: #c9dbe2; }
.set-n { grid-column: 2; grid-row: 1; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.setlist a.current .set-n { color: #c9dbe2; }

.results-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .25rem 1rem; margin-bottom: .75rem; }
.results-head h1 { margin: 0; }
.set-badge { margin: 0 0 .2rem; font-weight: 700; color: var(--link); font-size: .9rem; }
.result-count { margin: 0; color: var(--muted); font-size: .92rem; }

/* filters */
.filters { margin-bottom: 1rem; }
.filters-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filters-panel > summary {
  list-style: none; cursor: pointer; padding: .7rem 1rem; font-weight: 650; display: flex; align-items: center; gap: .5rem;
}
.filters-panel > summary::-webkit-details-marker { display: none; }
.filters-panel > summary::after { content: "+"; margin-left: auto; font-size: 1.2rem; line-height: 1; color: var(--muted); }
.filters-panel[open] > summary::after { content: "−"; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--gold-strong); display: inline-block; }
.filters-body { padding: .25rem 1rem 1rem; display: grid; gap: 1rem; }
.filter-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.chips { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips legend { font-weight: 600; font-size: .92rem; margin-bottom: .35rem; padding: 0; width: 100%; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block; min-width: 2.75rem; text-align: center; padding: .35rem .6rem; border-radius: 999px;
  border: 1px solid var(--line-strong); font-weight: 700; font-size: .85rem; background: var(--field-bg);
}
.chip input:checked + span { background: var(--mat); border-color: var(--mat); color: var(--on-dark); }
.chip input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.filter-actions { display: flex; align-items: center; gap: 1rem; }
@media (min-width: 960px) {
  /* One compact band on wide screens so cards stay above the fold. */
  .filters-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .9rem 1.75rem; padding-top: 0; }
  .filter-row { display: flex; gap: 1rem; }
  .filter-row .field select { width: auto; min-width: 11rem; padding: .45rem .6rem; }
  .filters-body .check { padding-bottom: .5rem; }
  .chips legend { margin-bottom: .25rem; }
  .chip span { padding: .25rem .55rem; }
}

/* grid of cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.tile-img { display: block; background: var(--img-bg); padding: 10px; }
.tile-img img, .tile-img .ph { aspect-ratio: 63 / 88; width: 100%; object-fit: contain; border-radius: 6px; }
.tile-body { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.tile-name { font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-name:hover { text-decoration: underline; }
.tile-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .78rem; }
.num { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .1rem; }
.tile-price { margin: auto 0 0; display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.tile-price strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.tile-price span { font-size: .78rem; color: var(--muted); }
.tile-price .low, .detail-stock.low { color: var(--low); font-weight: 650; }
.tile.is-sold .tile-img { opacity: .45; }
.tile.is-sold .tile-price span { color: var(--bad); font-weight: 650; }

.btn-add {
  width: 100%; min-height: 40px; border-radius: 8px; border: 1px solid var(--gold-strong); background: var(--gold);
  color: var(--gold-ink); font-weight: 750; cursor: pointer;
}
.btn-add:hover { background: #f5c044; }
.stepper { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; border: 1px solid var(--mat); border-radius: 8px; overflow: hidden; min-height: 40px; }
.stepper button { border: 0; background: var(--mat); color: var(--on-dark); font-size: 1.2rem; font-weight: 700; height: 100%; cursor: pointer; }
.stepper button[disabled] { background: var(--disabled); cursor: not-allowed; }
.stepper output { text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; font-size: .95rem; }
.stepper output small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); line-height: 1; }

/* card placeholder when there is no photo */
.ph {
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(135deg, #1d4658 0 10px, #1a4051 10px 20px);
  border: 4px solid #0f2c38; overflow: hidden;
}
.ph::after { content: ""; width: 26%; aspect-ratio: 1; border: 2px solid rgba(220, 235, 241, .3); transform: rotate(45deg); }

.more { text-align: center; margin-top: 1.5rem; }
.more-note { color: var(--muted); font-size: .85rem; margin-top: .5rem; }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; }

/* ---------- card detail ---------- */
.crumbs { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .9rem; margin-bottom: 1rem; color: var(--muted); }
.detail { display: grid; gap: 1.5rem; }
@media (min-width: 760px) { .detail { grid-template-columns: minmax(260px, 400px) 1fr; gap: 2.5rem; align-items: start; } }
.detail-img { background: var(--img-bg); border-radius: var(--radius); padding: 18px; }
.detail-img img, .detail-img .ph { aspect-ratio: 63 / 88; width: 100%; object-fit: contain; border-radius: 12px; }
.detail-num { color: var(--muted); font-weight: 650; margin: 0 0 .25rem; font-variant-numeric: tabular-nums; }
.detail-info h1 { font-size: 1.9rem; }
.facts { margin: 1rem 0; display: grid; gap: .5rem; }
.facts div { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.cond-note { display: block; font-size: .88rem; }
.detail-price { font-size: 2rem; font-weight: 800; margin: 1rem 0 0; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.detail-stock { color: var(--muted); }
.buy { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .5rem; }
.qty { display: grid; grid-template-columns: 44px 64px 44px; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; height: 44px; }
.qty button { border: 0; background: var(--soft); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.qty input { border: 0; background: var(--field-bg); text-align: center; font-weight: 700; font-size: 16px; width: 100%; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button, .qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.incart { width: 100%; margin: 0; color: var(--ok); font-weight: 600; min-height: 1.5em; }
.incart a { color: var(--ok); }
.soldout-note { color: var(--bad); font-weight: 600; }
.others { margin-top: 2rem; }
.others ul { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.others li + li { border-top: 1px solid var(--line); }
.others a { display: grid; grid-template-columns: 3rem 1fr auto; justify-items: start; gap: .75rem; align-items: center; padding: .7rem 1rem; text-decoration: none; color: var(--ink); }
.others a:hover { background: var(--hover-soft); }
.others a > :last-child { justify-self: end; }
.versions a { grid-template-columns: 40px 1fr auto; padding: .55rem 1rem; }
.v-img img, .v-img .ph { display: block; width: 40px; aspect-ratio: 63 / 88; object-fit: contain; border-radius: 3px; padding: 0; border-width: 2px; }
.v-img .ph::after { display: none; }
.v-what { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.v-what .num { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-price { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; }
.v-price .muted { font-weight: 400; font-size: .8rem; }

/* ---------- cart ---------- */
.cart-layout { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .cart-layout { grid-template-columns: 1fr 400px; align-items: start; } .checkout { position: sticky; top: 84px; } }
.cart-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cart-line { display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "img info total" "img qty remove"; gap: .4rem .8rem; padding: .85rem; align-items: center; }
.cart-line + .cart-line { border-top: 1px solid var(--line); }
.cl-img { grid-area: img; align-self: start; }
.cl-img img, .cl-img .ph { width: 56px; aspect-ratio: 63 / 88; object-fit: contain; border-radius: 4px; padding: 0; border-width: 2px; }
.cl-img .ph::after { display: none; }
.cl-info { grid-area: info; min-width: 0; }
.cl-name { font-weight: 700; color: var(--ink); text-decoration: none; display: block; }
.cl-meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.cl-qty { grid-area: qty; width: 150px; }
.cl-total { grid-area: total; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.cl-remove { grid-area: remove; justify-self: end; padding: .6rem 0 .6rem .75rem; }
.cl-warn { grid-column: 2 / -1; margin: 0; font-size: .85rem; color: var(--low); font-weight: 600; }
.cart-empty { text-align: center; }

.checkout { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.checkout h2 { margin: 0; }
.delivery { border: 0; margin: 0; padding: 0; display: grid; gap: .5rem; }
.delivery legend { font-weight: 600; font-size: .92rem; margin-bottom: .4rem; padding: 0; }
.option { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; padding: .7rem .8rem; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.option:has(input:checked) { border-color: var(--mat); box-shadow: inset 0 0 0 1px var(--mat); background: var(--selected-bg); }
.option input { margin: .2rem 0 0; width: 1.1rem; height: 1.1rem; accent-color: var(--mat); }
.option-main { display: flex; justify-content: space-between; gap: .5rem; font-weight: 650; }
.option-fee { font-variant-numeric: tabular-nums; }
.option-note { grid-column: 2; font-size: .85rem; color: var(--muted); }
.address { display: grid; gap: 1rem; }
.totals { margin: 0; border-top: 1px solid var(--line); padding-top: .75rem; display: grid; gap: .3rem; }
.totals div { display: flex; justify-content: space-between; }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 1.2rem; font-weight: 800; margin-top: .25rem; }
.fine { font-size: .85rem; color: var(--muted); margin: 0; }

/* ---------- order / payment ---------- */
.order-head { margin-bottom: 1.25rem; }
.order-head .muted { margin: 0; }
.ref-big, .ref { font-family: var(--mono); letter-spacing: .04em; }
.ref-big { font-size: 1.8rem; margin: 0 0 .5rem; }
.status-pill { display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-weight: 700; font-size: .85rem; margin: 0; background: var(--chip-bg); }
.s-awaiting_payment { background: var(--warn-bg); color: var(--warn-ink); }
.s-payment_submitted { background: var(--info-bg); color: var(--info-ink); }
.s-paid { background: var(--ok-bg); color: var(--ok); }
.s-fulfilled { background: var(--teal-bg); color: var(--teal-ink); }
.s-completed { background: var(--chip-bg); color: var(--chip-ink); }
.s-cancelled { background: var(--bad-bg); color: var(--bad); }
.order-layout { display: grid; gap: 1.5rem; }
.order-layout > * { min-width: 0; }
@media (min-width: 900px) { .order-layout { grid-template-columns: 1fr 380px; align-items: start; } }
.order-side { display: grid; gap: 1rem; }
.order-side section, .pay, .state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.state.ok { border-color: var(--ok-line); }
.state.bad { border-color: var(--bad-line); }
.pay-amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-bottom: .25rem; }
.pay-amount .muted { font-size: 1.1rem; font-weight: 600; letter-spacing: 0; }
.pay-by { color: var(--muted); }
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: .75rem; margin: 1rem 0; }
.qr { margin: 0; background: #fff; color: #14202b; border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 10px; text-align: center; } /* always white, so banking apps can scan it */
.qr img { width: 240px; height: 240px; image-rendering: pixelated; }
.qr figcaption { font-weight: 650; font-size: .9rem; margin-top: .25rem; }
.steps { padding-left: 1.3rem; display: grid; gap: .5rem; margin: 0 0 1rem; }
.manual { border-top: 1px solid var(--line); padding-top: .75rem; margin-bottom: 1rem; }
.manual summary { cursor: pointer; font-weight: 650; color: var(--link); padding: .55rem 0; }
.copylist { display: grid; gap: .5rem; margin: .75rem 0 0; }
.copylist div { display: grid; grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); gap: .5rem; align-items: center; }
@media (max-width: 420px) { .copylist div { grid-template-columns: minmax(0, 1fr); gap: .15rem; } }
.copylist dt { color: var(--muted); font-size: .9rem; }
.copylist dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-weight: 700; min-width: 0; }
.copylist dd > span { min-width: 0; overflow-wrap: anywhere; }
.copy { border: 1px solid var(--line-strong); background: var(--field-bg); border-radius: 6px; padding: .2rem .75rem; min-height: 36px; font-size: .85rem; font-weight: 650; cursor: pointer; flex: none; }
.paid-form { border-top: 1px solid var(--line); padding-top: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; }
.paid-form h3 { margin: 0; }
.paid-form.compact { border: 0; padding: 0; }
.items { width: 100%; border-collapse: collapse; font-size: .92rem; }
.items th, .items td { text-align: left; padding: .45rem 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.items thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.items .n { text-align: right; padding-left: .75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items tfoot th, .items tfoot td { border-bottom: 0; padding: .25rem 0; font-weight: 500; }
.items tfoot .grand th, .items tfoot .grand td { font-weight: 800; font-size: 1.05rem; padding-top: .5rem; }
.it-name { display: block; font-weight: 650; }
.it-meta { display: block; font-size: .8rem; color: var(--muted); }
.addr { white-space: pre-line; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.timeline li { display: grid; padding-left: 1rem; border-left: 2px solid var(--line-strong); }
.timeline time { font-size: .8rem; color: var(--muted); }

/* ---------- info pages ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 2rem; }
.cond-list { display: grid; gap: .75rem; }
.cond-list dt { font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.cond-list dd { margin: .15rem 0 0; color: var(--muted); }
.plain { padding-left: 1.2rem; display: grid; gap: .4rem; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: 20px; margin: 0 auto; width: fit-content; max-width: 520px;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  background: var(--toast-bg); color: var(--toast-ink); padding: .7rem 1rem; border-radius: 10px; font-weight: 600;
  transition: opacity .2s, transform .2s; z-index: 20; display: flex; gap: 1rem; align-items: center;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast a { color: var(--toast-link); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.footer-legal { margin: .25rem 0 0; font-size: .8rem; color: var(--muted); }

/* ---------- light / dark switch ---------- */
.theme-toggle {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; background: transparent; color: var(--on-dark); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--on-dark); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* ---------- account link in the header ---------- */
.acct-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 .55rem;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; color: var(--on-dark); text-decoration: none; font-weight: 650;
}
.acct-link:hover { color: var(--on-dark); border-color: var(--on-dark); }
.acct-link svg { width: 18px; height: 18px; flex: none; }
.acct-text { display: none; }
@media (min-width: 700px) { .acct-text { display: inline; } .acct-link { padding: 0 .8rem 0 .65rem; } }

/* ---------- customer accounts ---------- */
.account-auth h1 { margin-bottom: .25rem; }
.account-auth > .muted { margin-bottom: 1.25rem; }
.account-switch { margin: 1.75rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.account-switch p { margin: 0 0 .5rem; font-weight: 650; }
.account-help { margin-top: .75rem; }
.field > .pw-wrap { display: flex; gap: 6px; font-weight: 400; font-size: inherit; margin: 0; }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-show { flex: none; min-width: 64px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-weight: 650; font-size: .9rem; cursor: pointer; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--bad); }
.back { margin: 0 0 .5rem; font-size: .92rem; }
.back a::before { content: "‹ "; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.account-head h1 { margin: 0; }
.account-head p { margin: .15rem 0 0; }
.account-layout { display: grid; gap: 1.5rem; }
.account-layout > * { min-width: 0; }
@media (min-width: 900px) { .account-layout { grid-template-columns: 1fr 340px; align-items: start; } }
.account-orders { margin-bottom: 1.5rem; }
.ao-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ao-list li + li { border-top: 1px solid var(--line); }
.ao-row {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "ref status" "date total"; gap: .2rem .75rem; align-items: center;
  padding: .8rem 1rem; color: var(--ink); text-decoration: none;
}
.ao-row:hover { background: var(--hover-soft); }
.ao-ref { grid-area: ref; font-weight: 700; }
.ao-date { grid-area: date; font-size: .85rem; color: var(--muted); }
.ao-status { grid-area: status; justify-self: end; }
.ao-status .status-pill { font-size: .78rem; padding: .15rem .6rem; }
.ao-total { grid-area: total; justify-self: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.ao-total .muted { font-weight: 400; font-size: .85rem; }
@media (min-width: 640px) {
  .ao-row { grid-template-columns: 9rem 1fr auto auto; grid-template-areas: "ref date status total"; gap: 1rem; }
}
.account-side section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.kv { margin: 0 0 1rem; display: grid; gap: .6rem; }
.kv div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .5rem; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.account-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.danger-zone { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 650; padding: .4rem 0; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.acct-note { margin: .75rem 0 0; font-size: .92rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.checkout-who { margin: -.25rem 0 0; font-size: .9rem; color: var(--muted); }

/* ---------- main tabs under the header ---------- */
.mainnav { background: var(--mat); border-top: 1px solid rgba(255,255,255,.12); }
.mainnav-inner { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; display: flex; gap: .25rem; }
.mainnav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .85rem; color: var(--mat-ink); opacity: .82;
  text-decoration: none; font-weight: 650; font-size: .95rem; border-bottom: 3px solid transparent;
}
.mainnav a:first-child { margin-left: -.85rem; }
.mainnav a:hover { color: var(--on-dark); opacity: 1; }
.mainnav a.current { color: var(--on-dark); opacity: 1; border-bottom-color: var(--gold); }

/* ---------- contact page ---------- */
.contact-wrap { max-width: 860px; }
.contact-cards { display: grid; gap: 1rem; margin: 1.25rem 0; }
@media (min-width: 700px) { .contact-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.contact-card h2 { font-size: .95rem; color: var(--muted); font-weight: 650; margin-bottom: .35rem; }
.contact-value { font-size: 1.2rem; font-weight: 700; margin: 0 0 .75rem; overflow-wrap: anywhere; }
.contact-value a { color: var(--ink); text-decoration: none; }
.contact-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.contact-more { margin-top: .5rem; }
.track-more { margin-top: 1rem; }
