/* ============================================================
   AFFILIATE / REFERRAL PROGRAM
   Layered on top of app.css — reuses its tokens (--primary,
   --secondary, --muted, --line, --success ...). Navy + azure.
   ============================================================ */

/* ── Sidebar available-balance chip ─────────────────────────── */
.aff-nav-balance {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.75rem;
}
.aff-nav-balance-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.55); margin-bottom: 2px; }
.aff-nav-balance-value { display: block; font-size: 1.15rem; font-weight: 800; color: #fff; }

/* ── Page header ────────────────────────────────────────────── */
.aff-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.aff-head h1 { font-size: 1.5rem; font-weight: 800; color: var(--secondary); display: flex; align-items: center; gap: 0.55rem; }
.aff-head .subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

/* ── KPI cards ──────────────────────────────────────────────── */
.aff-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.aff-kpi {
    position: relative; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    padding: 1.2rem 1.3rem; box-shadow: 0 1px 3px rgba(18, 44, 92, 0.05);
    transition: transform .18s ease, box-shadow .18s ease;
}
.aff-kpi:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(18, 44, 92, 0.10); }
.aff-kpi::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--primary); }
.aff-kpi.k-success::after { background: var(--success); }
.aff-kpi.k-warning::after { background: var(--warning); }
.aff-kpi.k-navy::after { background: var(--secondary); }
.aff-kpi-ico { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 0.8rem; background: var(--info-lt); color: var(--primary); }
.aff-kpi.k-success .aff-kpi-ico { background: var(--success-lt); color: var(--success); }
.aff-kpi.k-warning .aff-kpi-ico { background: var(--warning-lt); color: var(--warning); }
.aff-kpi.k-navy .aff-kpi-ico { background: #e7edf8; color: var(--secondary); }
.aff-kpi-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.aff-kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--secondary); line-height: 1.1; margin-top: 3px; }
.aff-kpi-meta { font-size: 0.78rem; color: var(--muted); margin-top: 5px; }
.aff-kpi-meta .up { color: var(--success); font-weight: 700; }

/* ── Panels & layout ────────────────────────────────────────── */
.aff-grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.1rem; align-items: start; }
.aff-grid-2b { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 900px) { .aff-grid-2, .aff-grid-2b { grid-template-columns: 1fr; } }
.aff-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; margin-bottom: 1.1rem; }
.aff-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.aff-panel-head h2 { font-size: 1.02rem; font-weight: 700; color: var(--secondary); display: flex; align-items: center; gap: 0.5rem; }
.aff-panel-head .hint { font-size: 0.78rem; color: var(--muted); }

/* ── Referral link box ──────────────────────────────────────── */
.aff-linkbox { display: flex; align-items: stretch; gap: 0; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-soft); }
.aff-linkbox input { flex: 1; border: none; background: transparent; padding: 0.8rem 1rem; font-size: 0.92rem; color: var(--ink); font-family: var(--mono); outline: none; min-width: 0; }
.aff-linkbox button { border: none; background: var(--primary); color: #fff; padding: 0 1.2rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; white-space: nowrap; transition: background .15s; }
.aff-linkbox button:hover { background: var(--primary-dark); }
.aff-code-pill { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--info-lt); color: var(--primary-dark); border-radius: 999px; padding: 0.25rem 0.8rem; font-weight: 700; font-family: var(--mono); letter-spacing: 0.05em; }
.aff-share-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.aff-share-btn { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 0.45rem 0.95rem; font-size: 0.82rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: all .15s; }
.aff-share-btn:hover { border-color: var(--primary); color: var(--primary-dark); }

