/* ==========================================================================
   VeloChecker Design System — Race / Performance theme
   Dark surface, sport-orange accent, monospace numerics, sharp edges.
   ========================================================================== */

/* ---------- Google Fonts (loaded in HTML) ---------- */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0e1a;        /* deepest navy — body canvas */
  --bg-secondary: #0f1525;       /* slightly lifted — for image placeholders */
  --bg-tertiary: #0e1422;
  --bg-card: #131a2e;            /* card surface */
  --bg-grouped: #0e1422;
  --bg-elevated: #1a2138;        /* hover/focus surface */

  /* Text */
  --text-primary: #f0f3f9;
  --text-secondary: #8a96b3;
  --text-tertiary: #5a667e;

  /* Hi-vis accent (var names preserved so existing rules pick it up) */
  --accent-blue: #d4f504;        /* hi-vis lime */
  --accent-blue-hover: #e3ff44;
  --accent-blue-active: #bce302;
  --accent-on: #0a0e1a;          /* foreground when sitting on the accent */
  --link-blue: #d4f504;

  /* Semantic */
  --success-green: #7df569;
  --warning-orange: #ffb020;
  --danger-red: #ff4d6d;

  /* Borders & Dividers */
  --border-color: #1f2842;
  --border-light: #1a2138;
  --separator: rgba(255, 255, 255, 0.06);

  /* Shadows — flat dark theme, a touch of glow on lifted elements */
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.02), 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow-card-hover: 0 0 0 1px var(--accent-blue), 0 12px 32px rgba(212, 245, 4, 0.08);

  /* Typography */
  --font-system: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;
  --text-4xl: 3.5rem;

  /* Weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights */
  --leading-tight: 1.1;
  --leading-snug: 1.2;
  --leading-normal: 1.47;

  /* Transitions */
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  --duration-emphasis: 0.7s;
  --ease-default: cubic-bezier(0.25, 0.1, 0.25, 1.0);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1.0);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-system);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(212, 245, 4, 0.25);
  color: var(--text-primary);
}

a {
  color: var(--link-blue);
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-default);
}

a:hover {
  color: var(--accent-blue-hover);
}

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

/* ---------- Typography ---------- */
h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: -0.022em;
  color: var(--text-primary);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: -0.022em;
}

.text-secondary {
  color: var(--text-secondary);
}

.text-sm {
  font-size: var(--text-sm);
}

.overline {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* ---------- Layout ---------- */
.section {
  max-width: 980px;
  margin: 0 auto;
  padding: 80px 22px;
}

.section-narrow {
  max-width: 560px;
}

.section-wide {
  max-width: 1200px;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(22px, env(safe-area-inset-left));
  background: rgba(10, 14, 26, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}

.nav-brand {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-links a, .nav-links button {
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-system);
  transition: color var(--duration-normal) var(--ease-default);
}

.nav-links a:hover, .nav-links button:hover {
  color: var(--text-primary);
}

.nav-user-email {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

body {
  padding-top: 56px;
}

/* The `hidden` attribute must always win. Author `display` rules (e.g. .btn's
   inline-flex below) otherwise override the UA `[hidden]` rule at equal
   specificity — which left the admin-only Delete button visible to anonymous
   browsers once public group viewing was enabled (2026-06-12). */
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-system);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: 1.18;
  letter-spacing: -0.01em;
  border: none;
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-default),
              transform var(--duration-fast) ease,
              box-shadow var(--duration-normal) var(--ease-default);
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  padding: 14px 28px;
  color: var(--accent-on);
  background: var(--accent-blue);
  border-radius: 4px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: var(--text-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-blue-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-blue-active);
  transform: scale(0.98);
}

/* Filled CTAs are usually <a> elements, and the global link rules outrank
   .btn-primary on text colour: a:hover (0,1,1), [data-theme="light"] a (0,1,1)
   and [data-theme="light"] a:hover (0,2,1) all beat .btn-primary (0,1,0), so the
   label was painted the dark link-orange ON the orange fill — unreadable, both
   normal (light) and on hover (both themes). A filled button always wants the
   on-accent colour; pin it so no link rule can hijack it. */
.btn-primary,
.btn-primary:hover,
.btn-primary:active {
  color: var(--accent-on) !important;
}

.btn-secondary {
  padding: 0;
  color: var(--link-blue);
  background: none;
  font-size: var(--text-lg);
}

.btn-secondary::after {
  content: '\203A';
  font-size: 1.4em;
  transition: transform var(--duration-normal) var(--ease-default);
}

.btn-secondary:hover {
  color: var(--accent-blue-hover);
}

.btn-secondary:hover::after {
  transform: translateX(3px);
}

.btn-outlined {
  padding: 13px 28px;
  color: var(--accent-blue);
  background: transparent;
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: var(--text-sm);
}

.btn-outlined:hover:not(:disabled) {
  background: var(--accent-blue);
  color: var(--accent-on);
}

.btn-destructive {
  padding: 8px 18px;
  color: var(--danger-red);
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: 4px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-destructive:hover:not(:disabled) {
  background: var(--danger-red);
  color: #ffffff;
  border-color: var(--danger-red);
}

.btn-compact {
  padding: 9px 16px;
  font-size: var(--text-sm);
  border-radius: 4px;
}

.btn-full-width {
  width: 100%;
}

/* ---------- Form Inputs ---------- */
.input {
  width: 100%;
  padding: 14px 18px;
  font-family: var(--font-system);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  outline: none;
  transition: border-color var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default);
  -webkit-appearance: none;
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:hover {
  border-color: #2c3756;
}

.input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(212, 245, 4, 0.18);
}

.input-error {
  border-color: var(--danger-red);
}

.input-error:focus {
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.15);
}

.input-large {
  padding: 18px 24px;
  font-size: var(--text-lg);
  border-radius: 16px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-error {
  margin-top: 8px;
  font-size: var(--text-sm);
  color: var(--danger-red);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  transition: transform var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default),
              border-color var(--duration-normal) var(--ease-default);
  position: relative;
}

.card-interactive:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent-blue);
  cursor: pointer;
}

