:root {
  --bg: #f7f3ea;
  --bg2: #fffdfa;
  --ink: #1f1b16;
  --brand: #a1382b;
  --accent: #26547c;
  --line: #ddd3c4;
  --panel: #ffffff;
  --result-top: #fffcf4;
  --result-bottom: #ffffff;
  --flash-bg: #dcf5dd;
  --flash-border: #9dd69f;
  --error-bg: #ffe4dd;
  --error-border: #e0a08f;
  --code-bg: #251f19;
  --code-ink: #f7f0e0;
  --field-bg: #ffffff;
}

html[data-theme="dark"] {
  --bg: #111821;
  --bg2: #17222d;
  --ink: #ecf2ff;
  --brand: #ff9b61;
  --accent: #9bd2ff;
  --line: #2a3a49;
  --panel: #1a2633;
  --result-top: #1d2b39;
  --result-bottom: #192534;
  --flash-bg: #183a26;
  --flash-border: #2f7d4a;
  --error-bg: #442525;
  --error-border: #8e4040;
  --code-bg: #0f151d;
  --code-ink: #d7e7ff;
  --field-bg: #13202b;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background: radial-gradient(circle at top left, #fff7d8, var(--bg) 40%, #f2ebde 100%);
  transition: background 220ms ease, color 220ms ease;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(89, 140, 189, 0.26) 0%, rgba(89, 140, 189, 0) 60%),
    radial-gradient(900px 500px at 92% 0%, rgba(55, 96, 148, 0.24) 0%, rgba(55, 96, 148, 0) 56%),
    linear-gradient(160deg, #0f1722 0%, #101a26 46%, #0b131c 100%);
  background-attachment: fixed;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: blur(10px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #ffcf75);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent);
}
.search { display: flex; gap: 0.5rem; }
.search input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 999px;
}
button, .nav a {
  border: 1px solid var(--line);
  background: var(--field-bg);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}
