/*
 * Design System — SSR Price Guide Pages
 *
 * shadcn-style semantic token pairs (background / foreground).
 * Dark mode: swap :root values in .dark or prefers-color-scheme.
 */

/*
 * TODO: Replace tailwind.min.css with this standalone Preflight reset
 * once all edge-case interactions are verified (form elements,
 * placeholders, date pickers, etc.). The reset rules are preserved
 * below so the switchover is a one-line uncomment.
 *
 * See: _backend/src/templates/pages/static/tailwind.css @layer base
 */

/* ── Tokens ──────────────────────────────────────────────── */

:root {
  /* Page shell */
  --background: #ffffff;
  --foreground: #111827;

  /* Elevated surfaces (cards, panels) */
  --card: #ffffff;
  --card-foreground: #111827;

  /* Floating surfaces (popovers, dropdowns) */
  --popover: #ffffff;
  --popover-foreground: #111827;

  /* High-emphasis actions & brand */
  --primary: var(--color-primary-600);
  --primary-hover: var(--color-primary-500);
  --primary-foreground: #ffffff;
  --primary-light: var(--color-primary-100);
  --primary-text: var(--color-primary-900, #4c1d95);
  --primary-dark: var(--color-primary-950);

  /* Lower-emphasis actions */
  --secondary: #f3f4f6;
  --secondary-foreground: #374151;

  /* Subtle / muted content */
  --muted: #f9fafb;
  --muted-foreground: #374151;

  /* Interactive hover/focus states */
  --accent: #f3f4f6;
  --accent-foreground: #111827;

  /* Destructive actions */
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;

  /* Borders & separators */
  --border: #e5e7eb;
  --input: #d1d5db;

  /* Focus rings */
  --ring: var(--color-primary-300);

  /* Feedback */
  --gain-up: #2563eb;
  --gain-down: #dc2626;
  --gain-flat: #9ca3af;
  --error: #f87171;
  --success: #34d399;

  /* Typography scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 3rem;

  /* Layout */
  --nav-height-sm: 3rem;
  --nav-height: 4rem;
  --content-max: 80rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  /* Unified field tokens (inputs, buttons, selects, toggles) */
  --field-height: 2.25rem;
  --field-px: 0.75rem;
  --field-py: 0.375rem;
  --field-font: 13px;
  --field-radius: var(--radius);
  --field-border: var(--input);
  --field-focus-ring: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);

  /* Numeric display — Inter with tabular figures for aligned columns */
  --font-numeric: "Inter", ui-sans-serif, system-ui, sans-serif;

  /* Logo */
  --logo-fill: #f7f3fd;
  --logo-color: var(--color-primary-900, #4c1d95);
}

/* ── Dark mode ──────────────────────────────────────────── */

/* Dark mode — inspired by tentacle admin / linear.app.
   Near-black surfaces with a subtle cool tint, not flat gray. */
.dark,
[data-theme="dark"] {
  --background: lch(1.8% 0 272);
  --foreground: lch(97% 0.5 272);
  --card: lch(4.5% 0.75 272);
  --card-foreground: lch(97% 0.5 272);
  --popover: lch(6% 0.75 272);
  --popover-foreground: lch(97% 0.5 272);
  --secondary: lch(10% 1 272);
  --secondary-foreground: lch(80% 1 272);
  --muted: lch(4.5% 0.75 272);
  --muted-foreground: lch(55% 1 272);
  --accent: lch(10% 1 272);
  --accent-foreground: lch(97% 0.5 272);
  --destructive: #dc2626;
  --destructive-foreground: #fafafa;
  --border: lch(11% 2.91 272);
  --input: lch(16% 2 272);
  --ring: var(--color-primary-400);
  --primary-text: var(--color-primary-300);
  --primary-light: lch(10% 3 272);

  /* Dark logo: outline-only, no fill */
  --logo-fill: transparent;
  --logo-color: var(--muted-foreground);
}

/* ── Responsive utilities ────────────────────────────────── */

.sm-up {
  display: none;
}
@media (min-width: 640px) {
  .sm-up {
    display: inline;
  }
}
.md-up {
  display: none;
}
@media (min-width: 768px) {
  .md-up {
    display: inline;
  }
}
@media (min-width: 768px) {
  th.md-up,
  td.md-up {
    display: table-cell;
  }
}
.lg-up {
  display: none;
}
@media (min-width: 1024px) {
  .lg-up {
    display: inline;
  }
}

/* ── Visibility ──────────────────────────────────────────── */

[data-hidden] {
  display: none !important;
}

/* ── Base ────────────────────────────────────────────────── */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: var(--text-sm);
  line-height: 1.5;
  background-color: var(--background);
  color: var(--foreground);
}

/* ── Custom checkbox/radio ──────────────────────────────── */

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1.5px solid var(--muted-foreground);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background-color 100ms,
    border-color 100ms;
}
input[type="radio"] {
  border-radius: 50%;
}
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--primary);
  border-color: var(--primary-hover);
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
  background-size: 100%;
  background-position: center;
  background-repeat: no-repeat;
}
input[type="checkbox"]:hover:not(:checked),
input[type="radio"]:hover:not(:checked) {
  border-color: var(--muted-foreground);
}

main {
  flex: 1;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
}

/* ── Typography classes ──────────────────────────────────── */

/* Overline — small uppercase label for sections, table heads, meta */
.overline {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

/* Title — tight-tracked semibold heading for sections */
.title-lg {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
}
.title-md {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
}
.title-sm {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

/* Body — standard content text */
.body-sm {
  font-size: var(--text-sm);
  color: var(--secondary-foreground);
  line-height: 1.625;
}
.body-xs {
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

/* ── Mobile bottom nav ──────────────────────────────────── */

.mobile-nav-wrap {
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
@media (min-width: 768px) {
  .mobile-nav-wrap {
    display: none;
  }
}

.mobile-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3.5rem;
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--muted) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
}

/* ── Toast container ────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
@media (min-width: 768px) {
  .toast-container {
    bottom: 1.5rem;
  }
}

*,
::after,
::before,
::backdrop {
  border-color: var(--border);
}

::selection {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

/* ── Unified focus ring ─────────────────────────────────── */

:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--ring);
}

/* Inputs use a softer inner glow instead of double ring */
.input:focus,
.search-input:focus,
.code-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent);
}

