/* ========== Design tokens ========== */
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #f59e0b;
  --success: #10b981;
  --success-soft: #d1fae5;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow: 0 4px 6px -1px rgba(15,23,42,0.07), 0 2px 4px -2px rgba(15,23,42,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(15,23,42,0.08), 0 8px 10px -6px rgba(15,23,42,0.06);
  --shadow-glow: 0 0 0 4px rgba(79,70,229,.12);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1240px;
}

body.dark {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #0f172a;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary-soft: #1e1b4b;
  --success-soft: #064e3b;
  --danger-soft: #7f1d1d;
  --warn-soft: #78350f;
}

/* ========== Reset & base ========== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(79,70,229,.08), transparent 60%),
    radial-gradient(800px 400px at -10% 10%, rgba(245,158,11,.06), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.dark {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(79,70,229,.15), transparent 60%),
    radial-gradient(800px 400px at -10% 10%, rgba(245,158,11,.08), transparent 60%),
    var(--bg);
}

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 750; }
h2 { font-size: 22px; font-weight: 700; margin-top: 2em; }
h3 { font-size: 18px; font-weight: 650; }
p  { margin: 0 0 1em; }
a  { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-hover); }
code { font-family: var(--mono); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: .9em; }

/* ========== Header ========== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 32px;
  background: rgba(255,255,255,.75);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: padding .15s ease;
}
/* Compact mode: when the user scrolls past ~80px we drop the logo row
   on mobile so the search bar sits right at the top edge. Driven by a
   .scrolled class toggled in base.html's scroll listener. */
.site-header.scrolled { padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 768px) {
  .site-header.scrolled .logo,
  .site-header.scrolled .header-icons { display: none; }
  .site-header.scrolled .search { margin: 0; }
}
body.dark .site-header {
  background: rgba(11,18,32,.75);
  border-bottom-color: var(--border);
}
.site-header .logo {
  font-weight: 800; font-size: 20px; letter-spacing: -.02em;
  color: var(--text); display: inline-flex; align-items: center;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* The ampersand is the wordmark's flourish: serif italic, a touch larger.
   Explicit color — the parent's color is transparent (gradient text clip)
   and a shifted child glyph falls outside the clipped background. */
.site-header .logo .amp {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic; font-weight: 700;
  font-size: 1.22em; line-height: 1;
  margin: 0 2px; align-self: center;
  color: #a855f7;
}
.site-header .search {
  flex: 1; max-width: 560px; display: flex; gap: 8px; position: relative;
}
.site-header .search input {
  flex: 1; padding: 10px 14px 10px 40px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text);
  font-size: 14px; transition: all .15s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat; background-position: 14px center;
}
.site-header .search input:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow); }
.site-header .search button {
  padding: 10px 18px; border-radius: 999px; font-weight: 600;
}
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.site-header nav a {
  color: var(--text-muted); padding: 7px 11px; border-radius: 8px; font-size: 13.5px;
  font-weight: 500; transition: all .15s ease; white-space: nowrap;
}
.site-header nav a:hover { color: var(--text); background: var(--surface-2); }

/* Primary CTA buttons in nav */
.site-header nav a.cta {
  background: var(--primary); color: white; font-weight: 600;
}
.site-header nav a.cta:hover { background: var(--primary-hover); color: white; }

/* ========== Layout ========== */
main { max-width: var(--container); margin: 32px auto; padding: 0 32px; }

/* ========== Flash ========== */
.flash {
  padding: 12px 20px; margin: 0 auto 20px; max-width: var(--container);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  background: var(--warn-soft); border-left: 4px solid var(--warn); color: var(--text);
}
.flash.ok { background: var(--success-soft); border-color: var(--success); }
.flash.error { background: var(--danger-soft); border-color: var(--danger); }
.flash.info { background: var(--primary-soft); border-color: var(--primary); }

