/* ============================================================
   BOBA SCANNER — VAULT DESIGN SYSTEM
   Dark, premium, collector-grade. Syne + DM Sans.
   Gold accent. Built for power users who care about value.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:     #070b14;
  --bg-surface:  #0d1524;
  --bg-elevated: #121d34;
  --bg-hover:    #182540;
  --bg-input:    #0a1020;

  /* Borders */
  --border:        rgba(148,163,184,0.10);
  --border-strong: rgba(148,163,184,0.20);
  --border-focus:  rgba(245,158,11,0.50);

  /* Gold accent */
  --gold:       #f59e0b;
  --gold-dark:  #d97706;
  --gold-light: rgba(245,158,11,0.12);
  --gold-glow:  rgba(245,158,11,0.25);

  /* Blue */
  --primary:       #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59,130,246,0.12);
  --primary-lightest: rgba(59,130,246,0.06);

  /* Semantic */
  --success:       #10b981;
  --success-light: rgba(16,185,129,0.12);
  --danger:        #ef4444;
  --danger-light:  rgba(239,68,68,0.12);
  --warning:       #f59e0b;
  --warning-light: rgba(245,158,11,0.12);
  --info:          #3b82f6;
  --info-light:    rgba(59,130,246,0.12);

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  /* Gray scale — keep mapped for admin modal compatibility */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Typography */
  --font-display: 'Syne', -apple-system, sans-serif;
  --font-sans:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;

  /* Type 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:  2.25rem;

  /* Weights */
  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radius */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  /* Shadows — dark-optimized */
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.7);
  --shadow-2xl:0 25px 60px rgba(0,0,0,0.8);
  --shadow-gold: 0 4px 20px rgba(245,158,11,0.35);
  --shadow-gold-lg: 0 8px 32px rgba(245,158,11,0.45);
  --shadow-blue: 0 4px 20px rgba(59,130,246,0.35);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4,0,0.2,1);
  --transition-base: 220ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 350ms cubic-bezier(0.4,0,0.2,1);

  /* Z-index */
  --z-base:           0;
  --z-dropdown:    1000;
  --z-sticky:      1020;
  --z-fixed:       1030;
  --z-modal-backdrop:1040;
  --z-modal:       1050;
  --z-popover:     1060;
  --z-tooltip:     1070;
}

/* ── Accessibility ──────────────────────────────────────── */
/* Visually hides elements while keeping them accessible to screen readers */
.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;
}

/* ── Accessibility ──────────────────────────────────────── */
/* Visually hides elements while keeping them accessible to screen readers */
.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;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(59,130,246,0.07) 0%, transparent 60%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ─────────────────────────────────────────────── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(7,11,20,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(245,158,11,0.04), 0 4px 24px rgba(0,0,0,0.5);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0d1524;
  font-size: 20px;
  box-shadow: 0 0 20px var(--gold-glow), 0 2px 8px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.app-tagline {
  display: none;
  font-size: 11px;
  font-weight: 400;
  font-family: var(--font-sans);
  color: var(--text-muted);
  margin-left: 2px;
}

/* ── User Profile ─────────────────────────────────────── */
.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.user-avatar:hover { border-color: var(--gold); }

.user-info { display: none; }

.user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}
.user-email {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.btn-sign-out {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-sign-out:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-header-settings {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-header-settings:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ── Main Content ─────────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 16px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* ── Main Sections (theme reordering) ─────────────────── */
.main-sections {
  display: flex;
  flex-direction: column;
}
#statsContainer { order: 1; }
#uploadArea     { order: 2; }
#exportSection  { order: 3; }

/* ── Stats Bar ────────────────────────────────────────── */
.stats-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 14px 0 0 14px;
}
.stat-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* Colored left-accent per stat type */
#statCardScanned::before { background: var(--primary); }
#statCardAI::before      { background: var(--gold); }
#statCardCost::before    { background: var(--success); }
#statCardRate::before    { background: #a78bfa; }

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-bottom: 8px;
}
.stat-icon.cards { background: var(--primary-light); }
.stat-icon.ai    { background: var(--gold-light); }
.stat-icon.cost  { background: var(--success-light); }
.stat-icon.rate  { background: rgba(167,139,250,0.12); }

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Upload / Scan Section ────────────────────────────── */
.upload-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 20px 24px;
  margin-bottom: 14px;
  text-align: center;
  transition: border-color var(--transition-base);
  position: relative;
}
/* Subtle radial glow at top — makes it feel lit from above */
.upload-section::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 280px; height: 160px;
  background: radial-gradient(ellipse, rgba(245,158,11,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.upload-section > * {
  position: relative;
  z-index: 1;
}
.upload-section:hover {
  border-color: var(--border-strong);
}
.upload-section.dragover {
  border-color: var(--gold);
  background: var(--bg-elevated);
}
.upload-section.processing {
  pointer-events: none;
  opacity: 0.7;
}

.upload-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--gold-light), rgba(245,158,11,0.06));
  border: 1.5px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 0 30px rgba(245,158,11,0.12);
  position: relative;
}
/* Soft pulse ring around upload icon */
.upload-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(245,158,11,0.12);
  animation: uploadPulse 2.8s ease-in-out infinite;
}
@keyframes uploadPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0; transform: scale(1.18); }
}