/* ── Site Nav ────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.site-nav-inner {
  display: flex;
  align-items: center;
  height: var(--nav-height-sm);
  max-width: var(--content-max);
  margin: 0 auto;
  gap: 0.25rem;
  padding: 0 0.5rem;
}
@media (min-width: 640px) {
  .site-nav-inner {
    padding: 0 1rem;
  }
}
@media (min-width: 1024px) {
  .site-nav-inner {
    padding: 0 1.25rem;
  }
}
@media (min-width: 768px) {
  .site-nav-inner {
    height: var(--nav-height);
  }
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  color: var(--logo-color);
  flex-shrink: 0;
}

.nav-links {
  display: none;
  flex-grow: 1;
  gap: 1rem;
  font-size: var(--text-sm);
  font-weight: 500;
  padding-top: 0.25rem;
  margin-left: 1.5rem;
}

@media (min-width: 1024px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  color: var(--foreground);
  font-weight: 400;
  transition: color 150ms;
  text-decoration: none;
}
.nav-link:hover {
  color: var(--muted-foreground);
}

.nav-search {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 0.625rem;
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  pointer-events: none;
}
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 12px 24px rgba(0, 0, 0, 0.04);
  z-index: 50;
  max-height: 60vh;
  overflow-y: auto;
}
/* visibility handled by [data-hidden] global rule */

.nav-actions {
  display: flex;
  align-items: center;
  position: relative;
}

.profile-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: var(--field-height);
  border: 1px solid var(--border);
  border-radius: var(--field-radius);
  padding: 0 var(--field-px);
  font-size: var(--field-font);
  color: var(--secondary-foreground);
  background: none;
  cursor: pointer;
  transition: background 150ms;
}
.profile-toggle:hover {
  background: var(--muted);
}
.profile-toggle .icon {
  transition: transform 200ms;
}
.profile-toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}
.profile-toggle[aria-expanded="true"] {
  background: var(--muted);
}

.profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  width: 14rem;
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 12px 24px rgba(0, 0, 0, 0.04);
  z-index: 50;
  padding: 0.25rem 0;
  font-size: var(--text-sm);
}
.search-dropdown-wrap {
  position: relative;
}

.profile-menu a,
.profile-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  width: calc(100% - 0.5rem);
  border-radius: var(--radius);
  color: var(--secondary-foreground);
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--field-font);
  transition:
    background 150ms,
    color 150ms;
}
.profile-menu a:hover,
.profile-menu button:hover {
  background: var(--muted);
  color: var(--foreground);
}
.profile-menu hr {
  margin: 0.25rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* ── Content panel ───────────────────────────────────────── */

.content-panel {
  display: flex;
  flex-direction: column;
  max-width: var(--content-max);
  gap: 0.75rem;
  margin: 0 auto;
  padding: 1.25rem 0.75rem;
  min-height: 100vh;
}
.content-panel {
  padding-bottom: 5rem;
}
@media (min-width: 640px) {
  .content-panel {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
@media (min-width: 768px) {
  .content-panel {
    padding-bottom: 1.25rem;
  }
}
@media (min-width: 1024px) {
  .content-panel {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* ── Cards ───────────────────────────────────────────────── */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--muted);
}

.card-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  transition: background-color 150ms;
}
.card-row:hover {
  background-color: var(--muted);
}
a.card-row {
  text-decoration: none;
  color: inherit;
}

/* ── Badges ──────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary-text);
}

.badge-default {
  background-color: var(--secondary);
  color: var(--muted-foreground);
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: var(--field-height);
  padding: 0 1rem;
  font-size: var(--field-font);
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--field-radius);
  transition:
    background-color 150ms,
    color 150ms;
  cursor: pointer;
  user-select: none;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid transparent;
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary-text);
  border: 1px solid var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--primary) 12%, transparent);
}

.nav-signin {
  min-width: 10rem;
}

.btn-default {
  background-color: var(--background);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}
.btn-default:hover:not(:disabled) {
  background-color: var(--muted);
}

/* ── Inputs ──────────────────────────────────────────────── */

.input {
  display: block;
  width: 100%;
  height: var(--field-height);
  padding: 0 var(--field-px);
  border: 1px solid var(--field-border);
  border-radius: var(--field-radius);
  background-color: var(--background);
  color: var(--foreground);
  font-size: var(--field-font);
  transition:
    border-color 150ms,
    box-shadow 150ms;
}
textarea.input {
  height: auto;
  padding: var(--field-py) var(--field-px);
}
.input::placeholder {
  color: var(--muted-foreground);
}
.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: var(--field-focus-ring);
}

.input-with-icon {
  padding-left: 2.25rem;
}

/* ── Gain display ────────────────────────────────────────── */

.gain-up {
  color: var(--gain-up);
}
.gain-down {
  color: var(--gain-down);
}
.gain-flat {
  color: var(--gain-flat);
}

/* ── Icons ───────────────────────────────────────────────── */

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.icon-sm {
  width: 1rem;
  height: 1rem;
}
.icon-lg {
  width: 1.5rem;
  height: 1.5rem;
}
.icon-xl {
  width: 2rem;
  height: 2rem;
}
.icon-hero {
  width: 4rem;
  height: 4rem;
}
.icon-huge {
  width: 10rem;
  height: 10rem;
}

/* ── Divider ─────────────────────────────────────────────── */

.section-divider {
  width: 2.5rem;
  border-top: 2px solid var(--primary);
  margin: 0.75rem 0;
}

/* ── Label (alias for overline) ──────────────────────────── */

.label-uppercase {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

/* ── Page headings ───────────────────────────────────────── */

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}
@media (min-width: 768px) {
  .page-title {
    font-size: 1.875rem;
  }
}

.page-subtitle {
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}

.text-subtle {
  color: var(--muted-foreground);
}

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

/* ── Catalog (checklist index) ───────────────────────────── */

.catalog-layout {
  display: flex;
  gap: 2rem;
}

.catalog-sidebar {
  display: none;
  flex-shrink: 0;
  min-width: 200px;
  position: sticky;
  top: var(--nav-height);
  align-self: flex-start;
  max-height: calc(100vh - var(--nav-height));
  overflow-y: auto;
}
@media (min-width: 1024px) {
  .catalog-sidebar {
    display: block;
  }
}

.catalog-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  list-style: none;
  padding: 0;
}

