/* ==========================================================================
   HP Jeans Kids Affiliate — front-end
   Uses the theme's design tokens when available, with fallbacks.
   ========================================================================== */

.hpjk-aff {
  --aff-navy: var(--primary-navy, #1E5D82);
  --aff-navy-dark: var(--primary-navy-dark, #144460);
  --aff-gold: var(--accent-gold, #FDB933);
  --aff-gold-dark: var(--accent-gold-hover, #EAA81D);
  --aff-gold-light: var(--accent-gold-light, #FFF8E7);
  --aff-cream: var(--brand-cream, #F8F4E5);
  --aff-text: var(--text-main, #18181B);
  --aff-muted: var(--text-muted, #52525B);
  --aff-subtle: var(--text-subtle, #71717A);
  --aff-line: var(--border-hairline, rgba(30, 93, 130, 0.12));
  --aff-radius: 18px;
  --aff-radius-lg: 28px;
  --aff-shadow: 0 20px 48px -18px rgba(30, 93, 130, 0.18);
  --aff-green: #15803D;
  --aff-red: #B91C1C;
  color: var(--aff-text);
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: 80px;
}

.page-app-wrap { padding-top: 24px; }
.hpjk-aff--overlay { padding: 0; }
.hpjk-aff *, .hpjk-aff *::before, .hpjk-aff *::after { box-sizing: border-box; }
.hpjk-aff h1, .hpjk-aff h2, .hpjk-aff h3 { color: var(--aff-navy); margin: 0; }
.hpjk-aff p { margin: 0; }
.hpjk-aff [hidden] { display: none !important; }
.aff-locked, .aff-locked body { overflow: hidden; }

/* Shared atoms ------------------------------------------------------------ */
.aff-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--aff-gold-dark);
  margin-bottom: 12px;
}
.aff-muted { color: var(--aff-muted); font-size: 13.5px; }
.aff-block { display: block; }
.aff-card {
  background: #FFFFFF;
  border: 1px solid var(--aff-line);
  border-radius: var(--aff-radius);
  box-shadow: var(--aff-shadow);
  padding: 28px;
}
.aff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.aff-btn:hover { transform: translateY(-1px); }
.aff-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.aff-btn--primary { background: var(--aff-gold); color: var(--aff-text); box-shadow: 0 10px 24px -8px rgba(234, 168, 29, 0.6); }
.aff-btn--primary:hover { background: var(--aff-gold-dark); color: var(--aff-text); }
.aff-btn--dark { background: var(--aff-navy); color: #FFFFFF; }
.aff-btn--dark:hover { background: var(--aff-navy-dark); color: #FFFFFF; }
.aff-btn--ghost { background: #FFFFFF; color: var(--aff-navy); border-color: var(--aff-line); }
.aff-btn--ghost:hover { border-color: var(--aff-navy); color: var(--aff-navy); }
.aff-btn--block { width: 100%; }
.aff-stack { display: grid; gap: 12px; margin-top: 20px; }
.aff-stack--row { display: flex; flex-wrap: wrap; justify-content: center; }
.aff-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--aff-line);
  background: var(--aff-cream);
  color: var(--aff-navy);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.aff-chip:hover { border-color: var(--aff-navy); }
.aff-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--aff-navy);
  background: var(--aff-cream);
  border: 1px dashed rgba(30, 93, 130, 0.35);
  border-radius: 8px;
  padding: 4px 10px;
}
.aff-tier-pill {
  --tier: #94A3B8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--tier);
  background: color-mix(in srgb, var(--tier) 14%, #FFFFFF);
  border: 1px solid color-mix(in srgb, var(--tier) 40%, #FFFFFF);
}
.aff-tier-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tier); }
.aff-notice {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
}
.aff-notice.is-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.aff-notice.is-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.aff-alert {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--aff-gold-light);
  color: #92400E;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Forms ---------------------------------------------------------------- */
.aff-form { display: grid; gap: 16px; }
.aff-field { display: grid; gap: 6px; }
.aff-field > span { font-size: 13px; font-weight: 700; color: var(--aff-text); }
.aff-field input[type="text"],
.aff-field input[type="tel"],
.aff-field input[type="url"],
.aff-field input[type="number"],
.aff-field select,
.aff-share__link input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--aff-line);
  background: #FFFFFF;
  font: inherit;
  font-size: 14.5px;
  color: var(--aff-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.aff-field input:focus, .aff-field select:focus, .aff-share__link input:focus {
  border-color: var(--aff-gold);
  box-shadow: 0 0 0 3px rgba(253, 185, 51, 0.2);
}
.aff-field input:disabled { background: #F4F4F5; }
.aff-hint { font-size: 12.5px; color: var(--aff-subtle); }
.aff-hint code { font-size: 12px; color: var(--aff-navy); word-break: break-all; background: none; padding: 0; }
.aff-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--aff-muted); cursor: pointer; }
.aff-check input { margin-top: 4px; accent-color: var(--aff-gold-dark); width: 16px; height: 16px; flex-shrink: 0; }
.aff-input-group { display: flex; gap: 8px; }
.aff-input-group input { flex: 1; min-width: 0; }
.aff-upload { display: flex; align-items: center; gap: 12px; cursor: pointer; flex-wrap: wrap; }
.aff-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.aff-upload__btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px dashed rgba(30, 93, 130, 0.35);
  background: var(--aff-cream);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--aff-navy);
}
.aff-upload:focus-within .aff-upload__btn { border-color: var(--aff-gold); }
.aff-upload__name { font-size: 12.5px; color: var(--aff-subtle); }

/* Landing ----------------------------------------------------------------- */
.aff-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
  padding: 56px;
  border-radius: var(--aff-radius-lg);
  background:
    radial-gradient(circle at 85% 20%, rgba(253, 185, 51, 0.28), transparent 45%),
    linear-gradient(135deg, #FFFFFF 0%, var(--aff-cream) 100%);
  border: 1px solid var(--aff-line);
  margin-bottom: 72px;
  overflow: hidden;
}
.aff-hero__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(32px, 4.4vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 18px !important;
}
.aff-hero__title span { display: block; color: var(--aff-gold-dark); }
.aff-hero__lead { font-size: 16.5px; color: var(--aff-muted); max-width: 560px; margin-bottom: 28px !important; }
.aff-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 36px; }
.aff-hero__facts { list-style: none; margin: 0; padding: 24px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; border-top: 1px solid var(--aff-line); }
.aff-hero__facts strong { display: block; font-size: 20px; color: var(--aff-navy); }
.aff-hero__facts span { font-size: 13px; color: var(--aff-subtle); }

.aff-mock {
  position: relative;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 26px;
  box-shadow: 0 40px 80px -30px rgba(20, 68, 96, 0.35);
  transform: rotate(-2deg);
  max-width: 360px;
  margin-left: auto;
}
.aff-mock__head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.aff-mock__head strong { display: block; color: var(--aff-navy); }
.aff-mock__avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--aff-gold-light); display: grid; place-items: center; font-size: 24px; }
.aff-mock__amount span { font-size: 12.5px; color: var(--aff-subtle); }
.aff-mock__amount strong { display: block; font-size: 30px; color: var(--aff-navy); letter-spacing: -0.02em; }
.aff-mock__bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; margin-top: 18px; }
.aff-mock__bars i { flex: 1; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--aff-gold), rgba(253, 185, 51, 0.35)); }
.aff-mock__toast {
  position: absolute;
  left: -36px;
  bottom: -18px;
  background: var(--aff-navy);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  transform: rotate(2deg);
  box-shadow: 0 14px 28px -10px rgba(20, 68, 96, 0.6);
}