button:hover, .nav a:hover { border-color: var(--brand); }
.nav { display: flex; align-items: center; gap: 0.5rem; }
.nav-modern a, .nav-modern .user-pill, .nav-modern button.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.38em;
  border-radius: 999px;
  padding: 0.38em 1em 0.38em 0.7em;
  font-size: 1.04em;
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.03);
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  text-decoration: none;
  color: var(--ink);
  position: relative;
}
.nav-modern a svg, .nav-modern .user-pill svg, .nav-modern button.theme-toggle svg {
  margin-right: 0.18em;
  flex-shrink: 0;
  opacity: 0.82;
}
.nav-modern a:hover, .nav-modern .user-pill:hover, .nav-modern button.theme-toggle:hover {
  background: color-mix(in srgb, var(--brand) 7%, var(--panel));
  border-color: var(--brand);
  box-shadow: 0 4px 16px 0 rgba(0,0,0,0.07);
  color: var(--brand);
  transform: translateY(-2px) scale(1.07);
}
.nav-modern a span, .nav-modern .user-pill span, .nav-modern button.theme-toggle span {
  font-weight: 500;
  letter-spacing: 0.01em;
}
.user-pill {
  border: 1px solid var(--line);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.86rem;
  background: color-mix(in srgb, var(--field-bg) 88%, transparent);
}
.container { width: 80%; max-width: 1600px; margin: 1rem auto; padding: 0 1rem; }
.dashboard-home {
  display: grid;
  gap: 1rem;
}
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  background:
    radial-gradient(1000px 220px at 0% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--panel) 92%, #f8ecd7), var(--panel));
}
.dash-hero h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
}
.dash-hero p {
  margin: 0.35rem 0 0;
  opacity: 0.82;
}
.dash-hero-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.dash-btn {
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.5rem 0.95rem;
  color: var(--ink);
  background: color-mix(in srgb, var(--field-bg) 88%, transparent);
  font-weight: 700;
}
.dash-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.dash-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.dash-panel {
  display: grid;
  gap: 0.7rem;
}
.dash-panel-full {
  gap: 0.8rem;
}
.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.dash-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}
.dash-panel-head a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.86rem;
}
.dash-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  align-items: start;
  align-content: start;
}
.dash-cards-grid.newest {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.dash-cards-grid.five-col {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.dash-card {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.dash-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 18%, transparent);
}
.dash-card-img-wrap {
  aspect-ratio: 63 / 88;
  background: color-mix(in srgb, var(--line) 22%, transparent);
}
.dash-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dash-card-body {
  display: grid;
  gap: 0.22rem;
  padding: 0.52rem 0.6rem 0.62rem;
}
.dash-card-name {
  font-size: 0.83rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-card-meta {
  font-size: 0.72rem;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-card-price {
  font-size: 0.79rem;
  font-weight: 800;
  color: color-mix(in srgb, var(--ink) 88%, var(--brand));
}
.dash-card-price.foil {
  color: #bf8d1d;
}
.dash-empty {
  margin: 0;
  opacity: 0.72;
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .dash-sections-grid {
    grid-template-columns: 1fr;
  }
  .dash-cards-grid.newest {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .dash-cards-grid.five-col {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .container {
    width: 100%;
    max-width: none;
    margin: 0.65rem 0 0;
    padding: 0 0.6rem;
  }
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .dash-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dash-cards-grid.newest {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dash-cards-grid.five-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .container {
    width: 100%;
    max-width: none;
    margin: 0.55rem 0 0;
    padding: 0 0.5rem;
  }
}
.gallery-summary { margin: 0.8rem 0; opacity: 0.9; }
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}
.advanced-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  align-items: end;
}
.advanced-filters label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}
.advanced-filters input,
.advanced-filters select {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 10px;
}
.card-gallery-wrap {
  margin-top: 1rem;
}
.card-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}
.gallery-card {
  display: grid;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.45rem;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.04);
  transition: transform 0.22s cubic-bezier(.22,1.61,.36,1), box-shadow 0.22s, border-color 0.18s;
  will-change: transform;
}
.gallery-card:hover {
  transform: scale(1.17) rotate(-1.5deg) translateY(-7px);
  border-color: var(--brand);
  box-shadow: 0 8px 32px 0 rgba(0,0,0,0.13);
  z-index: 2;
}
.gallery-card img {
  width: 100%;
  aspect-ratio: 63 / 88;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #111;
}
.gallery-meta {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
}
.gallery-meta strong { line-height: 1.25; }
.price-pill {
  display: inline-flex;
  justify-self: start;
  margin-top: 0.15rem;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 700;
}
.price-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.price-pill.foil {
  border-color: #d7a628;
  color: #6a4300;
  background: linear-gradient(115deg, rgba(0, 255, 0, 0) 0%, rgba(0, 255, 0, 0.25) 25%, rgba(255, 255, 0, 0.3) 50%, rgba(255, 0, 0, 0.15) 75%, rgba(255, 0, 0, 0.3) 100%);
  box-shadow: 0 0 10px rgba(249, 198, 79, 0.35);
}
html[data-theme="dark"] .price-pill.foil {
  color: #ffe8ab;
  background: linear-gradient(115deg, rgba(0, 255, 0, 0) 0%, rgba(0, 255, 0, 0.25) 25%, rgba(255, 255, 0, 0.3) 50%, rgba(255, 0, 0, 0.15) 75%, rgba(255, 0, 0, 0.3) 100%);
  box-shadow: 0 0 12px rgba(249, 198, 79, 0.28);
}
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
}
.pager a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
}
.pager .disabled {
  color: color-mix(in srgb, var(--ink) 45%, var(--field-bg));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  cursor: default;
  user-select: none;
}
.pager a.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, var(--field-bg));
}
.detail-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}
.detail-grid--2 { grid-template-columns: 1.5fr 1fr; }
.detail-grid--3 { grid-template-columns: 1.5fr 1fr 1fr; }
.detail-main {
  display: grid;
  grid-template-columns: min(260px, 40%) 1fr;
  gap: 1rem;
  align-items: start;
}
.detail-image {
  width: 100%;
  max-width: 280px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.price-chart {
  width: 100%;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 85%, transparent), transparent);
}
.price-chart polyline {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-range { margin-top: 0.5rem; font-size: 0.9rem; }

/* ══ Cardmarket-style card page ══════════════════════════════ */
.cm-card-page { display: flex; flex-direction: column; gap: 1rem; }

/* Top section: image | stats | chart */
.cm-detail-top {
  display: grid;
  grid-template-columns: 300px 1fr minmax(260px, 380px);
  gap: 1.25rem;
  align-items: start;
}
.cm-card-media {
  display: flex;
  flex-direction: column;
}
.cm-card-img img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.cm-card-img:hover img {
  transform: scale(1.10)  rotate(-1.5deg) translateY(-7px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  z-index: 10;
  position: relative;
}
.cm-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ink);
  opacity: 0.8;
}
.cm-ext-link:hover { opacity: 1; background: var(--line); }

.cm-card-stats { min-width: 0; }
.cm-title { font-size: 1.3rem; font-weight: 700; margin: 0 0 0.15rem; }
.cm-subtitle { font-size: 0.88rem; opacity: 0.6; margin-bottom: 0.9rem; }
.cm-inline-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--brand) 45%, transparent);
  transition: color 120ms ease, border-color 120ms ease;
}
.cm-inline-link:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.cm-stats-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cm-stats-table th,
.cm-stats-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; }
.cm-stats-table th { font-weight: 500; opacity: 0.65; width: 55%; }
.cm-stats-table td { font-weight: 600; }
.cm-stats-table td.price-val { color: var(--brand); }
.cm-stats-sep td { border: none; padding: 0.1rem 0; }
.cm-fetched-at { margin-top: 0.6rem; font-size: 0.75rem; opacity: 0.45; }
.cm-card-qty-box {
  margin-top: 0.6rem;
  padding: 0.45rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}