.catalog-sidebar-link {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--secondary-foreground);
  border-radius: var(--radius);
  transition:
    background 150ms,
    color 150ms;
  text-decoration: none;
}
.catalog-sidebar-link:hover {
  background: var(--muted);
  color: var(--primary);
}

.catalog-content {
  flex-grow: 1;
  min-width: 0;
}

.catalog-toc-mobile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 1024px) {
  .catalog-toc-mobile {
    display: none;
  }
}

.catalog-group {
  margin-bottom: 3rem;
  scroll-margin-top: 5rem;
}
.catalog-group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.catalog-group-header:has([data-toggle-section]) {
  cursor: pointer;
}
.catalog-group h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
}
.catalog-group-header [data-toggle-section] .icon {
  transition: transform 200ms;
  transform: rotate(180deg);
}
.catalog-group-header [aria-expanded="false"] .icon {
  transform: rotate(0deg);
}

.catalog-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .catalog-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 768px) {
  .catalog-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.catalog-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  transition:
    border-color 150ms,
    box-shadow 150ms;
  text-decoration: none;
  color: inherit;
}
.catalog-card-thumbs {
  display: flex;
  flex-shrink: 0;
}
.catalog-card-thumb {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  object-fit: cover;
  border: 2px solid var(--card, #fff);
}
.catalog-card-thumb + .catalog-card-thumb {
  margin-left: -0.625rem;
}
.catalog-card:hover {
  border-color: var(--color-primary-300);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.catalog-card-name {
  font-weight: 500;
  color: var(--foreground);
}
.catalog-card:hover .catalog-card-name {
  color: var(--primary);
}
.catalog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ── Hero Section ────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100svh - var(--nav-height));
  padding: 1.25rem;
  margin: 0 auto;
  max-width: var(--content-max);
}

.hero-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.1em 0.35em;
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}
@media (min-width: 768px) {
  .hero-title {
    font-size: var(--text-4xl);
  }
}

.hero-accent {
  color: var(--primary);
}

.hero-tagline {
  max-width: var(--content-max);
  text-align: center;
  color: var(--muted-foreground);
}

.hero-search {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding-top: 2.5rem;
}

.hero-search-row {
  display: flex;
  gap: 0.5rem;
}
.hero-search-row .input {
  flex: 1;
  height: 2.75rem;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  border-radius: var(--radius);
}
.hero-search-row .btn {
  height: 2.75rem;
  padding: 0 1rem;
  font-size: var(--text-sm);
  border-radius: var(--radius);
}

.hero-browse {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--secondary-foreground);
}
.hero-browse a {
  color: var(--primary-text);
  font-weight: 500;
}
.hero-browse a:hover {
  text-decoration: underline;
}

/* ── SPG Guide Grid ──────────────────────────────────────── */

/* SPG — "Meet our Guides" 3-column layout (intro left, 2×2 grid right) */
.spg-guides-layout {
  display: grid;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .spg-guides-layout {
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
  }
}
.spg-guides-intro h2 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.025em;
}
.spg-guides-intro p {
  font-size: var(--text-lg);
  color: var(--muted-foreground);
  margin-top: 0.75rem;
}

.spg-guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
@media (min-width: 640px) {
  .spg-guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.spg-guide-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem;
  border-radius: var(--radius);
  transition: background-color 150ms;
}
.spg-guide-card:hover {
  background: var(--accent);
}
.spg-guide-icon {
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
  border-radius: var(--radius);
}
@media (min-width: 1024px) {
  .spg-guide-icon {
    width: 5rem;
    height: 5rem;
  }
}
.spg-guide-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}
.spg-guide-host {
  font-size: var(--text-sm);
  color: var(--primary-text);
  font-weight: 500;
}

/* ── Popular Section ─────────────────────────────────────── */

.section-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

.popular-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 1rem;
}
@media (min-width: 768px) {
  .popular-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

.popular-column {
  display: flex;
  flex-direction: column;
}
.popular-checklists {
  margin-top: 2.5rem;
}
.popular-column h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.75rem;
  color: var(--foreground);
}

.ranking-table {
  width: 100%;
}
.ranking-row {
  transition: background 150ms;
  cursor: pointer;
}
.ranking-row:hover {
  background: var(--muted);
}
.ranking-row td {
  padding: 0.375rem 0.25rem;
  vertical-align: middle;
}
.ranking-row td:last-child {
  text-align: right;
}
.ranking-thumb {
  width: 3rem;
  height: 2.5rem;
  object-fit: contain;
  border-radius: var(--radius);
}
@media (min-width: 768px) {
  .ranking-thumb {
    width: 3.5rem;
    height: 3rem;
  }
}
.ranking-thumb-placeholder {
  width: 3rem;
  height: 2.5rem;
  background: var(--secondary);
  border-radius: var(--radius);
}
@media (min-width: 768px) {
  .ranking-thumb-placeholder {
    width: 3.5rem;
    height: 3rem;
  }
}
.ranking-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--secondary-foreground);
}
@media (min-width: 768px) {
  .ranking-name {
    font-size: 0.875rem;
  }
}
.ranking-price {
  background: var(--primary-light);
  color: var(--primary-text);
  text-align: center;
  padding: 0.25rem 0.5rem;
  min-width: 3.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.checklist-list {
  columns: 1;
  gap: 1rem;
}
@media (min-width: 768px) {
  .checklist-list {
    columns: 2;
  }
}
@media (min-width: 1024px) {
  .checklist-list {
    columns: 3;
  }
}
.checklist-list li {
  break-inside: avoid-column;
  padding: 0.375rem 0;
}
.checklist-list-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: background 150ms;
}
.checklist-list-link:hover {
  background: var(--muted);
}
.checklist-list-link .name {
  font-size: 0.875rem;
  color: var(--secondary-foreground);
}
.checklist-count {
  background: var(--primary-light);
  color: var(--primary-text);
  text-align: center;
  padding: 0.5rem;
  min-width: 3rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Feature Cards ───────────────────────────────────────── */

.features-section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 6rem 0.75rem;
}
@media (min-width: 640px) {
  .features-section {
    padding-inline: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .features-section {
    padding-inline: 2rem;
  }
}

.features-header {
  text-align: center;
  margin-bottom: 4rem;
}
.features-header .section-label {
  margin-bottom: 1rem;
}
.features-header h2 {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 1rem;
}
@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem 2rem;
  }
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
  align-items: center;
}
.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.025em;
}
@media (min-width: 768px) {
  .feature-card h3 {
    font-size: 1.125rem;
  }
}
.feature-card p {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.625;
}
@media (min-width: 768px) {
  .feature-card p {
    font-size: 0.875rem;
  }
}