.card-body {
  padding: 24px;
}

/* ---------- Product List ---------- */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}

/* ---------- Product Card (Horizontal Row) ---------- */
.product-card {
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
}

.product-card-image {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

.product-card-image-placeholder {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-image-placeholder svg {
  width: 28px;
  height: 28px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

.product-card-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.product-card-price {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.product-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-card-watched-since {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ---------- Sparkline ---------- */
.product-card-sparkline {
  width: 120px;
  height: 50px;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-sparkline svg {
  width: 100%;
  height: 100%;
}

.sparkline-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--bg-grouped) 25%, var(--border-light) 50%, var(--bg-grouped) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ---------- Attention Section ---------- */
.attention-section {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.06), rgba(0, 113, 227, 0.04));
  border: 1px solid rgba(52, 199, 89, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.attention-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: 16px;
}

.attention-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #34c759;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.attention-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 0 6px;
}

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

/* ---------- Filter Chips ---------- */
.filter-chips-container {
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-chips-container::-webkit-scrollbar {
  display: none;
}

.filter-chips {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 980px;
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.filter-chip-count {
  font-size: var(--text-xs);
  opacity: 0.7;
}

/* ---------- Category Section ---------- */
.category-section {
  margin-bottom: 8px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
}

.category-header-text {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

.category-header-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 0 6px;
}

.category-chevron {
  margin-left: auto;
  color: var(--text-tertiary);
  transition: transform var(--duration-fast) var(--ease-default);
}

.category-section.collapsed .category-chevron {
  transform: rotate(-90deg);
}

.category-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--duration-fast) var(--ease-default);
}

.category-section.collapsed .category-items {
  display: none;
}

/* ---------- Trend Pill ---------- */
.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 980px;
  letter-spacing: 0.01em;
}

.trend-down {
  background: rgba(125, 245, 105, 0.12);
  color: var(--success-green);
  border: 1px solid rgba(125, 245, 105, 0.25);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
}

.trend-up {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger-red);
  border: 1px solid rgba(255, 77, 109, 0.25);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
}

.trend-unchanged {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
}

/* ---------- Status Pill ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 980px;
}

.status-ready {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.status-fetching {
  background: rgba(255, 159, 10, 0.12);
  color: #c77800;
}

/* ---------- Auth Form ---------- */
.auth-container {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 22px;
  background: var(--bg-secondary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-grouped);
  border-radius: 980px;
  padding: 3px;
  margin-bottom: 32px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  font-family: var(--font-system);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: center;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 980px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-error {
  margin-top: 16px;
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: var(--danger-red);
  background: rgba(255, 59, 48, 0.08);
  border-radius: 12px;
  text-align: center;
  display: none;
}

.auth-error.visible {
  display: block;
}

.auth-forgot {
  margin-top: 16px;
  text-align: center;
  font-size: var(--text-sm);
}

.auth-forgot a {
  color: var(--text-secondary);
  text-decoration: none;
}

.auth-forgot a:hover {
  color: var(--accent-blue);
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ---------- Page Header ---------- */
.page-header {
  text-align: center;
  padding: 48px 22px 32px;
}

.page-header h1 {
  font-size: var(--text-3xl);
  margin-bottom: 8px;
}

.page-header p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 80px 22px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: var(--text-xl);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ---------- Loading ---------- */
.loading-container {
  display: flex;
  justify-content: center;
  padding: 80px 22px;
}

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

.spinner-small {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner-inline {
  display: inline-block;
  vertical-align: middle;
}

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

/* Skeleton loading cards */
.skeleton {
  background: linear-gradient(90deg, var(--bg-grouped) 25%, var(--border-light) 50%, var(--bg-grouped) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 12px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px 18px 0 0;
}

.skeleton-text {
  height: 18px;
  margin-bottom: 8px;
}

.skeleton-text-short {
  width: 60%;
}

.skeleton-text-price {
  height: 32px;
  width: 40%;
  margin-bottom: 12px;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 68px;
  right: 22px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: 14px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform var(--duration-normal) var(--ease-out-expo);
  max-width: 360px;
}

.toast.visible {
  transform: translateX(0);
}

.toast-success {
  background: var(--success-green);
  color: #ffffff;
}

.toast-error {
  background: var(--danger-red);
  color: #ffffff;
}

/* ---------- Result Card (Add page) ---------- */
.result-card {
  max-width: 400px;
  margin: 32px auto 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-emphasis) var(--ease-out-expo),
              transform var(--duration-emphasis) var(--ease-out-expo);
}

.result-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.result-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg-secondary);
}

.result-card-body {
  padding: 24px;
  text-align: center;
}

.result-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.result-card-price {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

/* ---------- Product Detail ---------- */
.product-detail-header {
  text-align: center;
  padding: 40px 22px 28px;
  max-width: 720px;
  margin: 0 auto;
}

.product-detail-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.product-detail-retailer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: var(--text-sm);
  flex-wrap: wrap;
}

.retailer-domain {
  color: var(--text-secondary);
}

.retailer-separator {
  color: var(--text-tertiary);
}

.retailer-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--link-blue);
  text-decoration: none;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--text-xs);
  transition: opacity var(--duration-fast) var(--ease-default);
}

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

.retailer-link svg {
  flex-shrink: 0;
}

.product-detail-price {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.product-detail-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* ---------- Target Price (Product Detail) ---------- */
.target-price-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 22px 32px;
}

.target-price-card {
  padding: 24px 28px;
}

.target-price-header {
  margin-bottom: 16px;
}

.target-price-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.target-price-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.target-price-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.target-price-form .target-price-input-wrapper {
  width: 160px;
}

.target-price-status {
  margin-top: 12px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.target-price-status.success {
  color: var(--success-green);
}

.target-price-status.error {
  color: var(--danger-red);
}

/* ---------- Compare Prices (Product Detail) ---------- */
.compare-prices-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 22px 32px;
}

.compare-prices-card {
  padding: 24px 28px;
}

.compare-prices-header {
  margin-bottom: 16px;
}

.compare-prices-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.compare-prices-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.compare-prices-list {
  display: flex;
  flex-direction: column;
}

