/* ============================================
   CashHop — Complete Responsive Stylesheet
   Color scheme: Green/White (money/cashback)
   ============================================ */

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

:root {
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --blue-500: #3b82f6;
  --yellow-400: #facc15;
  --yellow-500: #eab308;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

a:hover {
  color: var(--green-700);
  text-decoration: underline;
}

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

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  color: var(--gray-900);
}

/* ── Container ─────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: 800px;
}

/* ── Navbar ────────────────────────────────── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.25rem 0;
}

.navbar-admin {
  background: var(--gray-800);
  border-bottom: none;
}

.navbar-admin .nav-brand-text,
.navbar-admin .nav-links a {
  color: var(--white);
}

.navbar-admin .nav-links a:hover {
  color: var(--green-400);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.nav-brand:hover {
  text-decoration: none;
}

.nav-favicon {
  height: 60px;
  width: auto;
}

.nav-brand-text {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--green-700);
}

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

.nav-links a {
  padding: 0.5rem 0.75rem;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--green-700);
  background: var(--green-50);
  text-decoration: none;
}

.nav-cta {
  margin-left: 0.5rem;
  color: var(--white) !important;
}

.nav-cta:hover {
  background: var(--green-200) !important;
  color: var(--green-900) !important;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--gray-700);
  border-radius: 1px;
  transition: 0.2s;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--green-600);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--green-700);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--green-600);
  border-color: var(--green-600);
}

.btn-outline:hover {
  background: var(--green-600);
  color: var(--white);
}

.btn-white {
  background: var(--white);
  color: var(--green-700);
}

.btn-white:hover {
  background: var(--green-50);
  color: var(--green-800);
}

.btn-danger {
  background: var(--red-500);
  color: var(--white);
}

.btn-danger:hover {
  background: var(--red-600);
  color: var(--white);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.1rem;
}

.btn-block {
  display: block;
  width: 100%;
}

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

/* ── Hero ──────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-600) 50%, var(--green-500) 100%);
  color: var(--white);
  padding: 2.5rem 0 2rem;
}

.hero-split {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-logo-side {
  display: flex;
  flex-shrink: 0;
  align-items: center;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.hero-logo-large {
  width: 250px;
  height: auto;
  animation: float 4s ease-in-out infinite;
}

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

.hero h1 {
  font-size: 2.75rem;
  color: var(--white);
  margin-bottom: 1.25rem;
  line-height: 1.15;
}

.hero-lead {
  font-size: 1.2rem;
  opacity: 0.95;
  margin-bottom: 1.1rem;
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.hero-cta .btn-outline {
  color: var(--white);
  border-color: var(--white);
}

.hero-cta .btn-outline:hover {
  background: var(--white);
  color: var(--green-700);
}

/* ── Sections ──────────────────────────────── */
.section {
  padding: 4rem 0;
}

.section-light {
  background: var(--gray-50);
}

.section-cta {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: var(--white);
}

.section-cta h2 {
  color: var(--white);
  margin-bottom: 1rem;
}

.section-cta p {
  margin-bottom: 2rem;
  line-height: 1.8;
}

.section-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-title {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.page-subtitle {
  color: var(--gray-500);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

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

/* ── Steps Grid (Homepage) ─────────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.step-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.step-number {
  width: 48px;
  height: 48px;
  background: var(--green-600);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.step-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.step-card p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* ── Comparison Table ──────────────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.comparison-table th,
.comparison-table td {
  padding: 1rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid var(--gray-100);
}

.comparison-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}

.comparison-table td:first-child,
.comparison-table th:first-child {
  text-align: left;
  font-weight: 500;
}

.highlight-col {
  background: var(--green-50) !important;
}

.comparison-table th.highlight-col {
  background: var(--green-100) !important;
  color: var(--green-800);
}

.check {
  color: var(--green-600);
  font-weight: 700;
}

.cross {
  color: var(--gray-400);
  font-weight: 500;
}

/* ── Retailer Preview Grid (Homepage) ──────── */
.retailer-preview-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.25rem;
}

.retailer-preview-card {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.retailer-preview-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 0.75rem;
  border-radius: 8px;
}

.retailer-preview-fallback {
  width: 64px;
  height: 64px;
  background: var(--green-100);
  color: var(--green-700);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 0.75rem;
}

.retailer-preview-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.retailer-preview-rate {
  display: block;
  font-size: 0.8rem;
  color: var(--green-600);
  font-weight: 500;
}

/* ── Retailer Grid Page ────────────────────── */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}