.feature-visual {
  border: 1px solid var(--border);
  background: var(--background);
  overflow: hidden;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  height: 200px;
  display: flex;
  flex-direction: column;
}

.feature-vis-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--secondary);
  background: var(--muted);
}
.feature-vis-dots {
  display: flex;
  gap: 5px;
}
.feature-vis-dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
}
.feature-vis-bar {
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--secondary);
}
.feature-vis-bar-wide {
  width: 80%;
}
.feature-vis-bar-third {
  width: 33%;
}
.feature-vis-bar-grow {
  flex-grow: 1;
}
.feature-vis-body {
  flex-grow: 1;
  padding: 1rem;
  display: flex;
}
.feature-vis-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.75rem;
}
.feature-vis-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}
.feature-vis-bottom {
  display: flex;
  align-items: flex-end;
  width: 100%;
}
.feature-vis-chart-svg {
  width: 100%;
  height: 80px;
}
.feature-vis-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 100%;
}
.feature-vis-grid-tile {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
}
.feature-vis-grid-tile:nth-child(odd) {
  background: var(--color-primary-50);
}
.feature-vis-grid-tile:nth-child(even) {
  background: var(--color-primary-100);
}

/* ── CTA Section ─────────────────────────────────────────── */

.cta-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 5rem 0.75rem;
  background: var(--muted);
  max-width: var(--content-max);
  margin: 0 auto;
  border-radius: var(--radius-lg);
}
@media (min-width: 640px) {
  .cta-section {
    padding-inline: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .cta-section {
    padding-inline: 2rem;
  }
}
.cta-section h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
}
.cta-section p {
  color: var(--muted-foreground);
}
.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

/* ── FAQ Section ─────────────────────────────────────────── */

.faq-section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 5rem 0.75rem;
}
@media (min-width: 640px) {
  .faq-section {
    padding-inline: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .faq-section {
    padding-inline: 2rem;
  }
}
.faq-section > h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
  text-align: center;
  margin-bottom: 3rem;
}

.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 768px) {
  .faq-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.faq-grid h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}
.faq-grid p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.625;
}
.faq-grid a {
  color: var(--primary-text);
  text-decoration: underline;
}

/* ── Cross-site promo ────────────────────────────────────── */

.cross-promo {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  border-top: 1px solid var(--secondary);
}
.cross-promo a {
  font-weight: 500;
  color: var(--secondary-foreground);
}
.cross-promo a:hover {
  text-decoration: underline;
}

/* ── Stats counter ───────────────────────────────────────── */

.stats-counter {
  text-align: center;
  padding: 3rem 0;
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  background: #1a1025;
  background: var(--primary-dark);
  color: #ffffff;
  border-top: 1px solid var(--border);
}
.site-footer .btn-outline {
  color: var(--primary-foreground);
  border-color: var(--primary-foreground);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem 1rem;
}
@media (min-width: 640px) {
  .footer-inner {
    padding-inline: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .footer-inner {
    padding-top: 4rem;
    padding-inline: 2rem;
  }
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1280px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: 2.5rem;
}
.footer-brand p {
  opacity: 0.8;
}

.footer-logo {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}
.footer-logo .icon {
  color: var(--muted-foreground);
  --logo-fill: transparent;
}

.footer-social {
  display: flex;
  gap: 1.5rem;
}
.footer-social a {
  opacity: 0.6;
  transition: opacity 150ms;
}
.footer-social a:hover {
  opacity: 1;
}

.footer-links strong {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.footer-links ul {
  list-style: none;
  padding: 0;
  margin-top: 0.25rem;
}
.footer-links li {
  margin-top: 0.25rem;
}
.footer-links a {
  color: inherit;
  opacity: 0.8;
  transition: opacity 150ms;
}
.footer-links a:hover {
  opacity: 1;
}

.footer-disclaimer {
  margin-top: 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.875rem;
  line-height: 1.25rem;
  opacity: 0.7;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.footer-disclaimer a {
  color: inherit;
  text-decoration: underline;
}

/* ── Detail Pages (collectible + checklist) ──────────────── */

.detail-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 3rem;
}
@media (min-width: 768px) {
  .detail-header {
    grid-template-columns: 1fr 1fr;
  }
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.detail-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.2;
  scroll-margin-top: 5rem;
}
@media (min-width: 768px) {
  .detail-title {
    font-size: 1.875rem;
  }
}
.detail-description {
  font-size: 0.875rem;
  color: var(--secondary-foreground);
  line-height: 1.625;
}

.detail-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.detail-media-short {
  max-height: 30rem;
}
.detail-image {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 22rem;
}
.detail-image img,
.detail-image .carousel {
  max-height: 22rem;
  object-fit: contain;
}

/* Mosaic — CSS-columns masonry for checklist hero thumbnails */
.thumb-mosaic {
  columns: 3;
  column-gap: 0.375rem;
  max-width: 24rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.thumb-mosaic img {
  width: 100%;
  display: block;
  margin-bottom: 0.375rem;
  border-radius: var(--radius);
  object-fit: cover;
  break-inside: avoid;
}
@media (min-width: 768px) {
  .thumb-mosaic {
    max-width: 20rem;
  }
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.card-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.tag-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--secondary-foreground);
  font-weight: 500;
  text-decoration: none;
  transition:
    background 150ms,
    border-color 150ms;
}
.tag:hover {
  background: var(--muted);
  border-color: var(--input);
}

/* Sellers expandable bar */
.sellers-bar {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sellers-toggle {
  width: 100%;
  border-radius: 0;
  justify-content: center;
  cursor: pointer;
  list-style: none;
}
.sellers-toggle::-webkit-details-marker {
  display: none;
}
.affiliate-disclaimer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: var(--muted);
  margin: 0;
  line-height: 1.4;
}
.affiliate-disclaimer .icon {
  color: var(--primary);
  flex-shrink: 0;
}

.alert-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--secondary-foreground);
  text-decoration: none;
  transition: background 150ms;
}
.alert-cta:hover {
  background: var(--muted);
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-icon {
  padding: 0.5rem;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 150ms;
}
.theme-toggle:hover {
  color: var(--foreground);
}
.theme-icon-sun {
  display: none;
}
.dark .theme-icon-sun {
  display: block;
}
.dark .theme-icon-moon {
  display: none;
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 1.5rem;
  text-align: center;
  overflow: hidden;
}
@media (min-width: 768px) {
  .stats-bar {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }
}
.stat {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.5rem;
  align-items: center;
  border-top: 1px solid var(--border);
}
.stat:nth-child(-n + 2) {
  border-top: none;
}
.stat:nth-child(odd) {
  border-right: 1px solid var(--border);
}
@media (min-width: 768px) {
  .stat {
    border-top: none !important;
    border-right: 1px solid var(--border);
  }
  .stat:nth-child(-n + 4) {
    border-top: none;
  }
  .stat:last-child {
    border-right: none;
  }
}
@media (min-width: 768px) {
  .stat {
    border-top: none;
  }
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

/* Chart section */
.chart-section {
  margin: 2.5rem 0;
}
.chart-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.chart-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}
.chart-range-buttons {
  display: flex;
  gap: 0.5rem;
}
.chart-range-buttons button {
  padding: 0.5rem 0.75rem;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 150ms;
}
@media (min-width: 768px) {
  .chart-range-buttons button {
    padding: 0.25rem 0.75rem;
    min-height: auto;
    font-size: 0.75rem;
  }
}
.chart-range-buttons button:hover {
  background: var(--muted);
}
.chart-range-buttons button[data-active] {
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-weight: 500;
}

.chart-container {
  padding: 0.5rem;
}
#chart,
#collection-chart {
  width: 100%;
}
#collection-chart .ts-chart-plot {
  aspect-ratio: 16 / 4;
  min-height: 160px;
}