.cm-card-qty-box .coll-qty-ctrl {
  margin-top: 0;
}
.cm-card-qty-box .coll-qty-ctrl.foil {
  margin-top: 0.25rem;
}

/* Chart column */
.cm-card-chart { display: flex; flex-direction: column; min-height: 0; }
.cm-chart-label { font-size: 0.78rem; opacity: 0.55; margin-bottom: 0.4rem; }
.chart-nodata { opacity: 0.5; font-size: 0.88rem; }
.chart-range { font-size: 0.82rem; opacity: 0.6; margin-top: 0.4rem; }
.price-chart-canvas {
  width: 100% !important;
  height: 200px !important;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 85%, transparent), transparent);
  padding: 8px;
  box-sizing: border-box;
}

/* Bottom section: filter sidebar | offers */
.cm-offers-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

/* Filter sidebar */
.cm-filter-sidebar { padding: 0.85rem; }
.cm-filter-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}
.cm-filter-x {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.5;
  line-height: 1;
  padding: 0 0.2rem;
}
.cm-filter-x:hover { opacity: 1; }
.cm-filter-group { margin-bottom: 1rem; }
.cm-filter-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.55;
  margin-bottom: 0.45rem;
}
.cm-filter-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  padding: 0.2rem 0;
  cursor: pointer;
}
.cm-filter-check input { cursor: pointer; }
.cm-filter-select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}
.cm-filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}
.btn-clear {
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.btn-clear:hover { background: var(--line); }
.btn-cm-filter {
  padding: 0.45rem 0.5rem;
  border: none;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.btn-cm-filter:hover { opacity: 0.85; }

/* Offers main area */
.cm-offers-main { min-width: 0; }
.cm-offers-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.cm-offers-toolbar h2 { margin: 0; font-size: 1.05rem; display: inline; }
.offers-count {
  display: inline-block;
  margin-left: 0.4rem;
  background: var(--line);
  border-radius: 20px;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  vertical-align: middle;
}
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-refresh:hover { opacity: 0.85; }
.offers-empty { opacity: 0.65; padding: 1rem 0; }

/* Offers table */
.offers-table-wrap { overflow-x: auto; }
.offers-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.offers-table th,
.offers-table td { border-bottom: 1px solid var(--line); padding: 0.5rem 0.6rem; text-align: left; }
.offers-table th { font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.6; }
.offers-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.offer-seller { font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 0.3rem; flex-wrap: nowrap; }
.seller-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.1rem 0.4rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.seller-flag { font-size: 1rem; line-height: 1; flex-shrink: 0; }
.seller-nick { overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.seller-type-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #888;
}
.seller-type-private    { background: #6b7280; }
.seller-type-professional { background: #3b82f6; }
.seller-type-powerseller  { background: #f59e0b; }
.offer-product { white-space: nowrap; }
.offer-price-cell { white-space: nowrap; }
.offer-price-cell .price-val { color: var(--brand); font-weight: 700; font-size: 1rem; }
.offer-qty {
  display: inline-block;
  margin-left: 0.5rem;
  min-width: 1.8rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  font-size: 0.82rem;
  opacity: 0.75;
}
.offer-lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.3rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.8;
}
.badge-foil {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.15rem 0.45rem;
  background: linear-gradient(135deg, #78350f, #d97706, #fbbf24, #d97706, #78350f);
  color: #1a0a00;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Condition badges ─────────────────────────────────────── */
.badge-cond {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-cond--near-mint     { background: #16a34a; color: #fff; }
.badge-cond--excellent     { background: #22c55e; color: #fff; }
.badge-cond--good          { background: #84cc16; color: #000; }
.badge-cond--light-play    { background: #ca8a04; color: #fff; }
.badge-cond--moderate-play { background: #ea580c; color: #fff; }
.badge-cond--heavy-play    { background: #dc2626; color: #fff; }
.badge-cond--damaged       { background: #7f1d1d; color: #fff; }
.badge-cond--poor          { background: #6b7280; color: #fff; }
.card-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 10px 26px rgba(30, 20, 10, 0.06);
}
.stack { display: grid; gap: 0.7rem; max-width: 420px; }
.stack input:not([type="checkbox"]):not([type="radio"]), .stack select, .stack textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 10px;
}
.stack-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  cursor: pointer;
}
.stack-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
  flex: 0 0 auto;
}
.stack-check span {
  line-height: 1.25;
}
.admin-log-wrap {
  margin-top: 0.8rem;
}
.admin-task-status {
  margin-top: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 80%, var(--bg2));
}
.admin-task-meta {
  margin-left: 0.65rem;
  opacity: 0.75;
  font-size: 0.88rem;
}
.admin-log-box {
  max-height: 360px;
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: pre-wrap;
}
.btn-danger {
  background: #b43a2d;
  color: #fff;
  border: 1px solid #9d2f24;
}
.btn-danger:hover {
  border-color: #7e231a;
  background: #9f2e23;
}
.btn-small {
  padding: 0.28rem 0.62rem;
  font-size: 0.82rem;
}
.admin-inline-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}
.admin-link-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--ink);
  background: var(--field-bg);
}
.admin-link-btn:hover {
  border-color: var(--brand);
}
.admin-panel .stack {
  max-width: 620px;
}
.admin-tabs {
  margin-top: 0.9rem;
}
.admin-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}
.admin-tab-btn {
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.42rem 0.82rem;
  cursor: pointer;
}
.admin-tab-btn.active {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, var(--field-bg));
  color: var(--brand);
  font-weight: 700;
}
.admin-tab-panel {
  display: none;
}
.admin-tab-panel.active {
  display: block;
}
.admin-tab-panel > h2 {
  margin-top: 0.15rem;
}
.admin-bulk-summary {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: color-mix(in srgb, var(--panel) 85%, var(--bg2));
  display: grid;
  gap: 0.22rem;
  font-size: 0.92rem;
}
.result {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  background: linear-gradient(180deg, var(--result-top) 0%, var(--result-bottom) 100%);
}
.result img {
  width: 88px;
  height: 122px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.inline-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.inline-form select, .inline-form input {
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.line {
  border-bottom: 1px dashed var(--line);
  padding: 0.3rem 0;
}
.flash, .error {
  padding: 0.7rem;
  border-radius: 10px;
  margin-bottom: 0.8rem;
}
.flash { background: var(--flash-bg); border: 1px solid var(--flash-border); }
.error { background: var(--error-bg); border: 1px solid var(--error-border); }
.hint pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.7rem;
  border-radius: 8px;
  overflow: auto;
}

.auth-page .container {
  max-width: none;
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 0 1rem;
}
.auth-shell {
  min-height: calc(100dvh - 72px);
  display: grid;
  place-items: center;
  padding: 1.2rem 0 2.2rem;
}
.is-guest .auth-shell {
  min-height: 100dvh;
}
.auth-card {
  width: min(100%, 460px);
  padding: 1.35rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
  background:
    radial-gradient(110% 160% at 100% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 65%),
    var(--panel);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--ink) 10%, transparent);
}
.auth-card h1 {
  margin: 0;
}
.auth-subtitle {
  margin: 0.4rem 0 0.95rem;
  opacity: 0.78;
}
.auth-form {
  max-width: none;
  gap: 0.8rem;
}
.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}
.auth-form input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 42px;
  border-radius: 11px;
}
.auth-form button[type="submit"] {
  margin-top: 0.25rem;
  min-height: 44px;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 86%, #fff), var(--brand));
  color: #fff;
  font-weight: 700;
}

@media (max-width: 760px) {
  .auth-shell {
    min-height: calc(100dvh - 64px);
    padding: 0.9rem 0 1.6rem;
  }
  .is-guest .auth-shell {
    min-height: 100dvh;
  }
  .auth-card {
    width: 100%;
    padding: 1rem 0.9rem;
    border-radius: 12px;
  }
}

/* ── Offers pagination ───────────────────────────────────── */
.offers-pager {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.pager-btn {
  min-width: 2rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.2;
  transition: background 0.15s;
}
.pager-btn:hover:not(:disabled) { background: var(--line); }
.pager-btn:disabled { opacity: 0.35; cursor: default; }
.pager-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}
.pager-ellipsis { padding: 0 0.2rem; opacity: 0.4; font-size: 0.85rem; }
.pager-info { margin-left: 0.5rem; font-size: 0.8rem; opacity: 0.55; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 0.5rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .nav { flex-wrap: wrap; }
  .detail-grid--2,
  .detail-grid--3 { grid-template-columns: 1fr; }
  .detail-main { grid-template-columns: 1fr; }
  .cm-detail-top { grid-template-columns: 1fr; }
  .cm-offers-section { grid-template-columns: 1fr; }
  .card-gallery { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

@media (max-width: 900px) {
  html[data-theme="dark"] body {
    background-attachment: scroll;
  }
}

@media (max-width: 760px) {
  .stack {
    max-width: none;
  }
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .inline-form select,
  .inline-form input:not([type="checkbox"]):not([type="radio"]),
  .inline-form button {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   TOPBAR SEARCH WRAP
═══════════════════════════════════════════════════════════════════════ */
.topbar-search-wrap {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}
.search { display: flex; gap: 0; width: 100%; }
.search input {
  flex: 1;
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.93rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.search input:focus { border-color: var(--brand); }

/* ═══════════════════════════════════════════════════════════════════════
   AUTOCOMPLETE DROPDOWN
═══════════════════════════════════════════════════════════════════════ */
.ac-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  z-index: 200;
  box-shadow: 0 10px 32px rgba(0,0,0,0.18);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}
.ac-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.12s;
  outline: none;
}
.ac-item:hover, .ac-item:focus { background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.ac-thumb {
  width: 38px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--line);
}
.ac-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
}
.ac-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ac-prices {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  align-items: flex-end;
  min-width: 84px;
  flex-shrink: 0;
}
.ac-price-val {
  font-weight: 700;
  opacity: 0.88;
  font-size: 0.72rem;
  white-space: nowrap;
}
.ac-price-val.foil {
  color: #cf9b1f;
}
.ac-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-meta { font-size: 0.75rem; opacity: 0.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 700px) {
  .ac-prices { min-width: 92px; }
  .ac-price-row { font-size: 0.69rem; }
}

/* ═══════════════════════════════════════════════════════════════════════
   HAMBURGER BUTTON
═══════════════════════════════════════════════════════════════════════ */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: var(--field-bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  padding: 9px 10px;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.hamburger-btn:hover { border-color: var(--brand); }
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.22s, opacity 0.22s;
  transform-origin: center;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════════════════════════════════
   SLIDE MENU PANEL
═══════════════════════════════════════════════════════════════════════ */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 998;
  backdrop-filter: blur(2px);
}
.menu-overlay.visible { display: block; }

.menu-panel {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  height: 100%;
  background: var(--panel);
  border-left: 1.5px solid var(--line);
  box-shadow: -6px 0 28px rgba(0,0,0,0.22);
  z-index: 999;
  transition: right 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.menu-panel.open { right: 0; }

.menu-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.menu-panel-title { font-weight: 700; font-size: 1rem; }
.menu-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.6;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.menu-close-btn:hover { opacity: 1; background: color-mix(in srgb, var(--line) 60%, transparent); }

.menu-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  opacity: 0.65;
  border-bottom: 1px solid var(--line);
}

.menu-links { display: flex; flex-direction: column; padding: 0.5rem 0; flex: 1; }
.menu-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 1rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.menu-link:hover { background: color-mix(in srgb, var(--brand) 8%, var(--panel)); color: var(--brand); }
.menu-link.active { border-left-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel)); color: var(--brand); font-weight: 600; }
.menu-logout { color: #c0392b; margin-top: auto; }
html[data-theme="dark"] .menu-logout { color: #ff7b6b; }

.menu-footer {
  border-top: 1px solid var(--line);
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}
.menu-theme-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.95rem;
  text-align: left;
}
.menu-theme-btn:hover { background: color-mix(in srgb, var(--line) 40%, transparent); }

/* ═══════════════════════════════════════════════════════════════════════
   COLLECTION PAGE
═══════════════════════════════════════════════════════════════════════ */
.collection-section {
  padding: 1.5rem 1rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}
.coll-header { margin-bottom: 1rem; }
.coll-header h1 { margin: 0; font-size: 1.6rem; }
.coll-header-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.coll-search-input {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  padding: 0.45rem 0.85rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.coll-search-input:focus { border-color: var(--brand); }
.coll-owned-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  opacity: 0.75;
  cursor: pointer;
  white-space: nowrap;
}
.coll-owned-toggle input { accent-color: var(--brand); cursor: pointer; }

.coll-stats-bar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  row-gap: 0.75rem;
}
.coll-stat { display: flex; flex-direction: column; gap: 2px; }
.coll-stat-label { font-size: 0.75rem; opacity: 0.55; text-transform: uppercase; letter-spacing: 0.04em; }
.coll-stat-value { font-size: 1.2rem; font-weight: 700; color: var(--brand); }
.coll-pct-bar {
  height: 4px;
  width: 120px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 3px;
}
.coll-pct-fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width 0.4s; }

.coll-filters {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.coll-filters select {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.coll-filters input[type="number"] {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  font-size: 0.9rem;
  width: 150px;
}
.coll-filters select:focus { outline: none; border-color: var(--brand); }
.coll-filters input[type="number"]:focus { outline: none; border-color: var(--brand); }

.coll-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
}
.coll-card {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: var(--panel);
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.2s, filter 0.2s;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}
.coll-card.coll-card-wide {
  grid-column: span 2;
}
.coll-card.not-owned {
  opacity: 0.38;
  filter: grayscale(0.75);
}
.coll-card.not-owned:hover {
  opacity: 0.7;
  filter: grayscale(0.3);
  transform: translateY(-2px);
}
.coll-card.owned {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: 0 2px 12px color-mix(in srgb, var(--brand) 18%, transparent);
}
.coll-card.owned:hover { transform: translateY(-3px); box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 28%, transparent); }

.coll-grid.coll-grid-gray-off .coll-card.not-owned {
  opacity: 1;
  filter: none;
}
.coll-grid.coll-grid-gray-off .coll-card.not-owned:hover {
  opacity: 1;
  filter: none;
}

.coll-gray-toggle {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.coll-gray-toggle:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--field-bg));
}

