/* Affiliate module styles. Everything is prefixed "af-" so it never clashes with TableTrack's own CSS. */
.af {
  --af-brand: #7c3aed;
  --af-brand-soft: color-mix(in srgb, var(--af-brand) 10%, transparent);
  --af-bg: #f6f7f9;
  --af-surface: #ffffff;
  --af-text: #1f2430;
  --af-muted: #6b7280;
  --af-line: #e6e8ec;
  --af-green: #15803d; --af-green-bg: #e8f6ee;
  --af-amber: #a16207; --af-amber-bg: #fdf4dc;
  --af-red: #b91c1c;   --af-red-bg: #fdecec;
  --af-blue: #1d4ed8;  --af-blue-bg: #e8effd;
  --af-gray: #4b5563;  --af-gray-bg: #eef0f3;
  --af-radius: 12px;
  --af-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  color: var(--af-text);
  font-size: 14px;
  line-height: 1.5;
}
.dark .af {
  --af-bg: #111827; --af-surface: #1f2937; --af-text: #f3f4f6; --af-muted: #9ca3af; --af-line: #374151;
  --af-green-bg: rgba(21,128,61,.18); --af-amber-bg: rgba(161,98,7,.2); --af-red-bg: rgba(185,28,28,.2);
  --af-blue-bg: rgba(29,78,216,.2); --af-gray-bg: rgba(75,85,99,.3);
  --af-green: #4ade80; --af-amber: #fbbf24; --af-red: #f87171; --af-blue: #93c5fd; --af-gray: #d1d5db;
}
.af *, .af *::before, .af *::after { box-sizing: border-box; }
.af a { color: var(--af-brand); text-decoration: none; }
.af a:hover { text-decoration: underline; }
.af h1, .af h2, .af h3 { margin: 0; line-height: 1.25; color: var(--af-text); }
.af h1 { font-size: 22px; font-weight: 700; }
.af h2 { font-size: 16px; font-weight: 650; }
.af h3 { font-size: 14px; font-weight: 650; }
.af p { margin: 0; }
.af-muted { color: var(--af-muted); }
.af-small { font-size: 12px; }
.af-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.af-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.af-end { text-align: end; }
.af .af-stack > * + *, .af.af-stack > * + * { margin-top: 16px; }
.af .af-stack-sm > * + * { margin-top: 8px; }
.af .af-stack > input[type=hidden] + *, .af .af-stack-sm > input[type=hidden] + * { margin-top: 0; }
.af-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.af-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.af-grow { flex: 1 1 auto; min-width: 0; }

/* ---------- Standalone portal shell ---------- */
body.af-body { margin: 0; background: var(--af-bg); font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif; }
.af-top { background: var(--af-surface); border-bottom: 1px solid var(--af-line); position: sticky; top: 0; z-index: 20; }
.af-top-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; min-height: 60px; }
.af-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--af-text) !important; }
.af-brand img { height: 30px; width: auto; }
.af-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.af-nav::-webkit-scrollbar { display: none; }
.af-nav a { padding: 8px 12px; border-radius: 8px; color: var(--af-muted); font-weight: 550; white-space: nowrap; }
.af-nav a:hover { background: var(--af-gray-bg); text-decoration: none; color: var(--af-text); }
.af-nav a.is-active { background: var(--af-brand-soft); color: var(--af-brand); }
.af-container { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }
@media (max-width: 720px) {
  .af-top-inner { flex-wrap: wrap; padding-top: 8px; gap: 8px; }
  .af-nav { order: 3; width: 100%; padding-bottom: 8px; }
}

/* ---------- Admin (inside TableTrack layout) ---------- */
.af-admin { padding: 20px 16px 48px; }
.af-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--af-line); margin-bottom: 20px; scrollbar-width: thin; }
.af-tabs a { padding: 10px 14px; color: var(--af-muted); font-weight: 550; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.af-tabs a:hover { color: var(--af-text); text-decoration: none; }
.af-tabs a.is-active { color: var(--af-brand); border-bottom-color: var(--af-brand); }
.af-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 4px; border-radius: 9px; background: var(--af-red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- Cards & stats ---------- */
.af-card { background: var(--af-surface); border: 1px solid var(--af-line); border-radius: var(--af-radius); box-shadow: var(--af-shadow); padding: 20px; }
.af-card-flush { padding: 0; overflow: hidden; }
.af-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--af-line); }
.af-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.af-grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.af-stat .af-stat-label { color: var(--af-muted); font-size: 12px; font-weight: 550; text-transform: uppercase; letter-spacing: .03em; }
.af-stat .af-stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.af-stat .af-stat-sub { color: var(--af-muted); font-size: 12px; margin-top: 2px; }
.af-stat-accent { border-color: color-mix(in srgb, var(--af-brand) 35%, var(--af-line)); background: linear-gradient(180deg, var(--af-brand-soft), var(--af-surface) 70%); }