/* ── Bespoke time-series chart (ts-chart) ─────────────────── */

.ts-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  color: var(--secondary-foreground);
}
.ts-chart-plot {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  min-height: 220px;
  max-height: 400px;
}
.ts-chart-svg {
  display: block;
  width: 100%;
  height: 100%;
  font-family: inherit;
  overflow: visible;
}
@media (min-width: 768px) {
  .ts-chart-plot {
    aspect-ratio: 16 / 6;
  }
}

.ts-chart-empty {
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  padding: 3rem 1rem;
}

.ts-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: 0.5;
}

.ts-axis-label {
  fill: var(--muted-foreground);
  font-size: 13px;
  font-family: inherit;
}

.ts-line-stroke {
  stroke: var(--ts-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ts-scatter-dot {
  fill: var(--ts-primary);
  opacity: 0.3;
}

.ts-avg-line {
  stroke: var(--muted-foreground);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.4;
}
.ts-avg-label {
  fill: var(--muted-foreground);
  font-size: 10px;
  font-family: inherit;
  opacity: 0.75;
}

.ts-outlier-ring {
  fill: none;
  stroke: var(--ts-primary);
  stroke-width: 1;
  opacity: 0.15;
}
.ts-outlier-dot {
  fill: var(--ts-primary);
  opacity: 0.15;
}

.ts-cursor-line {
  stroke: var(--muted-foreground);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.6;
}
.ts-cursor-halo {
  fill: var(--ts-primary);
  opacity: 0.2;
}
.ts-cursor-dot {
  fill: var(--ts-primary);
  stroke: var(--background, #fff);
  stroke-width: 2;
}

.ts-hit {
  cursor: crosshair;
}

/* Tooltip */
.ts-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 100ms,
    transform 100ms;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 10;
}
.ts-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.ts-tooltip-date {
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.125rem;
}
.ts-tooltip-value {
  color: var(--foreground);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-variant-numeric: tabular-nums;
}
.ts-tooltip-tag {
  margin-top: 0.25rem;
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  background: color-mix(
    in srgb,
    var(--color-warning, #f59e0b) 15%,
    transparent
  );
  color: var(--color-warning, #f59e0b);
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Stats strip */
.ts-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
@media (min-width: 640px) {
  .ts-stats {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    text-align: center;
  }
}
.ts-stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.ts-stat-label {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.ts-stat-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.9375rem;
  color: var(--foreground);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ts-stat-value.gain-up {
  color: #16a34a;
}
.ts-stat-value.gain-down {
  color: #dc2626;
}
.dark .ts-stat-value.gain-up {
  color: #4ade80;
}
.dark .ts-stat-value.gain-down {
  color: #f87171;
}

/* Sales section */
.sales-section {
  margin: 2.5rem 0;
}
.sales-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Data table (shared) */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  padding: 0.75rem 0.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table thead th:last-child {
  text-align: right;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--secondary);
}
.data-table tbody tr:hover {
  background: var(--muted);
}
.data-table tbody td {
  padding: 0.375rem 0.25rem;
  font-size: 0.875rem;
  vertical-align: middle;
}
@media (min-width: 768px) {
  .data-table tbody td {
    padding: 0.5rem;
  }
}
.data-table tbody td:last-child {
  text-align: right;
}
.data-table a {
  color: var(--secondary-foreground);
  text-decoration: none;
}
.data-table a:hover {
  color: var(--primary);
}

.thumb-cell {
  width: 3rem;
  height: 5rem;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.detail-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.card-row-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-grow: 1;
}
.card-row-info strong {
  font-size: 0.875rem;
  color: var(--foreground);
}
.card-row-price {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  flex-shrink: 0;
}

/* Items section */
.items-section {
  margin-top: 2rem;
}
.items-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.filter-search {
  flex-grow: 1;
  max-width: 20rem;
}
/* Native select styled to match enhanced version (prevents layout shift on JS enhance) */
.filter-select {
  width: auto;
  height: var(--field-height);
  padding: 0 2rem 0 var(--field-px);
  border: 1px solid var(--field-border);
  border-radius: var(--field-radius);
  font-size: var(--field-font);
  color: var(--secondary-foreground);
  background: var(--background)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 0.5rem center;
  background-size: 1rem;
  appearance: none;
  cursor: pointer;
}
.filter-select[data-hidden] {
  display: none;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-left: auto;
}
.view-toggle button {
  padding: 0.375rem 0.625rem;
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
}
.view-toggle button[data-active] {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.clickable-row {
  cursor: pointer;
}
.clickable-row:hover {
  background: var(--muted);
}

.data-table caption {
  caption-side: bottom;
  font-size: 0.75rem;
  text-transform: uppercase;
  text-align: right;
  color: var(--muted-foreground);
  padding: 0.5rem 0;
}

/* ── Prose (about, privacy, etc.) ─────────────────────────── */

.prose {
  max-width: 48rem;
}
.prose section {
  margin-bottom: 2.5rem;
}
.prose h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}
.prose p {
  color: var(--secondary-foreground);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose ul,
.prose ol {
  color: var(--secondary-foreground);
  line-height: 1.75;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.prose li {
  margin-bottom: 0.25rem;
}
.prose a {
  color: var(--primary);
  text-decoration: underline;
}

/* ── Error page ──────────────────────────────────────────── */

.error-page {
  align-items: center;
  justify-content: center;
}
.error-page-inner {
  display: flex;
  gap: 2rem;
  margin: 5rem 0;
  align-items: center;
}
@media (max-width: 639px) {
  .error-page-inner {
    flex-direction: column;
    text-align: center;
  }
}
.error-icon {
  color: var(--color-primary-300);
}
.error-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.error-search {
  max-width: 24rem;
}

/* ── Auth / Form pages ───────────────────────────────────── */

.auth-page {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 0 1rem;
}
@media (min-width: 768px) {
  .auth-page {
    margin: 4rem auto;
  }
}

/* Short pages: remove min-height so they don't stretch with empty space */
.content-panel:has(.auth-page),
.content-panel:has(.auth-split),
.content-panel:has(.auth-confirm),
.content-panel:has(.error-page),
.content-panel:has(.settings-form),
.content-panel:has(.content-panel-narrow) {
  min-height: auto;
}
.content-panel-narrow {
  min-height: auto !important;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--secondary-foreground);
}

/* Input with leading icon — flexbox centering, no absolute hacks */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon-wrap .icon {
  position: absolute;
  left: 0.75rem;
  color: var(--muted-foreground);
  pointer-events: none;
  flex-shrink: 0;
}
.input-icon-wrap .input {
  padding-left: 2.5rem;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--secondary);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--secondary-foreground);
}

.form-footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.form-footer a {
  color: var(--primary);
  font-weight: 500;
}

/* Auth split layout (signin page) */
.auth-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: start;
}
@media (min-width: 768px) {
  .auth-split {
    grid-template-columns: 1fr 1fr;
  }
}

.auth-welcome {
  display: none;
}
@media (min-width: 768px) {
  .auth-welcome {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2.5rem 0;
  }
}
.auth-welcome h1 {
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--foreground);
}
.auth-welcome p {
  color: var(--muted-foreground);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.feature-list-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.feature-list-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary-foreground);
}
.feature-list-item p {
  font-weight: 500;
  color: var(--foreground);
}
.feature-list-item .desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.auth-tabs a {
  flex: 1;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: -2px;
  color: var(--muted-foreground);
  border-bottom: 2px solid transparent;
  text-decoration: none;
}
.auth-tabs a[aria-current="page"],
.auth-tabs a[data-active] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Links ───────────────────────────────────────────────── */

.link {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.875rem;
}
.link:hover {
  text-decoration: underline;
}

/* ── Error/success messages ──────────────────────────────── */

.msg-error,
.msg-success,
.msg-info {
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  color: var(--primary-foreground);
}
.msg-error {
  background-color: var(--error);
}
.msg-success {
  background-color: var(--success);
}
.msg-info {
  background-color: var(--color-primary-100, #e0e7ff);
  color: var(--color-primary-800, #3730a3);
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-primary-200, #c7d2fe);
}
.msg-info a {
  color: inherit;
  text-decoration: underline;
}
.dark .msg-info,
[data-theme="dark"] .msg-info {
  background-color: var(--color-primary-950, #1e1b4b);
  color: var(--color-primary-200, #c7d2fe);
  border-color: var(--color-primary-800, #3730a3);
}

/* ── Page header row ────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

/* ── Chart panel ────────────────────────────────────────── */

.chart-panel {
  border-radius: var(--radius);
  border: 1px solid var(--secondary);
  padding: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  background: var(--background);
  margin-bottom: 1.5rem;
}

/* ── Collection table ───────────────────────────────────── */

.collection-table {
  width: 100%;
}
.collection-table thead tr {
  border-bottom: 1px solid var(--border);
}
.collection-table thead th {
  padding: 0.75rem 0.25rem;
  text-align: left;
}
@media (min-width: 768px) {
  .collection-table thead th {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
.collection-table thead th:last-child,
.collection-table thead th.col-right {
  text-align: right;
}

.collection-table tbody {
  font-size: 0.875rem;
}
.collection-table tbody tr {
  border-bottom: 1px solid var(--secondary);
}
.collection-table tbody tr:hover {
  background: var(--muted);
  cursor: pointer;
}
.collection-table tbody td {
  padding: 0.25rem;
  vertical-align: middle;
}
@media (min-width: 768px) {
  .collection-table tbody td {
    padding: 0.5rem;
  }
}
.collection-table tbody td.col-right {
  text-align: right;
}

.col-thumb {
  height: 5rem;
  width: 4rem;
}
.thumb-img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
}
.item-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--secondary-foreground);
  text-decoration: none;
}
.item-link:hover {
  color: var(--primary);
}
.gain-label {
  font-size: 0.75rem;
  font-weight: 500;
}
.price-label {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.price-dash {
  color: var(--input);
}

/* ── Empty state ────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 0;
  text-align: center;
}
.empty-state .icon {
  color: var(--input);
}
.empty-state p {
  color: var(--muted-foreground);
}
.empty-state a {
  color: var(--primary);
}
.empty-state a:hover {
  text-decoration: underline;
}

/* ── Purchases ──────────────────────────────────────────── */

.purchase-list {
  display: flex;
  flex-direction: column;
}
.purchase-list > * + * {
  border-top: 1px solid var(--secondary);
}

.purchase-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  transition: background 150ms;
}
.purchase-row:hover {
  background: var(--muted);
}
.purchase-thumb {
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
}
.purchase-info {
  flex-grow: 1;
  min-width: 0;
}
.purchase-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}
.purchase-price {
  flex-shrink: 0;
  text-align: right;
}
.purchase-price span {
  font-size: 0.875rem;
  font-weight: 500;
}
.purchase-actions {
  flex-shrink: 0;
}

/* ── Empty state + loading ───────────────────────────────── */

.empty-state-cell {
  padding: 3rem 1rem;
  text-align: center;
}
.empty-state-text {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  text-align: center;
  margin: 2rem 0;
}
.empty-state-text.text-error {
  color: var(--error);
}

tbody.is-loading,
[data-items].is-loading {
  opacity: 0.5;
  transition: opacity 150ms;
}

.alert-card-ends {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0 0 0;
}

/* ── Tip text ───────────────────────────────────────────── */

.tip-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 1rem;
}
.kbd {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  background: var(--secondary);
  border: 1px solid var(--input);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Alert cards grid ───────────────────────────────────── */

.alert-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .alert-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .alert-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.alert-card {
  transition: box-shadow 150ms;
  text-decoration: none;
  color: inherit;
}
.alert-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.alert-thumb-wrap {
  aspect-ratio: 1;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.alert-thumb {
  object-fit: contain;
  max-height: 100%;
}
.alert-card-body {
  padding: 0.75rem;
}
.alert-card-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alert-card:hover .alert-card-name {
  color: var(--primary);
}
.alert-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.alert-card-price {
  font-size: 0.875rem;
  font-weight: 500;
}
.alert-deal {
  font-size: 0.75rem;
  color: var(--gain-down);
}

/* ── Checkbox label ─────────────────────────────────────── */

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--secondary-foreground);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* ── Max price inline filter ────────────────────────────── */

.filter-inline {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.filter-inline-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.input-narrow {
  width: 5rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

/* ── Settings form ──────────────────────────────────────── */

.settings-form {
  display: flex;
  flex-direction: column;
}
.settings-form > * + * {
  border-top: 1px solid var(--border);
}

.settings-section {
  padding: 1.5rem 0;
}
.settings-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 1rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.setting-row + .setting-row {
  margin-top: 1rem;
}

.setting-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--secondary-foreground);
}
.setting-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.setting-toggle + .setting-toggle {
  margin-top: 1rem;
}
.setting-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* ── Search page ────────────────────────────────────────── */

.search-bar {
  display: flex;
  gap: 0.5rem;
  max-width: 36rem;
  margin-bottom: 2rem;
}
.search-input {
  flex-grow: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  background: var(--background);
  color: var(--foreground);
  transition:
    border-color 150ms,
    box-shadow 150ms;
}
.search-input::placeholder {
  color: var(--muted-foreground);
}
.search-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}
.search-results {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Confirm code input ─────────────────────────────────── */

.code-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5em;
  background: var(--background);
  color: var(--foreground);
  transition:
    border-color 150ms,
    box-shadow 150ms;
}
.code-input::placeholder {
  color: var(--input);
}
.code-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}

/* ── Auth confirm page ──────────────────────────────────── */

.auth-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 5rem 0;
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
}
.auth-confirm h1 {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--foreground);
}
.auth-confirm p {
  color: var(--muted-foreground);
  text-align: center;
}
.auth-confirm form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

