/* Updated CSS with main reset for Hero pages */
:root {
  color-scheme: dark;
  --color-background: #09090b;
  --color-background-alt: #18181b;
  --color-surface: #18181b;
  --color-surface-alt: #27272a;
  --color-border: #3f3f46;
  --color-border-strong: #52525b;
  --color-text: #fafafa;
  --color-muted: #a1a1aa;
  --color-accent: #60a5fa;
  --color-accent-dark: #3b82f6;
  --color-accent-soft: rgba(59, 130, 246, 0.22);
  --color-success: #22c55e;
  --color-success-soft: rgba(34, 197, 94, 0.18);
  --color-success-contrast: #bbf7d0;
  --color-danger: #f87171;
  --color-danger-soft: rgba(248, 113, 113, 0.2);
  --color-danger-contrast: #fee2e2;
  --color-info: #60a5fa;
  --color-info-soft: rgba(96, 165, 250, 0.2);
  --color-info-contrast: #e0f2fe;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.65);
  --shadow-card: 0 10px 32px rgba(0, 0, 0, 0.45);
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(
    180deg,
    var(--color-background) 0%,
    var(--color-background-alt, var(--color-background)) 100%
  );
  color: var(--color-text);
  display: flex;
  flex-direction: column;
}

body[data-theme="light"] {
  color-scheme: light;
  --color-background: #f5f6fb;
  --color-background-alt: #eef1f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f3fa;
  --color-border: #d9deeb;
  --color-border-strong: #c3c8d8;
  --color-text: #1f2937;
  --color-muted: #5b6472;
  --color-accent: #2563eb;
  --color-accent-dark: #1d4ed8;
  --color-accent-soft: #e6edff;
  --color-success: #16a34a;
  --color-success-soft: rgba(22, 163, 74, 0.12);
  --color-success-contrast: #14532d;
  --color-danger: #dc2626;
  --color-danger-soft: rgba(220, 38, 38, 0.12);
  --color-danger-contrast: #7f1d1d;
  --color-info: #2563eb;
  --color-info-soft: rgba(37, 99, 235, 0.12);
  --color-info-contrast: #1d4ed8;
  --shadow-soft: 0 18px 42px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 10px 28px rgba(15, 23, 42, 0.08);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --color-background: #09090b;
  --color-background-alt: #18181b;
  --color-surface: #18181b;
  --color-surface-alt: #27272a;
  --color-border: #3f3f46;
  --color-border-strong: #52525b;
  --color-text: #fafafa;
  --color-muted: #a1a1aa;
  --color-accent: #60a5fa;
  --color-accent-dark: #3b82f6;
  --color-accent-soft: rgba(59, 130, 246, 0.22);
  --color-success: #22c55e;
  --color-success-soft: rgba(34, 197, 94, 0.18);
  --color-success-contrast: #bbf7d0;
  --color-danger: #f87171;
  --color-danger-soft: rgba(248, 113, 113, 0.2);
  --color-danger-contrast: #fee2e2;
  --color-info: #60a5fa;
  --color-info-soft: rgba(96, 165, 250, 0.2);
  --color-info-contrast: #e0f2fe;
  --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.65);
  --shadow-card: 0 10px 32px rgba(0, 0, 0, 0.45);
}

body[data-theme="auto"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  body[data-theme="auto"],
  body:not([data-theme]) {
    color-scheme: light;
    --color-background: #f5f6fb;
    --color-background-alt: #eef1f9;
    --color-surface: #ffffff;
    --color-surface-alt: #f0f3fa;
    --color-border: #d9deeb;
    --color-border-strong: #c3c8d8;
    --color-text: #1f2937;
    --color-muted: #5b6472;
    --color-accent: #2563eb;
    --color-accent-dark: #1d4ed8;
    --color-accent-soft: #e6edff;
    --color-success: #16a34a;
    --color-success-soft: rgba(22, 163, 74, 0.12);
    --color-success-contrast: #14532d;
    --color-danger: #dc2626;
    --color-danger-soft: rgba(220, 38, 38, 0.12);
    --color-danger-contrast: #7f1d1d;
    --color-info: #2563eb;
    --color-info-soft: rgba(37, 99, 235, 0.12);
    --color-info-contrast: #1d4ed8;
    --shadow-soft: 0 18px 42px rgba(15, 23, 42, 0.12);
    --shadow-card: 0 10px 28px rgba(15, 23, 42, 0.08);
  }
}

main {
  flex: 1;
  width: calc(100% - 32px);
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  width: calc(100% - 32px);
  max-width: 100%;
  margin: 16px auto 0;
  padding: 16px 24px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.brand-subtitle {
  display: block;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 999px;
}

.app-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.app-nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-weight: 500;
}

.app-nav a.active,
.app-nav a:hover,
.app-nav a:focus-visible {
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-surface-alt);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.button.icon-only {
  padding: 0 14px;
  min-width: 44px;
  height: 100%;
}

.button.icon-only .button-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.button.primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

.button.secondary {
  background: var(--color-surface);
  color: var(--color-accent-dark);
  border-color: var(--color-accent);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  background: var(--color-accent-soft);
}

.button.inline {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.button.inline.danger {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: transparent;
}

.button.inline.danger:hover,
.button.inline.danger:focus-visible {
  background: rgba(220, 38, 38, 0.12);
}

.button.link {
  background: transparent;
  color: var(--color-accent-dark);
  border-color: transparent;
  padding: 0;
}

.ghost {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  font-size: 0.9rem;
  cursor: pointer;
}

.ghost:hover,
.ghost:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.theme-toggle span {
  line-height: 1;
}

.button-group {
  display: inline-flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.button-group .button {
  border-radius: 0;
  border-right-width: 0;
}

.button-group .button:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.button-group .button:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  border-right-width: 1px;
}

.button-group .button.is-active,
.button-group .button[aria-pressed="true"] {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  position: relative;
  z-index: 1;
}

.page-hero {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.page-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.page-hero p {
  margin: 0;
  color: var(--color-muted);
  max-width: 680px;
  line-height: 1.6;
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--color-accent-dark);
  font-weight: 600;
  margin-bottom: 8px;
}

.panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.collection-followup {
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--color-muted);
}