/* ---------- Buttons & forms ---------- */
.af-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--af-line); background: var(--af-surface); color: var(--af-text) !important; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.af-btn:hover { background: var(--af-gray-bg); }
.af-btn-primary { background: var(--af-brand); border-color: var(--af-brand); color: #fff !important; }
.af-btn-primary:hover { background: color-mix(in srgb, var(--af-brand) 88%, #000); }
.af-btn-danger { color: var(--af-red) !important; }
.af-btn-success { background: var(--af-green); border-color: var(--af-green); color: #fff !important; }
.af-btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.af-btn[disabled] { opacity: .5; cursor: not-allowed; }
.af-form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.af-form .af-full { grid-column: 1 / -1; }
.af-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.af-label { font-weight: 600; font-size: 13px; }
.af-help { color: var(--af-muted); font-size: 12px; }
.af-input, .af-select, .af-textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--af-line); border-radius: 8px; background: var(--af-surface); color: var(--af-text); font: inherit; min-height: 38px; }
.af-input:focus, .af-select:focus, .af-textarea:focus { outline: 2px solid color-mix(in srgb, var(--af-brand) 40%, transparent); border-color: var(--af-brand); }
.af-textarea { min-height: 90px; resize: vertical; }
.af-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.af-check input { margin-top: 3px; accent-color: var(--af-brand); width: 16px; height: 16px; flex: none; }
.af-error { color: var(--af-red); font-size: 12px; }
.af-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.af-filters .af-input, .af-filters .af-select { width: auto; min-width: 140px; }
.af-inline { display: inline; }

/* ---------- Tables ---------- */
.af-table-wrap { overflow-x: auto; }
.af-table { width: 100%; border-collapse: collapse; }
.af-table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--af-muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 16px; background: var(--af-bg); border-bottom: 1px solid var(--af-line); white-space: nowrap; }
.af-table td { padding: 12px 16px; border-bottom: 1px solid var(--af-line); vertical-align: top; }
.af-table tr:last-child td { border-bottom: 0; }
.af-table tfoot td { font-weight: 700; background: var(--af-bg); }
.af-empty { padding: 32px 16px; text-align: center; color: var(--af-muted); }

/* ---------- Badges & alerts ---------- */
.af-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--af-gray-bg); color: var(--af-gray); }
.af-badge-active, .af-badge-approved, .af-badge-paid, .af-badge-green { background: var(--af-green-bg); color: var(--af-green); }
.af-badge-pending, .af-badge-requested, .af-badge-pending_approval, .af-badge-amber { background: var(--af-amber-bg); color: var(--af-amber); }
.af-badge-reversed, .af-badge-rejected, .af-badge-suspended, .af-badge-red { background: var(--af-red-bg); color: var(--af-red); }
.af-badge-blue, .af-badge-link, .af-badge-portal { background: var(--af-blue-bg); color: var(--af-blue); }
.af-alert { padding: 12px 16px; border-radius: 10px; border: 1px solid transparent; }
.af-alert-success { background: var(--af-green-bg); color: var(--af-green); border-color: color-mix(in srgb, var(--af-green) 25%, transparent); }
.af-alert-error { background: var(--af-red-bg); color: var(--af-red); border-color: color-mix(in srgb, var(--af-red) 25%, transparent); }
.af-alert-info { background: var(--af-blue-bg); color: var(--af-blue); border-color: color-mix(in srgb, var(--af-blue) 25%, transparent); }
.af-alert ul { margin: 4px 0 0; padding-inline-start: 18px; }

/* ---------- Referral link ---------- */
.af-link-box { display: flex; gap: 8px; align-items: stretch; }
.af-link-box .af-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--af-bg); }
@media (max-width: 520px) { .af-link-box { flex-direction: column; } }

