/* Layout only. Colors, fonts and radius come from theme.css; change them there. */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body.no-scroll { overflow: hidden; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.small { font-size: 13px; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.big { font-size: 20px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.center { display: flex; justify-content: center; margin-top: 12px; }
.loading { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty { padding: 32px 16px 8px; text-align: center; color: var(--muted); display: grid; gap: 6px; }
.empty h3 { color: var(--text); }

/* ---------- layout ---------- */

.shell { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.page-narrow { max-width: 760px; }
.admin main.page { display: block; }
.stack { display: grid; gap: 12px; align-content: start; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.col { flex-direction: column; align-items: stretch !important; }
.grow { flex: 1; min-width: 0; }
.split { display: grid; gap: 24px; margin-top: 12px; }
.sticky { align-self: start; }
@media (min-width: 860px) {
  .split { grid-template-columns: 300px 1fr; }
  .admin .split { grid-template-columns: 1fr 280px; }
  .split-even { grid-template-columns: 1fr 1fr; }
  .sticky { position: sticky; top: 76px; }
}
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stack > .page-head { margin-bottom: 0; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.hero { display: grid; gap: 8px; padding: 12px 0; max-width: 640px; }

.top {
  position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 16px;
}
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.logo img { width: 28px; height: 28px; object-fit: contain; }
.nav { display: flex; gap: 4px; overflow-x: auto; order: 3; width: 100%; }
.nav a { padding: 6px 10px; border-radius: var(--radius); text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a.is-on { color: var(--text); background: var(--surface); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance-pill { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; }
@media (min-width: 760px) { .nav { order: 0; width: auto; } }
.foot { border-top: 1px solid var(--border); padding: 20px 16px; display: grid; gap: 6px; }
.foot p { max-width: 900px; margin: 0 auto; width: 100%; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); cursor: pointer;
  text-decoration: none; font-weight: 600; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); cursor: pointer; }
input:not([type=checkbox]), select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
}
input:disabled, select:disabled { background: var(--surface); color: var(--muted); }
.row > input, .row > select { width: auto; }
.row > input.grow { flex: 1; }
input.cell { min-width: 70px; padding: 5px 8px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 13px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; }
.is-locked { opacity: .45; pointer-events: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input { flex: 1 1 220px; width: auto; }
.filters select { width: auto; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); cursor: pointer; font-size: 13px; }
.tab.is-on { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }

/* ---------- content blocks ---------- */

.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.cards { display: grid; gap: 12px; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
.grid { display: grid; gap: 14px; }
.grid-packs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-slabs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid-small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.pack-card { display: grid; gap: 8px; align-content: start; }
.pack-card-art { display: block; }
.pack-box {
  aspect-ratio: 5 / 7; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface);
  display: grid; place-content: center; text-align: center; gap: 4px; padding: 12px;
}
.pack-img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; }
.pack-detail-art { width: min(220px, 70%); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; }
.list { display: grid; gap: 6px; padding: 0; list-style: none; }
.list > li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.list > li.col { display: grid; gap: 8px; }
.thumb { width: 44px; flex: none; }
.rank { width: 20px; text-align: center; color: var(--muted); font-weight: 700; }
.steps { padding-left: 20px; display: grid; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.stats > div { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { font-size: 18px; font-weight: 700; }
.rows { display: grid; gap: 4px; }
.rows > div { display: flex; justify-content: space-between; gap: 10px; }
.rows dt { color: var(--muted); }
.rows dd { font-weight: 600; }
.kv { display: grid; gap: 8px; }
.kv dt { font-size: 12px; color: var(--muted); }
.notice { padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius); background: var(--surface); }
.note { font-size: 13px; color: var(--muted); }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar-initial { display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--border); font-weight: 700; }
.user-link { color: inherit; }
.caption { display: grid; gap: 1px; min-width: 0; font-size: 14px; }
.slab-card { display: grid; gap: 6px; align-content: start; min-width: 0; text-decoration: none; color: inherit; }
.stack > .tier { justify-self: start; }
.tier { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--tier); color: var(--tier); font-size: 12px; font-weight: 600; }
.tier-common { --tier: var(--t-common); } .tier-uncommon { --tier: var(--t-uncommon); } .tier-rare { --tier: var(--t-rare); }
.tier-epic { --tier: var(--t-epic); } .tier-legendary { --tier: var(--t-legendary); }
.login { max-width: 380px; margin: 40px auto; }
.login-logo { width: 48px; height: 48px; }
.preview-slab { width: min(260px, 100%); }
.google-slot { min-height: 44px; display: grid; place-items: center; }

/* Leftovers from account pages, kept plain */
.eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.bar { height: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); }
.ladder, .streak { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0; list-style: none; font-size: 12px; }
.streak { grid-template-columns: repeat(7, 1fr); }
.ladder li, .streak span { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 6px; display: grid; text-align: center; }
.ladder .is-on, .streak .is-on { border-color: var(--brand); font-weight: 700; }
.code-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: var(--radius); }
.code-row code { font-size: 18px; letter-spacing: .15em; }
.balance { font-size: 32px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); cursor: pointer; }
.chip-btn.is-on { border-color: var(--brand); font-weight: 700; }
.chip { font-size: 12px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; }
.caption-by { font-size: 12px; }
.caption-price { font-weight: 700; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form .grow, .inline-form input { flex: 1; min-width: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ledger-amt { text-align: right; display: grid; flex: none; }
.list.ledger > li > div:first-child { flex: 1; min-width: 0; display: grid; }
.link-list { display: grid; }
.link-list a, .link-list button { padding: 10px 0; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.link-list > :first-child { border-top: 0; }
.dock { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 46; width: min(520px, calc(100% - 24px));
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  background: var(--bg); border: 1px solid var(--text); border-radius: var(--radius); }
.slab-card.is-picked .slab { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- overlays ---------- */

.backdrop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.modal { width: 100%; max-width: 500px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: var(--radius); padding: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.confirm { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: 6px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--good); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.toast-bad { border-left-color: var(--bad); }

.rip { position: fixed; inset: 0; z-index: 200; overflow-y: auto; background: var(--bg); display: grid; place-items: center; padding: 56px 16px 24px; }
.rip-close { position: fixed; top: 12px; right: 12px; }
.rip-center { display: grid; justify-items: center; gap: 16px; }
.rip-pack { width: 200px; }
.rip-result { display: grid; gap: 20px; justify-items: center; max-width: 820px; width: 100%; }
.rip-slab { width: min(260px, 70vw); }
@media (min-width: 760px) { .rip-result { grid-template-columns: 280px 1fr; align-items: center; justify-items: start; } .rip-slab { width: 280px; } }

/* ---------- slabs ---------- */
/* Sizes inside a slab use cqw (1% of the slab's width), so one design works from
   44px thumbnails to the full-size reveal. Label colors match each grading
   company's real labels on purpose, so they are not theme tokens. */

.slab { container-type: inline-size; width: 100%; border-radius: 4cqw; }
.slab[role=button] { cursor: pointer; }
.tier-ring { outline: 2px solid var(--tier); outline-offset: 2px; }
.slab-case {
  padding: 3.5cqw; border-radius: 4cqw; border: 1px solid #c4c9d0;
  background: linear-gradient(160deg, #f4f6f8, #dfe3e8 55%, #eef1f4);
  box-shadow: inset 0 0 0 1.2cqw rgba(255, 255, 255, .55), 0 2px 6px rgba(0, 0, 0, .15);
}
.slab-window { margin-top: 3cqw; aspect-ratio: 63 / 88; border-radius: 2.5cqw; overflow: hidden; background: #0e1014; }
.slab-window img { width: 100%; height: 100%; object-fit: cover; }
.slab-fallback { height: 100%; display: grid; place-items: center; padding: 6cqw; text-align: center; color: #bbb; font-size: 6cqw; }
.slab-scan img { width: 100%; height: auto; border-radius: 3cqw; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.barcode { display: block; fill: #111; }

.lbl { color: #111; font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif; line-height: 1.15; }

/* PSA: white label in a red frame; details left, number and grade right, cert + barcode below. */
.lbl-psa { background: #fff; border: 1.3cqw solid #d71f26; border-radius: 1.2cqw; padding: 1.6cqw 2.4cqw 1.4cqw; }
.psa-rows { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 2cqw; row-gap: .3cqw;
  font-size: 4.1cqw; font-weight: 700; text-transform: uppercase; letter-spacing: -.01em; }
.psa-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.15em; }
.psa-r { text-align: right; white-space: nowrap; }
.psa-grade { font-size: 6cqw; line-height: 1; align-self: end; }
.psa-foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 1.2cqw; }
.psa-cert { display: grid; gap: .4cqw; }
.psa-cert .barcode { width: 30cqw; height: 3.8cqw; }
.psa-cert b { font-size: 3.6cqw; letter-spacing: .04em; }
.psa-mark { background: #d71f26; color: #fff; font: italic 900 5cqw/1 Arial, sans-serif; padding: .7cqw 2cqw; border-radius: .8cqw; letter-spacing: .04em; }

/* CGC: white label, navy brand block left, details centre, boxed grade right. */
.lbl-cgc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; background: #fff; border: .8cqw solid #13284f; border-radius: 1.2cqw; overflow: hidden; }
.cgc-mark { background: #13284f; color: #fff; font: 900 5cqw/1 Arial, sans-serif; writing-mode: vertical-rl; transform: rotate(180deg);
  display: grid; place-items: center; padding: 1.4cqw 1.2cqw; letter-spacing: .1em; }
.cgc-body { display: grid; gap: .2cqw; padding: 1.6cqw 2cqw; font-size: 3.4cqw; min-width: 0; }
.cgc-body > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cgc-body b { font-size: 4.6cqw; }
.cgc-cert { display: flex; align-items: center; gap: 1.5cqw; }
.cgc-cert .barcode { width: 20cqw; height: 3.2cqw; flex: none; }
.cgc-cert em { font-style: normal; font-size: 3.2cqw; }
.cgc-grade { display: grid; place-content: center; justify-items: center; padding: 1.4cqw 2.6cqw; border-left: .6cqw solid #13284f; text-align: center; }
.cgc-grade span { font-size: 3cqw; font-weight: 700; max-width: 20cqw; }
.cgc-grade b { font: 900 11cqw/1 Arial, sans-serif; }

/* Beckett: metallic label (silver, gold for 9.5+, black for a perfect 10), big grade left with subgrades. */
.lbl-bgs { display: grid; grid-template-columns: auto minmax(0, 1fr); border-radius: 1.2cqw; padding: 1.8cqw 2.4cqw 1.4cqw; column-gap: 2.6cqw;
  border: .5cqw solid rgba(0, 0, 0, .25); }
.bgs-silver { background: linear-gradient(170deg, #f1f3f5, #c4cad1 45%, #eceff2 60%, #b7bec6); }
.bgs-gold { background: linear-gradient(170deg, #f6e7a8, #c9a33e 45%, #f2dd8c 60%, #b98f2c); }
.bgs-black { background: linear-gradient(170deg, #2a2a2a, #050505 50%, #222); color: #e7c75e; }
.bgs-black .barcode { fill: #e7c75e; }
.bgs-grade { display: grid; justify-items: center; align-content: center; text-align: center; }
.bgs-grade b { font: 900 12cqw/1 Arial, sans-serif; }
.bgs-grade span { font-size: 3cqw; font-weight: 700; }
.bgs-body { display: grid; gap: .3cqw; font-size: 3.5cqw; font-weight: 700; text-transform: uppercase; min-width: 0; align-content: center; }
.bgs-body > span, .bgs-body > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgs-body > b { font-size: 4.2cqw; }
.bgs-subs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2cqw; font-size: 2.8cqw; font-weight: 600; margin-top: .4cqw; }
.bgs-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 2cqw; margin-top: 1.2cqw; font-size: 3cqw; }
.bgs-foot .barcode { width: 26cqw; height: 3.2cqw; }
.bgs-foot em { font-style: normal; font-weight: 700; letter-spacing: .05em; }
.bgs-mark { font-weight: 900; letter-spacing: .12em; margin-right: auto; }