.compare-prices-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--separator);
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast) var(--ease-default);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 8px;
}

.compare-prices-row:last-child {
  border-bottom: none;
}

.compare-prices-row:hover {
  background: var(--bg-secondary);
}

.compare-prices-retailer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.compare-prices-domain {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.compare-prices-product-title {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.compare-prices-price {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  white-space: nowrap;
  margin-left: 16px;
}

/* ---------- Price History Table ---------- */
.history-table-container,
.history-table-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 8px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}

.history-table th {
  text-align: left;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 12px 16px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--separator);
}

.history-table td:nth-child(2) {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-table tbody tr {
  transition: background var(--duration-fast) var(--ease-default);
}

.history-table tbody tr:hover {
  background: var(--bg-secondary);
}

/* ---------- Animations ---------- */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-emphasis) var(--ease-out-expo),
              transform var(--duration-emphasis) var(--ease-out-expo);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-up:nth-child(1) { transition-delay: 0.0s; }
.fade-up:nth-child(2) { transition-delay: 0.06s; }
.fade-up:nth-child(3) { transition-delay: 0.12s; }
.fade-up:nth-child(4) { transition-delay: 0.18s; }
.fade-up:nth-child(5) { transition-delay: 0.24s; }
.fade-up:nth-child(6) { transition-delay: 0.30s; }
.fade-up:nth-child(7) { transition-delay: 0.36s; }
.fade-up:nth-child(8) { transition-delay: 0.42s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Utilities ---------- */
.hidden {
  display: none !important;
}

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

.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  .page-header h1 {
    font-size: var(--text-2xl);
  }

  .product-card {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }

  .product-card-sparkline {
    width: 100%;
    height: 40px;
    min-width: unset;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
  }

  .product-detail-price {
    font-size: var(--text-3xl);
  }

  .auth-card {
    padding: 32px 24px;
  }

  .nav-links {
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .nav-user-email {
    display: none;
  }
}

/* ---------- Add page specific ---------- */
.add-container {
  min-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 22px;
}

.add-form {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

.add-form h1 {
  font-size: var(--text-3xl);
  margin-bottom: 8px;
}

.add-form p {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: var(--text-lg);
}

.add-input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.add-input-group .input {
  flex: 1;
}

.add-hint {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: 12px;
}

/* ---------- Target Price Input ---------- */
.target-price-group {
  max-width: 280px;
}

.target-price-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.target-price-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.target-price-currency {
  position: absolute;
  left: 16px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  pointer-events: none;
}

.target-price-input-wrapper .input {
  padding-left: 36px;
  width: 100%;
}

/* ---------- Target Price Pill (Dashboard) ---------- */
.target-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 980px;
  letter-spacing: 0.01em;
}

.target-pill-pending {
  background: rgba(212, 245, 4, 0.10);
  color: var(--accent-blue);
  border: 1px solid rgba(212, 245, 4, 0.25);
}

.target-pill-hit {
  background: rgba(125, 245, 105, 0.15);
  color: var(--success-green);
  border: 1px solid rgba(125, 245, 105, 0.3);
}

/* ---------- Group Pill (Dashboard) ---------- */
.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 980px;
  letter-spacing: 0.01em;
  background: rgba(88, 86, 214, 0.10);
  color: #5856d6;
}

/* ---------- Product Group Card (Dashboard) ---------- */
.product-group-card {
  border-left: 3px solid #5856d6;
}

.group-best-domain {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.product-card-domain {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ---------- Group Comparison Page ---------- */
.group-detail-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 22px 16px;
}

.group-detail-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: var(--weight-bold);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.group-detail-subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

/* ---------- Header track / favourite toggle ---------- */
.group-detail-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.group-detail-title-row .group-detail-title {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.track-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default),
              color var(--duration-fast) var(--ease-default);
  -webkit-user-select: none;
  user-select: none;
}
.track-toggle:hover:not(:disabled) {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.track-toggle .track-toggle-icon {
  width: 16px;
  height: 16px;
  fill: none;
  transition: fill var(--duration-fast) var(--ease-default);
}
.track-toggle[aria-pressed="true"] {
  border-color: var(--accent-blue);
  background: rgba(212, 245, 4, 0.08);
  color: var(--accent-blue);
}
.track-toggle[aria-pressed="true"] .track-toggle-icon {
  fill: var(--accent-blue);
}
.track-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Group page: cheapest hero card ---------- */
.detail-hero {
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 0 22px;
}

/* ---------- Variant selector (size / colour dropdowns) ----------
   Rendered into the specs panel's #variant-controls slot by group.js. */
.variant-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.variant-control {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.variant-control-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.variant-select-wrap {
  position: relative;
}
.variant-select-wrap::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.variant-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 34px 9px 12px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.variant-select:hover {
  border-color: var(--accent-blue);
}
.variant-select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(212, 245, 4, 0.18);
}
.variant-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}
.variant-empty {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 18px 0;
}
.detail-hero-card {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 28px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-blue);
  border-radius: 6px;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}
/* When there's no alerts panel (e.g. ungrouped product page), the hero falls
   back to a two-column layout. */
.detail-hero-card:not(:has(.detail-hero-alerts)) {
  grid-template-columns: 200px 1fr;
}
.detail-hero-card::before {
  /* Subtle hi-vis glow stripe */
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 240px;
  height: 100%;
  background: linear-gradient(135deg, transparent 60%, rgba(212, 245, 4, 0.04) 100%);
  pointer-events: none;
}
.detail-hero-image-wrap {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}
.detail-hero-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.detail-hero-image-wrap svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
  color: var(--text-tertiary);
}
.detail-hero-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-hero-tag {
  align-self: flex-start;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--accent-blue);
  color: var(--accent-on);
  border-radius: 3px;
  margin-bottom: 4px;
}
/* Stock-status variants used on the product detail hero */
.detail-hero-tag--in {
  background: rgba(125, 245, 105, 0.14);
  color: var(--success-green);
  border: 1px solid rgba(125, 245, 105, 0.35);
}
.detail-hero-tag--out {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger-red);
  border: 1px solid rgba(255, 77, 109, 0.32);
}
.detail-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.detail-hero-retailer {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.detail-hero-price {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  margin: 4px 0 6px;
}
.detail-hero-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
  min-height: 14px;
}
.detail-hero-meta .savings {
  color: var(--success-green);
  font-weight: var(--weight-semibold);
}
.detail-hero-meta .overpay {
  color: var(--danger-red);
  font-weight: var(--weight-semibold);
}