/* ── Funnel ─────────────────────────────────────────────────── */
.aff-funnel { display: flex; flex-direction: column; gap: 0.85rem; }
.aff-funnel-row .aff-funnel-top { display: flex; justify-content: space-between; font-size: 0.83rem; margin-bottom: 0.3rem; }
.aff-funnel-row .aff-funnel-top .lbl { color: var(--ink-soft); font-weight: 600; }
.aff-funnel-row .aff-funnel-top .val { color: var(--secondary); font-weight: 800; }
.aff-funnel-track { height: 12px; border-radius: 999px; background: var(--accent); overflow: hidden; }
.aff-funnel-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #6fc6f5); }
.aff-funnel-fill.f2 { background: linear-gradient(90deg, #2b8fd6, var(--primary)); }
.aff-funnel-fill.f3 { background: linear-gradient(90deg, var(--success), #4fd07f); }

/* ── Earnings bar chart ─────────────────────────────────────── */
.aff-chart { display: flex; align-items: flex-end; gap: 0.6rem; height: 180px; padding-top: 0.5rem; }
.aff-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 0.4rem; }
.aff-chart-bar-wrap { width: 100%; display: flex; align-items: flex-end; justify-content: center; flex: 1; }
.aff-chart-bar { width: 68%; max-width: 42px; border-radius: 7px 7px 0 0; background: linear-gradient(180deg, var(--primary), #8ed2f7); min-height: 4px; position: relative; transition: filter .15s; }
.aff-chart-bar:hover { filter: brightness(1.05); }
.aff-chart-bar .amt { position: absolute; top: -1.35rem; left: 50%; transform: translateX(-50%); font-size: 0.68rem; font-weight: 700; color: var(--secondary); white-space: nowrap; }
.aff-chart-x { font-size: 0.72rem; color: var(--muted); font-weight: 600; }

/* ── Status pills ───────────────────────────────────────────── */
.aff-pill { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px; padding: 0.22rem 0.7rem; font-size: 0.74rem; font-weight: 700; }
.aff-pill i { font-size: 0.6rem; }
.aff-pill.p-green { background: var(--success-lt); color: var(--success); }
.aff-pill.p-amber { background: var(--warning-lt); color: var(--warning); }
.aff-pill.p-blue  { background: var(--info-lt); color: var(--primary-dark); }
.aff-pill.p-grey  { background: #eef2f6; color: var(--muted); }
.aff-pill.p-red   { background: var(--danger-lt); color: var(--danger); }

/* ── Tables ─────────────────────────────────────────────────── */
.aff-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.aff-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; min-width: 640px; }
.aff-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-soft); white-space: nowrap; }
.aff-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink-soft); vertical-align: middle; }
.aff-table tr:last-child td { border-bottom: none; }
.aff-table tr:hover td { background: #fafcfe; }
.aff-table .u-name { font-weight: 700; color: var(--secondary); }
.aff-table .u-sub { font-size: 0.76rem; color: var(--muted); }
.aff-amt { font-weight: 800; color: var(--secondary); font-variant-numeric: tabular-nums; }
.aff-amt.pos { color: var(--success); }

.aff-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.aff-user-cell { display: flex; align-items: center; gap: 0.65rem; }

/* ── Empty state ────────────────────────────────────────────── */
.aff-empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.aff-empty i { font-size: 2.2rem; color: var(--accent-md); margin-bottom: 0.7rem; display: block; }
.aff-empty h3 { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 0.35rem; }

/* ── Balance hero (earnings page) ───────────────────────────── */
.aff-balance-hero { background: linear-gradient(135deg, var(--secondary) 0%, #0b3183 55%, var(--primary) 140%); border-radius: 18px; padding: 1.6rem 1.7rem; color: #fff; position: relative; overflow: hidden; }
.aff-balance-hero::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(57,168,234,0.5), transparent 70%); top: -110px; right: -80px; }
.aff-balance-hero .lbl { font-size: 0.8rem; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.06em; position: relative; }
.aff-balance-hero .val { font-size: 2.5rem; font-weight: 800; margin: 0.15rem 0 0.2rem; position: relative; }
.aff-balance-hero .sub { font-size: 0.85rem; color: rgba(255,255,255,0.8); position: relative; }
.aff-balance-hero .actions { margin-top: 1.1rem; position: relative; display: flex; gap: 0.6rem; flex-wrap: wrap; }

.aff-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-top: 1rem; }
.aff-mini { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 0.9rem 1rem; }
.aff-mini .lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.aff-mini .val { font-size: 1.15rem; font-weight: 800; color: var(--secondary); margin-top: 2px; }

/* ── Forms ──────────────────────────────────────────────────── */
.aff-field { margin-bottom: 1rem; }
.aff-field label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 0.4rem; }
.aff-input { width: 100%; padding: 0.7rem 0.9rem; border: 1.5px solid var(--line); border-radius: 10px; font-size: 0.92rem; font-family: inherit; color: var(--ink); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.aff-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(57,168,234,0.13); }
.aff-help { font-size: 0.76rem; color: var(--muted); margin-top: 0.35rem; }