.collection-followup p {
  margin: 0;
  line-height: 1.6;
}

.empty-state {
  margin: 16px 0 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-muted);
  text-align: center;
  font-size: 0.95rem;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.alert--floating {
  position: fixed;
  top: 24px;
  right: 24px;
  width: min(420px, calc(100% - 48px));
  margin: 0;
  z-index: 2000;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-12px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 0ms linear 180ms;
}

.alert--visible {
  opacity: 1;
  visibility: visible;
}

.alert--floating.alert--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.alert[data-variant="success"] {
  border-color: transparent;
  background: var(--color-success-soft);
  color: var(--color-success-contrast);
}

.alert[data-variant="error"] {
  border-color: transparent;
  background: var(--color-danger-soft);
  color: var(--color-danger-contrast);
}

.alert[data-variant="info"] {
  border-color: transparent;
  background: var(--color-info-soft);
  color: var(--color-info-contrast);
}

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.collection-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}


.collection-table th,
.collection-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.collection-table th {
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-alt);
}

.collection-table input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #fff;
  font-size: 0.9rem;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-checkbox {
  text-align: center;
}

.table-checkbox input {
  width: 18px;
  height: 18px;
}

.portfolio-list {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.portfolio-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portfolio-card header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.portfolio-card header p {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.portfolio-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  font-size: 0.9rem;
}

.portfolio-card dt {
  font-weight: 600;
  color: var(--color-muted);
}

.portfolio-card dd {
  margin: 0;
}

.portfolio-card footer {
  margin-top: auto;
}

.add-card-form {
  display: grid;
  gap: 16px;
  max-width: 540px;
}

.add-card-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.add-card-form label {
  font-weight: 600;
}

.add-card-form-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.add-card-form-control {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.add-card-form input[type="text"],
.add-card-form input[type="number"],
.add-card-form input[type="password"],
.add-card-form input[type="email"],
.add-card-form input[type="url"],
.add-card-form select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 1rem;
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.add-card-form input[type="text"]:focus,
.add-card-form input[type="number"]:focus,
.add-card-form input[type="password"]:focus,
.add-card-form input[type="email"]:focus,
.add-card-form input[type="url"]:focus,
.add-card-form select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.add-card-form select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b6472' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.search-summary {
  margin: 16px 0 0;
  color: var(--color-muted);
}


.card-search-toolbar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.card-search-toolbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-search-toolbar-group--view {
  margin-left: auto;
  justify-content: flex-end;
}

.card-search-toolbar-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-muted);
  text-transform: uppercase;
}