/* ── Readonly input ─────────────────────────────────────── */

.input-readonly {
  background: var(--muted);
  color: var(--muted-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Modals ─────────────────────────────────────────────── */

body.modal-open {
  overflow: hidden;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.modal-positioner {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}
.modal-panel {
  background: var(--background);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  width: 95vw;
  display: flex;
  flex-direction: column;
}
.modal-panel-sm {
  max-width: 32rem;
}
.modal-panel-md {
  max-width: 28rem;
}
.modal-panel-lg {
  max-width: 32rem;
  max-height: 75vh;
}

.modal-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

.modal-body {
  padding: 0.5rem;
  overflow-y: auto;
  flex-grow: 1;
}
.modal-body-padded {
  padding: 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.modal-hint {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  padding: 0.5rem;
}

/* Condition range */
.range-full {
  width: 100%;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Delete button (danger) */
.btn-danger {
  color: var(--gain-down);
  background: none;
  border: none;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.05);
}

/* ── Carousel ───────────────────────────────────────────── */

.carousel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.carousel-img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-lg);
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: color-mix(in srgb, var(--background) 80%, transparent);
  border: none;
  border-radius: var(--radius-full);
  padding: 0.375rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background 150ms;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-btn:hover {
  background: var(--background);
}
.carousel-btn-prev {
  left: 0.5rem;
}
.carousel-btn-next {
  right: 0.5rem;
}
.carousel-dots {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.375rem;
}
.carousel-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--input);
  transition: background 150ms;
}
.carousel-dot.active {
  background: var(--primary);
}

/* ── Narrow content panel ───────────────────────────────── */

.content-panel-narrow {
  max-width: 42rem;
}

/* ── Breadcrumbs ───────────────────────────────────────── */

.breadcrumb-nav {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.breadcrumb-link {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 150ms;
}
.breadcrumb-link:hover {
  color: var(--primary);
}
.breadcrumb-sep {
  color: var(--input);
  flex-shrink: 0;
}
.breadcrumb-current {
  color: var(--secondary-foreground);
  font-weight: 500;
}

/* ── Toast messages (sonner-style) ─────────────────────────── */

.toast-msg {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  min-width: 16rem;
  max-width: 22rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--card-foreground);
  font-size: var(--text-sm);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.05);
  pointer-events: auto;
  transform: translateY(0.75rem);
  opacity: 0;
  transition:
    transform 300ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 200ms ease-out;
}
.toast-msg[data-state="visible"] {
  transform: none;
  opacity: 1;
}
.toast-msg[data-state="leaving"] {
  transform: translateY(0.75rem);
  opacity: 0;
}
.toast-msg[data-type="error"] {
  border-color: color-mix(in srgb, var(--destructive) 25%, var(--border));
}
.toast-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}
.toast-msg[data-type="success"] .toast-icon {
  color: var(--success);
}
.toast-msg[data-type="error"] .toast-icon {
  color: var(--destructive);
}