.adv-card .coll-card-body {
  min-height: 132px;
}

.coll-filters-advanced {
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.coll-filters-advanced .coll-search-input {
  max-width: 360px;
}

.coll-filters-advanced input[type="text"],
.coll-filters-advanced input[type="number"] {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
}

.coll-filters-advanced input[type="text"] {
  min-width: 200px;
}

.coll-filters-advanced input[type="number"] {
  width: 150px;
}

.coll-filters-advanced #adv-set-name {
  min-width: 170px;
}

.coll-filters-advanced input:-webkit-autofill,
.coll-filters-advanced input:-webkit-autofill:hover,
.coll-filters-advanced input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
  transition: background-color 5000s ease-in-out 0s;
}

.coll-filters-advanced input:focus {
  border-color: var(--brand);
}

.coll-filters-advanced button {
  padding: 0.45rem 0.85rem;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.coll-filters-advanced button:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--field-bg));
}

.advanced-search-section .card-block {
  margin-bottom: 1rem;
}

.advanced-search-section .coll-grid {
  margin-top: 0.2rem;
}

.coll-card-img-wrap {
  position: relative;
  aspect-ratio: 2.5/3.5;
  background: var(--line);
  overflow: hidden;
}
.coll-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.coll-card-img-wrap.is-landscape {
  aspect-ratio: 16/9;
}
.coll-card-img-wrap.is-landscape img {
  object-fit: contain;
  background: color-mix(in srgb, var(--line) 80%, #000 20%);
}
.coll-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coll-qty-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--brand);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.coll-qty-badge.foil {
  right: 5px;
  left: auto;
  top: 28px;
  background: linear-gradient(115deg, rgba(0, 255, 0, 0) 0%, rgba(0, 255, 0, 0.25) 25%, rgba(255, 255, 0, 0.3) 50%, rgba(255, 0, 0, 0.15) 75%, rgba(255, 0, 0, 0.3) 100%);
  color: #fff8d6;
  border: 1px solid rgba(255, 238, 168, 0.7);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.coll-card-body {
  padding: 0.4rem 0.5rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.coll-card-name {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.coll-card-set { font-size: 0.68rem; opacity: 0.5; }
.coll-card-price { font-size: 0.72rem; color: var(--brand); font-weight: 600; }
.coll-price-stack {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}
.coll-card-price.foil {
  color: #cf9b1f;
  background: transparent;
  text-shadow: none;
  border-radius: 0;
  padding: 0;
}
html[data-theme="dark"] .coll-card-price.foil {
  color: #ffe8ad;
}

.coll-qty-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.coll-qty-ctrl.foil {
  margin-top: 0.18rem;
}
.qty-row-label {
  width: 22px;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  text-align: center;
}
.qty-row-label.foil {
  background: linear-gradient(115deg, rgba(0, 255, 0, 0) 0%, rgba(0, 255, 0, 0.25) 25%, rgba(255, 255, 0, 0.3) 50%, rgba(255, 0, 0, 0.15) 75%, rgba(255, 0, 0, 0.3) 100%);
  border-radius: 4px;
  color: #ffe9b0;
}
.qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}
.qty-btn:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--field-bg)); }
.qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-val {
  min-width: 22px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.coll-count-info {
  margin-top: 1.25rem;
  font-size: 0.82rem;
  opacity: 0.5;
  text-align: right;
}
.coll-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.coll-pagination .pager-btn {
  text-decoration: none;
  color: var(--ink);
}
.coll-loading,
.coll-empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  opacity: 0.45;
  font-size: 0.9rem;
}
.coll-pagination .pager-btn {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg2);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink);
  transition: background 0.15s;
}
.coll-pagination .pager-btn:hover { background: var(--field-bg); }
.coll-pagination .pager-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.coll-pagination .pager-info {
  margin-left: 0.5rem;
  font-size: 0.78rem;
  opacity: 0.55;
}