.aff-section { margin-bottom: 72px; }
.aff-section__head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.aff-section__head h2 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(26px, 3vw, 36px); margin-bottom: 10px; }
.aff-section__head p { color: var(--aff-muted); }

.aff-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: none; }
.aff-step { background: #FFFFFF; border: 1px solid var(--aff-line); border-radius: var(--aff-radius); padding: 28px; }
.aff-step__num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--aff-navy);
  color: #FFFFFF;
  font-weight: 800;
  margin-bottom: 16px;
}
.aff-step h3 { font-size: 17px; margin-bottom: 8px; font-family: inherit; }
.aff-step p { color: var(--aff-muted); font-size: 14px; }

.aff-bonus {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
  border-radius: var(--aff-radius);
  background: linear-gradient(135deg, var(--aff-navy), var(--aff-navy-dark));
  color: #FFFFFF;
  margin-bottom: 20px;
}
.aff-bonus__icon { font-size: 30px; }
.aff-bonus strong { display: block; font-size: 16px; }
.aff-bonus p { color: rgba(255, 255, 255, 0.82); font-size: 14px; }
.aff-bonus .woocommerce-Price-amount { color: inherit; }
.aff-bonus__amount { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--aff-gold); white-space: nowrap; }

.aff-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.aff-tier {
  --tier: #94A3B8;
  position: relative;
  background: #FFFFFF;
  border: 1px solid var(--aff-line);
  border-top: 4px solid var(--tier);
  border-radius: var(--aff-radius);
  padding: 24px;
  text-align: center;
}
.aff-tier__name { display: block; font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tier); }
.aff-tier__rate { display: block; font-size: 44px; line-height: 1.1; color: var(--aff-navy); margin: 8px 0 2px; letter-spacing: -0.03em; }
.aff-tier__label { display: block; font-size: 13px; color: var(--aff-subtle); margin-bottom: 14px; }
.aff-tier__range { display: block; font-size: 13px; font-weight: 600; color: var(--aff-muted); padding-top: 12px; border-top: 1px dashed var(--aff-line); }