/* ---------- Feedback modal + report affordances ---------- */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.feedback-overlay.hidden { display: none; }
.feedback-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-blue);
  border-radius: 6px;
  width: 100%;
  max-width: 440px;
  padding: 24px 24px 18px;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.feedback-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.feedback-close:hover { color: var(--text-primary); }
.feedback-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.feedback-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin: 0 0 14px;
}
.feedback-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.feedback-optional { color: var(--text-tertiary); }
.feedback-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-system);
  font-size: var(--text-sm);
  resize: vertical;
  min-height: 80px;
  outline: none;
}
.feedback-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(212, 245, 4, 0.15);
}
.feedback-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.feedback-status {
  font-size: 11px;
  margin-top: 8px;
  min-height: 14px;
}
.feedback-status.success { color: var(--success-green); }
.feedback-status.error   { color: var(--danger-red); }

/* Small "report" affordances rendered inside the specs header and on each retailer row. */
.report-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default),
              background var(--duration-fast) var(--ease-default);
}
.report-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: rgba(212, 245, 4, 0.05);
}
.report-btn svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}
/* The specs panel header becomes a row so the report button can sit on the right. */
.specs-panel-header.with-report {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.specs-panel-header.with-report .report-btn {
  text-transform: none;
  font-size: 10px;
  letter-spacing: 0.04em;
}
/* Icon-only variant on retailer rows; absolute-positioned so it doesn't fight
   the row's external link target. */
.group-retailer-card { position: relative; }
.group-retailer-card .retailer-report-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default),
              color var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default);
}
.group-retailer-card:hover .retailer-report-btn { opacity: 1; }
.group-retailer-card .retailer-report-btn:hover {
  color: var(--danger-red);
  border-color: var(--danger-red);
}
.group-retailer-card .retailer-report-btn svg {
  width: 12px;
  height: 12px;
}

/* Per-watched-listing target-price card on the group page. */
#target-price-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.target-price-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.target-price-row-retailer {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: 0.04em;
}
.target-price-row-current {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.target-price-status.success { color: var(--success-green); }
.target-price-status.error   { color: var(--danger-red); }
.detail-hero-cta {
  align-self: flex-start;
}

/* ---------- Group page: full retailer list section ---------- */
.detail-section {
  max-width: 1100px;
  margin: 0 auto 56px;
  padding: 0 22px;
}
.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ---------- Group page: add-a-retailer box ---------- */
.add-retailer-box {
  padding: 18px 20px;
  border-left: 3px solid var(--accent-blue);
}
.add-retailer-intro {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.add-retailer-box .add-input-group {
  margin-bottom: 0;
}
.add-retailer-box .add-hint {
  margin-top: 12px;
}

/* ---------- Hero alerts panel (right side of the hero card) ---------- */
.detail-hero-alerts {
  min-width: 240px;
  max-width: 280px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-hero-alerts-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
/* Variant-level tracking: the sizes the user tracks in this group, each a chip
   you can click to stop tracking. */
.tracked-variants {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 10px;
}
.tracked-variants-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.tracked-variant-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 980px;
  border: 1px solid var(--accent-blue);
  background: rgba(212, 245, 4, 0.12);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  line-height: 1.4;
}
.tracked-variant-chip:hover {
  background: rgba(212, 245, 4, 0.22);
}
.tracked-variant-chip span { color: var(--text-tertiary); font-weight: 400; }

/* The tracked size shown on a dashboard card title (C2). */
.tracked-size-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 980px;
  background: rgba(212, 245, 4, 0.16);
  border: 1px solid var(--accent-blue);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  vertical-align: middle;
  white-space: nowrap;
}

/* Cookie consent banner (C5) — fixed bottom bar, theme-aware, privacy-first. */
.cookie-consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
}
.cookie-consent-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.cookie-consent-text {
  flex: 1 1 320px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.cookie-consent-text a { color: var(--link-blue); text-decoration: underline; }
.cookie-consent-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}
@media (max-width: 560px) {
  .cookie-consent-actions { width: 100%; }
  .cookie-consent-actions .btn { flex: 1; }
}
.detail-hero-alert-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-hero-alert-row label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.detail-hero-alert-input {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: border-color var(--duration-fast) var(--ease-default);
}
.detail-hero-alert-input:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(212, 245, 4, 0.18);
}
.detail-hero-alert-input .prefix,
.detail-hero-alert-input .suffix {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  padding: 6px 10px;
  display: flex;
  align-items: center;
}
.detail-hero-alert-input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  width: 100%;
}
.detail-hero-alert-input input::-webkit-outer-spin-button,
.detail-hero-alert-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Free tier: the Premium-only alert inputs are disabled, but stay clearly
   VISIBLE rather than blanked out — a free user should be able to SEE the
   target-price + price-drop boxes they'd unlock (the 🔒 label marks them as
   Premium). Shown as readable-but-locked fields with a dashed border + a
   not-allowed cursor, so it's obvious they're an upgrade, not broken. */
.detail-hero-alert-input:has(input:disabled) {
  border-style: dashed;
  opacity: 0.9;
}
.detail-hero-alert-input input:disabled {
  cursor: not-allowed;
  color: var(--text-secondary);
  -webkit-text-fill-color: var(--text-secondary);  /* keep disabled text legible in Safari */
}
.detail-hero-alert-input input:disabled::placeholder {
  color: var(--text-tertiary);
  opacity: 1;   /* keep the example value (0.00 / 10) visible under the lock */
}
.detail-hero-alerts-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.detail-hero-alerts-actions .btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 11px;
}
.detail-hero-alerts-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 2px;
  min-height: 12px;
}
.detail-hero-alerts-status.success { color: var(--success-green); }
.detail-hero-alerts-status.error   { color: var(--danger-red); }