.upload-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.upload-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ── Scan Buttons ─────────────────────────────────────── */
.scan-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 480px;
  margin: 0 auto 4px;
}

.btn-scan-primary,
.btn-scan-secondary {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 16px 12px;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s;
  letter-spacing: -0.01em;
}

/* Gold primary — the reason you open the app */
.btn-scan-primary {
  background: linear-gradient(150deg, #fbbf24 0%, #f59e0b 40%, #d97706 100%);
  color: #0d1524;
  box-shadow: var(--shadow-gold);
}
.btn-scan-primary:hover  {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-gold-lg);
}
.btn-scan-primary:active { transform: translateY(0) scale(0.99); box-shadow: var(--shadow-gold); }

/* Green secondary */
.btn-scan-secondary {
  background: linear-gradient(150deg, #34d399 0%, #10b981 50%, #059669 100%);
  color: white;
  box-shadow: 0 4px 18px rgba(16,185,129,0.35);
}
.btn-scan-secondary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 28px rgba(16,185,129,0.45);
}
.btn-scan-secondary:active { transform: translateY(0) scale(0.99); }

.btn-scan-primary .btn-icon,
.btn-scan-secondary .btn-icon { font-size: 24px; }

/* ── Batch / Secondary Buttons ────────────────────────── */
.button-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.btn-group-item {
  padding: 12px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-height: 52px;
}
.btn-group-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.btn-group-item .btn-icon { font-size: 18px; }

/* ── Collection Nav Buttons ───────────────────────────── */
.collection-nav-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 480px;
  margin: 14px auto 0;
}

.btn-collection-nav,
.btn-pricecheck-nav {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-collection-nav {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.25);
  color: #93c5fd;
}
.btn-collection-nav:hover {
  background: rgba(59,130,246,0.14);
  border-color: rgba(59,130,246,0.4);
}

.btn-pricecheck-nav {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.25);
  color: #6ee7b7;
}
.btn-pricecheck-nav:hover {
  background: rgba(16,185,129,0.14);
  border-color: rgba(16,185,129,0.4);
}

.collection-nav-count {
  font-size: 12px;
  opacity: 0.7;
  font-weight: 500;
}

/* ── Scan tools row: Batch Scan + Deck Builder equal tiles ─ */
.scan-tools-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin: 10px auto 0;
}

.btn-tool-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}
.btn-tool-item:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.btn-tool-item .btn-icon { font-size: 16px; }

.btn-tool-deck {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.25);
  color: #fcd34d;
}
.btn-tool-deck:hover {
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.4);
  color: #fde68a;
}

/* ── Deck Builder nav button (3rd tab) ─────────────────── */
.btn-deckbuilder-nav {
  flex: 1;
  min-width: 90px;
  max-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid rgba(245,158,11,0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(245,158,11,0.08);
  color: #fcd34d;
}
.btn-deckbuilder-nav:hover {
  background: rgba(245,158,11,0.14);
  border-color: rgba(245,158,11,0.4);
}

/* ── Export / Tools Section ───────────────────────────── */
.export-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 20px 16px;
  margin-bottom: 14px;
  text-align: center;
}

.export-section h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