.aff-join { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.aff-join__intro h2 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(26px, 3vw, 34px); margin-bottom: 18px; }
.aff-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.aff-checklist li { position: relative; padding-left: 30px; color: var(--aff-muted); font-size: 14.5px; }
.aff-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #DCFCE7;
  color: var(--aff-green);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.aff-join__card h3 { font-size: 22px; margin-bottom: 6px; }
.aff-join__card .aff-form { margin-top: 20px; }
.aff-status { text-align: center; padding: 12px 0; }
.aff-status > span { font-size: 40px; display: block; margin-bottom: 10px; }
.aff-status h3 { margin-bottom: 8px; }
.aff-status p { color: var(--aff-muted); }

.aff-faq__list { max-width: 820px; margin: 0 auto; display: grid; gap: 12px; }
.aff-faq details { background: #FFFFFF; border: 1px solid var(--aff-line); border-radius: 14px; padding: 0 22px; }
.aff-faq summary { cursor: pointer; padding: 18px 0; font-weight: 700; color: var(--aff-navy); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.aff-faq summary::-webkit-details-marker { display: none; }
.aff-faq summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--aff-gold-dark); }
.aff-faq details[open] summary::after { content: "−"; }
.aff-faq details p { padding-bottom: 18px; color: var(--aff-muted); font-size: 14.5px; }

/* Dashboard ----------------------------------------------------------------- */
.aff-dash__top { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; margin-bottom: 20px; }
.aff-profile__head { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.aff-profile__avatar { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--aff-gold-light); }
.aff-profile__name { font-family: 'Playfair Display', Georgia, serif; font-size: 24px; line-height: 1.2; margin-bottom: 6px !important; }
.aff-profile__meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.aff-progress__label { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--aff-muted); margin-bottom: 8px; }
.aff-progress__label .woocommerce-Price-amount { font-weight: 700; color: var(--aff-navy); }
.aff-progress__bar { height: 10px; border-radius: 999px; background: #EEF2F6; overflow: hidden; }
.aff-progress__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--aff-gold), var(--tier, var(--aff-gold-dark))); }