/* Signed-out state: hide the input form and show the sign-in CTA. The
   previous "dim inputs" approach was too subtle — users didn't realise the
   inputs were unusable, only that "save" didn't work. Now the panel is
   explicit about needing an account. */
.detail-hero-alerts-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-hero-alerts-signin {
  display: none;
}
.detail-hero-alerts[data-anon="true"] .detail-hero-alerts-form {
  display: none;
}
.detail-hero-alerts[data-anon="true"] .detail-hero-alerts-signin {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 6px 0 2px;
}
.detail-hero-alerts-signin-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-blue);
  align-self: center;
  filter: drop-shadow(0 0 8px rgba(212, 245, 4, 0.35));
}
.detail-hero-alerts-signin-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  font-family: var(--font-system);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}
.detail-hero-alerts-signin-text strong {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}
.detail-hero-alerts-signin-btn {
  width: 100%;
  font-size: 11px;
  padding: 9px 12px;
}

/* Legacy class — kept for any consumer still rendering it dynamically. */
.detail-hero-alerts-prompt {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 8px 0;
}

/* Tablet/mobile: keep image-left + body-right at all widths, but shrink the
   image and price as the viewport narrows. The alerts panel always stacks
   below the image/body row at <=1024px so it gets full width. */
@media (max-width: 1024px) {
  .detail-hero-card {
    grid-template-columns: 200px 1fr;
  }
  .detail-hero-alerts {
    grid-column: 1 / -1;
    max-width: none;
  }
}

@media (max-width: 880px) {
  .detail-hero-card {
    grid-template-columns: 130px 1fr;
    gap: 18px;
    padding: 20px 22px;
    text-align: left;
  }
  .detail-hero-image-wrap {
    width: 130px;
    height: 130px;
  }
  .detail-hero-price {
    font-size: clamp(2rem, 9vw, 2.75rem);
  }
}

@media (max-width: 520px) {
  /* Stack the hero into a single column on phones — image, then body
     (retailer / price / meta / actions), then the alerts panel — each full
     width. The previous "96px 1fr" kept a 2-column grid that crushed the body
     to a sliver and let the retailer name, price and alerts collide. */
  .detail-hero-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px 18px;
  }
  .detail-hero-image-wrap {
    width: 96px;
    height: 96px;
  }
  .detail-hero-price {
    font-size: clamp(1.75rem, 10vw, 2.25rem);
  }
  .detail-hero-meta {
    font-size: 11px;
  }
  .detail-hero-actions .btn {
    padding: 10px 16px;
    font-size: 12px;
  }
}

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

.group-retailer-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.group-retailer-color {
  width: 4px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 2px 0 0 2px;
}

.group-retailer-image {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

.group-retailer-image-placeholder {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

.group-retailer-domain {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.group-retailer-details {
  flex: 1;
  min-width: 0;
}

.group-retailer-domain {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-retailer-title {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: none;
}

.group-retailer-price-section {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.group-retailer-price {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.group-best-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  border-radius: 3px;
  background: var(--accent-blue);
  color: var(--accent-on);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Warning badge next to a retailer's title when we couldn't pin down the
   specific size/colour for that listing (cyclestore-style single-page
   retailer that sells every variant behind one URL). Amber accent so the
   user notices it — the price they see is for the family, not the specific
   size/colour they picked. The tooltip on the element explains why.
   ::before renders an info glyph so the badge reads as a notice. */
/* "All retailers" header row: title left, freshness label right */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

/* "Prices checked X ago" — the comparison's freshness (trust signal) */
.group-freshness {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Which variant a retailer's cheapest row is, shown in the "Any" view
   (e.g. "42 · White/Coral") — explains price differences between rows */
.group-retailer-variant-hint {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
}

.group-retailer-unconfirmed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  border-radius: 3px;
  background: rgba(255, 176, 32, 0.14);   /* warm amber wash */
  color: #ffc664;                          /* readable amber on dark bg */
  border: 1px solid rgba(255, 176, 32, 0.35);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  cursor: help;
}

.group-retailer-unconfirmed::before {
  content: '⚠';
  font-size: 12px;
  line-height: 1;
}

.group-retailer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-tertiary);
  transition: all var(--duration-fast) var(--ease-default);
  flex-shrink: 0;
}

.group-retailer-link:hover {
  background: var(--bg-elevated);
  color: var(--accent-blue);
}

@media (max-width: 640px) {
  .group-retailer-card {
    gap: 12px;
    padding: 14px 16px;
  }

  .group-retailer-price-section {
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .add-input-group {
    flex-direction: column;
  }
}

/* ==========================================================================
   Explore Page — Trolley-style horizontal carousels
   ========================================================================== */

/* ---------- Home hero (Explore = the home page) ---------- */
.home-hero {
  border-bottom: 0.5px solid var(--border-color);
  padding: 56px 20px 42px;
  text-align: center;
}
.home-hero-inner { max-width: 720px; margin: 0 auto; }
.home-hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--link-blue);          /* theme-safe accent: orange on dark, deep orange on light */
  margin-bottom: 14px;
}
.home-hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: var(--weight-bold);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.home-hero-title span { color: var(--link-blue); }
.home-hero-sub {
  margin: 16px auto 0;
  max-width: 560px;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-secondary);
}
.home-hero-search { max-width: 560px; margin: 28px auto 0; }
.home-hero-props {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 34px auto 0;
  flex-wrap: wrap;
}
.home-prop { display: flex; align-items: center; gap: 11px; text-align: left; }
.home-prop svg { width: 22px; height: 22px; color: var(--link-blue); flex: 0 0 auto; }
.home-prop strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.home-prop span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
}
.home-popular-label {
  max-width: 1200px;
  margin: 30px auto 0;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
@media (max-width: 560px) {
  .home-hero { padding: 40px 18px 32px; }
  .home-hero-props { gap: 16px; flex-direction: column; align-items: flex-start; max-width: 300px; margin-left: auto; margin-right: auto; }
}

.explore-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 8px;
}

.explore-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
}