/* ── Search results (nav dropdown) ─────────────────────────── */

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--secondary-foreground);
  text-decoration: none;
  transition:
    background 150ms,
    color 150ms;
}
.search-result-item:hover,
.search-result-item[data-active] {
  background: var(--primary-light);
  color: var(--primary-text);
}
.search-no-results {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  padding: 0.75rem;
}

/* ── Home search results ───────────────────────────────────── */

.home-search-results {
  display: flex;
  width: 100%;
  flex-direction: column;
  padding: 0 1.25rem;
}
.home-search-section {
  /* nothing extra needed, structural only */
}
.home-search-heading {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--input);
  margin-top: 0.75rem;
}
.home-search-heading h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted-foreground);
}
.home-search-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.home-search-list li {
  border-bottom: 1px solid var(--secondary);
}
.home-search-list li:last-child {
  border-bottom: none;
}

.home-search-checklist-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  transition: color 150ms;
}
.home-search-checklist-link:hover {
  color: var(--primary);
}
.home-search-checklist-link[data-active] {
  background: var(--primary-light);
}

.home-search-count {
  background: var(--primary-light);
  color: var(--primary-text);
  text-align: center;
  padding: 0.25rem;
  min-width: 2.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
}
.home-search-collectible-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
  transition: color 150ms;
}
.home-search-collectible-link:hover {
  color: var(--primary);
}
.home-search-collectible-link[data-active] {
  background: var(--primary-light);
}