/* ========== Hero (index) ========== */
.hero {
  position: relative; padding: 56px 48px; margin-bottom: 40px;
  background:
    radial-gradient(circle at 90% 20%, rgba(168,85,247,.18), transparent 55%),
    radial-gradient(circle at 10% 90%, rgba(79,70,229,.16), transparent 55%),
    linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  border-radius: var(--radius-xl);
  color: white; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 24px 24px; opacity: .35; pointer-events: none;
}
.hero h1 {
  font-size: clamp(32px, 4.5vw, 54px); font-weight: 800; margin: 0 0 16px;
  max-width: 760px; letter-spacing: -.03em;
}
.hero p { font-size: 18px; max-width: 620px; color: rgba(255,255,255,.85); margin: 0 0 28px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero card-stack — three fanned-out stylized trading cards on the right. */
.hero-with-cards { display: flex; align-items: center; gap: 32px; }
.hero-with-cards .hero-copy { flex: 1; min-width: 0; }
.hero-cards {
  position: relative; width: 320px; height: 240px; flex-shrink: 0;
  pointer-events: none; user-select: none;
}
.hero-card {
  position: absolute; bottom: 0; left: 50%;
  width: 140px; aspect-ratio: 3/4;
  border-radius: 14px;
  box-shadow: 0 18px 40px -10px rgba(0,0,0,0.45), inset 0 0 0 2px rgba(255,255,255,0.18);
  transform-origin: center bottom;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 0 10px;
  font-size: 9px; letter-spacing: 0.2em; font-weight: 700;
  color: rgba(255,255,255,0.92); text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.hero-card::after {
  /* holo sheen */
  content: ""; position: absolute; inset: 8px; border-radius: 8px;
  background: linear-gradient(125deg,
    transparent 0%, rgba(255,255,255,0.18) 30%, transparent 45%,
    rgba(255,255,255,0.12) 60%, transparent 75%);
  pointer-events: none;
}
.hero-card.hc1 {
  background: linear-gradient(135deg, #3b82f6, #4338ca);
  transform: translateX(calc(-50% - 80px)) rotate(-12deg);
  z-index: 1;
  animation: hcEnterL .65s cubic-bezier(.17,.67,.32,.99) both, hcFloat 6s ease-in-out infinite;
}
.hero-card.hc2 {
  background: linear-gradient(135deg, #ec4899, #be185d);
  transform: translateX(-50%);
  z-index: 3; box-shadow: 0 20px 50px -10px rgba(236,72,153,0.45), inset 0 0 0 2px rgba(255,255,255,0.25);
  animation: hcEnterC .65s .05s cubic-bezier(.17,.67,.32,.99) both, hcFloat 6s .05s ease-in-out infinite;
}
.hero-card.hc3 {
  background: linear-gradient(135deg, #10b981, #0891b2);
  transform: translateX(calc(-50% + 80px)) rotate(12deg);
  z-index: 2;
  animation: hcEnterR .65s .1s cubic-bezier(.17,.67,.32,.99) both, hcFloat 6s .1s ease-in-out infinite;
}
@keyframes hcEnterL {
  from { opacity: 0; transform: translate(calc(-50% - 40px), 16px) rotate(-5deg) scale(.88); }
  to   { opacity: 1; transform: translateX(calc(-50% - 80px)) rotate(-12deg); }
}
@keyframes hcEnterC {
  from { opacity: 0; transform: translate(-50%, 24px) scale(.85); }
  to   { opacity: 1; transform: translateX(-50%); }
}
@keyframes hcEnterR {
  from { opacity: 0; transform: translate(calc(-50% + 40px), 16px) rotate(5deg) scale(.88); }
  to   { opacity: 1; transform: translateX(calc(-50% + 80px)) rotate(12deg); }
}
@keyframes hcFloat {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -4px; }
}
@media (max-width: 768px) {
  /* Stack cards below copy on mobile, scaled down so they fit the narrower viewport. */
  .hero-with-cards { flex-direction: column; gap: 16px; align-items: stretch; }
  .hero-cards { width: 100%; height: 180px; margin-top: 4px; }
  .hero-card { width: 110px; }
  /* Tighten the fan-out so cards don't run off the edge on small screens. */
  .hero-card.hc1 {
    transform: translateX(calc(-50% - 60px)) rotate(-12deg);
    animation: hcEnterLSm .65s cubic-bezier(.17,.67,.32,.99) both, hcFloat 6s ease-in-out infinite;
  }
  .hero-card.hc3 {
    transform: translateX(calc(-50% + 60px)) rotate(12deg);
    animation: hcEnterRSm .65s .1s cubic-bezier(.17,.67,.32,.99) both, hcFloat 6s .1s ease-in-out infinite;
  }
  @keyframes hcEnterLSm {
    from { opacity: 0; transform: translate(calc(-50% - 30px), 16px) rotate(-5deg) scale(.88); }
    to   { opacity: 1; transform: translateX(calc(-50% - 60px)) rotate(-12deg); }
  }
  @keyframes hcEnterRSm {
    from { opacity: 0; transform: translate(calc(-50% + 30px), 16px) rotate(5deg) scale(.88); }
    to   { opacity: 1; transform: translateX(calc(-50% + 60px)) rotate(12deg); }
  }
}
.hero .btn-primary { background: white; color: var(--primary); }
.hero .btn-primary:hover { background: #f1f5f9; }
.hero .btn-ghost {
  background: rgba(255,255,255,.12); color: white;
  border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px);
}
.hero .btn-ghost:hover { background: rgba(255,255,255,.18); }

/* ========== Sports grid ========== */
.sports-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 14px; margin: 20px 0 44px;
}
.sport-tile {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: 28px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); color: var(--text);
  font-weight: 600; text-align: center; transition: all .18s ease;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.sport-tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent, rgba(79,70,229,.08));
  opacity: 0; transition: opacity .18s ease;
}
.sport-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); color: var(--primary); }
.sport-tile:hover::after { opacity: 1; }