.explore-header p {
  margin-top: 4px;
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* Category section */
.explore-category {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 0;
}

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

.explore-category-header h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

.explore-category-header .see-all-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--accent-blue);
  text-decoration: none;
  white-space: nowrap;
}

.explore-category-header .see-all-link:hover {
  text-decoration: underline;
}

/* Carousel wrapper (positions arrows) */
.carousel-wrapper {
  position: relative;
}

/* Carousel track (horizontal scroll) */
.carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* Scroll arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all var(--duration-fast) var(--ease-default);
  box-shadow: var(--shadow-sm);
}

.carousel-arrow:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-md);
}

.carousel-arrow--left {
  left: -12px;
}

.carousel-arrow--right {
  right: -12px;
}

.carousel-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.carousel-arrow svg {
  width: 16px;
  height: 16px;
}

/* Carousel card (vertical product card) */
.carousel-card {
  flex: 0 0 180px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  display: flex;
  flex-direction: column;
  position: relative;
}

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

.carousel-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
  background: var(--bg-secondary);
  margin-bottom: 10px;
}

.carousel-card-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.carousel-card-domain {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--weight-medium);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: var(--leading-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  min-height: 2.4em;
}

.carousel-card-price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.carousel-card-price {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.carousel-card-trend {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 1px 6px;
  border-radius: 980px;
}

.carousel-card-trend--down {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.carousel-card-trend--up {
  background: rgba(255, 59, 48, 0.12);
  color: #d70015;
}

.carousel-card-trend--unchanged {
  background: var(--bg-grouped);
  color: var(--text-tertiary);
}

.carousel-card-watchers {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

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

/* Track button */
.track-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent-on);
  background: var(--accent-blue);
  border: none;
  border-radius: 980px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.track-btn:hover {
  background: var(--accent-blue-hover);
}

.track-btn:active {
  background: var(--accent-blue-active);
  transform: scale(0.97);
}

.track-btn.tracked {
  background: var(--success-green);
  pointer-events: none;
}

/* Skeleton loader for carousels */
.carousel-skeleton {
  flex: 0 0 180px;
  height: 280px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Infinite scroll sentinel */
.scroll-sentinel {
  height: 1px;
  width: 100%;
}

/* Explore loading / end state */
.explore-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.explore-end {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.explore-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.explore-empty h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin-bottom: 8px;
}

/* Fade-in for explore categories */
.explore-category {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
}

.explore-category.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Nav link styles for Explore */
.nav-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

/* Responsive: Explore */
@media (max-width: 640px) {
  .explore-header {
    padding: 24px 16px 4px;
  }

  .explore-header h1 {
    font-size: var(--text-xl);
  }

  .explore-category {
    padding: 20px 16px 0;
  }

  .explore-category-header h2 {
    font-size: var(--text-lg);
  }

  .carousel-card {
    flex: 0 0 150px;
  }

  .carousel-card-title {
    font-size: var(--text-xs);
  }

  .carousel-card-price {
    font-size: var(--text-sm);
  }

  .carousel-arrow {
    display: none;
  }

  .carousel-track {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .carousel-card {
    flex: 0 0 140px;
    padding: 10px;
  }
}

/* ==========================================================================
   Stock Status — Out-of-Stock badges and card dimming
   ========================================================================== */

/* Stock badge (shared) */
.stock-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 980px;
  white-space: nowrap;
}

.stock-badge--out {
  background: rgba(255, 59, 48, 0.12);
  color: #d70015;
}

.stock-badge--in {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

/* Dashboard: dimmed card for out-of-stock products */
.product-card--out-of-stock {
  opacity: 0.6;
}

.product-card--out-of-stock:hover {
  opacity: 0.85;
}

/* Explore: out-of-stock overlay on carousel card */
.carousel-card--out-of-stock {
  opacity: 0.6;
}

.carousel-card--out-of-stock:hover {
  opacity: 0.85;
}

.carousel-card-stock {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: #d70015;
  margin-bottom: 4px;
}

.carousel-card-retailers {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 980px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent-blue);
  margin-bottom: 4px;
  white-space: nowrap;
}

/* ==========================================================================
   Biggest price drops — drop cards reuse .carousel-card, adding a "deal" badge
   overlaid on the image and an old→new price row. A drop is good news for the
   shopper, so the badge + new price use the savings green (not the up/down red).
   ========================================================================== */

.drop-card-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  color: #ffffff;
  background: #248a3d;
  border-radius: 980px;
  box-shadow: 0 2px 8px rgba(36, 138, 61, 0.35);
}

.drop-card-badge-arrow {
  font-size: 0.9em;
  line-height: 1;
}

.drop-card-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.drop-card-price-old {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.drop-card-price-new {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: #248a3d;
}

/* Dark theme: lift the savings green so it stays legible on the navy card
   (#248a3d only clears AA-large there); light theme keeps the deeper green. */
:root[data-theme="dark"] .drop-card-price-new {
  color: #34c759;
}

/* ==========================================================================
   Image Placeholder — shown when retailer CDN blocks direct image access
   ========================================================================== */

.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-secondary);
  border-radius: 10px;
  width: 100%;
  height: 100%;
  min-height: 60px;
}

.img-placeholder img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  opacity: 0.7;
}