@media (max-width: 560px) {
  .coll-card.coll-card-wide {
    grid-column: span 1;
  }
}

@media (max-width: 1650px) {
  .coll-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1350px) {
  .coll-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  .coll-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .collection-section {
    max-width: none;
    margin: 0;
    padding: 1rem 0 2rem;
  }
  .coll-header-row,
  .coll-filters,
  .coll-filters-advanced {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .coll-search-input,
  .coll-filters select,
  .coll-filters input[type="number"],
  .coll-filters-advanced input[type="text"],
  .coll-filters-advanced input[type="number"],
  .coll-filters-advanced button {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .coll-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .coll-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.adv-pagination {
  margin-top: 0.9rem;
}

/* ── Portfolio panel ─────────────────────────────────────────────────── */
.port-section {
  margin: 2rem auto;
  padding: 0 1rem 3rem;
}
.port-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.4rem;
}
.port-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.7rem;
}
.port-kpi-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.port-kpi {
  flex: 1 1 180px;
  background: var(--card-bg, #1e1e2e);
  border: 1px solid var(--border, #2a2a3e);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.port-kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .65;
}
.port-kpi-val {
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.port-kpi-sub {
  font-size: 0.8rem;
  opacity: .55;
}
.port-kpi-change {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.1rem;
}
.port-change-up   { color: #4ade80; }
.port-change-down { color: #f87171; }
.port-chart-wrap {
  background: var(--card-bg, #1e1e2e);
  border: 1px solid var(--border, #2a2a3e);
  border-radius: 10px;
  padding: 1.25rem 1rem;
  margin-bottom: 0.5rem;
}
.port-chart-note {
  font-size: 0.75rem;
  opacity: .5;
  margin-bottom: 1.5rem;
}
.port-empty {
  opacity: .6;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.port-cmd {
  background: var(--code-bg, #12121a);
  border: 1px solid var(--border, #2a2a3e);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.83rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.port-history-table-wrap {
  overflow-x: auto;
}
.port-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.port-table th,
.port-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border, #2a2a3e);
}
.port-table th:first-child,
.port-table td:first-child {
  text-align: left;
}
.port-table thead th {
  opacity: .7;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

@media (max-width: 600px) {
  .port-kpi-val { font-size: 1.15rem; }
}

/* ── Portfolio top-5 cards ───────────────────────────────────────────── */
.port-top-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
}
.port-top-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--card-bg, #1e1e2e);
  border: 1px solid var(--border, #2a2a3e);
  border-radius: 10px;
  padding: 0.6rem 1rem 0.6rem 0.65rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s;
}
.port-top-card:hover {
  border-color: #6c63ff;
  background: var(--hover-bg, #26263a);
}
.port-top-img {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.port-top-img-placeholder {
  background: var(--border, #2a2a3e);
}
.port-top-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.port-top-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.port-top-set {
  font-size: 0.75rem;
  opacity: .55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.port-top-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: #6c63ff;
  font-variant-numeric: tabular-nums;
}
.port-top-qty {
  font-size: 0.75rem;
  opacity: .55;
}

/* ── Admin panel (adm-*) ───────────────────────────────────────────────── */
.adm { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; }
.adm-side { position: sticky; top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.adm-side-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); opacity: .8; margin: 2px 6px 10px; }
.adm-nav { display: flex; flex-direction: column; gap: 4px; }
.adm .admin-tab-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px; padding: 9px 12px; color: var(--ink); font: inherit; cursor: pointer; }
.adm .admin-tab-btn:hover { background: rgba(155, 210, 255, .08); }
.adm .admin-tab-btn.active { background: rgba(155, 210, 255, .16); color: var(--accent); font-weight: 600; }
.adm-badge { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.adm-main { min-width: 0; }
.adm .admin-tab-panel { display: none; }
.adm .admin-tab-panel.active { display: block; }
.adm-head { margin-bottom: 16px; }
.adm-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
.adm-head p, .adm-muted { color: var(--ink); opacity: .65; margin: 0; font-size: 14px; }
.adm-h2 { font-size: 1.05rem; margin: 22px 0 10px; }
.adm-h2:first-of-type { margin-top: 0; }
.adm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.adm-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.adm-kpi span { display: block; font-size: 12px; opacity: .65; margin-bottom: 6px; }
.adm-kpi strong { font-size: 1.5rem; }
.adm-kpi.warn strong { color: var(--brand); }
.adm-table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: 10px; border-bottom: 1px solid var(--line); }
.adm-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-warn-text { color: var(--brand); font-weight: 600; }
.adm-card-name { font-weight: 600; }
.adm-tag { display: inline-block; font-size: 11px; background: var(--error-bg); color: var(--ink); border-radius: 6px; padding: 1px 7px; }
.adm-link-sm { color: var(--accent); text-decoration: none; font-size: 13px; }
.adm-link-sm:hover { text-decoration: underline; }
.adm-link { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--accent); font: inherit; cursor: pointer; }
.adm-link:hover { border-color: var(--accent); }
.adm-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; align-items: end; }
.adm-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.adm-grid label.adm-check { flex-direction: row; align-items: center; gap: 8px; }
.adm-grid label.adm-check input { width: auto; }
.adm-grid label.adm-wide { grid-column: 1 / -1; }
.adm-grid input:not([type="checkbox"]), .adm-grid select, .adm-grid textarea, .adm-id-input {
  width: 100%; background: var(--field-bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.adm-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.adm-ids-form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.adm-ids-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 4px; }
.adm-id-input { width: 140px; }
.adm-id-input.adm-filled { border-color: var(--accent); }
.adm-candidates { min-width: 280px; }
.adm-cand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 6px 6px 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; color: var(--ink); cursor: pointer; font: inherit; text-align: left; }
.adm-cand:hover { border-color: var(--accent); }
.adm-cand strong { font-size: 13px; }
.adm-cand span { font-size: 11px; opacity: .7; }
.adm-cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.adm-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.adm-box h3 { margin: 0 0 6px; font-size: 1rem; }
.adm-box h4 { margin: 14px 0 6px; font-size: .9rem; opacity: .7; }
.adm-log-sm { max-height: 240px; overflow: auto; }
.adm-log { max-height: 420px; overflow: auto; }
.adm-notice { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.adm-empty { background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; }
.adm-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.adm-fieldset:disabled { opacity: .5; }
.adm-danger { border: 1px solid var(--error-border); background: var(--error-bg); border-radius: 12px; padding: 14px; margin-top: 16px; }
.adm-danger h3 { margin: 0 0 4px; }
.adm-status { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { position: static; }
  .adm-nav { flex-direction: row; flex-wrap: wrap; }
  .adm .admin-tab-btn { width: auto; }
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-cards-2 { grid-template-columns: 1fr; }
}

/* ── Collection: hover details on card image ─────────────────────────── */
.coll-hover-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; gap: 6px; padding: 10px;
  background: rgba(10, 16, 24, .93); color: #ecf2ff; font-size: 12px; line-height: 1.35;
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.coll-card-img-wrap:hover .coll-hover-panel,
.coll-card-img-wrap:focus-within .coll-hover-panel { opacity: 1; pointer-events: auto; }
.coll-hover-panel a { color: #9bd2ff; }
.coll-hover-id { opacity: .85; }
.coll-tag { align-self: flex-start; background: #334155; color: #fff; border-radius: 6px; padding: 2px 7px; font-size: 11px; }
.coll-tag.warn { background: #b45309; }
.coll-hover-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.coll-hover-edit input { width: 110px; background: #13202b; color: #ecf2ff; border: 1px solid #2a3a49; border-radius: 6px; padding: 4px 6px; font: inherit; }
.coll-hover-edit button { padding: 4px 9px; font: inherit; }
.coll-hover-msg { font-size: 11px; opacity: .8; }

/* ── Card page: last values seen in the browser ─────────────────────── */
.cm-live-box { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.cm-live-title { font-size: 12px; opacity: .7; margin-bottom: 4px; }

/* Price table and "seen in browser" box side by side on the card page */
.cm-stats-pair { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cm-stats-pair > .cm-stats-table { flex: 1 1 260px; min-width: 0; }
.cm-stats-pair > .cm-live-box { flex: 0 1 240px; margin-top: 0; }

/* Three-column price table: label | guide | seen on Cardmarket */
.cm-stats-3col { table-layout: fixed; }
.cm-stats-3col col.c-label { width: 46%; }
.cm-stats-3col col.c-guide { width: 24%; }
.cm-stats-3col col.c-seen { width: 30%; }
.cm-stats-3col th { width: auto; white-space: nowrap; }
.cm-stats-3col thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .65; font-weight: 600; }
.cm-stats-3col thead th:not(:first-child),
.cm-stats-3col td { text-align: right; }
.adm-inline-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.adm-token-input { flex: 1; font-family: ui-monospace, monospace; background: var(--field-bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.adm-form .adm-check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.adm-form .adm-check input { margin-top: 4px; }
.adm-form label:not(.adm-check) { display: block; margin-bottom: 10px; }
.adm-form select { background: var(--field-bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; margin-top: 4px; }
.adm-image-edit { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.adm-image-preview { width: 110px; height: auto; border-radius: 8px; border: 1px solid var(--line); }

/* ── Card page: charts below the details ─────────────────────────────── */
.cm-charts { display: grid; gap: 16px; margin-top: 16px; }
.cm-chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.cm-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cm-chart-head h2 { margin: 0; font-size: 1rem; }
.cm-chart-head .cm-muted { font-size: 12px; opacity: .6; }
.cm-chart-box { position: relative; height: 280px; }
.cm-charts .chart-nodata { opacity: .6; margin: 8px 0; }
.adm-queue { display: flex; flex-direction: column; gap: 10px; }
.adm-queue-info { font-size: 14px; }
.adm-inline { display: inline-flex; gap: 6px; align-items: center; }
.adm-select { background: var(--field-bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; }