/* ========== Card grid ========== */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 18px; margin-bottom: 32px;
}
.card-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); transition: all .18s ease;
  display: block;
}
.card-tile:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: var(--border-strong); color: var(--text);
}
.card-tile img {
  width: 100%; aspect-ratio: 2.5/3.5; object-fit: cover;
  background: linear-gradient(135deg, var(--surface-2), var(--border));
  border-radius: var(--radius); margin-bottom: 10px;
}
.card-title { font-weight: 600; margin: 8px 0 2px; font-size: 15px; }
.card-meta { color: var(--text-muted); font-size: 13px; }
.card-price {
  font-weight: 700; color: var(--success); margin-top: 8px; font-size: 16px;
  display: inline-block; padding: 2px 8px; background: var(--success-soft); border-radius: 6px;
}

/* ========== Tables ========== */
.listings {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.listings th, .listings td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.listings th {
  background: var(--surface-2); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.listings tr:last-child td { border-bottom: none; }
.listings tr:hover td { background: var(--surface-2); }

/* ========== Buttons ========== */
.btn, button, input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; background: var(--primary); color: white;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s ease;
  text-decoration: none;
  min-height: 40px; /* WCAG 2.5.5 minimum touch target on mobile */
}
@media (hover: none) and (pointer: coarse) {
  /* On true touch devices, bump up to the recommended 44px */
  .btn, button, input[type=submit] { min-height: 44px; }
}
.btn:hover, button:hover, input[type=submit]:hover {
  background: var(--primary-hover); transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:active, button:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }

/* ========== Forms ========== */
.form, .auth-form, .listing-form {
  max-width: 540px; background: var(--surface);
  padding: 28px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px;
}
.form label, .auth-form label, .listing-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-weight: 500; font-size: 14px; color: var(--text);
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], input[type=file], input:not([type]),
textarea, select {
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; transition: all .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow);
}
textarea { resize: vertical; min-height: 80px; }

/* ========== Card detail ========== */
.card-detail {
  display: grid; grid-template-columns: 280px 1fr; gap: 32px;
  background: var(--surface); padding: 28px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}
.card-hero { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.total { font-size: 22px; font-weight: 700; margin: 18px 0; }
.hint { color: var(--text-muted); font-size: 13px; }
.crumb { color: var(--text-muted); margin-bottom: 8px; font-size: 13px; }
.crumb a { color: var(--text-muted); }
.crumb a:hover { color: var(--primary); }

/* ========== Badges / tiers ========== */
.tier, .badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  font-weight: 600; vertical-align: middle;
}
.tier-gold   { background: #fef3c7; color: #92400e; }
.tier-silver { background: #e5e7eb; color: #374151; }
.tier-bronze { background: #fed7aa; color: #7c2d12; }
.badge-new { background: var(--primary-soft); color: var(--primary); }
.badge-verified { background: var(--success-soft); color: #065f46; }

/* ========== Grid (subscription/custom) ========== */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px; margin-bottom: 32px;
}
.grid > .card {
  background: var(--surface); padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.grid > .card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ========== Footer ========== */
footer {
  text-align: center; color: var(--text-muted);
  margin: 80px 0 32px; font-size: 14px; padding: 0 20px;
}
footer a { color: var(--text-muted); margin: 0 4px; }
footer a:hover { color: var(--primary); }

/* ========== Theme toggle ========== */
.theme-toggle {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 7px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px;
}
.theme-toggle:hover { background: var(--surface-2); }
/* Show the moon in light mode (clicking will go dark); show the sun in dark mode (clicking will go light). */
.theme-toggle-btn .theme-icon-light { display: none; }
.theme-toggle-btn .theme-icon-dark  { display: inline; }
body.dark .theme-toggle-btn .theme-icon-light { display: inline; }
body.dark .theme-toggle-btn .theme-icon-dark  { display: none; }

/* Home page sport+league cards */
.sport-cards, .brand-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.sport-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.sport-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.sport-card-head {
  display: flex; align-items: center; gap: 10px; color: var(--text);
  text-decoration: none; font-size: 15px;
}
.sport-card-head:hover { color: var(--primary); }
.league-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.league-chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  text-decoration: none; border: 1px solid transparent;
}
.league-chip:hover {
  background: var(--primary-soft); color: var(--primary);
  border-color: var(--primary); text-decoration: none;
}
.teams-toggle { margin-top: 4px; }
.teams-toggle summary {
  cursor: pointer; font-size: 12px; color: var(--text-dim);
  user-select: none; padding: 2px 0;
}
.teams-toggle[open] summary { color: var(--primary); }
.team-row {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline;
  padding: 6px 0; border-top: 1px dashed var(--border);
}
.team-row-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; margin-right: 6px;
}
.team-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: transparent; color: var(--text-muted);
  text-decoration: none; border: 1px solid var(--border);
}
.team-chip:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
  text-decoration: none;
}