.img-placeholder svg {
  width: 28px;
  height: 28px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

/* ==========================================================================
   Race / Performance theme — final overrides on top of the shared layout
   ========================================================================== */

/* Body canvas: a very faint grid to add tech texture without noise */
body {
  background-color: var(--bg-primary);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
}

/* Brand mark with a hi-vis dot */
.nav-brand {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(212, 245, 4, 0.7);
}

/* Nav links: uppercase + orange underline reveal on hover.
   The :not(.nav-cta) carve-out lets the primary "Add Product" anchor opt out
   of the inherited base styling and use its own padding/outline rules below,
   while still sharing the same hover *behaviour* (color shift + underline). */
.nav-links a, .nav-links button {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 6px 0;
  position: relative;
}
.nav-links a:hover, .nav-links button:hover {
  color: var(--accent-blue);
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent-blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}
.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

/* Primary nav CTA — orange-outlined pill that shares the nav-link hover.
   Distinct enough that "Add Product" reads as the primary action, but the
   interaction model (orange color shift + underline reveal) matches Explore so
   the two don't fight visually on hover. */
.nav-links a.nav-cta {
  padding: 6px 14px;
  border: 1px solid var(--accent-blue);
  border-radius: 3px;
  color: var(--accent-blue);
  background: transparent;
  box-shadow: 0 0 0 0 rgba(212, 245, 4, 0);
  transition:
    color var(--duration-normal) var(--ease-default),
    background var(--duration-normal) var(--ease-default),
    box-shadow var(--duration-normal) var(--ease-default);
}
/* On hover the CTA gets a subtle orange glow that fades in. The underline
   pseudo from the base rule still fires (same as Explore) for consistency. */
.nav-links a.nav-cta:hover {
  color: var(--accent-on);
  background: var(--accent-blue);
  box-shadow: 0 0 0 1px var(--accent-blue), 0 0 14px rgba(212, 245, 4, 0.35);
}
/* The nav-link underline reveal targets the bottom edge; on the CTA pill we
   want it to align with the bottom of the outline, not float underneath. */
.nav-links a.nav-cta::after {
  bottom: -2px;
}

/* ==========================================================================
   Mobile burger nav — collapse the top-bar links on small screens
   ========================================================================== */
.nav-burger {
  display: none;                 /* desktop: hidden, links shown inline */
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  margin-right: -8px;            /* optical: pull toward the safe-area edge */
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  border-radius: 2px;
  background: var(--text-primary);
  transition: transform var(--duration-normal) var(--ease-default),
              opacity var(--duration-fast) var(--ease-default);
}
/* Burger morphs into an X while the menu is open. The middle bar collapses to
   zero width (not just opacity) so it can't poke out past the X as two stubs. */
.nav.nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.nav-open .nav-burger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav.nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-burger { display: flex; }

  /* Links collapse into a drop-down panel beneath the bar */
  .nav-links {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 999;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px max(22px, env(safe-area-inset-left)) 10px;
    background: #12161f;                       /* fully opaque — no content bleed-through */
    border-bottom: 1px solid var(--separator);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.4);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--duration-normal) var(--ease-default),
                opacity var(--duration-normal) var(--ease-default);
  }
  .nav.nav-open .nav-links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Stacked full-width rows */
  .nav-links a,
  .nav-links button {
    width: 100%;
    padding: 15px 4px;
  }
  .nav-links a:not(.nav-cta),
  .nav-links > #nav-auth {
    border-bottom: 1px solid var(--separator);
  }
  .nav-links > *:last-child { border-bottom: none; }
  .nav-links a::after { display: none; }   /* no underline-reveal in a stacked menu */

  /* #nav-auth is a <span> wrapping the auth controls — let it stack too */
  #nav-auth {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .nav-user-email {
    padding: 12px 4px 2px;
  }

  /* CTA pill: a centred block, not a stretched bar */
  .nav-links a.nav-cta {
    margin: 10px 0 4px;
    text-align: center;
    padding: 13px 14px;
  }
}

/* Mobile drop-down panel on the light theme */
@media (max-width: 640px) {
  [data-theme="light"] .nav-links {
    background: #ffffff;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.14);
  }
}

/* Headlines: uppercase tight display for that race-board feel */
.page-header h1,
h1.page-title {
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: var(--weight-bold);
  font-size: clamp(2rem, 4vw, 3rem);
}
.page-header p {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* Any element with class .mono or data-mono renders with the mono face */
.mono, [data-mono] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Stock badges — flatten to dark theme + hi-vis IN_STOCK */
.stock-badge {
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  padding: 3px 8px;
  font-size: 10px;
}
.stock-badge--out {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger-red);
  border: 1px solid rgba(255, 77, 109, 0.3);
}
.stock-badge--in {
  background: rgba(125, 245, 105, 0.1);
  color: var(--success-green);
  border: 1px solid rgba(125, 245, 105, 0.3);
}

/* Empty state icon: orange stroke */
.empty-state-icon {
  color: var(--accent-blue);
  opacity: 0.8;
}

/* Spinner: orange ring on dark */
.spinner {
  border-color: var(--border-color);
  border-top-color: var(--accent-blue);
}

/* Sparkline: orange stroke for the price trend */
.product-card-sparkline svg path,
.product-card-sparkline svg line,
.product-card-sparkline svg polyline {
  stroke: var(--accent-blue) !important;
}

/* Domain pill: small mono retailer chip */
.product-card-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

/* Numeric content inside cards (price-history graphs etc.) */
.product-card-price-row .product-card-price + *,
.product-card-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* Auth card frame: subtle orange corner accent */
.auth-card {
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), transparent 60%);
}

/* Form input focus glow matches the orange */
.input-error:focus {
  box-shadow: 0 0 0 3px rgba(255, 77, 109, 0.2);
}

/* Auth-tabs underline accent */
.auth-tab {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

/* Reset shadow defaults on cards that hardcoded light-theme shadow */
.card {
  box-shadow: var(--shadow-card);
}

/* Section header text-secondary should still be readable */
.text-secondary {
  color: var(--text-secondary);
}

/* ---------- Spec sheet panel (product + group pages) ---------- */
.specs-panel {
  max-width: 980px;
  margin: 16px auto 24px;
  padding: 0 22px;
}
.specs-panel.hidden { display: none; }
.specs-panel-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-blue);
  border-radius: 6px;
  padding: 16px 20px;
}
.specs-panel-header {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.specs-panel-subheader {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin: 16px 0 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-light);
}
.specs-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 24px;
  row-gap: 6px;
  margin: 0;
}
.specs-grid dt {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  font-size: 11px;
  align-self: baseline;
}
.specs-grid dd {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin: 0;
  align-self: baseline;
}

/* Group page "Found a better price?" — specs (1/4) + add-retailer (3/4),
   two separate cards. The parent .detail-section owns the page width. */