/* ── Buttons — Generic ────────────────────────────────── */
.btn-primary {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-6);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  font-family: var(--font-sans);
  color: #0d1524;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-gold);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 52px;
}
.btn-primary:hover  { transform: translateY(-2px); box-shadow: var(--shadow-gold-lg); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 40px;
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ── FAB ──────────────────────────────────────────────── */
.fab-container {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: var(--z-fixed);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fab {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0d1524;
  border: none;
  box-shadow: var(--shadow-gold), var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all var(--transition-base);
}
.fab:hover  { transform: scale(1.1); box-shadow: var(--shadow-gold-lg), var(--shadow-xl); }
.fab:active { transform: scale(0.95); }

.fab-sync {
  width: 48px;
  height: 48px;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(59,130,246,0.9), rgba(37,99,235,0.9));
  box-shadow: var(--shadow-blue), var(--shadow-md);
  color: white;
}
.fab-sync.syncing { animation: spin 1s linear infinite; }

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

/* ── Card Grid ────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.card-item {
  background: var(--bg-surface);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.card-item:hover {
  border-color: rgba(245,158,11,0.30);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.12), 0 16px 40px rgba(0,0,0,0.6);
  transform: translateY(-3px);
}

.card-image-container {
  position: relative;
  width: 100%;
  padding-top: 70%;
  background: #0a1020;
  overflow: hidden;
}

.card-image {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}

.card {
  max-width: 400px;
  margin: 0 auto;
}

.cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  justify-content: start;
}

/* Mobile: 3 cards across with compact thumbnails */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0 12px;
  }
  .card-item {
    border-radius: 10px;
  }
  .card-image-container {
    padding-top: 100%; /* square thumbnails on mobile */
  }
  .card-content {
    padding: 6px 8px 8px;
  }
  .card-title {
    font-size: 0.75rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card-athlete {
    font-size: 10px;
    margin-bottom: 4px;
  }
  .card-info-grid {
    display: none; /* hide detail rows on mobile grid */
  }
  .card-footer {
    padding: 4px 6px 6px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .card-footer .btn-ebay,
  .card-footer .btn-wrong-card,
  .card-footer .btn-detail,
  .card-footer .btn-card-more {
    font-size: 10px;
    padding: 4px 6px;
  }
  /* Hide secondary buttons on mobile grid - accessible via card detail instead */
  .card-footer .btn-wrong-card,
  .card-footer .btn-card-more {
    display: none !important;
  }
  .card-footer .card-footer-ebay span:last-child {
    display: none; /* hide "Search eBay" text, keep icon */
  }
  .card-badge {
    top: 4px;
    right: 4px;
    padding: 2px 6px;
    font-size: 9px;
  }
  .card-price-row {
    font-size: 10px;
  }
  .conf-badge {
    font-size: 9px !important;
    padding: 1px 4px !important;
  }
  .listing-badge {
    font-size: 9px !important;
  }
  .rtl-badge {
    font-size: 9px !important;
  }
}

/* Very small phones: still 3 across but tighter */
@media (max-width: 380px) {
  .cards-grid {
    gap: 6px;
    padding: 0 8px;
  }
  .card-content {
    padding: 4px 6px 6px;
  }
  .card-title {
    font-size: 0.7rem;
  }
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
  letter-spacing: 0.02em;
}
.badge-free { background: rgba(16,185,129,0.85); color: white; }
.badge-paid { background: rgba(245,158,11,0.85); color: #0d1524; }

.card-content { padding: 14px 16px; }

.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.card-athlete {
  font-size: 12px;
  color: #60a5fa;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.meta-tag {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(148,163,184,0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.card-info-grid  { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.card-info-row   { display: flex; align-items: baseline; gap: 8px; line-height: 1.4; }
.card-info-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  min-width: 58px;
  flex-shrink: 0;
}
.card-info-value { font-size: 13px; font-weight: 600; color: var(--text-primary); word-break: break-word; }

/* Condition badge on thumbnail cards */
.card-condition-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(148,163,184,0.10);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

/* Card footer */
.card-footer {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

.card-footer-ebay {
  flex: 1;
  justify-content: center;
  font-size: 13px;
  padding: 9px 12px;
}

.card-footer-detail {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.card-footer-detail:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.card-fields { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.field-row   { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.field-label { font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--text-secondary); }
.field-value { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--text-primary); }

/* ── Price rows on grid cards ─────────────────────────── */
.card-price-row  { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.price-avg {
  font-size: 1.2rem; font-weight: 800;
  color: #93c5fd; background: rgba(59,130,246,0.12);
  padding: 2px 8px; border-radius: 6px;
}
.price-low {
  font-size: 1.2rem; font-weight: 800;
  color: #6ee7b7; background: rgba(16,185,129,0.12);
  padding: 2px 8px; border-radius: 6px;
}

/* ── Loading ──────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7,11,20,0.92);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.loading-overlay.active { opacity: 1; pointer-events: all; }

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(245,158,11,0.15);
  border-top-color: var(--gold);
  border-radius: var(--radius-full);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 20px var(--gold-glow);
}
.loading-text {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.progress-bar {
  width: 180px;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  margin-top: 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
  box-shadow: 0 0 8px var(--gold-glow);
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  min-width: 260px;
  max-width: 88vw;
  padding: 13px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(245,158,11,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: var(--z-tooltip);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
  backdrop-filter: blur(20px);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-icon    { font-size: 20px; }
.toast-message { font-size: 14px; font-weight: 600; }

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon  { font-size: 52px; margin-bottom: 16px; opacity: 0.5; }
.empty-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.empty-text  { font-size: 14px; color: var(--text-muted); }

/* ── Modals ───────────────────────────────────────────── */
/* Modal backgrounds stay WHITE for compatibility with all inline styles */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: var(--z-modal);
}
.modal.active { display: flex; align-items: center; justify-content: center; }

.modal-backdrop {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
  max-width: 500px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  z-index: 1;
}
.modal-large { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.01em;
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: #f3f4f6;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover { background: #e5e7eb; color: #111827; }

.modal-body   { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Settings */
.setting-group        { margin-bottom: 20px; }
.setting-group:last-child { margin-bottom: 0; }
.setting-group h3     { font-size: 15px; font-weight: 600; color: #111827; margin: 0 0 10px; }
.setting-item         { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; user-select: none; }
.setting-item:hover   { opacity: 0.8; }
.setting-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: #2563eb; }
.setting-item span    { font-size: 14px; color: #374151; }

.setting-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: white;
  cursor: pointer;
}
.setting-select:focus  { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.setting-range-container { display: flex; align-items: center; gap: 10px; }
.setting-range {
  flex: 1; height: 6px; border-radius: var(--radius-full);
  background: #e5e7eb; outline: none; -webkit-appearance: none;
}
.setting-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: var(--radius-full);
  background: #2563eb;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.setting-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.setting-range::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: var(--radius-full);
  background: #2563eb;
  cursor: pointer; border: none;
}

/* ── Responsive ───────────────────────────────────────── */
@media (min-width: 480px) {
  .app-main { padding: 16px 20px; }
}

@media (min-width: 640px) {
  .stats-container { grid-template-columns: repeat(4, 1fr); }
  .cards-grid      { grid-template-columns: repeat(2, 1fr); }
  .app-tagline     { display: inline; }
  .user-info       { display: block; }
  .app-main        { max-width: 720px; }
}

@media (min-width: 1024px) {
  .app-main        { max-width: 900px; }
  .upload-section  { padding: 36px 32px 28px; }
  .upload-icon     { width: 84px; height: 84px; font-size: 40px; }
}

@media (min-width: 1280px) {
  .cards-grid { grid-template-columns: repeat(3, 1fr); }
  .app-main   { max-width: 1100px; }
}

@media (max-width: 640px) {
  .modal-content { width: 96%; max-height: 92vh; border-radius: 16px; }
  .modal-header  { padding: 16px; }
  .modal-body    { padding: 16px; }
  .modal-footer  { padding: 12px 16px; }
}

/* ── Accessibility ────────────────────────────────────── */
*:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

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

/* ── Force Sync + header buttons ──────────────────────── */
.btn-force-sync,
.btn-collection {
  padding: 7px 13px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-collection {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
}
.btn-collection:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-force-sync {
  background: linear-gradient(135deg, rgba(59,130,246,0.9), rgba(37,99,235,0.9));
  color: white;
}
.btn-force-sync:hover   { opacity: 0.9; transform: translateY(-1px); }
.btn-force-sync.syncing { animation: spin 1s linear infinite; pointer-events: none; }

/* ── Collection Modal ─────────────────────────────────── */
.modal-fullscreen {
  max-width: 95vw;
  width: 95vw;
  max-height: 92vh;
  height: 92vh;
  display: flex;
  flex-direction: column;
}
.modal-fullscreen .modal-body { flex: 1; overflow-y: auto; padding: 16px; }

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

/* Collection modal: 3 across on mobile */
@media (max-width: 768px) {
  .collection-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .collection-grid .collection-card-img {
    height: 80px;
    object-fit: contain;
  }
  .collection-grid .collection-card-name {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .collection-grid .collection-card-meta {
    font-size: 9px;
  }
}

.collection-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all var(--transition-fast);
  position: relative;
}
.collection-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.12); transform: translateY(-2px); }

.collection-card-image {
  width: 100%;
  aspect-ratio: 7/5;
  object-fit: cover;
  background: #f3f4f6;
  display: block;
}
.collection-card-image.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  aspect-ratio: 7/5;
  background: #f3f4f6;
}
.collection-card-info       { padding: 8px 10px; }
.collection-card-name       { font-weight: 700; font-size: 14px; color: #111827; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collection-card-meta       { font-size: 11px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collection-card-badge      { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 99px; margin-top: 4px; font-weight: 600; }
.collection-card-badge.free { background: #d1fae5; color: #065f46; }
.collection-card-badge.ai   { background: #fef3c7; color: #92400e; }

.collection-empty      { text-align: center; padding: 60px 20px; color: #6b7280; }
.collection-empty-icon { font-size: 60px; margin-bottom: 16px; }

@media (max-width: 480px) {
  .btn-collection span.btn-text  { display: none; }
  .btn-force-sync span.btn-text  { display: none; }
  .collection-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .modal-fullscreen { max-width: 100vw; width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
}

/* ── Collection price rows ────────────────────────────── */
.coll-price-row  { display: flex; gap: 5px; flex-wrap: wrap; margin: 2px 0 5px; }
.coll-price-avg  { font-size: 1rem; font-weight: 800; color: #1d4ed8; background: #eff6ff; padding: 1px 6px; border-radius: 5px; }
.coll-price-low  { font-size: 1rem; font-weight: 800; color: #065f46; background: #d1fae5; padding: 1px 6px; border-radius: 5px; }
.collection-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 6px; }
.collection-ebay-link {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  background: linear-gradient(135deg, #e53238, #c0272d);
  color: white; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: all .15s;
}
.collection-ebay-link:hover { transform: translateY(-1px); }
.collection-ebay-link.listing-active { background: linear-gradient(135deg, #065f46, #047857); }
.collection-card-img-wrap { position: relative; }

/* ═══════════════════════════════════════════
   TAG SYSTEM — unchanged
═══════════════════════════════════════════ */
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: #f3f4f6; color: #374151;
  border: 1.5px solid #e5e7eb;
  cursor: default; white-space: nowrap; transition: all 0.15s;
}
.tag-chip-sm         { padding: 2px 7px; font-size: 11px; }
.tag-chip-selectable { cursor: pointer; border-color: #d1d5db; }
.tag-chip-selectable:hover { background: #e5e7eb; border-color: #9ca3af; }
.tag-chip-on,
.tag-chip-active     { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }

.card-tags-row  { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 4px; }

.tag-filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 10px 0 14px; border-bottom: 1px solid #f3f4f6; margin-bottom: 12px;
}
.tag-filter-label   { font-size: 12px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.tag-filter-chip    { cursor: pointer; border-color: #d1d5db; }
.tag-filter-chip.tag-chip-on { background: #1d4ed8; color: white; border-color: #1d4ed8; }
.tag-clear-btn      { padding: 4px 10px; font-size: 12px; color: #ef4444; border: 1.5px solid #fca5a5; border-radius: 99px; background: #fff; cursor: pointer; font-weight: 600; }
.tag-clear-btn:hover { background: #fee2e2; }

.btn-tag-add        { padding: 8px 14px; background: #1d4ed8; color: white; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-tag-add:hover  { background: #1e40af; }
.btn-tag-remove     { padding: 8px 14px; background: #ef4444; color: white; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-tag-remove:hover { background: #dc2626; }

.card-select-btn {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 99px;
  background: white; border: 2px solid #d1d5db;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; cursor: pointer;
  z-index: 10; color: #6b7280;
  box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: all 0.15s;
}
.card-select-btn:hover  { border-color: #1d4ed8; color: #1d4ed8; }
.card-select-btn.active { background: #1d4ed8; border-color: #1d4ed8; color: white; }
.collection-card.selected { outline: 2.5px solid #1d4ed8; outline-offset: 1px; }

#bulkActionBar { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }

@media (max-width: 480px) {
  .tag-filter-bar { gap: 5px; }
  #bulkActionBar  { flex-wrap: wrap; gap: 6px; }
}

/* ═══════════════════════════════════════════
   EBAY INTEGRATION — updated slightly
═══════════════════════════════════════════ */
.card-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }

.btn-ebay {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; flex: 1;
  padding: 9px 14px;
  background: linear-gradient(135deg, #e53238, #c0272d);
  color: white; border: none; border-radius: var(--radius-lg);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
  min-height: 40px; white-space: nowrap; text-decoration: none;
}
.btn-ebay:hover        { background: linear-gradient(135deg, #c0272d, #a01f24); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(229,50,56,0.4); }
.btn-ebay:active       { transform: translateY(0); }
.btn-ebay-icon         { font-size: 15px; line-height: 1; }

.btn-remove { padding: 9px 12px; background: white; color: #ef4444; border: 1.5px solid #ef4444; border-radius: var(--radius-lg); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition-fast); min-height: 40px; white-space: nowrap; }
.btn-remove:hover      { background: #fee2e2; }

.btn-wrong-card { padding: 9px 10px; background: white; color: #d97706; border: 1.5px solid #fbbf24; border-radius: var(--radius-lg); font-size: 12px; font-weight: 500; cursor: pointer; transition: all var(--transition-fast); min-height: 40px; white-space: nowrap; }
.btn-wrong-card:hover  { background: #fef3c7; border-color: #f59e0b; color: #92400e; }

.affiliate-disclosure  { margin-top: 8px; font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ═══════════════════════════════════════════
   ADMIN DASHBOARD — preserved intact
═══════════════════════════════════════════ */
.admin-dashboard-content { max-width: 95vw; width: 1200px; max-height: 90vh; overflow: hidden; }

.admin-tabs {
  display: flex; gap: 6px; padding: 16px 20px 0;
  border-bottom: 2px solid #e5e7eb;
  background: #f9fafb; overflow-x: auto;
}
.admin-tab {
  padding: 10px 20px; background: transparent; border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px; font-weight: 600; color: #6b7280;
  cursor: pointer; transition: all 0.2s;
  position: relative; top: 2px; white-space: nowrap;
}
.admin-tab:hover        { color: #2563eb; background: #f1f5f9; border-radius: 8px 8px 0 0; }
.admin-tab.active       { color: #2563eb; border-bottom-color: #2563eb; background: white; border-radius: 8px 8px 0 0; }

.admin-content          { padding: 20px; max-height: calc(90vh - 180px); overflow-y: auto; }
.admin-tab-content      { display: none; }
.admin-tab-content.active { display: block; }

.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; margin-bottom: 28px; }
.overview-stat { background: linear-gradient(135deg, #2563eb, #4f46e5); color: white; padding: 20px; border-radius: 16px; text-align: center; box-shadow: 0 4px 16px rgba(37,99,235,0.3); }
.overview-stat .stat-icon  { font-size: 28px; margin-bottom: 6px; }
.overview-stat .stat-value { font-size: 32px; font-weight: 700; margin: 6px 0; }
.overview-stat .stat-label { font-size: 13px; opacity: 0.9; }

.overview-section          { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px; margin-bottom: 20px; }
.overview-section h4       { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: #111827; }
.recent-users-list         { display: flex; flex-direction: column; gap: 10px; }
.recent-user-item          { display: flex; align-items: center; gap: 10px; padding: 10px; background: #f9fafb; border-radius: 8px; }
.recent-user-item img      { width: 38px; height: 38px; border-radius: 50%; }
.recent-user-item .user-info { flex: 1; display: block; }
.recent-user-item .user-info strong { display: block; font-size: 13px; color: #111827; }
.recent-user-item .user-info small  { font-size: 11px; color: #6b7280; }
.recent-user-item > small  { font-size: 11px; color: #9ca3af; }

.error-list  { display: flex; flex-direction: column; gap: 6px; }
.error-item  { display: flex; gap: 10px; padding: 10px; background: #fef2f2; border-left: 4px solid #ef4444; border-radius: 4px; font-size: 12px; }
.error-time  { color: #6b7280; font-weight: 600; min-width: 80px; }
.error-user  { color: #374151; min-width: 140px; }
.error-message { color: #dc2626; flex: 1; }

.users-controls             { display: flex; gap: 10px; margin-bottom: 16px; }
.users-controls input       { flex: 1; padding: 9px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.users-controls select      { padding: 9px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; cursor: pointer; }

.users-table-container      { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 12px; }
.users-table                { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table thead          { background: #f9fafb; }
.users-table th             { padding: 11px 14px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid #e5e7eb; }
.users-table tbody tr       { border-bottom: 1px solid #f3f4f6; transition: background 0.15s; }
.users-table tbody tr:hover { background: #f9fafb; }
.users-table tbody tr.admin-user { background: #f5f3ff; }
.users-table tbody tr.admin-user:hover { background: #ede9fe; }
.users-table td             { padding: 10px 14px; }

.user-cell          { display: flex; align-items: center; gap: 8px; }
.user-avatar-small  { width: 30px; height: 30px; border-radius: 50%; }

.limit-cell  { min-width: 90px; }
.mini-bar    { width: 100%; height: 4px; background: #e5e7eb; border-radius: 2px; margin-top: 3px; overflow: hidden; }
.mini-fill   { height: 100%; background: #2563eb; transition: width 0.3s; }

.status-badge              { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-badge.admin        { background: #7c3aed; color: white; }
.status-badge.regular      { background: #f1f5f9; color: #475569; }
.status-badge.success      { background: #10b981; color: white; }
.status-badge.failed       { background: #ef4444; color: white; }

.btn-icon       { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px; opacity: 0.7; transition: opacity 0.15s; }
.btn-icon:hover { opacity: 1; }

.logs-controls         { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.logs-controls select  { padding: 9px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-sm                { padding: 7px 14px !important; font-size: 12px !important; }

.logs-table-container  { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 12px; }
.logs-table            { width: 100%; border-collapse: collapse; font-size: 12px; }
.logs-table thead      { background: #f9fafb; }
.logs-table th         { padding: 9px 11px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid #e5e7eb; }
.logs-table tbody tr   { border-bottom: 1px solid #f3f4f6; }
.logs-table tbody tr.log-success { background: #f0fdf4; }
.logs-table tbody tr.log-failed  { background: #fef2f2; }
.logs-table td         { padding: 9px 11px; }

.stats-grid      { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 28px; }
.stats-grid .stat-card    { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px; text-align: center; }
.stats-grid .stat-card::before { display: none; }
.stats-grid .stat-card h4 { font-size: 13px; color: #6b7280; margin: 0 0 10px; font-weight: 600; }
.stat-big        { font-size: 30px; font-weight: 700; color: #2563eb; margin: 6px 0; }
.stat-detail     { font-size: 11px; color: #9ca3af; }

.chart-section   { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; }
.chart-section h4{ font-size: 15px; font-weight: 700; margin: 0 0 16px; }
.simple-chart    { display: flex; gap: 14px; align-items: flex-end; height: 180px; padding: 0 16px; }
.chart-bar       { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-fill        { width: 100%; background: linear-gradient(to top, #2563eb, #60a5fa); border-radius: 4px 4px 0 0; min-height: 20px; }
.bar-label       { font-size: 10px; color: #6b7280; font-weight: 600; }
.bar-value       { font-size: 12px; font-weight: 700; color: #111827; }

.edit-user-content { padding: 18px; }
.form-group        { margin-bottom: 18px; }
.form-group label  { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-group input[type="number"],
.form-group input[type="text"]   { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.form-group input[type="checkbox"] { width: 16px; height: 16px; margin-right: 6px; cursor: pointer; }
.user-logs-content { max-height: 480px; overflow-y: auto; }
.modal-large       { max-width: 95vw !important; width: 1200px !important; }

.btn-admin {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: white; border: none; border-radius: 8px;
  padding: 7px 14px; font-weight: 600; cursor: pointer;
  font-size: 13px; transition: all 0.2s;
}
.btn-admin:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(124,58,237,0.35); }

@media (max-width: 768px) {
  .admin-dashboard-content  { width: 95vw; }
  .admin-tabs                { overflow-x: auto; padding: 10px; }
  .admin-tab                 { padding: 9px 14px; font-size: 12px; white-space: nowrap; }
  .overview-grid             { grid-template-columns: 1fr 1fr; }
  .users-controls            { flex-direction: column; }
  .stats-grid                { grid-template-columns: 1fr; }
  .simple-chart              { padding: 0 6px; }
  .admin-content             { padding: 12px; }
  .users-table, .logs-table  { font-size: 11px; }
  .users-table th, .users-table td,
  .logs-table th, .logs-table td { padding: 7px; }
}
@media (max-width: 480px) {
  .overview-grid             { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   V1.1 FEATURE STYLES
═══════════════════════════════════════════ */

/* Update Banner */
.update-banner {
  position: sticky; top: 0; z-index: 200;
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: white; padding: 9px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.update-banner-content  { display: flex; align-items: center; gap: 8px; flex: 1; }
.update-banner-icon     { font-size: 16px; }
.update-banner-notes    { font-weight: 400; opacity: .85; }
.update-banner-actions  { display: flex; gap: 8px; }
.update-banner-btn      { padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; }
.update-banner-refresh  { background: white; color: #1d4ed8; }
.update-banner-dismiss  { background: rgba(255,255,255,.15); color: white; }

/* Confidence badges */
.conf-badge { position: absolute; top: 28px; left: 8px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; pointer-events: none; }
.conf-low   { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.conf-ok    { background: rgba(255,255,255,.85); color: #374151; }

/* Listing badges */
.listing-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 99px; margin-top: 4px; }
.listing-badge.listed { background: #d1fae5; color: #065f46; }
.listing-badge.sold   { background: #fee2e2; color: #991b1b; }
a.listing-badge { text-decoration: none; cursor: pointer; transition: opacity .15s; position: absolute; bottom: 6px; left: 6px; }
a.listing-badge:hover { opacity: .85; }

/* RTL badge */
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.rtl-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; background: #fef3c7; color: #92400e; white-space: nowrap; flex-shrink: 0; }

/* Action buttons on card detail */
.btn-rtl    { padding: 9px 10px; background: white; color: #92400e; border: 1.5px solid #d97706; border-radius: var(--radius-lg); font-size: 15px; cursor: pointer; transition: all .15s; min-height: 40px; }
.btn-rtl.active { background: #fef3c7; border-color: #f59e0b; }
.btn-rtl:hover  { background: #fef9c3; border-color: #fbbf24; }
.btn-detail { padding: 9px 10px; background: white; color: #2563eb; border: 1.5px solid #93c5fd; border-radius: var(--radius-lg); font-size: 15px; cursor: pointer; transition: all .15s; min-height: 40px; }
.btn-detail:hover { background: #eff6ff; }

/* Notes field */
.card-condition-row { margin-top: 8px; }
.card-notes-row     { margin-top: 8px; }
.field-notes {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; border: 1.5px solid #e5e7eb;
  border-radius: 8px; font-size: 12px; font-family: inherit;
  resize: vertical; min-height: 52px; color: #374151;
}
.field-notes:focus { outline: none; border-color: #93c5fd; background: #eff6ff; }

/* Manual search modal */
.manual-search-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f3f4f6; cursor: pointer; transition: background .12s; }
.manual-search-row:hover { background: #f9fafb; }
.manual-search-info { flex: 1; min-width: 0; }
.manual-search-name { font-size: 13px; font-weight: 600; color: #111827; }
.manual-search-meta { font-size: 11px; color: #9ca3af; margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Scan history */
.history-row      { display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; border-bottom: 1px solid #f3f4f6; }
.history-icon     { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.history-info     { flex: 1; min-width: 0; }
.history-card-name{ font-size: 13px; font-weight: 600; color: #111827; }
.history-card-meta{ font-size: 11px; color: #9ca3af; margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.history-time     { font-size: 11px; color: #9ca3af; white-space: nowrap; }

/* Batch scanner */
.batch-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 10px; padding: 4px 0; }
.batch-empty-hint { grid-column: 1/-1; padding: 40px 20px; text-align: center; }
.batch-card-tile  { position: relative; border: 1.5px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: white; transition: border-color .15s; }
.batch-card-tile.batch-tile-done  { border-color: #6ee7b7; }
.batch-card-tile.batch-tile-error { border-color: #fca5a5; }
.batch-thumb-wrap { position: relative; height: 100px; overflow: hidden; background: #f3f4f6; }
.batch-thumb      { width: 100%; height: 100%; object-fit: cover; }
.batch-tile-status{ position: absolute; bottom: 4px; right: 4px; font-size: 16px; }
.batch-tile-info  { padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.batch-tile-remove{ position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.5); color: white; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.batch-spinner-anim { display: inline-block; animation: spin 1s linear infinite; }

/* Collection stats dashboard */
.stats-top-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 400px) { .stats-top-grid { grid-template-columns: repeat(2,1fr); } }
.stats-box       { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; text-align: center; }
.stats-box-icon  { font-size: 20px; }
.stats-box-value { font-size: 22px; font-weight: 800; color: #111827; margin: 4px 0 2px; }
.stats-box-label { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .04em; }
.stats-box-sub   { font-size: 11px; color: #6b7280; margin-top: 2px; }

.stats-sections  { display: flex; flex-direction: column; gap: 14px; }
.stats-breakdown-title { font-size: 12px; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; }
.stats-bar-row   { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.stats-bar-label { font-size: 12px; color: #374151; min-width: 100px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-bar-track { flex: 1; height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.stats-bar-fill  { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 99px; transition: width .4s ease; min-width: 2px; }
.stats-bar-count { font-size: 12px; font-weight: 700; color: #374151; min-width: 24px; text-align: right; }

/* eBay monitor */
#ebayMonitorSettings { margin-top: 14px; }
#ebayMonitorSettings h3 { font-size: 13px; font-weight: 700; margin: 0 0 5px; }
#settingsVersionInfo p  { font-size: 12px; color: #6b7280; }

/* Print */
@media print {
  .app-header, .fab-container, .upload-section, .button-group { display: none; }
  .card-item { page-break-inside: avoid; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION + MORE SHEET + STATS STRIP — UI/UX Redesign
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bottom-nav-height: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

/* ── Bottom Navigation Bar ─────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(7, 11, 20, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: var(--z-sticky);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast), background-color 0.15s ease;
    position: relative;
    font-family: var(--font-sans);
    /* iOS: remove 300ms tap delay and ensure reliable touch response */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
    /* Ensure nothing can overlay and steal taps */
    -webkit-user-select: none;
    user-select: none;
}

.bottom-nav-item:active {
    background: rgba(245, 158, 11, 0.12);
}

.bottom-nav-item.active {
    color: var(--gold);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--gold);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 8px var(--gold-glow);
}

.bottom-nav-icon {
    font-size: 24px;
    line-height: 1;
}

.bottom-nav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bottom-nav-badge {
    position: absolute;
    top: 5px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    background: var(--gold);
    color: #0d1524;
    border-radius: 99px;
    font-size: 9px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.bottom-nav-badge:not(:empty) {
    display: flex;
}

/* Push content above the fixed nav bar */
.app-main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 20px) !important;
}

/* ── More Sheet ────────────────────────────────────────────────────────── */
.more-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: calc(var(--z-sticky) + 10);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.more-sheet-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--border-strong);
    border-bottom: none;
    z-index: calc(var(--z-sticky) + 11);
    transform: translateY(100%);
    transition: transform var(--transition-slow);
    padding-bottom: calc(var(--safe-bottom) + 16px);
    max-height: 85vh;
    overflow-y: auto;
}

.more-sheet.active {
    transform: translateY(0);
}

.more-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 99px;
    margin: 12px auto 8px;
    flex-shrink: 0;
}

.more-sheet-body {
    padding: 4px 0 0;
}

.more-sheet-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 24px;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}

.more-sheet-item:hover,
.more-sheet-item:active {
    background: var(--bg-elevated);
}

.more-sheet-item--danger {
    color: var(--danger);
}

.more-sheet-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.more-sheet-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.more-sheet-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 4px 24px 8px;
}

.more-sheet-disclosure {
    font-size: 11px;
    color: var(--text-muted);
    padding: 12px 24px 4px;
    line-height: 1.5;
}

/* ── Stats Strip ───────────────────────────────────────────────────────── */
.stats-strip {
    margin: 14px 0 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    overflow: hidden;
}

.stats-strip-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: color var(--transition-fast);
}

.stats-strip-toggle:hover {
    color: var(--text-primary);
}

.stats-strip-arrow {
    font-size: 10px;
    display: inline-block;
    transition: transform var(--transition-fast);
}

.stats-strip-toggle[aria-expanded="true"] .stats-strip-arrow {
    transform: rotate(180deg);
}

.stats-strip-expanded {
    padding: 0 12px 12px;
}

.stats-container-inline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* ── Tab Visibility System ─────────────────────────────────────────────── */

/* Elements always hidden — replaced by new UI */
#statsContainer          { display: none !important; }
.collection-nav-row      { display: none !important; }
#exportSection           { display: none !important; }
#tournamentToolsRow      { display: none !important; } /* moved to More sheet */

/* Scan tab: hide collection grid area */
body.tab-scan #collectionSliderWrap { display: none !important; }
body.tab-scan #emptyState           { display: none !important; }
body.tab-scan #cardSearchBar        { display: none !important; }
body.tab-scan #cardsGrid            { display: none !important; }
body.tab-scan #fabContainer         { display: none !important; }

/* Collection tab: hide scan area */
body.tab-collection #uploadArea  { display: none !important; }
body.tab-collection #statsStrip  { display: none !important; }

/* Header: hide old settings + sign-out buttons (kept in DOM for JS compatibility) */
.btn-header-settings { display: none !important; }
.btn-sign-out        { display: none !important; }

/* Icon-only sync button in header */
.btn-icon-only {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--text-secondary);
    transition: color var(--transition-fast), border-color var(--transition-fast);
    line-height: 1;
}

.btn-icon-only:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* Toast: raise above bottom nav */
.toast {
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px) !important;
}

/* Scan buttons: full width on scan tab */
body.tab-scan .scan-actions-row {
    flex-direction: column;
    max-width: 100%;
}

body.tab-scan .btn-scan-primary,
body.tab-scan .btn-scan-secondary {
    max-width: 100%;
    flex-direction: row;
    padding: 20px 24px;
    gap: 14px;
    font-size: 18px;
    justify-content: center;
    min-height: 64px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body.tab-scan .btn-scan-primary .btn-icon,
body.tab-scan .btn-scan-secondary .btn-icon {
    font-size: 28px;
}

body.tab-scan .btn-scan-primary:active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform 0.08s, opacity 0.08s;
}
body.tab-scan .btn-scan-secondary:active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform 0.08s, opacity 0.08s;
}

/* Tool row buttons: bigger on mobile */
body.tab-scan .scan-tools-row .btn-tool-item {
    padding: 14px 16px;
    font-size: 15px;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
body.tab-scan .scan-tools-row .btn-tool-item .btn-icon {
    font-size: 20px;
}
body.tab-scan .scan-tools-row .btn-tool-item:active {
    transform: scale(0.97);
    opacity: 0.85;
    transition: transform 0.08s, opacity 0.08s;
}