/* Wide Browse menu — supports the 2-column layout for sport→league subnav */
.menu-panel.menu-wide {
  min-width: 380px; max-height: 78vh; overflow-y: auto;
  column-count: 2; column-gap: 16px;
}
.menu-panel a.sub {
  padding: 4px 12px 4px 22px; font-size: 13px; color: var(--text-muted);
  font-weight: 400;
}
.menu-panel a.sub:hover { color: var(--primary); background: var(--surface-2); }
@media (max-width: 540px) {
  .menu-panel.menu-wide { min-width: 0; column-count: 1; }
}

/* Search autocomplete dropdown */
.site-header .search { position: relative; }
.search-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  list-style: none; margin: 0; padding: 4px; z-index: 300;
  max-height: 360px; overflow-y: auto;
}
.search-suggest li {
  padding: 8px 10px; cursor: pointer; border-radius: 6px;
  display: flex; align-items: baseline; gap: 8px;
}
.search-suggest li:hover, .search-suggest li.active {
  background: var(--primary-soft); color: var(--primary);
}
.search-suggest .kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); width: 36px; flex-shrink: 0;
}
.search-suggest .sub { color: var(--text-muted); font-size: 12px; margin-left: auto; }

/* Sticky add-to-cart bar on card detail (mobile only) */
.card-sticky-bar { display: none; }
@media (max-width: 720px) {
  .card-sticky-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 10px 14px; box-shadow: 0 -2px 8px rgba(15,23,42,.06);
  }
  body { padding-bottom: 76px; }  /* room for the bar so content isn't hidden */
}

/* ========== Bottom nav (mobile) ========== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: none; justify-content: space-around; padding: 8px 0;
}
.bottom-nav a {
  flex: 1; text-align: center; font-size: 20px; padding: 6px;
  color: var(--text-muted); text-decoration: none;
}
.bottom-nav a:hover { color: var(--primary); }
body.dark .bottom-nav { background: rgba(11,18,32,.92); }

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .card-detail { grid-template-columns: 1fr; }
  .card-hero { max-width: 280px; margin: 0 auto; }
  .hero { padding: 40px 28px; }
}
@media (max-width: 768px) {
  .site-header { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .site-header .search { order: 3; flex-basis: 100%; max-width: none; }
  .site-header nav {
    order: 4; width: 100%; overflow-x: auto; flex-wrap: nowrap;
    padding: 4px 0; scrollbar-width: none;
  }
  .site-header nav::-webkit-scrollbar { display: none; }
  main { padding: 0 16px; margin: 20px auto; }
  /* Any table inside <main> scrolls horizontally on phones (not just .listings) */
  main table { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  main table th, main table td { white-space: nowrap; }
  .listings { display: block; overflow-x: auto; white-space: nowrap; }
  .sports-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 16px; }
  .bottom-nav { display: flex; }
  body { padding-bottom: 72px; }
  input, select, textarea, button { min-height: 44px; font-size: 16px; }
  /* Search filter form wraps cleanly on mobile */
  .search-filters { gap: 8px !important; }
  .search-filters input, .search-filters select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  /* Footer pieces stack instead of overflow */
  footer { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; font-size: 13px; }
  footer form { flex-basis: 100%; margin-left: 0 !important; }
  /* Heavy menu panels — keep them inside the viewport */
  .menu-panel { max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto; }
}
@media (max-width: 480px) {
  .sports-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 32px 20px; border-radius: var(--radius-lg); }
}

/* ========== Misc ========== */
img { content-visibility: auto; }
.auction-room .countdown { font-size: 24px; font-weight: 700; color: var(--danger); margin: 12px 0; }
.auction-room .current-bid { font-size: 18px; margin: 12px 0; }
.chat-log { background: var(--surface-2) !important; border: 1px solid var(--border) !important; border-radius: var(--radius) !important; }