.detail-split-panel {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 24px;
  align-items: start;
}
/* The specs panel carries its own page-level max-width / centring margin
   when standalone — neutralise it so the split grid owns the layout. */
.detail-split-panel > .specs-panel {
  max-width: none;
  margin: 0;
  padding: 0;
}
@media (max-width: 880px) {
  .detail-split-panel {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Light theme. The theme is chosen by theme.js — the saved preference, else
   the OS setting — and applied as data-theme="light" on <html>; dark is the
   default (race brand identity). Driven by the attribute rather than @media so
   the in-nav toggle can override the OS preference.
   ========================================================================== */
:root[data-theme="light"] {
  /* Backgrounds */
  --bg-primary: #fafbfc;
  --bg-secondary: #f0f3f7;
  --bg-tertiary: #f7f8fa;
  --bg-card: #ffffff;
  --bg-grouped: #f0f3f7;
  --bg-elevated: #f7f8fa;

  /* Text */
  --text-primary: #0a0e1a;
  --text-secondary: #4a5470;
  --text-tertiary: #8a96b3;

  /* Light mode uses the khaki / olive (#5a7c00) as the SINGLE accent — buttons,
     badges, the brand dot and links — with near-white text sitting on it. (Dark
     mode keeps the hi-vis lime, which only pops against the near-black canvas.) */
  --accent-blue: #5a7c00;
  --accent-blue-hover: #6b9200;
  --accent-blue-active: #4c6800;
  --accent-on: #fafbfc;
  --link-blue: #5a7c00;

  /* Semantic — darker for contrast on light bg */
  --success-green: #2d8a2d;
  --warning-orange: #cc7a00;
  --danger-red: #d62942;

  /* Borders & dividers */
  --border-color: #e0e4ed;
  --border-light: #ebeef4;
  --separator: rgba(0, 0, 0, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 0 0 1px var(--accent-blue),
                       0 12px 32px rgba(90, 124, 0, 0.2);
}

/* Body grid: invert the texture for a faint dark grid on light canvas */
[data-theme="light"] body {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
}

/* Nav: glassy white instead of glassy dark */
[data-theme="light"] .nav {
  background: rgba(255, 255, 255, 0.78);
}

/* Input hover border on light */
[data-theme="light"] .input:hover {
  border-color: #c7cdd9;
}

/* Stock badges: tune in/out for white-canvas contrast */
[data-theme="light"] .stock-badge--in {
  background: rgba(45, 138, 45, 0.1);
  color: var(--success-green);
  border-color: rgba(45, 138, 45, 0.3);
}
[data-theme="light"] .stock-badge--out {
  background: rgba(214, 41, 66, 0.08);
  color: var(--danger-red);
  border-color: rgba(214, 41, 66, 0.25);
}

/* Domain pill on light: a soft slate instead of frosted-white */
[data-theme="light"] .product-card-domain {
  background: rgba(0, 0, 0, 0.03);
}

/* Inline links use the darker deep orange accent so they're readable. The orange
   accent border around hovered cards still pops because it sits on the
   border, not inline with text. */
[data-theme="light"] a {
  color: var(--link-blue);
}
[data-theme="light"] a:hover {
  color: #44610a;
}

/* In-nav theme toggle (injected by theme.js into .nav-links) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
  line-height: 0;
}
.theme-toggle:hover { color: var(--text-primary); background: var(--bg-elevated); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ==========================================================================
   Dashboard — race-board header + stats strip
   ========================================================================== */

.dashboard-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 22px 20px;
  position: relative;
}

.dashboard-header-inner {
  max-width: 760px;
  border-left: 3px solid var(--accent-blue);
  padding-left: 18px;
}

.dashboard-header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: 10px;
  font-weight: var(--weight-bold);
}
.dashboard-header-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(212, 245, 4, 0.65);
  animation: dashboard-pulse 2.4s ease-in-out infinite;
}

@keyframes dashboard-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.dashboard-header-title {
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-weight: var(--weight-bold);
  font-size: clamp(1.85rem, 3.4vw, 2.6rem);
  line-height: 1.04;
  margin: 0 0 8px;
}

.dashboard-header-subtitle {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

/* Stats strip — four compact cells. Race-board readout, mono numerics. */
.dashboard-stats {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.dashboard-stat::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
  transition: background var(--duration-normal) var(--ease-default);
}
.dashboard-stat--accent::after {
  background: var(--accent-blue);
  box-shadow: 0 0 8px rgba(212, 245, 4, 0.4);
}

.dashboard-stats--has-drops .dashboard-stat--accent {
  background: linear-gradient(180deg, rgba(125, 245, 105, 0.06), transparent 80%);
}

.dashboard-stat-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.dashboard-stat-value {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1;
}

.dashboard-stats--has-drops .dashboard-stat--accent .dashboard-stat-value {
  color: var(--success-green);
}

/* Content section: tighten the top padding so it sits closer to the stats */
.dashboard-content {
  padding-top: 28px;
}

@media (max-width: 720px) {
  .dashboard-header {
    padding: 28px 18px 16px;
  }
  .dashboard-header-inner {
    padding-left: 14px;
  }
  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
    padding: 0 18px;
  }
  .dashboard-stat {
    padding: 12px 14px;
  }
  .dashboard-stat-value {
    font-size: 1.35rem;
  }
}

@media (max-width: 380px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
}

/* ---------- Site footer (injected on every page by auth.js) ---------- */
.site-footer { border-top: 1px solid var(--separator); margin-top: 72px; padding: 44px 22px; }
.site-footer-inner { max-width: 980px; margin: 0 auto; text-align: center; }
.site-footer-brand {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.site-footer-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px 24px; margin-bottom: 18px; list-style: none;
}
.site-footer-links a { color: var(--text-secondary); font-size: var(--text-sm); text-decoration: none; }
.site-footer-links a:hover { color: var(--text-primary); }
.site-footer-disclosure {
  color: var(--text-tertiary); font-size: var(--text-xs);
  max-width: 640px; margin: 0 auto 12px; line-height: 1.55;
}
.site-footer-copy { color: var(--text-tertiary); font-size: var(--text-xs); }