.home-search-thumb {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  flex-shrink: 0;
}
.home-search-name {
  font-weight: 500;
  flex-grow: 1;
}
.home-search-price {
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* ── Full search results page ─────────────────────────────── */

.search-results-heading {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--input);
}
.search-results-heading h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--muted-foreground);
}
.search-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.search-results-list li {
  border-bottom: 1px solid var(--border);
}
.search-results-list li:last-child {
  border-bottom: none;
}
.search-results-list li:hover {
  background: var(--muted);
  border-radius: var(--radius);
}

.search-results-checklist-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  transition: color 150ms;
}
.search-results-checklist-link:hover {
  color: var(--primary);
}

.search-results-count {
  background: var(--primary-light);
  color: var(--primary-text);
  text-align: center;
  padding: 0.25rem;
  min-width: 2.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
}
.search-results-collectible-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
  transition: color 150ms;
}
.search-results-collectible-link:hover {
  color: var(--primary);
}

.search-results-thumb {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  flex-shrink: 0;
}
.search-results-name {
  font-weight: 500;
  flex-grow: 1;
}
.search-results-price {
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* ── Grid view cards ───────────────────────────────────────── */

.grid-view {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 640px) {
  .grid-view {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768px) {
  .grid-view {
    grid-template-columns: repeat(4, 1fr);
  }
}

.grid-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 150ms,
    box-shadow 150ms;
}
.grid-card:hover {
  border-color: var(--color-primary-300);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.grid-card-media {
  aspect-ratio: 1;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.grid-card-img {
  object-fit: contain;
  max-height: 100%;
}
.grid-card-info {
  padding: 0.75rem;
}
.grid-card-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grid-card:hover .grid-card-name {
  color: var(--primary);
}
.grid-card-price {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

/* ── Owned badge ───────────────────────────────────────────── */

.owned-badge-wrap {
  position: relative;
}
.owned-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--color-success, #22c55e);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.owned-badge-icon {
  width: 0.75rem;
  height: 0.75rem;
  color: white;
}

/* Collectible action button "on" state is styled generically via
 * button[aria-pressed="true"] at the bottom of the file — no per-button
 * data-attribute rules needed. */

/* ── Custom select dropdowns ───────────────────────────────── */

.custom-select-wrap {
  position: relative;
  display: inline-block;
}
.custom-select-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  height: var(--field-height);
  padding: 0 var(--field-px);
  border: 1px solid var(--field-border);
  border-radius: var(--field-radius);
  font-size: var(--field-font);
  color: var(--secondary-foreground);
  background: var(--background);
  cursor: pointer;
  transition:
    background 150ms,
    border-color 150ms;
}
.custom-select-btn:hover {
  background: var(--muted);
}
.custom-select-btn:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: var(--field-focus-ring);
}

.custom-select-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  transition: transform 150ms;
}
.custom-select-chevron[data-open] {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  padding: 0.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 12px 24px rgba(0, 0, 0, 0.04);
  z-index: 50;
  min-width: 100%;
  padding: 0.25rem;
}
.custom-select-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--field-py) var(--field-px);
  font-size: var(--field-font);
  color: var(--secondary-foreground);
  white-space: nowrap;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background 150ms,
    color 150ms;
}
.custom-select-option:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.custom-select-option[data-selected] {
  font-weight: 500;
  color: var(--foreground);
}
.dark .custom-select-option:hover,
[data-theme="dark"] .custom-select-option:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.dark .custom-select-option[data-selected],
[data-theme="dark"] .custom-select-option[data-selected] {
  background: var(--secondary);
  color: var(--foreground);
}

/* ── Picker modal results ──────────────────────────────────── */

.picker-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--secondary-foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition:
    background 150ms,
    color 150ms;
}
.picker-result-item:hover {
  background: var(--primary-light);
  color: var(--primary-text);
}

/* ── Carousel data-attribute states ────────────────────────── */

.carousel-dot[data-active] {
  background: var(--primary);
}

/* ── Reduced motion ──────────────────────────────────────────
 * Respect user's motion preference — kill transitions, animations,
 * and smooth-scroll. Keep instant transform/opacity updates so UI
 * still toggles, just without movement.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Accessibility: aria-state as first-class styling hook ───
 * CSS targets the accessible state directly. JS only needs to set
 * aria-* correctly and styling follows — no parallel data-* to sync.
 */

/* Toggle buttons — collect/wishlist/alert action buttons use
 * aria-pressed to convey state to screen readers. Style follows.
 */
button[aria-pressed="true"].btn-default,
.action-bar [data-action][aria-pressed="true"] {
  background: var(--primary-light);
  border-color: var(--color-primary-300);
}

/* Disclosure widgets — any [aria-expanded] icon rotates consistently */
[aria-expanded="true"] > .custom-select-chevron,
[aria-expanded="true"] > .icon.chevron {
  transform: rotate(180deg);
}