.trust-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; margin-left: 4px; white-space: nowrap;
}
.trust-trusted  { background: #dcfce7; color: #15803d; }
.trust-verified { background: #dbeafe; color: #1d4ed8; }
.trust-standard { background: #f3f4f6; color: #4b5563; }
.trust-caution  { background: #fee2e2; color: #b91c1c; }
body.dark .trust-trusted  { background: rgba(34,197,94,.15); color: #86efac; }
body.dark .trust-verified { background: rgba(59,130,246,.15); color: #93c5fd; }
body.dark .trust-standard { background: rgba(156,163,175,.15); color: #d1d5db; }
body.dark .trust-caution  { background: rgba(239,68,68,.15); color: #fca5a5; }

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: skel 1.4s linear infinite;
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Toast notifications (slide in bottom-right). Each toast gets an icon,
   a tinted background that matches its severity, and a manual dismiss
   button so the user isn't forced to wait for auto-fade. */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px;
  pointer-events: none;  /* container itself doesn't block clicks */
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; animation: toast-in .25s ease-out;
  border-left: 4px solid var(--primary);
  backdrop-filter: blur(8px);
}
.toast.ok    { border-left-color: var(--success); background: rgba(5, 150, 105, .10); }
.toast.error { border-left-color: var(--danger);  background: rgba(220, 38, 38, .10); }
.toast.warn  { border-left-color: #f59e0b;        background: rgba(245, 158, 11, .10); }
body.dark .toast.ok    { background: rgba(5, 150, 105, .18); }
body.dark .toast.error { background: rgba(220, 38, 38, .18); }
body.dark .toast.warn  { background: rgba(245, 158, 11, .18); }
.toast::before {
  flex: 0 0 auto; font-size: 16px; line-height: 1.4;
}
.toast.ok::before    { content: "✅"; }
.toast.error::before { content: "⚠️"; }
.toast.warn::before  { content: "⚠️"; }
.toast:not(.ok):not(.error):not(.warn)::before { content: "ℹ️"; }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-close {
  flex: 0 0 auto; background: transparent; border: 0;
  color: var(--text-muted); cursor: pointer; padding: 0 4px;
  font-size: 16px; opacity: .6;
}
.toast .toast-close:hover { opacity: 1; }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@media (max-width: 640px) {
  .toast-container { left: 16px; right: 16px; bottom: 80px; max-width: none; }
}

/* Focus states */
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

/* Keyboard shortcut hint */
.kbd {
  font-family: var(--mono); font-size: 11px; padding: 2px 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 4px; color: var(--text-muted);
}

/* Section titles with accent bar */
section.section-title, h2.section {
  display: flex; align-items: center; gap: 10px;
}
h2.section::before {
  content: ""; display: inline-block; width: 4px; height: 22px;
  background: linear-gradient(180deg, var(--primary), #a855f7); border-radius: 2px;
}

/* ========== Batch 6: UI/UX polish ========== */

/* --- Animations --- */
@keyframes fadeUp { from {opacity:0; transform:translateY(8px);} to {opacity:1; transform:translateY(0);} }
@keyframes pulseDot { 0%,100% {opacity:1;} 50% {opacity:.3;} }
main { animation: fadeUp .3s ease-out; }
.grid > .card { animation: fadeUp .4s ease-out both; }
.grid > .card:nth-child(2) { animation-delay: .05s; }
.grid > .card:nth-child(3) { animation-delay: .1s; }
.grid > .card:nth-child(4) { animation-delay: .15s; }
.grid > .card:nth-child(n+5) { animation-delay: .2s; }
.btn, button { transition: transform .1s, background-color .15s, box-shadow .15s; }
.btn:active, button:active { transform: translateY(1px) scale(.98); }

/* --- Autocomplete dropdown --- */
.ac-wrap { position: relative; flex: 1; }
.ac-panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 300; max-height: 400px; overflow-y: auto;
}
.ac-panel.open { display: block; }
.ac-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; cursor: pointer; color: var(--text);
  text-decoration: none; border-bottom: 1px solid var(--border);
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.selected { background: var(--primary-soft); }
.ac-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; background: var(--surface-2); border-radius: 4px;
  color: var(--text-muted);
}
.ac-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ac-section {
  padding: 8px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-dim); background: var(--surface-2);
}

/* --- Command palette --- */
.palette-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px); z-index: 1000; align-items: flex-start;
  justify-content: center; padding-top: 15vh;
}
.palette-backdrop.open { display: flex; animation: fadeUp .15s ease-out; }
.palette {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; width: min(600px, 92vw); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette input {
  width: 100%; border: 0; padding: 18px 20px; font-size: 16px;
  background: transparent; color: var(--text); border-bottom: 1px solid var(--border);
}
.palette input:focus { outline: 0; }
.palette-results { max-height: 50vh; overflow-y: auto; }
.palette-results a {
  display: flex; align-items: center; padding: 10px 20px; color: var(--text);
  text-decoration: none; font-size: 14px; border-left: 3px solid transparent;
}
.palette-results a:hover, .palette-results a.selected {
  background: var(--primary-soft); border-left-color: var(--primary);
}
.palette-hint {
  padding: 8px 20px; font-size: 11px; color: var(--text-dim);
  border-top: 1px solid var(--border); background: var(--surface-2);
  display: flex; justify-content: space-between;
}

/* --- Mobile drawer nav --- */
.nav-burger { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--text); }
/* Push the right-side icon cluster to the far right edge. The bell
   absorbs all flex slack before it; the burger sits flush after the
   bell. Falls back to pushing the burger when no bell (anon viewer).
   The bell gets margin-left:auto and burger does NOT, so they stay
   together at the right instead of splitting the free space. */
.site-header .inbox-bell { margin-left: auto; }
.site-header:not(:has(.inbox-bell)) > .nav-burger { margin-left: auto; }
.theme-toggle-mobile { display: none; }   /* shown only on mobile via @media rule */
.nav-drawer { display: none; }
@media (max-width: 840px) {
  /* Mobile: hide the desktop nav, use the burger drawer as the menu.
     Drawer mirrors every desktop section so nothing is missing. */
  .site-header nav { display: none !important; }
  .nav-burger { display: inline-block; }
  /* Move the theme toggle inline next to the hamburger so there's a single icon row. */
  .site-header .theme-toggle.theme-toggle-mobile { display: inline-flex; margin-left: 4px; }
  .nav-drawer {
    display: block; position: fixed; top: 0; right: -320px; width: 300px; height: 100vh;
    background: var(--surface); border-left: 1px solid var(--border); z-index: 500;
    transition: right .25s ease-out; overflow-y: auto; padding: 20px;
    box-shadow: var(--shadow-lg);
  }
  .nav-drawer.open { right: 0; }
  .nav-drawer a {
    display: block; padding: 10px 12px; color: var(--text); text-decoration: none;
    border-radius: 6px; font-weight: 500;
  }
  .nav-drawer a:hover { background: var(--primary-soft); color: var(--primary); }
  .nav-drawer .drawer-section {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--text-dim); margin: 16px 0 4px; padding: 0 12px;
  }
  /* Collapsible drawer groups (replace flat sections). */
  .nav-drawer .drawer-group { margin: 0; padding: 4px 0; border-bottom: 1px solid var(--border); }
  .nav-drawer .drawer-group:last-child { border-bottom: 0; }
  .nav-drawer .drawer-group > summary {
    list-style: none; cursor: pointer;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--text-dim); padding: 12px 12px 8px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .nav-drawer .drawer-group > summary::-webkit-details-marker { display: none; }
  .nav-drawer .drawer-group > summary::after {
    content: "▸"; transition: transform .2s ease; font-size: 10px; color: var(--text-dim);
  }
  .nav-drawer .drawer-group[open] > summary::after { transform: rotate(90deg); }
  .nav-drawer .drawer-group[open] > summary { color: var(--text); }
  .nav-drawer .drawer-group > summary:hover { color: var(--primary); }
  /* Drawer sub-section (e.g. Seller -> Listings & inventory) */
  .nav-drawer .drawer-subgroup {
    margin: 4px 8px 4px 12px;
    border-left: 1px solid var(--border);
  }
  .nav-drawer .drawer-subgroup > summary {
    list-style: none; cursor: pointer;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    color: var(--text-dim); padding: 8px 12px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .nav-drawer .drawer-subgroup > summary::-webkit-details-marker { display: none; }
  .nav-drawer .drawer-subgroup > summary::after {
    content: "▸"; transition: transform .2s ease; font-size: 9px; color: var(--text-dim);
  }
  .nav-drawer .drawer-subgroup[open] > summary::after { transform: rotate(90deg); }
  .nav-drawer .drawer-subgroup[open] > summary { color: var(--text); }
  .nav-drawer .drawer-subgroup > a {
    display: block; padding: 8px 12px 8px 20px; font-size: 13px;
    color: var(--text); text-decoration: none;
  }
  .nav-drawer .drawer-subgroup > a:hover { background: var(--bg-2, rgba(255,255,255,0.04)); }
  .drawer-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 490;
  }
  .drawer-backdrop.open { display: block; }
}

/* --- Toast v2 --- */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  display: flex; gap: 10px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: fadeUp .25s ease-out;
}
.toast.ok { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast::before {
  content: "ℹ"; font-weight: 700; font-size: 16px; color: var(--primary);
  width: 20px; flex-shrink: 0;
}
.toast.ok::before { content: "✓"; color: var(--success); }
.toast.error::before { content: "✕"; color: var(--danger); }
.toast.warn::before { content: "⚠"; color: var(--warn); }

/* --- Card art component --- */
.card-art {
  aspect-ratio: 2.5 / 3.5; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, var(--surface-2), var(--border));
  position: relative; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.card-art-placeholder {
  font-size: 40px; opacity: .3;
  background: repeating-linear-gradient(45deg, var(--border) 0 10px, var(--surface-2) 10px 20px);
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.card-art.holo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,.2) 50%, transparent 70%);
  mix-blend-mode: overlay;
}

/* --- Sticky buy-box --- */
.buy-box {
  position: sticky; top: 80px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow);
}
.buy-box .price {
  font-size: 2rem; font-weight: 800; color: var(--text);
  font-family: var(--mono); letter-spacing: -.02em;
}
.buy-box .price-delta { font-size: 13px; font-weight: 600; }
.buy-box .price-delta.up { color: var(--success); }
.buy-box .price-delta.down { color: var(--danger); }
.trust-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; background: var(--success-soft);
  color: var(--success); font-size: 12px; font-weight: 600;
}