.search-wrapper {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
}

.category-filter {
  flex: 0 1 220px;
  min-width: 0;
  max-width: 100%;
}

.search-input {
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--green-500);
}

.category-select {
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.category-select:focus {
  border-color: var(--green-500);
}

.selected-count-bar {
  background: var(--green-50);
  border: 2px solid var(--green-200);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  color: var(--green-800);
  position: sticky;
  top: 60px;
  z-index: 50;
}

.retailer-grid {
  display: grid;
  /* Fluid grid — tracks shrink to container, never overflow. 132px is 60%
     of the previous 220px baseline card width. */
  /* UI tweak Pass 5 (2026-04-12): desktop card width x1.3 (132 -> 172). */
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.retailer-card {
  position: relative;
  cursor: pointer;
  min-width: 0; /* allow grid track to shrink below intrinsic content width */
}

.retailer-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.retailer-card-inner {
  text-align: center;
  padding: 0.75rem 0.5rem 0.6rem;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  /* Polish Pass 3 (2026-04-12): card height restored to 144px so the logo
     has room to breathe. Rate-num is a literal 3rem (root-relative) and
     dominates the card regardless of wrapper font-size.
     UI tweak 2026-04-12: reduced to 0.8x (144 -> 115px) alongside the
     rate-num shrink from 3rem -> 2rem, keeping card proportions tight.
     UI tweak Pass 5 (2026-04-12): desktop height x1.2 (115 -> 138px). */
  height: 138px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.retailer-card:hover .retailer-card-inner {
  border-color: var(--green-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.retailer-card input:checked ~ .retailer-card-inner {
  border-color: var(--green-500);
  background: var(--green-50);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.retailer-card input:checked ~ .retailer-check-overlay {
  display: flex;
}

.retailer-check-overlay {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: var(--green-600);
  color: var(--white);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  z-index: 2;
}

.retailer-logo-wrap {
  width: 100%;
  height: 48px;
  max-width: 84px;
  margin: 0 auto 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.retailer-logo {
  max-width: 84px;
  max-height: 48px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.retailer-logo-fallback {
  width: 44px;
  height: 44px;
  background: var(--green-100);
  color: var(--green-700);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.retailer-name {
  font-size: 0.78rem;
  margin: 0 0 0.2rem;
  line-height: 1.3;
  height: 1.3em;
  width: 100%;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-word;
  /* Polish Pass 3: 1-line clamp (not 2) — the pre-squeeze 2-line 2.6em
     cannot fit inside a 144px card alongside a 48px logo slot and a
     48px 3rem rate-num. Names are already EJS-truncated to 20 chars,
     so a single line with ellipsis is lossless in practice. */
}

.retailer-rate {
  display: block;
  overflow: hidden;
  /* Polish Pass 3: wrapper uses a readable rem base so the suffix text
     ("cashback", "per sale") stays legible. The rate-num is rem-based
     (3rem) so it is unaffected by this wrapper font-size. */
  font-size: 0.78rem;
  color: var(--green-600);
  font-weight: 500;
  margin: 0;
  line-height: 1.2;
  width: 100%;
  word-break: break-word;
  margin-top: auto;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.retailer-rate-num {
  font-weight: 700;
  /* UI tweak 2026-04-13: 2rem -> 1.5rem for retailers page + add-more-stores. */
  font-size: 1.5rem;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  color: var(--green-700);
}

/* Polish Pass 3: rate-num is rem-based so no wrapper-scoped override
   needed on /retailers. Dashboard (.my-link-rate) keeps its own rule. */

/* ── Forms ─────────────────────────────────── */
.register-form,
.review-form {
  max-width: 480px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--gray-700);
}

.form-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--green-500);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.form-note {
  text-align: center;
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 1rem;
}

.radio-group {
  display: flex;
  gap: 1.5rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.radio-label input {
  accent-color: var(--green-600);
}

/* ── Alerts ────────────────────────────────── */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--green-50);
  color: var(--green-800);
  border: 1px solid var(--green-200);
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ── My Links Page ─────────────────────────── */
.instruction-banner {
  background: var(--green-50);
  border: 2px solid var(--green-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.instruction-banner h3 {
  color: var(--green-800);
  margin-bottom: 1rem;
}

.instruction-banner ol {
  padding-left: 1.5rem;
  color: var(--gray-700);
}

.instruction-banner ol li {
  margin-bottom: 0.5rem;
}

.instruction-note {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--green-700);
  font-style: italic;
}

/* 2026-04-13: dashboard store cards reuse the .retailer-card visual style
   from the /retailers grid. The whole card is a link (target=_blank),
   with a small × button overlaid on the top-right for removal. The button
   sits above the link via z-index and stops click propagation so the
   card's link does not fire when you click the ×. */
.dashboard-retailer-card .retailer-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.dashboard-retailer-card .retailer-card-inner {
  cursor: pointer;
}

.dashboard-retailer-card:hover .retailer-card-inner {
  border-color: var(--green-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.dashboard-remove-form {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
  z-index: 3;
}

.dashboard-remove-btn {
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-500, #888);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dashboard-remove-btn:hover {
  background: #fee;
  color: #c00;
  border-color: #f99;
}

.my-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.my-link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
  /* Uniform dashboard card height regardless of store name length. */
  min-height: 88px;
}

.my-link-card:hover {
  box-shadow: var(--shadow-md);
}

.my-link-card { position: relative; }

.my-link-remove-form {
  margin: 0;
  flex-shrink: 0;
}

.my-link-remove-btn {
  background: transparent;
  border: 1px solid var(--gray-200);
  color: var(--gray-500, #888);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.my-link-remove-btn:hover {
  background: #fee;
  color: #c00;
  border-color: #f99;
}

.my-link-logo-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.my-link-logo {
  max-width: 56px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.my-link-logo-fallback {
  width: 56px;
  height: 56px;
  background: var(--green-100);
  color: var(--green-700);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.my-link-info {
  flex: 1;
  min-width: 0;
}

.my-link-info h3 {
  font-size: 0.95rem;
  margin: 0 0 0.15rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.my-link-rate {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.8rem;
  color: var(--green-600);
  line-height: 1.3;
}

/* Polish Pass 2: match the visual emphasis of the retailers grid —
   rate number is the dominant element of the dashboard row. */
.my-link-rate .retailer-rate-num {
  font-size: 2em;
  color: var(--green-700);
}

.my-link-btn {
  flex-shrink: 0;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
}

/* ── How It Works Page ─────────────────────── */
.how-steps {
  margin: 2rem 0;
}

.how-step {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--gray-100);
}

.how-step:last-child {
  border-bottom: none;
}

.how-step-number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--green-600);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}

.how-step-content h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.how-step-content p {
  color: var(--gray-600);
}

/* ── CTA Box ───────────────────────────────── */
.cta-box {
  background: var(--green-50);
  border: 2px solid var(--green-200);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin-top: 3rem;
}

.cta-box h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.cta-box p {
  color: var(--gray-600);
  margin-bottom: 1.25rem;
}

/* ── FAQ ───────────────────────────────────── */
.faq-list,
.faq-snippet {
  margin: 2rem 0;
}

.faq-item,
details {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-item summary,
details summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--gray-50);
  transition: background 0.2s;
  list-style: none;
}

.faq-item summary::-webkit-details-marker,
details summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before,
details summary::before {
  content: '+';
  float: right;
  font-size: 1.25rem;
  color: var(--green-600);
  font-weight: 700;
}

.faq-item[open] summary::before,
details[open] summary::before {
  content: '-';
}

.faq-item summary:hover,
details summary:hover {
  background: var(--green-50);
}

.faq-item p,
details p {
  padding: 1rem 1.25rem;
  color: var(--gray-600);
  line-height: 1.7;
}

/* ── Reviews ───────────────────────────────── */
.aggregate-rating {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--green-50);
  border-radius: var(--radius-lg);
}

.big-rating {
  font-size: 3rem;
  font-weight: 700;
  color: var(--green-700);
}

.stars-large .star {
  font-size: 1.5rem;
}

.star {
  color: var(--gray-300);
  font-size: 1.1rem;
}

.star.filled {
  color: var(--yellow-400);
}

.review-form-section {
  background: var(--gray-50);
  padding: 2rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.review-form-section h2 {
  margin-bottom: 0.5rem;
}

.review-form-section p {
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.star-input {
  display: flex;
  gap: 0.25rem;
  flex-direction: row;
}

.star-label {
  cursor: pointer;
}

.star-label input {
  display: none;
}

.star-pick {
  font-size: 2rem;
  color: var(--gray-300);
  transition: color 0.15s;
}

/* Star highlighting is handled by JavaScript */

.reviews-list {
  margin-top: 2rem;
}

.reviews-list h2 {
  margin-bottom: 1.5rem;
}

.review-item {
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.review-date {
  font-size: 0.85rem;
  color: var(--gray-400);
}

.review-text {
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.review-author {
  font-size: 0.9rem;
  color: var(--gray-500);
}

.reviews-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.review-card {
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.review-card .review-stars {
  margin-bottom: 0.75rem;
}

.review-card .review-comment {
  color: var(--gray-600);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.review-card .review-author {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ── Stats ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.stat-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-700);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ── Data Table ────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem;
}

.data-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}

.data-table tr:hover {
  background: var(--gray-50);
}

/* ── Stats timeseries line chart (inline SVG, no JS libs) ── */
/* Two polylines: total views (light green) + unique visitors (dark green). */
.line-chart {
  padding: 1rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.line-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.line-chart-grid {
  stroke: var(--gray-200);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.line-chart-axis {
  stroke: var(--gray-300);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.line-chart-ylabel,
.line-chart-xlabel {
  fill: var(--gray-500);
  font-size: 10px;
  font-family: inherit;
}

.line-chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-chart-line-views {
  stroke: #16a34a;
}

.line-chart-line-uniques {
  stroke: #f59e0b;
}

.line-chart-dot-views {
  fill: #16a34a;
  stroke: var(--white);
  stroke-width: 1.5;
}

.line-chart-dot-uniques {
  fill: #f59e0b;
  stroke: var(--white);
  stroke-width: 1.5;
}

.line-chart-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.line-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.line-chart-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.line-chart-swatch-views {
  background: #16a34a;
}

.line-chart-swatch-uniques {
  background: #f59e0b;
}

.line-chart-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--gray-500);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
}

.row-pending {
  background: #fffbeb;
}

.row-inactive {
  opacity: 0.6;
}

/* ── Status Badges ─────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-scheduled {
  background: #dbeafe;
  color: #1e40af;
}

.status-sent {
  background: var(--green-100);
  color: var(--green-800);
}

.status-awaiting {
  background: #fff3cd;
  color: #856404;
}

.status-failed {
  background: #fecaca;
  color: #b91c1c;
}

.rate-badge {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-700);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Article Pages ─────────────────────────── */
.article-meta {
  font-size: 0.9rem;
  color: var(--gray-400);
  margin-bottom: 2rem;
}

.article-lead {
  font-size: 1.15rem;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 2rem;
}

article h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
}

article p {
  margin-bottom: 1rem;
  line-height: 1.75;
  color: var(--gray-700);
}

article ul, article ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

article li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  color: var(--gray-700);
}

/* ── Error Page ────────────────────────────── */
.error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--gray-300);
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 1.25rem;
  color: var(--gray-500);
}

/* ── Empty State ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

.empty-state h3 {
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}

/* ── Footer ────────────────────────────────── */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer h4 {
  color: var(--white);
  margin-bottom: 1rem;
  font-size: 1.15rem;
}

.footer-tagline {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.footer ul {
  list-style: none;
}

.footer ul li {
  margin-bottom: 0.6rem;
}

.footer a {
  color: var(--gray-400);
  font-size: 1.05rem;
}

.footer a:hover {
  color: var(--white);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--gray-700);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 1rem;
}

/* Shopping Records Table */
.shopping-records {
  width: 100%;
}

.shopping-records .section-title {
  margin-bottom: 1.5rem;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.records-table thead {
  background: var(--green-50);
}

.records-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--green-800);
  border-bottom: 2px solid var(--green-200);
  white-space: nowrap;
}

.records-table td {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

.records-table tbody tr:hover {
  background: var(--gray-50);
}

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

.cashback-amount {
  font-weight: 600;
  color: var(--green-600) !important;
}

.records-intro {
  color: var(--gray-500);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.records-table-empty {
  opacity: 0.45;
}

.records-table-empty .sample-row td {
  font-style: italic;
  color: var(--gray-400);
}

/* Payout Settings */
.payout-settings {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.payout-settings h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--gray-800);
}

.payout-form-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.payout-form-row:last-child {
  margin-bottom: 0;
}

.payout-radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-700);
}

.payout-email-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .retailer-preview-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-cta {
    margin-left: 0;
    margin-top: 0.5rem;
  }

  .hero {
    padding: 1.5rem 0 1.5rem;
  }

  .hero-split {
    flex-direction: column;
    text-align: center;
  }

  .hero-logo-large {
    width: 180px;
    height: auto;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-lead {
    font-size: 1.05rem;
  }

  .section {
    padding: 3rem 0;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .page-title {
    font-size: 1.75rem;
  }

  .retailer-preview-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* UI tweak Pass 5 (2026-04-12): fix big gaps below search bar and below
     category dropdown on mobile/tablet. Root cause: .filter-bar base is
     `display:flex; flex-wrap:wrap; gap:1rem; margin-bottom:1.5rem`. In the
     481–768px range the search wrapper (flex 1 1 220px) and category filter
     (flex 0 1 220px) wrap onto two rows, creating a 1rem row-gap below the
     search; then the 1.5rem margin-bottom creates a second gap below the
     category before the grid. Pass 4 only patched <=480px, leaving this
     range untouched — hence the "still broken" report. Force single-column
     stacking here with tight gaps. */
  .filter-bar {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  /* UI tweak 2026-04-13 (Pass 6): the REAL culprit behind the "big empty
     gaps" on /retailers mobile. Base rules set `.search-wrapper` and
     `.category-filter` to `flex: 1 1 220px`. When .filter-bar becomes
     `flex-direction: column` on mobile, that 220px flex-basis applies to
     the MAIN axis (height), inflating each wrapper to 220px tall even
     though their only child is a 44px input. Reset basis to auto so the
     wrappers size to their content. */
  .search-wrapper,
  .category-filter {
    flex: 0 0 auto;
  }

  /* UI tweak 2026-04-13: additional vertical-gap fixes on /retailers mobile.
     .page-subtitle base has margin-bottom: 2rem (gap above search bar);
     section base on mobile is 3rem 0 (huge top/bottom). Tighten both so
     the search/category/grid stack reads as a single tight cluster. */
  .page-subtitle {
    margin-bottom: 0.75rem;
  }

  /* UI tweak 2026-04-13: two-column store grid on mobile. Desktop keeps the
     fluid auto-fill rule; mobile forces exactly 2 columns with a tight
     10px gap so cards occupy the visible viewport without 1-col waste. */
  .retailer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* UI tweak Pass 5: mobile card height x1.2. Desktop rule sets 138px;
     explicit mobile override keeps parity and documents intent.
     UI tweak 2026-04-13: trim to 120px so 2-col cards on narrow phones
     don't feel oversized; also tighten inner padding. */
  .retailer-card-inner {
    height: 120px;
    padding: 0.6rem 0.4rem 0.5rem;
  }

  .retailer-name {
    font-size: 0.72rem;
  }

  .retailer-rate {
    font-size: 0.72rem;
  }

  .retailer-logo-wrap {
    height: 42px;
    max-width: 72px;
    margin-bottom: 0.3rem;
  }

  .retailer-logo {
    max-width: 72px;
    max-height: 42px;
  }

  .reviews-preview-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .how-step {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .aggregate-rating {
    flex-direction: column;
    text-align: center;
  }

  .my-links-grid {
    grid-template-columns: 1fr;
  }

  .records-table thead {
    display: none;
  }

  .records-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.5rem;
  }

  .records-table td {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
  }

  .records-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray-600);
    margin-right: 1rem;
  }

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

@media (max-width: 480px) {
  .retailer-preview-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-cta .btn {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    /* UI tweak 2026-04-12: tighten large empty gaps below search bar and
       below category dropdown on mobile. */
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  /* UI tweak 2026-04-13 (Pass 6): see matching rule in the 768px block.
     In column flex, the base `flex: 1 1 220px` basis applies to height,
     puffing each wrapper to 220px around a 44px input. Reset to auto. */
  .search-wrapper,
  .category-filter {
    flex: 0 0 auto;
  }

  /* Polish Pass 3: explicit mobile rate-num size. The desktop base rule
     is already 3rem (rem = root-relative), so this is a defensive
     re-statement to prevent any future mobile override from regressing
     the rate number. Only the rate number is overridden on mobile —
     card height, logo slot, padding, and name styling keep mobile
     defaults (inherited from desktop). */
  .retailer-rate-num {
    font-size: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .selected-count-bar {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .my-link-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ── Admin mobile fixes (2026-04-22) ────────────
   1. Hamburger spans need to be white on the dark admin nav (default
      gray-700 spans are nearly invisible against gray-800 bg).
   2. The base mobile collapse style sets the open .nav-links background
      to white, which makes the white admin link text vanish — override
      to dark BG inside .navbar-admin so text stays readable.
   3. Compact .data-table on small screens — at 10 columns × 0.75rem×1rem
      padding the user table doesn't fit on a phone. Tighten padding +
      shrink font, and reduce link-cell wrapping.                       */
.navbar-admin .nav-toggle span {
  background: var(--white);
}

@media (max-width: 768px) {
  .navbar-admin .nav-links {
    background: var(--gray-800);
    border-bottom: 1px solid var(--gray-700);
    box-shadow: var(--shadow-md);
  }

  .navbar-admin .nav-links a {
    color: var(--white);
    padding: 0.6rem 0.75rem;
    width: 100%;
    display: block;
  }

  .navbar-admin .nav-links a:hover,
  .navbar-admin .nav-links a.active {
    color: var(--green-400);
    background: var(--gray-700);
  }

  .data-table th,
  .data-table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.78rem;
  }

  .data-table {
    /* keep a usable min width so columns don't crush; .table-responsive
       wrapper provides horizontal scroll past this width */
    min-width: 640px;
  }
}

@media (max-width: 480px) {
  .data-table th,
  .data-table td {
    padding: 0.3rem 0.4rem;
    font-size: 0.72rem;
  }
}