.aff-share__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.aff-share__head h2 { font-size: 17px; font-family: inherit; }
.aff-share__link { display: flex; gap: 8px; }
.aff-share__link input { flex: 1; min-width: 0; background: var(--aff-cream); font-size: 13.5px; }
.aff-share__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.aff-builder { margin-top: 16px; border-top: 1px dashed var(--aff-line); padding-top: 14px; }
.aff-builder summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--aff-navy); }
.aff-builder .aff-muted { margin: 8px 0 10px; font-size: 13px; }
.aff-builder__result { margin-top: 10px !important; font-size: 12.5px; color: var(--aff-green); word-break: break-all; }
.aff-builder__result.is-error { color: var(--aff-red); }

.aff-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.aff-stat { background: #FFFFFF; border: 1px solid var(--aff-line); border-radius: var(--aff-radius); padding: 20px 22px; }
.aff-stat:first-child { background: linear-gradient(135deg, var(--aff-navy), var(--aff-navy-dark)); border-color: transparent; color: #FFFFFF; }
.aff-stat__label { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--aff-subtle); }
.aff-stat:first-child .aff-stat__label, .aff-stat:first-child .aff-stat__sub { color: rgba(255, 255, 255, 0.75); }
.aff-stat__value { display: block; font-size: 26px; letter-spacing: -0.02em; color: var(--aff-navy); margin: 6px 0 2px; }
.aff-stat__value--accent { color: var(--aff-gold); }
.aff-stat__value .woocommerce-Price-amount { color: inherit; }
.aff-stat__sub { font-size: 12.5px; color: var(--aff-subtle); }
.aff-stat__sub .woocommerce-Price-amount { color: inherit; font-weight: 700; }

.aff-tabs { padding: 0; overflow: hidden; }
.aff-tabs__nav { display: flex; gap: 4px; padding: 8px; background: var(--aff-cream); border-bottom: 1px solid var(--aff-line); overflow-x: auto; }
.aff-tabs__nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--aff-muted);
  cursor: pointer;
  white-space: nowrap;
}
.aff-tabs__nav button[aria-selected="true"] { background: #FFFFFF; color: var(--aff-navy); box-shadow: 0 6px 16px -10px rgba(20, 68, 96, 0.4); }
.aff-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--aff-navy); color: #FFFFFF; font-size: 11.5px; text-align: center; }
.aff-dot { width: 8px; height: 8px; border-radius: 50%; background: #EF4444; }
.aff-tabs__panel { padding: 28px; }
.aff-subtitle { font-family: inherit; font-size: 16px; margin: 32px 0 14px !important; }

.aff-table-wrap { overflow-x: auto; }
.aff-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.aff-table th { text-align: left; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--aff-subtle); padding: 10px 12px; border-bottom: 1px solid var(--aff-line); white-space: nowrap; }
.aff-table td { padding: 14px 12px; border-bottom: 1px solid var(--aff-line); vertical-align: top; }
.aff-table tr:last-child td { border-bottom: 0; }
.aff-table .is-num { text-align: right; white-space: nowrap; }
.aff-table .aff-muted { font-size: 12.5px; }
.aff-items { max-width: 260px; color: var(--aff-muted); }
.aff-plus { color: var(--aff-green); }
.aff-plus .woocommerce-Price-amount { color: inherit; }
.aff-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.aff-badge--pending { background: #FEF3C7; color: #92400E; }
.aff-badge--approved, .aff-badge--paid { background: #DCFCE7; color: #166534; }
.aff-badge--rejected { background: #FEE2E2; color: #991B1B; }

.aff-empty { text-align: center; padding: 32px 16px; }
.aff-empty > span { font-size: 40px; display: block; margin-bottom: 10px; }
.aff-empty h3 { margin-bottom: 8px; }
.aff-empty p { color: var(--aff-muted); max-width: 440px; margin: 0 auto 20px; }

.aff-bank { grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: start; }
.aff-bank__fields { display: grid; gap: 16px; }
.aff-qr-card { background: var(--aff-cream); border-radius: var(--aff-radius); padding: 20px; text-align: center; }
.aff-qr-card__label { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--aff-subtle); margin-bottom: 12px; }
.aff-qr-card__img { background: #FFFFFF; border-radius: 14px; min-height: 240px; display: grid; place-items: center; padding: 12px; margin-bottom: 12px; }
.aff-qr-card__img img { max-width: 100%; max-height: 320px; border-radius: 8px; }
.aff-qr-card__empty { color: var(--aff-subtle); font-size: 13px; padding: 0 16px; }

.aff-payout { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 28px; align-items: start; }
.aff-payout__balance { background: linear-gradient(135deg, var(--aff-gold-light), #FFFFFF); border: 1px solid rgba(253, 185, 51, 0.4); border-radius: var(--aff-radius); padding: 24px; }
.aff-payout__balance > span:first-child { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--aff-subtle); }
.aff-payout__balance strong { display: block; font-size: 34px; color: var(--aff-navy); letter-spacing: -0.02em; margin: 6px 0 10px; }
.aff-payout__balance .woocommerce-Price-amount { color: inherit; }

/* QR modal & toast ------------------------------------------------------- */
.aff-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(11, 22, 34, 0.6);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.aff-modal__dialog { position: relative; background: #FFFFFF; border-radius: 24px; padding: 32px; width: min(420px, 100%); text-align: center; }
.aff-modal__dialog h2 { font-size: 20px; margin-bottom: 6px; }
.aff-modal__dialog canvas { display: block; margin: 20px auto 12px; width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--aff-line); }
.aff-modal__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--aff-cream); cursor: pointer; font-size: 16px; color: var(--aff-navy); }
.aff-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 160%);
  opacity: 0;
  z-index: 1300;
  background: var(--aff-navy);
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 16px 30px -12px rgba(20, 68, 96, 0.6);
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.aff-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* Responsive ---------------------------------------------------------------- */
@media (max-width: 1024px) {
  .aff-hero { grid-template-columns: 1fr; padding: 40px; }
  .aff-hero__visual { display: none; }
  .aff-dash__top { grid-template-columns: 1fr; }
  .aff-stats { grid-template-columns: repeat(2, 1fr); }
  .aff-join, .aff-bank, .aff-payout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hpjk-aff { font-size: 14.5px; }
  .aff-hero { padding: 28px 20px; margin-bottom: 48px; }
  .aff-hero__facts { grid-template-columns: 1fr; }
  .aff-steps { grid-template-columns: 1fr; }
  .aff-bonus { flex-wrap: wrap; }
  .aff-bonus__amount { margin-left: 0; }
  .aff-card, .aff-tabs__panel { padding: 20px; }
  /* The tabs card frames its own nav and panel; padding here would double the inset. */
  .aff-card.aff-tabs { padding: 0; }
  .aff-tabs__panel { padding: 16px; }
  .aff-tabs__nav { scrollbar-width: none; }
  .aff-tabs__nav::-webkit-scrollbar { display: none; }
  .aff-stats { grid-template-columns: 1fr; }
  .aff-share__link { flex-direction: column; }
  .aff-table thead { display: none; }
  .aff-table, .aff-table tbody, .aff-table tr, .aff-table td { display: block; width: 100%; }
  .aff-table tr { border: 1px solid var(--aff-line); border-radius: 14px; padding: 6px 14px; margin-bottom: 12px; }
  .aff-table td { border: 0; padding: 8px 0 8px 40%; position: relative; text-align: right; min-height: 34px; }
  .aff-table td::before { content: attr(data-label); position: absolute; left: 0; top: 8px; width: 38%; font-size: 12px; font-weight: 700; color: var(--aff-subtle); text-align: left; }
  .aff-table .is-num { text-align: right; }
  .aff-items { max-width: none; }
}

/* Statistics tab ---------------------------------------------------------- */
.aff-stats-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.aff-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--aff-cream);
  border: 1px solid var(--aff-line);
}
.aff-segmented button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--aff-muted);
  cursor: pointer;
}
.aff-segmented button[aria-pressed="true"] { background: #FFFFFF; color: var(--aff-navy); box-shadow: 0 4px 12px -8px rgba(20, 68, 96, 0.5); }
.aff-segmented--sm button { padding: 6px 12px; font-size: 12.5px; }
.aff-btn--sm { padding: 9px 16px; font-size: 13.5px; }
.aff-stats-period { margin: 12px 0 16px !important; font-size: 13px; }
[data-stats].is-loading .aff-kpis,
[data-stats].is-loading .aff-chart { opacity: 0.55; transition: opacity 0.2s ease; }

.aff-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.aff-kpi { background: #FFFFFF; border: 1px solid var(--aff-line); border-radius: 14px; padding: 16px; min-width: 0; }
.aff-kpi__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--aff-subtle); }
.aff-kpi__value { display: block; font-size: 22px; font-weight: 700; color: var(--aff-text); letter-spacing: -0.01em; margin: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aff-kpi__delta { display: block; font-size: 12px; color: var(--aff-subtle); }
.aff-kpi__delta b { font-weight: 700; }
.aff-kpi__delta .is-up { color: #15803D; }
.aff-kpi__delta .is-down { color: #B91C1C; }
.aff-kpi__delta .is-flat { color: var(--aff-muted); }
.aff-kpi.is-loading .aff-kpi__label,
.aff-kpi.is-loading .aff-kpi__value,
.aff-kpi.is-loading .aff-kpi__delta { background: #F1EFEA; border-radius: 6px; color: transparent; }

.aff-chart-card { border: 1px solid var(--aff-line); border-radius: 16px; padding: 18px 18px 12px; margin-bottom: 20px; background: #FFFFFF; }
.aff-chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.aff-chart-head h3 { font-family: inherit; font-size: 15px; color: var(--aff-text) !important; }
.aff-chart { position: relative; min-height: 240px; }
.aff-chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.aff-chart svg:focus-visible { outline: 2px solid var(--aff-gold); outline-offset: 4px; border-radius: 6px; }
.aff-chart__tick { font-size: 11px; fill: #71717A; font-variant-numeric: tabular-nums; }
.aff-chart__bar { transition: fill 0.15s ease; }
.aff-chart__empty { position: absolute; inset: 40px 0 auto; text-align: center; color: var(--aff-subtle); font-size: 13.5px; pointer-events: none; }
.aff-chart__tip {
  position: absolute;
  transform: translateX(-50%);
  background: #18181B;
  color: #FFFFFF;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
.aff-chart__tip strong { display: block; font-size: 14px; }
.aff-chart__tip span { color: rgba(255, 255, 255, 0.75); }
.aff-chart-table { margin-top: 8px; }
.aff-chart-table summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--aff-navy); padding: 6px 0; }
.aff-chart-table .aff-table-wrap { max-height: 320px; overflow: auto; }

.aff-table--compact td, .aff-table--compact th { padding: 8px 10px; font-size: 13px; }

.aff-stats-bottom { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
.aff-panel { border: 1px solid var(--aff-line); border-radius: 16px; padding: 18px; background: #FFFFFF; }
.aff-panel h3 { font-family: inherit; font-size: 15px; margin-bottom: 12px !important; color: var(--aff-text) !important; }
.aff-status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.aff-status-list li { display: flex; justify-content: space-between; align-items: center; }
.aff-status-list strong { font-size: 16px; color: var(--aff-text); }

@media (max-width: 1100px) {
  .aff-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .aff-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Five tiles: the last one takes the full row instead of sitting alone. */
  .aff-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .aff-stats-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* Range presets stay on one swipeable row. */
  .aff-stats-toolbar > .aff-segmented { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .aff-stats-toolbar > .aff-segmented::-webkit-scrollbar { display: none; }
  .aff-segmented button { flex: 0 0 auto; white-space: nowrap; }
  .aff-kpi { padding: 14px; }
  .aff-kpi__value { font-size: 19px; text-overflow: clip; }
}
@media (max-width: 640px) {
  .aff-table--compact thead { display: table-header-group; }
  .aff-table--compact, .aff-table--compact tbody { display: table; width: 100%; }
  .aff-table--compact tr { display: table-row; border: 0; padding: 0; margin: 0; }
  .aff-table--compact td { display: table-cell; padding: 8px 6px; text-align: left; min-height: 0; }
  .aff-table--compact td::before { content: none; }
  .aff-table--compact .is-num { text-align: right; }
}