/* --- Image lightbox --- */
.lightbox-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.92);
  z-index: 3000; align-items: center; justify-content: center;
}
.lightbox-backdrop.open { display: flex; }
.lightbox-backdrop img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* --- Empty states --- */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .emoji { font-size: 56px; opacity: .7; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin: 0 0 6px; }
.empty-state p { margin: 0 0 16px; }

/* --- Loading spinner --- */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
button.loading { pointer-events: none; opacity: .7; }
button.loading::after {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: white;
  border-radius: 50%; animation: spin 1s linear infinite;
}

/* --- Chart polish --- */
.chart-toolbar {
  display: flex; gap: 4px; margin-bottom: 12px;
}
.chart-toolbar button {
  padding: 4px 10px; font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px;
}
.chart-toolbar button.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

/* --- Fair-price badge --- */
.fair-badge {
  display: inline-block; margin-left: 6px; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  vertical-align: middle; letter-spacing: .02em;
}
.fair-badge.fair-good { background: var(--success-soft); color: #065f46; border: 1px solid #10b98133; }
.fair-badge.fair-ok   { background: var(--warn-soft); color: #92400e; border: 1px solid #f59e0b33; }
.fair-badge.fair-high { background: var(--danger-soft); color: #991b1b; border: 1px solid #ef444433; }
body.dark .fair-badge.fair-good { color: #6ee7b7; }
body.dark .fair-badge.fair-ok   { color: #fcd34d; }
body.dark .fair-badge.fair-high { color: #fca5a5; }

/* --- Live badge --- */
.live-dot {
  display: inline-block; width: 8px; height: 8px; background: var(--danger);
  border-radius: 50%; margin-right: 6px; animation: pulseDot 1.4s infinite;
}

/* ================================================================
   Responsive audit pass — universal mobile fitness fixes
   Applied 2026-06-09 to address sizing breakage on narrow phones.
   ================================================================ */

/* Global box model + prevent horizontal scroll */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { -webkit-text-size-adjust: 100%; }

/* All media never exceeds its container */
img, video, picture, svg, canvas, iframe { max-width: 100%; height: auto; }

/* Tables scroll horizontally instead of breaking layout */
.table-responsive, .scrollable-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { max-width: 100%; }
@media (max-width: 640px) {
  /* Wide tables scroll sideways. Do NOT force rows to width:100% with
     table-layout:fixed — that crushes every column into the viewport and
     nowrap cell text overflows on top of its neighbors (the unreadable
     /admin/users mess on phones). */
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Form inputs — prevent iOS zoom-on-focus + minimum touch target */
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=search], input[type=tel], input[type=url],
input[type=date], input[type=datetime-local], input[type=time],
select, textarea {
  font-size: 16px;
  min-height: 44px;
  max-width: 100%;
}
@media (max-width: 480px) {
  input[type=text], input[type=email], input[type=password],
  input[type=number], input[type=search], input[type=tel],
  select, textarea { width: 100%; }
}

/* Buttons — minimum 44x44 touch target on mobile */
@media (max-width: 640px) {
  button, .btn, a.btn, input[type=submit], input[type=button] {
    min-height: 44px; padding-left: 16px; padding-right: 16px;
  }
}

/* Body font scales with viewport (~14 px at 320 wide → 17 px at 1200 wide) */
body { font-size: clamp(14px, 0.875rem + 0.2vw, 17px); }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2.2rem); line-height: 1.2; }
h2 { font-size: clamp(1.2rem, 1.0rem + 0.8vw, 1.7rem); line-height: 1.25; }
h3 { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem); line-height: 1.3; }

/* Long words/URLs wrap instead of overflowing */
h1, h2, h3, h4, p, td, th, dt, dd, li, a, span, label {
  overflow-wrap: anywhere; word-break: break-word;
}

/* Card grids auto-fit instead of overflowing */
.grid, .card-grid, .listing-grid, .set-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

/* Page containers respect viewport on narrow screens */
.container, main, .content, .page {
  max-width: 100%;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

/* Bottom nav: safe-area for home indicator on iOS, higher touch target */
.bottom-nav {
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a { min-height: 48px; min-width: 48px; }

/* Drawer reaches full height + respects safe area */
.nav-drawer {
  max-width: 90vw;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* Stack the hero copy + cards on narrow screens */
@media (max-width: 640px) {
  .hero, .hero-with-cards { flex-direction: column; text-align: center; }
  .hero-cards { margin: 1em auto; }
}

/* Modal / dialog never wider than the viewport */
.modal, dialog { max-width: min(96vw, 600px); }

/* Long player names in card tiles ellipsis instead of pushing layout */
.card .player_name, .listing .player_name { 
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Sticky headers respect safe area top */
.sticky-header, header.sticky { padding-top: env(safe-area-inset-top); }

/* ========================================================================
   UI utility classes
   --------------------------------------------------------------------------
   Replace the inline-style soup that accumulated across ~30 templates.
   Each utility is one purpose-built class; combine them rather than re-inlining.
   Documented in README.md under "CSS conventions".
   ======================================================================== */

/* The standard 'panel' shape used by every dashboard card, form container,
   list row, etc. Replace inline:
   `background:var(--surface-2); border:1px solid var(--border, #e5e7eb);
    border-radius:10px; padding:1em 1.2em;` */
.ui-panel {
  background: var(--surface-2);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 1em 1.2em;
}
.ui-panel-sm { padding: .6em .9em; border-radius: 8px; }
.ui-panel-lg { padding: 1.4em 1.6em; border-radius: 12px; }

/* Hover lift used by clickable tiles. */
.ui-hover-lift { transition: transform .1s ease, box-shadow .1s ease; }
.ui-hover-lift:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* KPI dashboard grids — every admin page uses one of these. */
.ui-kpi-grid    { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
                  gap: .5em; }
.ui-kpi-grid-lg { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
                  gap: .6em; }
.ui-card-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
                  gap: .7em; }

/* Single KPI tile: replaces ~14 different inline copies of the same shape. */
.ui-kpi { background: var(--surface-2); border: 1px solid var(--border, #e5e7eb);
          border-radius: 10px; padding: .8em 1em; text-decoration: none; color: inherit; }
.ui-kpi .ui-kpi-label { font-size: .72em; color: var(--text-muted, #888);
                        text-transform: uppercase; letter-spacing: .04em; }
.ui-kpi .ui-kpi-value { font-size: 1.5em; font-weight: 700; margin-top: .15em; }
.ui-kpi .ui-kpi-sub   { font-size: .78em; color: var(--text-muted, #888); margin-top: .2em; }
.ui-kpi-alert  { border-color: #dc2626; background: rgba(220,38,38,.06); }
.ui-kpi-alert  .ui-kpi-value { color: #dc2626; }
.ui-kpi-warn   { border-color: #f59e0b; background: rgba(245,158,11,.06); }
.ui-kpi-warn   .ui-kpi-value { color: #b9651b; }
.ui-kpi-good   { border-left: 3px solid #059669; }
.ui-kpi-good   .ui-kpi-value { color: #059669; }
.ui-kpi-bad    { border-left: 3px solid #dc2626; }
.ui-kpi-bad    .ui-kpi-value { color: #dc2626; }

/* Pulsing dot for "live / N viewing now" pills. */
.ui-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #059669;
               animation: ui-live-beat 1.5s ease-in-out infinite; display: inline-block; }
@keyframes ui-live-beat { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Status pills (open / paid / shipped / delivered / cancelled / pending).
   Replace 10+ inline copies. */
.ui-pill { font-size: .72em; padding: .15em .55em; border-radius: 1em;
           font-weight: 700; display: inline-block; }
.ui-pill-red    { background: rgba(220,53,69,.18); color: #7f1d1d; }
.ui-pill-amber  { background: rgba(240,173,78,.22); color: #b9651b; }
.ui-pill-green  { background: rgba(76,175,80,.18); color: #2e7d32; }
.ui-pill-blue   { background: rgba(44,108,209,.15); color: #1565c0; }
.ui-pill-purple { background: rgba(124,58,237,.18); color: #6a1b9a; }
.ui-pill-neutral{ background: var(--surface); color: var(--text-muted, #888); }
.ui-pill-solid-red  { background: #dc2626; color: #fff; }

/* Gradient hero card used by /collection / /trade-finder / /player/<name> /
   /set/<id>/registry / /me/affiliate / /me/refer / /me/loyalty etc. */
.ui-hero-gradient {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff; border-radius: 12px; padding: 1.5em 1.7em; margin: .5em 0 1em;
}
.ui-hero-gradient h1, .ui-hero-gradient h2 { margin: 0 0 .3em; }

/* Sticky action bar at the top of a list (bulk delete, bulk moderate, etc). */
.ui-action-bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-2);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: .55em .8em;
  margin: .5em 0 .7em;
  display: flex; gap: .5em; align-items: center; flex-wrap: wrap;
  font-size: .88em;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* Empty-state block used everywhere. */
.ui-empty {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 2em 1.5em;
  text-align: center;
  color: var(--text-muted, #888);
  margin: 1em 0;
}
.ui-empty .ui-empty-icon { font-size: 48px; }

/* Section header label - small uppercase muted, used above each KPI block. */
.ui-section-label {
  font-size: .78em;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted, #888);
  margin: 1.3em 0 .5em;
  font-weight: 600;
}

/* Flex helpers — common micro-layouts. */
.ui-row     { display: flex; gap: .7em; align-items: center; flex-wrap: wrap; }
.ui-row-sm  { display: flex; gap: .4em; align-items: center; flex-wrap: wrap; }
.ui-stack   { display: flex; flex-direction: column; gap: .5em; }
.ui-stack-sm{ display: flex; flex-direction: column; gap: .3em; }
.ui-mt-1    { margin-top: .5em; }
.ui-mt-2    { margin-top: 1em; }
.ui-mb-1    { margin-bottom: .5em; }
.ui-grow    { flex: 1; min-width: 0; }
.ui-truncate{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Muted helper text — replaces inline `color:var(--text-muted,#888); font-size:.85em` */
.ui-muted     { color: var(--text-muted, #888); }
.ui-muted-sm  { color: var(--text-muted, #888); font-size: .85em; }
.ui-muted-xs  { color: var(--text-muted, #888); font-size: .78em; }