/* ── Modal (withdraw) ───────────────────────────────────────── */
.aff-modal-bd { position: fixed; inset: 0; background: rgba(10,15,30,0.55); backdrop-filter: blur(5px); z-index: 9000; display: none; align-items: center; justify-content: center; padding: 1rem; }
.aff-modal-bd.open { display: flex; }
.aff-modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; overflow: hidden; box-shadow: 0 28px 64px rgba(0,0,0,0.25); }
.aff-modal-head { padding: 1.15rem 1.4rem; background: var(--secondary); color: #fff; display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.aff-modal-body { padding: 1.4rem; }
.aff-modal-foot { padding: 0.9rem 1.4rem; border-top: 1px solid var(--line); background: var(--surface-soft); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ═══════════════════════════════════════════════════════════════
   PUBLIC MARKETING LANDING (dark, on-brand with the main site)
   ═══════════════════════════════════════════════════════════════ */
.affl { --affl-navy: #0a1530; color: #e9eef7; }
.affl-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 80% -10%, rgba(57,168,234,0.22), transparent 60%), linear-gradient(160deg, #0a1530 0%, #0f2350 60%, #122c5c 100%); padding: 5rem 0 4rem; }
.affl-hero-inner { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 3rem; align-items: center; }
@media (max-width: 900px) { .affl-hero-inner { grid-template-columns: 1fr; } }
.affl-eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; background: rgba(57,168,234,0.14); border: 1px solid rgba(57,168,234,0.35); color: #8fd0f7; border-radius: 999px; padding: 0.4rem 0.95rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; }
.affl-h1 { font-size: clamp(2.1rem, 4.5vw, 3.3rem); font-weight: 800; line-height: 1.1; color: #fff; margin: 1.1rem 0; letter-spacing: -0.02em; }
.affl-h1 .hl { color: #39a8ea; }
.affl-sub { font-size: 1.05rem; line-height: 1.65; color: rgba(233,238,247,0.72); max-width: 33rem; margin-bottom: 1.7rem; }
.affl-cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.affl-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.95rem 1.8rem; border-radius: 10px; font-weight: 700; font-size: 0.98rem; text-decoration: none; cursor: pointer; border: none; transition: transform .12s, box-shadow .15s, background .15s; }
.affl-btn-primary { background: linear-gradient(90deg, #39a8ea, #12c2e9); color: #fff; box-shadow: 0 8px 22px rgba(57,168,234,0.35); }
.affl-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(57,168,234,0.45); }
.affl-btn-ghost { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.18); color: #fff; }
.affl-btn-ghost:hover { background: rgba(255,255,255,0.12); }
.affl-trust { display: flex; gap: 1.6rem; margin-top: 2rem; flex-wrap: wrap; }
.affl-trust .t { display: flex; flex-direction: column; }
.affl-trust .t b { font-size: 1.5rem; color: #fff; font-weight: 800; }
.affl-trust .t span { font-size: 0.8rem; color: rgba(233,238,247,0.6); }

/* Hero visual: framed photo + floating earnings cards */
.affl-visual { position: relative; }
.affl-photo { width: 100%; border-radius: 20px; display: block; box-shadow: 0 30px 70px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.08); object-fit: cover; aspect-ratio: 4 / 3.4; background: #0f2350; }
.affl-float { position: absolute; background: rgba(12,22,46,0.86); backdrop-filter: blur(10px); border: 1px solid rgba(57,168,234,0.28); border-radius: 14px; padding: 0.8rem 1rem; box-shadow: 0 16px 40px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 0.7rem; }
.affl-float .ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(52,199,89,0.16); color: #34c759; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.affl-float .ic.blue { background: rgba(57,168,234,0.16); color: #39a8ea; }
.affl-float .lbl { font-size: 0.68rem; color: rgba(233,238,247,0.6); }
.affl-float .val { font-size: 1rem; font-weight: 800; color: #fff; }
.affl-float.f-earn { bottom: 1.4rem; left: -1.2rem; }
.affl-float.f-ref { top: 1.6rem; right: -1rem; }
@media (max-width: 560px) { .affl-float { display: none; } }

.affl-section { padding: 4rem 0; }
.affl-section.alt { background: rgba(255, 255, 255, 0.02); }
.affl-section-head { text-align: center; max-width: 40rem; margin: 0 auto 2.6rem; }
.affl-section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; color: #fff; margin-bottom: 0.6rem; }
.affl-section-head p { color: rgba(233,238,247,0.66); font-size: 1rem; line-height: 1.6; }
.affl-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
@media (max-width: 800px) { .affl-steps { grid-template-columns: 1fr; } }
.affl-step { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.09); border-radius: 16px; padding: 1.8rem 1.5rem; position: relative; }
.affl-step .num { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #39a8ea, #12c2e9); color: #fff; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.affl-step h3 { color: #fff; font-size: 1.12rem; font-weight: 700; margin-bottom: 0.5rem; }
.affl-step p { color: rgba(233,238,247,0.66); font-size: 0.9rem; line-height: 1.6; }

.affl-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.2rem; }
.affl-feature { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.09); border-radius: 16px; padding: 1.6rem 1.4rem; }
.affl-feature .fic { width: 46px; height: 46px; border-radius: 12px; background: rgba(57,168,234,0.14); color: #39a8ea; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 1rem; }
.affl-feature h3 { color: #fff; font-size: 1.05rem; font-weight: 700; margin-bottom: 0.45rem; }
.affl-feature p { color: rgba(233,238,247,0.64); font-size: 0.88rem; line-height: 1.6; }

/* Earnings calculator strip */
.affl-calc { background: linear-gradient(135deg, rgba(57,168,234,0.12), rgba(18,44,92,0.4)); border: 1px solid rgba(57,168,234,0.25); border-radius: 20px; padding: 2.2rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
@media (max-width: 800px) { .affl-calc { grid-template-columns: 1fr; } }
.affl-calc h2 { color: #fff; font-size: 1.6rem; font-weight: 800; margin-bottom: 0.5rem; }
.affl-calc p { color: rgba(233,238,247,0.7); font-size: 0.95rem; line-height: 1.6; }
.affl-calc-card { background: rgba(10,17,36,0.7); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 1.5rem; }
.affl-calc-card .row { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px dashed rgba(255,255,255,0.12); color: rgba(233,238,247,0.75); font-size: 0.9rem; }
.affl-calc-card .row:last-child { border-bottom: none; }
.affl-calc-card .row b { color: #fff; }
.affl-calc-total { font-size: 1.9rem; font-weight: 800; color: #34c759; }

.affl-final { text-align: center; padding: 4.5rem 0; }
.affl-final h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); font-weight: 800; color: #fff; margin-bottom: 0.8rem; }
.affl-final p { color: rgba(233,238,247,0.7); max-width: 34rem; margin: 0 auto 1.8rem; font-size: 1.02rem; }