.card-search-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.card-search-view-toggle button {
  border: 1px solid transparent;
  border-radius: calc(var(--radius-sm) - 2px);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--color-muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.card-search-view-toggle button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.card-search-view-toggle button:hover,
.card-search-view-toggle button:focus-visible {
  color: var(--color-accent);
}

.card-search-view-toggle button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-search-view-toggle button[aria-pressed="true"],
.card-search-view-toggle button.is-active {
  background: var(--color-surface);
  color: var(--color-accent);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
  border-color: var(--color-border);
}

.card-search-toolbar-group--sort label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.card-search-toolbar-group--sort select {
  padding: 8px 32px 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
  font-weight: 500;
  background-color: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b6472' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-search-toolbar-group--sort select:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.card-search-toolbar-group--sort select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-search-results {
  margin-top: 24px;
}

.card-search-pagination {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-search-pagination button {
  border: none;
  background: none;
  padding: 6px 12px;
  font: inherit;
  color: var(--color-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.card-search-pagination button:hover:not(:disabled),
.card-search-pagination button:focus-visible:not(:disabled) {
  color: var(--color-accent);
  background-color: var(--color-accent-soft);
}

.card-search-pagination button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-search-pagination button.is-active {
  color: var(--color-accent-dark);
  background-color: var(--color-accent-soft);
  cursor: default;
}

.card-search-pagination button:disabled {
  opacity: 0.5;
  cursor: default;
}

.card-search-results--list {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.card-search-results--grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (min-width: 1600px) {
  .card-search-results--grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) and (max-width: 1599px) {
  .card-search-results--grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .card-search-results--grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .card-search-results--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .card-search-results--grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.card-search-item {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-search-results--grid .card-search-item {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--color-surface-alt);
  box-shadow: var(--shadow-card);
  min-height: 100%;
  width: 100%;
  overflow: hidden;
}

.card-search-results--grid .card-search-item:hover,
.card-search-results--grid .card-search-item:focus-within {
  background: var(--color-surface);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

body[data-theme="dark"] .card-search-results--grid .card-search-item {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 32px rgba(8, 14, 26, 0.45);
}

body[data-theme="dark"] .card-search-results--grid .card-search-item:hover,
body[data-theme="dark"] .card-search-results--grid .card-search-item:focus-within {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 42px rgba(8, 14, 26, 0.55);
}

@media (prefers-color-scheme: dark) {
  body[data-theme="auto"] .card-search-results--grid .card-search-item,
  body:not([data-theme]) .card-search-results--grid .card-search-item {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 32px rgba(8, 14, 26, 0.45);
  }

  body[data-theme="auto"] .card-search-results--grid .card-search-item:hover,
  body[data-theme="auto"] .card-search-results--grid .card-search-item:focus-within,
  body:not([data-theme]) .card-search-results--grid .card-search-item:hover,
  body:not([data-theme]) .card-search-results--grid .card-search-item:focus-within {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 18px 42px rgba(8, 14, 26, 0.55);
  }
}

.card-search-results--list .card-search-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 6px;
  padding: 8px 12px;
  background: none;
  border: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
  z-index: 0;
}

.card-search-results--list .card-search-item:hover,
.card-search-results--list .card-search-item:focus-within {
  background: var(--color-surface-alt);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
  z-index: 5;
}

.card-search-list-row {
  display: grid;
  grid-template-columns: auto minmax(56px, auto) minmax(0, 1fr) minmax(88px, auto)
    minmax(120px, auto) minmax(140px, auto);
  grid-template-areas: "thumb set name number rarity price";
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
  width: 100%;
  grid-column: 1 / -1;
}

.card-search-list-thumb {
  grid-area: thumb;
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-background-alt), var(--color-surface));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.card-search-list-thumb[data-has-preview="true"] .card-search-thumbnail-link {
  cursor: pointer;
}

.card-search-list-thumb .card-search-thumbnail-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-search-list-thumb[data-has-preview="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  pointer-events: none;
}

.card-search-list-icon {
  width: 32px;
  height: 32px;
  color: var(--color-muted);
}

.card-search-list-icon-frame {
  fill: rgba(148, 163, 184, 0.12);
  stroke: currentColor;
  stroke-width: 2;
}

.card-search-list-icon-stripe {
  fill: currentColor;
  opacity: 0.32;
}

.card-search-list-preview {
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  width: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  background: var(--color-surface);
  transform: translateY(-50%) scale(0.96);
  transform-origin: left center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.card-search-list-preview img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: calc(var(--radius-sm) - 4px);
}

.card-search-list-thumb:hover .card-search-list-preview,
.card-search-list-thumb:focus .card-search-list-preview,
.card-search-list-thumb:focus-visible .card-search-list-preview,
.card-search-list-thumb:focus-within .card-search-list-preview {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  visibility: visible;
}

.card-search-list-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.card-search-list-name {
  grid-area: name;
  justify-self: start;
  text-align: left;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-search-list-set {
  grid-area: set;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  width: 56px;
  flex-shrink: 0;
}

.card-search-results--list .card-search-list-set {
  gap: 4px;
}

.card-search-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
  line-height: 1;
  min-height: 32px;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.card-search-badge--rarity {
  gap: 8px;
}

body[data-theme="dark"] .card-search-badge--rarity {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  body[data-theme="auto"] .card-search-badge--rarity,
  body:not([data-theme]) .card-search-badge--rarity {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}

.card-search-set-icon {
  width: 28px;
  height: 28px;
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}

.card-search-results--list .card-search-set-icon {
  width: 28px;
  height: 28px;
}

.card-search-set-fallback {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--color-muted-strong, var(--color-text));
  white-space: nowrap;
}

.card-search-list-number {
  grid-area: number;
  justify-self: end;
  text-align: right;
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.card-search-list-rarity {
  grid-area: rarity;
  justify-self: end;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.card-search-results--list .card-search-list-rarity {
  gap: 8px;
}

.card-search-list-price {
  grid-area: price;
  justify-self: end;
  text-align: right;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.card-search-list-price--empty {
  color: var(--color-muted);
  font-weight: 500;
}

.card-search-list-price-value {
  display: inline-block;
  min-width: 0;
  white-space: nowrap;
}

.card-search-results--list .card-search-list-price .card-search-form {
  display: flex;
  align-items: center;
}

.card-search-results--list .card-search-list-price .card-search-form .form-footer {
  margin-left: 0;
}

.card-search-results--grid .card-search-media {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  position: relative;
}

.card-search-thumbnail {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: linear-gradient(135deg, var(--color-background-alt), var(--color-surface));
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-search-results--grid .card-search-thumbnail {
  flex: 1;
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  aspect-ratio: unset;
}

.card-search-thumbnail-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}

.card-search-thumbnail-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-search-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-search-thumbnail-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  width: 100%;
  height: 100%;
}

/* Overlay for grid view - info over thumbnail */
.card-search-results--grid .card-search-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
  padding: 16px 12px 12px;
  pointer-events: none;
  z-index: 1;
}

.card-search-results--grid .card-search-overlay-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.card-search-results--grid .card-search-overlay .card-search-title-link {
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.card-search-results--grid .card-search-overlay .card-search-title-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.card-search-results--grid .card-search-overlay .card-search-info h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
}

.card-search-results--grid .card-search-overlay .card-search-info-meta {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.card-search-results--grid .card-search-overlay .card-search-info-divider {
  color: rgba(255, 255, 255, 0.6);
}

.card-search-results--grid .card-search-overlay .card-search-info-number {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.card-search-results--grid .card-search-overlay .card-search-price {
  color: white;
  font-size: 1.1rem;
  margin: 4px 0 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.card-search-results--grid .card-search-overlay .card-search-price-label {
  font-weight: 500;
  opacity: 0.9;
}

.card-search-results--grid .card-search-overlay .card-search-price-value {
  font-weight: 700;
  color: #fbbf24;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Set badges in overlay */
.card-search-results--grid .card-search-overlay .card-search-set-badges {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  gap: 12px;
}

.card-search-results--grid .card-search-overlay .card-search-set-code {
  color: #334155;
  text-shadow: none;
  font-weight: 700;
}

/* Icon styling - white background for visibility */
.card-search-results--grid .card-search-overlay .card-search-rarity-icon,
.card-search-results--grid .card-search-overlay .card-search-badge--set {
  background: white;
  border-radius: 4px;
  padding: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.card-search-results--grid .card-search-overlay .card-search-rarity-icon img,
.card-search-results--grid .card-search-overlay .card-search-set-icon {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  display: block;
}

.card-search-results--grid .card-search-overlay .card-search-rarity-icon-fallback {
  color: #334155;
  text-shadow: none;
  font-weight: 700;
}

/* Hide default info section in grid view (now in overlay) */
.card-search-results--grid .card-search-media + .card-search-info {
  display: none;
}

.card-quick-add {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-accent);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease,
    color 0.2s ease;
}

.card-quick-add span {
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 500;
}

.card-quick-add:hover,
.card-quick-add:focus-visible {
  background: var(--color-accent);
  color: #fff;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.28);
}

.card-quick-add:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-search-results--grid .card-quick-add {
  display: inline-flex;
  position: absolute;
  top: 12px;
  right: 12px;
}

.card-search-results--grid .card-quick-add:active {
  transform: translateY(0) scale(0.95);
}

/* Collection badge - shows item is in collection */
.card-collection-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
  border: 2px solid white;
  cursor: default;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-collection-badge:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5), 0 3px 6px rgba(0, 0, 0, 0.25);
}

.card-collection-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.card-collection-badge span {
  line-height: 1;
  min-width: 16px;
  text-align: center;
}

/* Hide quick-add button when item is in collection */
.card-search-item:has(.card-collection-badge) .card-quick-add {
  display: none;
}

.card-search-set {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  width: 100%;
}

.card-search-set-badges {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 0;
  background: var(--color-surface-alt);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

body[data-theme="dark"] .card-search-set-badges {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card-search-set-badges .card-search-badge {
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

.card-search-set-code {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--color-muted-strong, var(--color-text));
  white-space: nowrap;
  line-height: 1;
}

.card-search-results--grid .card-search-set {
  text-align: center;
}

.card-search-set-fallback {
  text-align: center;
}

.card-search-rarity-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.card-search-results--list .card-search-rarity-icon {
  width: 28px;
  height: 28px;
}

.card-search-rarity-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-search-rarity-icon-fallback {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-search-results--list .card-search-rarity-icon-fallback {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.card-search-info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-search-results--list .card-search-info {
  gap: 12px;
}

.card-search-results--grid .card-search-info {
  gap: 6px;
}

.card-search-info h3 {
  margin: 0 0 6px;
}

.card-search-title-link {
  color: inherit;
  text-decoration: none;
}

.card-search-title-link:hover,
.card-search-title-link:focus-visible {
  text-decoration: underline;
}

.card-search-info p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.card-search-price {
  font-weight: 600;
  color: var(--color-accent-dark);
}

.card-search-info-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.card-search-info-divider {
  color: var(--color-muted);
}

.card-search-info-number {
  color: var(--color-text);
  font-weight: 600;
}

.card-search-inline-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 24px;
  align-items: start;
}

.card-search-inline-field {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--color-muted);
  min-width: 0;
}

.card-search-inline-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

.card-search-inline-value {
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.card-search-meta {
  margin-top: 4px;
  font-size: 0.85rem;
}


.card-search-form {
  display: none;
}

.card-search-results--list .card-quick-add {
  display: inline-flex;
}


@media (max-width: 860px) {
  .card-search-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .card-search-toolbar-group {
    justify-content: space-between;
    width: 100%;
  }

  .card-search-toolbar-group--view {
    margin-left: 0;
  }

  .card-search-toolbar-group--sort {
    gap: 8px;
  }

  .card-search-toolbar-group--sort select {
    flex: 1;
  }
}

@media (max-width: 720px) {
  .card-search-results--list .card-search-item {
    row-gap: 12px;
  }

  .card-search-list-row {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "thumb name"
      "set name"
      "number rarity"
      "price price";
    row-gap: 12px;
  }

  .card-search-list-set {
    justify-self: start;
  }

  .card-search-list-name,
  .card-search-list-number,
  .card-search-list-rarity,
  .card-search-list-price {
    justify-self: start;
    text-align: left;
  }

  .card-search-list-rarity {
    justify-content: flex-start;
  }

  .card-search-list-price {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-search-inline-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

.checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 500;
}

.card-detail-hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card-detail-main {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
}

.card-detail-image {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-detail-placeholder {
  font-size: 3rem;
  color: var(--color-muted);
}

.card-detail-info h1 {
  margin: 0 0 12px;
}

.card-detail-set {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 1rem;
  color: var(--color-muted);
  margin-bottom: 16px;
}

.card-detail-set-visual {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

.card-detail-set-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
}

.card-detail-rarity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.card-detail-set-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.card-detail-rarity-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.card-detail-rarity-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--color-text);
  text-transform: uppercase;
}

.card-detail-set-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--color-text);
}

.card-detail-set-code {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.card-detail-price {
  margin-bottom: 16px;
}

.card-detail-era,
.card-detail-artist {
  margin: 0 0 12px;
  color: var(--color-muted);
}

.card-detail-description {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-detail-description-content {
  white-space: pre-line;
  line-height: 1.6;
  color: var(--color-text);
}

.card-detail-description-meta {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.card-detail-history {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-detail-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-price-history-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-price-history-button {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-muted);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.card-price-history-button:hover:not(:disabled),
.card-price-history-button:focus-visible:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.card-price-history-button.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.card-price-history-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.card-price-chart-container {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-price-chart-container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
}

.card-price-chart-container.is-empty::before {
  background: var(--color-surface);
  opacity: 0.8;
}

.card-price-chart-figure {
  width: 100%;
  height: 220px;
  display: block;
}

.card-price-chart-area {
  opacity: 0.45;
}

.card-price-chart-line {
  stroke: var(--color-accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-price-chart-marker {
  fill: var(--color-surface);
  stroke: var(--color-accent);
  stroke-width: 1.4;
}

.card-price-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-muted);
  padding: 24px;
  z-index: 1;
}

.card-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.card-detail-meta dt {
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.card-detail-meta dd {
  margin: 0;
}

.card-detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.card-detail-related .panel-header p {
  max-width: 520px;
}

.related-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Selection Grid for Modal */
.selection-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.selection-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
}

.selection-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 100px;
}

.selection-item:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.selection-item.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.selection-item-logo {
  width: 100%;
  height: 50px;
  object-fit: contain;
  margin-bottom: 8px;
}

.selection-item-placeholder {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-alt);
  border-radius: 50%;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--color-muted);
}

.selection-item-name {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
  word-break: break-word;
}

.selection-item-meta {
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-top: 4px;
}

/* Artist list specific overrides */
.selection-grid.artists {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.selection-grid.artists .selection-item {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  gap: 10px;
  min-height: 60px;
  padding: 8px 12px;
}

.selection-grid.artists .selection-item-placeholder {
  margin-bottom: 0;
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.selection-grid.artists .selection-item-info {
  display: flex;
  flex-direction: column;
}

/* Dark theme adjustments */
body[data-theme="dark"] .selection-search {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .selection-grid {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .selection-item {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .selection-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-accent);
}

body[data-theme="dark"] .selection-item.selected {
  background: rgba(99, 102, 241, 0.2);
}

/* Styles for collection edit view */
.collection-edit-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.collection-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.collection-edit-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.collection-edit-field input,
.quantity-control {
  width: 100%;
}

.collection-edit-field input[type="number"],
.collection-edit-field input[type="text"] {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.collection-edit-field input[type="number"]:focus,
.collection-edit-field input[type="text"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.collection-edit-field input[type="number"]::placeholder {
  color: var(--color-muted);
  opacity: 0.6;
}

.quantity-control {
  display: flex;
  align-items: center;
}

.quantity-control .quantity-input {
  text-align: center;
  border-left: none;
  border-right: none;
  border-radius: 0;
  z-index: 1;
  padding: 10px 8px;
  font-size: 0.9rem;
  background-color: var(--color-surface);
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  min-width: 50px;
  -moz-appearance: textfield;
}

.quantity-control .quantity-input::-webkit-outer-spin-button,
.quantity-control .quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-control .quantity-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  position: relative;
  z-index: 2;
}

.quantity-control .quantity-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  z-index: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-control .quantity-btn:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-accent);
}

.quantity-control .quantity-btn:active {
  background: var(--color-border);
}

.quantity-control .quantity-btn--minus {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.quantity-control .quantity-btn--plus {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.collection-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.collection-edit-actions .button {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.collection-edit-actions .button.danger {
  background: transparent;
  border-color: var(--color-danger, #ef4444);
  color: var(--color-danger, #ef4444);
}

.collection-edit-actions .button.danger:hover {
  background: var(--color-danger, #ef4444);
  color: white;
}

.related-card {
  display: grid;
  grid-template-columns: minmax(72px, 88px) 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: inherit;
  text-decoration: none;
  align-items: center;
}

.related-card:hover,
.related-card:focus-visible {
  border-color: var(--color-accent);
}

.related-card-media {
  margin: 0;
}

.related-card-thumbnail {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: linear-gradient(135deg, var(--color-background-alt), var(--color-surface));
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-card-thumbnail-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.related-card-thumbnail-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.related-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.related-card-name {
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-card-meta {
  font-size: 0.85rem;
  color: var(--color-muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-empty {
  margin-top: 12px;
  color: var(--color-muted);
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  align-items: center;
}

.auth-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
}

.auth-copy p {
  margin: 0 0 12px;
  color: var(--color-muted);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 12px;
}

.feature-list li {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--color-muted);
}

.feature-list span {
  font-weight: 600;
  color: var(--color-accent-dark);
}

.form-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.form-card h2 {
  margin: 0;
}

.form-card p {
  margin: 0;
  color: var(--color-muted);
}

.form-card label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--color-text);
}

.form-card input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 1rem;
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.form-card input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-card input::placeholder {
  color: var(--color-muted);
  opacity: 0.6;
}

.form-card input:disabled {
  background-color: var(--color-surface-alt);
  color: var(--color-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.inline-link {
  color: var(--color-accent);
  font-weight: 600;
}

.home-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  align-items: center;
}

.home-hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 2.6vw, 2.6rem);
}

.home-hero-copy p {
  margin: 0 0 20px;
  color: var(--color-muted);
  line-height: 1.6;
}

.home-hero-cards {
  display: grid;
  gap: 16px;
}

.home-hero-cards article {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

.home-hero-cards h3 {
  margin: 0 0 8px;
}

/* Portfolio value card for logged-in users on homepage */
.home-hero-stats {
  display: flex;
  align-items: stretch;
}

.portfolio-value-card {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  border: none;
  box-shadow: var(--shadow-soft);
  color: #fff;
  text-align: center;
  min-width: 280px;
}

.portfolio-value-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
}

.portfolio-value {
  margin: 0 0 8px;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
}

.portfolio-value span {
  font-size: 1.2rem;
  font-weight: 500;
  opacity: 0.85;
}

.portfolio-meta {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

.home-panel {
  display: grid;
  gap: 16px;
}

.home-news-grid,
.home-sets-grid,
.home-legal {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.home-news-card,
.home-legal article {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 16px;
  background: var(--color-surface-alt);
}

.home-news-tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.horizontal-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  overflow-x: auto;
  gap: 16px;
  padding-bottom: 16px;
}

.home-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--color-background-secondary, #f5f5f5);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.stat-card h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary, #3b82f6);
}

.stat-label {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.home-trends {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.home-trends-column h3 {
  margin: 0 0 8px;
}

.home-trends-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.home-trends-column li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.trend-up {
  color: var(--color-success);
  font-weight: 600;
}

.trend-down {
  color: var(--color-danger);
  font-weight: 600;
}

.legal-content h2 {
  margin-top: 24px;
  font-size: 1.1rem;
}

.legal-content p {
  color: var(--color-muted);
  line-height: 1.6;
}

.settings-panel {
  display: grid;
  gap: 24px;
}

.settings-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.settings-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--color-surface-alt);
  display: grid;
  gap: 16px;
}

.settings-card h2 {
  margin: 0;
}

.settings-card p {
  margin: 0;
  color: var(--color-muted);
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-form label,
.settings-form fieldset {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text);
}

.settings-form input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-form input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.settings-form input::placeholder {
  color: var(--color-muted);
  opacity: 0.6;
}

.settings-form input:disabled {
  background-color: var(--color-surface-alt);
  color: var(--color-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.avatar-selector {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
}

.avatar-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.avatar-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.avatar-option input {
  margin: 0;
}

.avatar-option-visual {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--color-muted);
  background-color: var(--color-surface-alt);
}

.app-footer {
  margin: 48px 0 32px;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  display: grid;
  gap: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-accent);
}

@media (max-width: 900px) {
  .app-header {
    grid-template-columns: auto auto;
    grid-template-areas: "brand actions" "nav nav";
  }

  .brand {
    grid-area: brand;
  }

  .header-actions {
    grid-area: actions;
  }

  .app-nav {
    grid-area: nav;
    flex-direction: column;
    align-items: stretch;
    background: var(--color-surface-alt);
    padding: 12px;
    border-radius: var(--radius-md);
    display: none;
  }

  .app-nav[data-open="true"] {
    display: flex;
  }

  .nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  main {
    gap: 24px;
    padding-top: 24px;
  }

  .page-hero,
  .panel {
    padding: 16px;
  }

  .card-detail-main {
    grid-template-columns: 1fr;
  }

  .card-detail-history-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card-price-history-controls {
    justify-content: flex-start;
  }

  .collection-table {
    min-width: 600px;
  }
}

/* Collection Statistics */
.collection-stats {
  margin-bottom: 24px;
}

/* Portfolio-specific styles */
.card-search-quantity-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--color-accent);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 5;
  pointer-events: none;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--color-surface-alt);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.card-search-price-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.card-search-price-info .card-search-price {
  font-size: 0.85rem;
  color: var(--color-text);
}

.card-search-variants {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Collection Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-card {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--color-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.stat-value--positive {
  color: var(--color-success, #22c55e);
}

.stat-value--negative {
  color: var(--color-danger, #ef4444);
}

.stat-card--highlight {
  background: linear-gradient(135deg, var(--color-surface-alt) 0%, var(--color-primary-light, rgba(37, 99, 235, 0.1)) 100%);
  border-color: var(--color-primary);
}

.stat-card--highlight .stat-value {
  color: var(--color-primary);
}

.stat-card--small {
  padding: 12px 16px;
}

.stat-card--small .stat-value {
  font-size: 1.25rem;
}

.stat-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.stat-breakdown span {
  display: flex;
  justify-content: space-between;
  color: var(--color-muted);
}

.stat-breakdown small {
  font-weight: 500;
}

.stats-purchase-details {
  margin-top: 16px;
}

.stats-purchase-details summary {
  cursor: pointer;
  color: var(--color-muted);
  font-size: 0.875rem;
  padding: 8px 0;
  user-select: none;
}

.stats-purchase-details summary:hover {
  color: var(--color-text);
}

.stats-grid--secondary {
  margin-top: 12px;
}

.stats-grid--secondary .stat-card {
  background: var(--color-surface);
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 400px;
  margin-top: 16px;
  padding: 16px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.chart-container canvas {
  max-height: 100%;
}

@media (max-width: 768px) {
  .chart-container {
    height: 300px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
}

/* Collection grid view styles */
.card-collection-item {
  position: relative;
}

.card-collection-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.card-collection-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.quantity-btn:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
  transform: scale(1.1);
}

.quantity-btn:active {
  transform: scale(0.95);
}

.quantity-input {
  width: 60px;
  height: 32px;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 600;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quantity-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.card-collection-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #dc2626;
  background: white;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-collection-delete:hover {
  background: #dc2626;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.card-collection-delete:active {
  transform: translateY(0);
}

.card-collection-delete svg {
  width: 18px;
  height: 18px;
}

.card-collection-price {
  margin-top: 8px;
  padding: 8px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
}

.card-collection-price-label {
  font-size: 0.875rem;
  color: var(--color-muted);
  font-weight: 500;
}

.card-collection-price-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
}

body[data-theme="dark"] .quantity-btn {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .quantity-control .quantity-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .quantity-control .quantity-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--color-accent);
}

body[data-theme="dark"] .quantity-control .quantity-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .collection-edit-controls {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .collection-edit-field input[type="number"],
body[data-theme="dark"] .collection-edit-field input[type="text"] {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .collection-edit-field input:focus {
  border-color: var(--color-accent);
}

body[data-theme="dark"] .card-collection-delete {
  background: rgba(220, 38, 38, 0.1);
  border-color: #dc2626;
}

/* Collection view modes */
[data-collection-mode="clean"] .card-collection-item {
  padding: 0;
  overflow: hidden;
}

[data-collection-mode="clean"] .card-search-media {
  position: relative;
}

[data-collection-mode="clean"] .card-search-thumbnail {
  border-radius: 0;
  border: none;
}

[data-collection-mode="clean"] .card-search-info,
[data-collection-mode="clean"] .card-collection-controls {
  display: none;
}

/* Info mode uses gradient overlay from search */
[data-collection-mode="info"] .card-collection-item {
  padding: 0;
  overflow: hidden;
}

[data-collection-mode="info"] .card-search-media {
  flex: 1;
  position: relative;
}

[data-collection-mode="info"] .card-search-thumbnail {
  flex: 1;
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  aspect-ratio: unset;
}

[data-collection-mode="info"] .card-search-info,
[data-collection-mode="info"] .card-collection-controls {
  display: none;
}

/* Edit mode - default styling already applied */
[data-collection-mode="edit"] .card-collection-item {
  padding: 0;
}

[data-collection-mode="edit"] .card-search-media {
  padding: 16px 16px 0;
}

[data-collection-mode="edit"] .card-search-info {
  padding: 0 16px;
}

[data-collection-mode="edit"] .card-collection-controls {
  padding: 0 16px 16px;
}
/* ============================================
   MODAL / DIALOG SYSTEM
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  transform: scale(1);
  transition: transform 0.2s ease;
}

.modal-overlay.hidden .modal {
  transform: scale(0.95);
}

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-text);
}

.modal-body {
  padding: 24px;
  color: var(--color-text);
  line-height: 1.6;
}

.modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer .button {
  min-width: 100px;
}

/* Danger modal variant */
.modal.modal--danger .modal-header {
  border-bottom-color: var(--color-danger);
}

.modal.modal--danger .modal-header h2 {
  color: var(--color-danger);
}

/* Dark theme adjustments */
body[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

body[data-theme="dark"] .modal {
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}



.form-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-control--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.form-control--checkbox input {
    margin: 0;
    width: 16px;
    height: 16px;
}



.chart-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* ============================================
   USER COLLECTIONS MODULE
   ============================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
}

/* Collections Grid */
.collections-container {
  min-height: 300px;
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.collection-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.collection-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}

.collection-cover {
  height: 140px;
  background: linear-gradient(135deg, var(--color-accent-soft) 0%, var(--color-surface-alt) 100%);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collection-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.collection-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collection-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  width: fit-content;
}

.collection-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.collection-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.collection-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.progress-bar {
  height: 8px;
  background: var(--color-surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar.large {
  height: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-success) 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-muted);
}

.empty-icon {
  font-size: 4rem;
  opacity: 0.5;
  margin-bottom: 16px;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--color-text);
}

.empty-state p {
  margin: 0 0 24px;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal Enhancements for Collections */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1.5rem;
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.modal-header {
  position: relative;
}

/* Radio Group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-group.horizontal {
  flex-direction: row;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.radio-option input {
  margin-top: 4px;
}

.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.radio-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.radio-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-text strong {
  font-weight: 600;
  color: var(--color-text);
}

.radio-text small {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Collection Detail Page */
.collection-detail-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.collection-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.back-link {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.back-link:hover {
  color: var(--color-accent);
}

.collection-title-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.collection-title-section h1 {
  margin: 0;
}

.collection-actions {
  margin-left: auto;
}

/* Stats Bar */
.collection-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-stat {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.progress-stat .progress-bar {
  flex: 1;
}

.progress-stat .stat-value {
  font-size: 1.2rem;
  white-space: nowrap;
}

/* Filters */
.collection-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.filter-group select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.view-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.view-btn:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.view-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

/* Cards Grid */
.cards-container {
  min-height: 400px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Card Thumbnail */
.card-thumbnail {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid transparent;
}

.card-thumbnail:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-card);
}

.card-thumbnail.owned {
  border-color: var(--color-success);
  opacity: 1;
}

.card-thumbnail.missing {
  opacity: 0.5;
  filter: grayscale(40%);
}

.card-thumbnail.missing:hover {
  opacity: 0.8;
  filter: grayscale(0%);
}

.card-image-wrapper {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--color-surface-alt);
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-muted);
  background: linear-gradient(135deg, var(--color-surface-alt), var(--color-background));
}

.ownership-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-muted);
  transition: all 0.2s ease;
}

.ownership-badge.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.quantity-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.card-info {
  padding: 8px;
  background: var(--color-surface);
}

.card-number {
  display: block;
  font-size: 0.7rem;
  color: var(--color-muted);
  font-weight: 600;
}

.card-name {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Overlay for Collection Detail */
.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
  padding: 40px 10px 10px 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.card-thumbnail:hover .card-overlay {
  opacity: 1;
}

.card-overlay-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-overlay-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-overlay-number {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.card-overlay-rarity {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  padding: 2px 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  width: fit-content;
}

.card-overlay-price {
  font-size: 0.75rem;
  color: #4ade80;
  font-weight: 700;
}

.card-overlay-set {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.page-info {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* Modal Small */
.modal.modal-small {
  max-width: 400px;
}

/* Collection Value Chart Section */
.collection-value-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 32px 24px;
  margin-bottom: 24px;
}

.value-header-row {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .value-header-row {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.value-header-left {
  flex: 1;
}

.value-header-title {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin: 0 0 8px 0;
}

.value-display-main {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.value-amount-large {
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--color-success);
  line-height: 1;
}

@media (min-width: 768px) {
  .value-amount-large {
    font-size: 3rem;
  }
}

.value-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.value-change-badge.positive {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.value-change-badge.negative {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.value-change-badge svg {
  flex-shrink: 0;
}

.chart-period-selector {
  display: flex;
  background: var(--color-surface-alt);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  gap: 2px;
  align-self: flex-start;
}

@media (min-width: 768px) {
  .chart-period-selector {
    align-self: flex-end;
  }
}

.period-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-btn:hover {
  color: var(--color-text);
}

.period-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.value-chart-container {
  width: 100%;
  height: 256px;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}

.chart-grid-lines {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.grid-line {
  width: 100%;
  height: 1px;
  background: var(--color-border);
  opacity: 0.3;
  border-top: 1px dashed var(--color-border);
}

.value-chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Collection Value Panel */
.collection-value-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px;
}

.value-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.value-panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.value-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.value-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}

.value-stat.owned {
  border-left: 4px solid var(--color-success);
}

.value-stat.missing {
  border-left: 4px solid var(--color-danger);
}

.value-stat.total {
  border-left: 4px solid var(--color-accent);
}

.value-stat.avg {
  border-left: 4px solid var(--color-muted);
}

.value-stat-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-muted);
  flex-shrink: 0;
}

.value-stat.owned .value-stat-icon {
  color: var(--color-success);
}

.value-stat.missing .value-stat-icon {
  color: var(--color-danger);
}

.value-stat.total .value-stat-icon {
  color: var(--color-accent);
}

.value-stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.value-stat-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

/* Top Cards Section */
.top-cards-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.top-card-item {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}

.top-card-item h4 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--color-muted);
  font-weight: 500;
}

.top-card-content {
  min-height: 60px;
}

.top-card-placeholder {
  color: var(--color-muted);
  font-style: italic;
}

.top-card-mini {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-card-mini img {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.top-card-placeholder-img {
  width: 50px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-muted);
}

.top-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.top-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-card-number {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.top-card-price {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-accent-dark);
}

.value-note {
  text-align: center;
  color: var(--color-muted);
}

/* Responsive adjustments */
@media (max-width: 720px) {
  .collection-stats-bar {
    flex-direction: column;
  }
  
  .progress-stat {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }
  
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .collection-actions {
    margin-left: 0;
  }
  
  .value-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .top-cards-section {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   SETS BROWSING PAGE
   ============================================ */

.sets-search {
  flex: 1;
  max-width: 300px;
}

.sets-search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sets-search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.set-card {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.set-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.set-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.set-card-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.set-card-code {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.set-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.set-card-series {
  font-weight: 500;
}

.set-card-year::before,
.set-card-count::before {
  content: "•";
  margin-right: 8px;
  opacity: 0.5;
}

.set-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.set-card-actions .button {
  flex: 1;
  text-align: center;
  justify-content: center;
}

/* ============================================
   ADD CARD MODAL
   ============================================ */

.modal-large {
  max-width: 700px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-large .modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-card-form {
  margin-bottom: 16px;
}

.search-input-group {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-group input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.search-input-group input[type="text"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.search-results-container {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.search-result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease;
}

.search-result-card:hover {
  border-color: var(--color-accent);
}

.search-result-card.added {
  opacity: 0.6;
  background: var(--color-success-soft);
  border-color: var(--color-success);
}

.search-result-image {
  width: 60px;
  height: 84px;
  flex-shrink: 0;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-border);
}

.search-result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-muted);
  font-size: 0.8rem;
}

.owned-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--color-success);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-set {
  display: block;
  font-size: 0.8rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-to-collection-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.search-loading,
.search-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  color: var(--color-muted);
}

.search-empty p {
  text-align: center;
  margin: 0;
}

/* ============================================
   COLLECTION WIZARD MODAL
   ============================================ */

.modal-wizard {
  max-width: 800px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-wizard .modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}

.wizard-step .form-actions {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

/* Set search bar */
.set-search-bar {
  margin-bottom: 16px;
  flex-shrink: 0;
}

.set-search-bar input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.set-search-bar input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* Sets by era container */
.sets-by-era {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

.era-section {
  margin-bottom: 24px;
}

.era-section:last-child {
  margin-bottom: 0;
}

.era-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-accent-soft);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.era-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
}

.era-count {
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* Sets grid */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.set-selection-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--color-surface-alt);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.set-selection-card:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  transform: translateY(-2px);
}

.set-card-logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.set-card-logo img {
  max-height: 60px;
  max-width: 160px;
  object-fit: contain;
}

.set-card-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--color-muted);
}

.set-symbol-small {
  height: 40px;
  width: auto;
}

.set-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.set-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.2;
}

.set-card-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* Set preview header */
.set-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.set-preview-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.set-preview-logo {
  height: 50px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.set-preview-info h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.set-preview-info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.artist-icon-large {
  font-size: 2.5rem;
}

.set-type-selector {
  display: flex;
  gap: 12px;
}

.set-type-selector .radio-option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.set-type-selector .radio-option.compact .radio-label {
  padding: 6px 10px;
}

.set-type-selector .radio-option.compact .radio-label small {
  font-size: 0.7rem;
}

/* Set preview cards */
.set-preview-cards {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
  min-height: 150px;
  max-height: 300px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.preview-card {
  position: relative;
  aspect-ratio: 0.714;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-border);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-card--missing {
  opacity: 0.35;
  filter: grayscale(0.5);
}

.preview-card:hover {
  transform: scale(1.05);
  z-index: 1;
}

.preview-card-number {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Artists list */
.artists-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-bottom: 16px;
}

.artist-selection-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.artist-selection-item:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.artist-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.artist-name {
  flex: 1;
  font-weight: 600;
  color: var(--color-text);
}

.artist-count {
  font-size: 0.85rem;
  color: var(--color-muted);
  flex-shrink: 0;
}

/* Loading and error states */
.wizard-step .loading-state,
.wizard-step .error-state,
.wizard-step .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  color: var(--color-muted);
  gap: 12px;
}

.wizard-step .error-state {
  color: var(--color-danger);
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .modal-wizard {
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  
  .sets-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .set-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .set-type-selector {
    width: 100%;
  }
  
  .set-type-selector .radio-option {
    flex: 1;
  }
  
  .set-preview-cards {
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  }
}


@keyframes scan {
  0% { top: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ============================================
   VIEW TRANSITIONS & ANIMATIONS
   ============================================ */

/* Enable View Transitions for same-origin navigations */
@view-transition {
  navigation: auto;
}

/* Keep the header stable during transitions */
header.sticky {
  view-transition-name: app-header;
}

/* Fade animation for content */
::view-transition-old(root) {
  animation: fade-out 0.2s ease-out forwards;
}

::view-transition-new(root) {
  animation: fade-in 0.2s ease-out forwards;
}

@keyframes fade-out {
  to { opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
}

/* Reset main padding/width for pages with Hero sections to allow full-bleed */
main:has(.dashboard-hero),
main:has(.collection-hero),
main:has(.my-collections-hero),
main:has(.search-hero),
main:has(.price-check-hero),
main:has(.settings-hero),
main:has(.sets-hero),
main:has(.set-hero) {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: block;
}

/* Search Button in Input */
.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.search-button-lg {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  padding: 0 24px;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.search-button-lg:hover {
  background: var(--color-accent-dark);
}

.search-button-lg i {
  width: 20px;
  height: 20px;
}

/* Reset main padding/width for pages with Hero sections to allow full-bleed */
main:has(.dashboard-hero),
main:has(.collection-hero),
main:has(.my-collections-hero),
main:has(.search-hero),
main:has(.price-check-hero),
main:has(.settings-hero),
main:has(.sets-hero),
main:has(.set-hero) {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: block;
  gap: 0;
}

/* Search Button in Input */
.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.search-button-lg {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  padding: 0 24px;
  background: #f43f5e; /* Rose-500 */
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  box-shadow: 0 4px 6px -1px rgba(244, 63, 94, 0.2);
}

.search-button-lg:hover {
  background: #e11d48; /* Rose-600 */
}

.search-button-lg i {
  width: 20px;
  height: 20px;
}