/* ---------- Chart ---------- */
.af-bars { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 8px; }
.af-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.af-bar-fill { width: 100%; max-width: 44px; background: var(--af-brand); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.af-bar-label { font-size: 12px; color: var(--af-muted); }
.af-bar-value { font-size: 11px; color: var(--af-muted); white-space: nowrap; }

/* ---------- Disclosure (inline action forms) ---------- */
.af-pop { position: relative; display: inline-block; }
.af-pop > summary { list-style: none; cursor: pointer; }
.af-pop > summary::-webkit-details-marker { display: none; }
.af-pop[open] > .af-pop-body { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; width: min(340px, 86vw); background: var(--af-surface); border: 1px solid var(--af-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.16); padding: 16px; }
.af-pop-body .af-form { grid-template-columns: 1fr; }
details.af-section > summary { cursor: pointer; font-weight: 650; }

/* ---------- Auth pages ---------- */
.af-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.af-auth-card { width: 100%; max-width: 440px; }
.af-auth-card.af-wide { max-width: 640px; }
.af-auth-head { text-align: center; margin-bottom: 20px; }
.af-auth-head img { height: 40px; margin-bottom: 12px; }

/* ---------- Pagination ---------- */
.af-pages { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; padding: 14px; }
.af-pages a, .af-pages span { min-width: 34px; padding: 6px 10px; border: 1px solid var(--af-line); border-radius: 8px; text-align: center; color: var(--af-text); background: var(--af-surface); }
.af-pages .is-current { background: var(--af-brand); border-color: var(--af-brand); color: #fff; }
.af-pages .is-disabled { color: var(--af-muted); opacity: .6; }

.af-terms { max-height: 220px; overflow-y: auto; padding: 12px; border: 1px solid var(--af-line); border-radius: 8px; background: var(--af-bg); white-space: pre-line; font-size: 13px; }
.af-kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; }
.af-kv dt { color: var(--af-muted); }
.af-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ================= Public program page ================= */
.af-lp { --af-ink: #1f2430; --af-ink-2: #5b6271; --af-tint: color-mix(in srgb, var(--af-brand) 7%, #fff); background: #fff; color: var(--af-ink); font-size: 16px; line-height: 1.6; }
.dark .af-lp { --af-ink: #f3f4f6; --af-ink-2: #a3a9b6; --af-tint: color-mix(in srgb, var(--af-brand) 12%, #111827); background: #111827; }
.af-lp-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.af-lp-narrow { max-width: 820px; }
.af-lp-section { padding: 72px 0; }
.af-lp-band { background: var(--af-tint); }
.af .af-lp-h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -0.01em; color: var(--af-ink); }
.af .af-lp-sub { color: var(--af-ink-2); margin-top: 8px; max-width: 60ch; }
.af-lp-btn { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.af-lp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

/* Hero */
.af-lp-hero { background: var(--af-tint); padding: 72px 0 88px; overflow: hidden; }
.af-lp-hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center; }
.af .af-lp-title { font-size: clamp(32px, 5vw, 54px); line-height: 1.08; font-weight: 800; letter-spacing: -0.025em; color: var(--af-ink); max-width: 16ch; }
.af .af-lp-lead { font-size: 18px; color: var(--af-ink-2); margin-top: 20px; max-width: 54ch; }
.af .af-lp-fine { font-size: 14px; color: var(--af-ink-2); margin-top: 18px; max-width: 54ch; }

/* The receipt */
.af-lp-receipt { margin: 0; justify-self: center; width: 100%; max-width: 340px; transform: rotate(-2deg); filter: drop-shadow(0 18px 30px rgba(31, 36, 48, .16)); }
[dir="rtl"] .af-lp-receipt { transform: rotate(2deg); }
.af-lp-receipt-paper { --edge: 9px; background: #fff; color: #1f2430; padding: 28px 24px 26px; font-variant-numeric: tabular-nums;
  -webkit-mask: radial-gradient(circle var(--edge) at 50% 0, transparent 98%, #000) 50% 0 / calc(var(--edge) * 2.4) 51% repeat-x,
                radial-gradient(circle var(--edge) at 50% 100%, transparent 98%, #000) 50% 100% / calc(var(--edge) * 2.4) 51% repeat-x;
          mask: radial-gradient(circle var(--edge) at 50% 0, transparent 98%, #000) 50% 0 / calc(var(--edge) * 2.4) 51% repeat-x,
                radial-gradient(circle var(--edge) at 50% 100%, transparent 98%, #000) 50% 100% / calc(var(--edge) * 2.4) 51% repeat-x; }
.af-lp-receipt-head { text-align: center; font-weight: 800; font-size: 18px; letter-spacing: .02em; padding-bottom: 14px; border-bottom: 2px dashed #c9ccd3; }
.af-lp-receipt-head span { font-weight: 500; font-size: 13px; color: #5b6271; letter-spacing: 0; }
.af-lp-receipt-lines { margin: 14px 0 0; }
.af-lp-receipt-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.af-lp-receipt-lines dt { color: #5b6271; }
.af-lp-receipt-lines dd { margin: 0; font-weight: 600; text-align: end; }
.af-lp-receipt-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding-top: 14px; border-top: 2px dashed #c9ccd3; }
.af-lp-receipt-total span { font-weight: 600; }
.af-lp-receipt-total strong { font-size: 28px; font-weight: 800; color: var(--af-brand); }
.af-lp-receipt-foot { font-size: 12px; color: #8a909c; text-align: center; margin-top: 14px; }

/* Video */
.af-lp-video { margin-top: 28px; position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 20px 40px rgba(31, 36, 48, .18); }
.af-lp-video iframe, .af-lp-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Steps: a real sequence, so numbered */
.af-lp-steps { list-style: none; counter-reset: step; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.af-lp-steps li { counter-increment: step; position: relative; padding-top: 56px; }
.af-lp-steps li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--af-brand); color: #fff; font-weight: 700; }
.af-lp-steps li:not(:last-child)::after { content: ""; position: absolute; top: 20px; inset-inline-start: 52px; inset-inline-end: -20px; border-top: 2px dashed color-mix(in srgb, var(--af-brand) 35%, transparent); }
.af .af-lp-steps h3 { font-size: 17px; }
.af .af-lp-steps p { color: var(--af-ink-2); margin-top: 6px; font-size: 15px; }

/* Slider: native scroll-snap so swipe, RTL and keyboard all work */
.af-lp-slider { display: grid; grid-auto-flow: column; grid-auto-columns: min(100%, 680px); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; margin-top: 28px; padding-bottom: 8px; scrollbar-width: none; outline-offset: 6px; }
.af-lp-slider::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: reduce) { .af-lp-slider { scroll-behavior: auto; } }
.af-lp-slide { scroll-snap-align: start; margin: 0; }
.af-lp-slide img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 14px; border: 1px solid var(--af-line); background: #fff; display: block; }
.af-lp-slide figcaption { margin-top: 12px; color: var(--af-ink-2); font-size: 15px; }
.af-lp-mock { aspect-ratio: 16 / 10; background: var(--af-surface); border: 1px solid var(--af-line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.af .af-lp-mock-title { font-weight: 700; font-size: 18px; }
.af-lp-mock .af-btn { align-self: flex-start; pointer-events: none; }
.af-lp-mock-stats { display: flex; flex-wrap: wrap; gap: 28px; }
.af-lp-mock-stats div { display: flex; flex-direction: column; }
.af-lp-mock-stats span { color: var(--af-ink-2); font-size: 13px; }
.af-lp-mock-stats strong { font-size: 24px; }
.af-lp-mock-form { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; align-items: center; }
.af-lp-mock-form span { color: var(--af-ink-2); font-size: 14px; }
.af-lp-mock-form i { font-style: normal; border: 1px solid var(--af-line); border-radius: 8px; padding: 7px 11px; background: var(--af-bg); }
.af-lp-mock .af-bars { height: 120px; }
.af-lp-arrow { width: 44px; height: 44px; padding: 0; font-size: 22px; border-radius: 50%; }
.af-lp-dots { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.af-lp-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: color-mix(in srgb, var(--af-brand) 25%, transparent); cursor: pointer; }
.af-lp-dots button.is-on { background: var(--af-brand); width: 26px; border-radius: 5px; }

/* Rates, ways, who, FAQ */
.af-lp-two { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 48px; align-items: start; }
.af-lp-rates .af-table { background: var(--af-surface); border: 1px solid var(--af-line); border-radius: 14px; overflow: hidden; border-collapse: separate; border-spacing: 0; }
.af-lp-rates th { background: transparent; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--af-ink); width: 38%; vertical-align: top; padding: 14px 18px; border-bottom: 1px solid var(--af-line); }
.af-lp-rates td { padding: 14px 18px; color: var(--af-ink-2); }
.af-lp-rates tr:last-child th { border-bottom: 0; }
.af-lp-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 28px; border-top: 2px solid var(--af-ink); }
.af-lp-ways > div { padding: 24px 24px 8px 0; }
.af-lp-ways > div + div { border-inline-start: 1px solid color-mix(in srgb, var(--af-ink) 18%, transparent); padding-inline-start: 24px; }
[dir="rtl"] .af-lp-ways > div { padding: 24px 0 8px 24px; }
[dir="rtl"] .af-lp-ways > div + div { padding-inline-start: 24px; }
.af .af-lp-ways h3 { font-size: 19px; }
.af .af-lp-ways p { color: var(--af-ink-2); margin-top: 8px; }
.af-lp-who { list-style: none; margin: 0; padding: 0; }
.af-lp-who li { padding: 14px 0; border-bottom: 1px solid var(--af-line); font-size: 17px; }
.af-lp-who li:first-child { padding-top: 0; }
.af-lp-faq { margin-top: 24px; }
.af-lp-faq details { border-bottom: 1px solid color-mix(in srgb, var(--af-ink) 14%, transparent); }
.af-lp-faq summary { list-style: none; cursor: pointer; padding: 18px 0; font-weight: 650; font-size: 17px; display: flex; justify-content: space-between; gap: 16px; }
.af-lp-faq summary::-webkit-details-marker { display: none; }
.af-lp-faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--af-brand); flex: none; }
.af-lp-faq details[open] summary::after { content: "−"; }
.af .af-lp-faq p { padding: 0 0 18px; color: var(--af-ink-2); max-width: 65ch; }
.af-lp-final { text-align: center; }
.af-lp-final .af-lp-sub { margin-inline: auto; }
.af-lp-final .af-lp-actions { justify-content: center; }
.af-lp a:focus-visible, .af-lp button:focus-visible, .af-lp summary:focus-visible, .af-lp-slider:focus-visible { outline: 3px solid color-mix(in srgb, var(--af-brand) 55%, transparent); outline-offset: 3px; border-radius: 6px; }

@media (max-width: 900px) {
  .af-lp-hero-grid, .af-lp-two { grid-template-columns: 1fr; gap: 40px; }
  .af-lp-steps { grid-template-columns: 1fr 1fr; }
  .af-lp-steps li::after { display: none; }
}
@media (max-width: 600px) {
  .af-lp-section { padding: 52px 0; }
  .af-lp-hero { padding: 48px 0 64px; }
  .af-lp-steps, .af-lp-ways { grid-template-columns: 1fr; }
  .af-lp-ways > div, [dir="rtl"] .af-lp-ways > div { padding: 20px 0 4px; }
  .af-lp-ways > div + div { border-inline-start: 0; border-top: 1px solid color-mix(in srgb, var(--af-ink) 18%, transparent); padding-inline-start: 0; }
  .af-lp-mock { aspect-ratio: auto; padding: 20px; }
  .af-lp-slider-nav { display: none; }
}

/* ---------- Admin: match TableTrack's own form components (x-label, x-input, x-select, x-button, x-secondary-button, x-right-modal) ---------- */
.af-admin { --af-ctl-border: #d1d5db; --af-ctl-bg: #fff; --af-ctl-text: #4b5563; --af-label: #374151; --af-title: #111827; }
.dark .af-admin { --af-ctl-border: #374151; --af-ctl-bg: #111827; --af-ctl-text: #d1d5db; --af-label: #d1d5db; --af-title: #fff; }
.af-admin > .af-between h1 { font-size: 16px; font-weight: 600; line-height: 24px; color: var(--af-title); }
.af-admin h2 { font-weight: 600; color: var(--af-title); }
.af-admin .af-label { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--af-label); }
.af-admin .af-field { gap: 4px; }
.af-admin .af-input, .af-admin .af-select, .af-admin .af-textarea {
  min-height: 0; padding: 8px 12px; border: 1px solid var(--af-ctl-border); border-radius: 6px; background-color: var(--af-ctl-bg);
  color: var(--af-ctl-text); font-size: 12px; line-height: 16px; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
}
.af-admin .af-select { padding-inline-end: 40px; }
.af-admin .af-textarea { font-size: 14px; line-height: 20px; }
.af-admin .af-input:focus, .af-admin .af-select:focus, .af-admin .af-textarea:focus { outline: none; border-color: #6b7280; box-shadow: 0 0 0 1px #6b7280; }
.dark .af-admin .af-input:focus, .dark .af-admin .af-select:focus, .dark .af-admin .af-textarea:focus { border-color: #4b5563; box-shadow: 0 0 0 1px #4b5563; }
.af-admin input[type=checkbox], .af-admin input[type=radio] {
  accent-color: auto; color: rgb(var(--color-base, 124, 58, 237)); border: 1px solid var(--af-ctl-border); background-color: var(--af-ctl-bg);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); cursor: pointer; width: 16px; height: 16px;
}
.af-admin input[type=checkbox] { border-radius: 4px; }
.af-admin input[type=checkbox]:checked, .af-admin input[type=radio]:checked { background-color: currentColor; border-color: transparent; }
.af-admin input[type=checkbox]:focus, .af-admin input[type=radio]:focus { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6b7280; }
.af-admin .af-check { font-size: 14px; font-weight: 500; color: var(--af-label); }
.af-admin .af-btn {
  gap: 4px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--af-ctl-border); background: var(--af-ctl-bg);
  color: #374151 !important; font-size: 12px; line-height: 16px; font-weight: 600; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); transition: background-color .15s;
}
.dark .af-admin .af-btn { background: #1f2937; border-color: #6b7280; color: #d1d5db !important; }
.af-admin .af-btn:hover { background: #f9fafb; }
.dark .af-admin .af-btn:hover { background: #374151; }
.af-admin .af-btn-primary { background: rgb(var(--color-base, 124, 58, 237)); border-color: transparent; color: #fff !important; box-shadow: none; }
.af-admin .af-btn-primary:hover, .dark .af-admin .af-btn-primary:hover { background: rgba(var(--color-base, 124, 58, 237), .8); }
.dark .af-admin .af-btn-primary { background: rgb(var(--color-base, 124, 58, 237)); border-color: transparent; color: #fff !important; }
.af-admin .af-btn-danger { background: #fee2e2; border-color: #ef4444; color: #b91c1c !important; box-shadow: none; }
.af-admin .af-btn-danger:hover { background: #fecaca; }
.dark .af-admin .af-btn-danger { background: #1f2937; border-color: #ef4444; color: #f87171 !important; }
.af-admin .af-btn-success { background: #dcfce7; border-color: #22c55e; color: #15803d !important; box-shadow: none; }
.af-admin .af-btn-success:hover { background: #bbf7d0; }
.dark .af-admin .af-btn-success { background: #1f2937; border-color: #22c55e; color: #4ade80 !important; }
.af-admin .af-btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.af-admin .af-pages .is-current { background: rgb(var(--color-base, 124, 58, 237)); border-color: transparent; }

/* Pop-up forms open as a right-side drawer, like TableTrack's "Add restaurant". */
.af-admin details.af-pop[open] > .af-pop-body {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; inset-inline-start: auto; z-index: 61; width: min(42rem, 100vw); max-width: 100vw;
  margin: 0; border: 0; border-radius: 0; padding: 0 0 24px; overflow-y: auto; background: #fff; box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  animation: af-drawer-in .3s ease-out; text-align: start; white-space: normal;
}
.af-admin details.af-pop.af-pop-narrow[open] > .af-pop-body { width: min(28rem, 100vw); }
.dark .af-admin details.af-pop[open] > .af-pop-body { background: #1f2937; }
.af-admin details.af-pop[open]::before { content: ""; position: fixed; inset: 0; z-index: 60; background: rgba(107, 114, 128, .75); cursor: default; }
.dark .af-admin details.af-pop[open]::before { background: rgba(17, 24, 39, .75); }
.af-admin .af-pop-body > :not(.af-drawer-head) { margin-inline: 24px; }
.af-admin .af-pop-body > .af-form, .af-admin .af-pop-body .af-form { grid-template-columns: 1fr; gap: 16px; }
.af-admin .af-pop-body .af-form > button[type=submit] { justify-self: start; }
.af-admin .af-drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px 12px; margin-bottom: 8px; background: inherit; }
.af-admin .af-drawer-head h3 { font-size: 18px; line-height: 28px; font-weight: 500; color: var(--af-title); }
.af-admin .af-drawer-close { border: 0; background: transparent; color: #6b7280; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.af-admin .af-drawer-close:hover { background: #f3f4f6; color: #111827; }
@keyframes af-drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
[dir=rtl] .af-admin details.af-pop[open] > .af-pop-body { animation-name: af-drawer-in-rtl; }
@keyframes af-drawer-in-rtl { from { transform: translateX(-100%); } to { transform: translateX(0); } }
body.af-drawer-open { overflow: hidden; }

/* ---------- Referral tools: share buttons, QR, getting started, tiers ---------- */
.af-refer { display: flex; gap: 20px; align-items: flex-start; }
.af-qr { flex: none; width: 190px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 12px; border: 1px solid var(--af-line); border-radius: 12px; background: #fff; }
.af-qr img { display: block; width: 148px; height: 148px; }
.dark .af-qr { color: #374151; }
@media (max-width: 640px) { .af-refer { flex-direction: column; } .af-qr { width: 100%; } }
.af-share { display: flex; flex-wrap: wrap; gap: 8px; }
.af-share-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 35%, var(--af-line)); background: color-mix(in srgb, var(--c) 8%, var(--af-surface)); color: var(--af-text) !important; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.af-share-btn svg { color: var(--c); }
.dark .af-share-btn svg { color: color-mix(in srgb, var(--c) 60%, #fff); }
.af-share-btn:hover { background: color-mix(in srgb, var(--c) 16%, var(--af-surface)); }
.af-progress { height: 8px; border-radius: 999px; background: var(--af-gray-bg); overflow: hidden; }
.af-progress > span { display: block; height: 100%; background: var(--af-brand); border-radius: inherit; transition: width .4s; }
.af-onboarding-body { display: grid; gap: 20px; }
.af-onboarding-body.has-video { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .af-onboarding-body.has-video { grid-template-columns: 1fr; } }
.af-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.af-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--af-line); }
.af-steps li:last-child { border-bottom: 0; }
.af-step-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: var(--af-gray-bg); color: var(--af-muted); }
.af-steps li.is-done .af-step-dot { background: var(--af-green-bg); color: var(--af-green); }
.af-steps li.is-done strong { color: var(--af-muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--af-muted) 50%, transparent); }
.af-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.af-video iframe, .af-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.af-tiers { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.af-tier { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--af-line); border-radius: 10px; }
.af-tier-rate { font-size: 20px; font-weight: 700; }
.af-tier.is-reached { border-color: color-mix(in srgb, var(--af-green) 35%, var(--af-line)); }
.af-tier.is-current { border-color: var(--af-brand); background: var(--af-brand-soft); }

/* ---------- Marketing kit ---------- */
.af-kit { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.af-kit-item { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.af-kit-thumb { aspect-ratio: 4 / 3; background: var(--af-bg); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--af-line); overflow: hidden; }
.af-kit-thumb img, .af-kit-thumb video { width: 100%; height: 100%; object-fit: contain; }
.af-kit-ext { font-size: 22px; font-weight: 800; color: var(--af-muted); letter-spacing: .05em; }
.af-kit-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.af-kit-body .af-row { margin-top: auto; padding-top: 6px; }
.af-message textarea { width: 100%; min-height: 110px; resize: vertical; }

/* ---------- Statement ---------- */
.af-statement-sum { display: grid; gap: 0; }
.af-statement-sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--af-line); }
.af-statement-sum > div:last-child { border-bottom: 0; font-weight: 700; font-size: 16px; }
.af-plus { color: var(--af-green); }
@media print {
  .af-top, .af-no-print, .af-alert { display: none !important; }
  body.af-body { background: #fff; }
  .af-card { box-shadow: none; break-inside: avoid; }
  .af-container { padding: 0; max-width: none; }
}

/* ---------- Admin "log in as affiliate" banner ---------- */
.af-impersonating { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 8px 16px; background: #fef3c7; color: #78350f; border-bottom: 1px solid #fcd34d; font-size: 13px; font-weight: 550; text-align: center; }
.af-impersonating form { margin: 0; }
.af-impersonating button { padding: 5px 12px; border-radius: 8px; border: 1px solid #b45309; background: #b45309; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.af-impersonating button:hover { background: #92400e; }
.af-impersonating + .af-top { top: 0; position: relative; }
