:root {
    --purple: #5b2b71;
    --purple-dark: #30183f;
    --purple-soft: #f2ebf6;
    --amber: #e98b2a;
    --green: #257960;
    --ink: #211a25;
    --muted: #6d6670;
    --line: #e7e1e9;
    --surface: #ffffff;
    --background: #f7f5f8;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: Inter, "Segoe UI", Arial, sans-serif; }
a { color: inherit; }
.b2b-brand { display: inline-flex; align-items: center; }
.b2b-brand img { display: block; width: 230px; height: auto; }
.b2b-brand.compact img { width: 165px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--amber); font-size: .76rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }

.b2b-login-page, .referral-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at top right, #eadcf1 0, transparent 38%), linear-gradient(145deg, #f8f6f9, #f2eef4); }
.b2b-login-card, .referral-card { width: min(100%, 540px); padding: 46px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: 0 24px 70px rgba(48,24,63,.12); text-align: center; }
.b2b-login-card .b2b-brand, .referral-card .b2b-brand { margin-bottom: 28px; }
.b2b-login-card h1, .referral-card h1 { margin: 0 0 14px; color: var(--purple-dark); font-size: clamp(1.9rem, 5vw, 2.7rem); line-height: 1.08; }
.b2b-login-card > p, .referral-lead { color: var(--muted); font-size: 1.04rem; line-height: 1.65; }
.google-signin { display: flex; justify-content: center; margin: 30px 0 14px; min-height: 44px; }
.login-help, .referral-note { margin: 12px 0 24px; color: var(--muted); font-size: .86rem !important; }
.back-link { color: var(--purple); font-weight: 700; text-decoration: none; }
.b2b-alert { margin: 22px 0; padding: 12px 16px; border-radius: 12px; font-size: .92rem; }
.b2b-alert.error { color: #8d2631; background: #fff0f1; border: 1px solid #f1c8cd; }
.referral-actions { display: flex; gap: 12px; justify-content: center; margin: 28px 0 18px; }

.b2b-button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 10px 18px; border: 1px solid var(--purple); border-radius: 11px; color: #fff; background: var(--purple); font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.b2b-button:hover { background: var(--purple-dark); }
.b2b-button.secondary { color: var(--purple); background: #fff; }

.b2b-topbar { min-height: 76px; display: flex; align-items: center; gap: 24px; padding: 12px clamp(20px, 5vw, 64px); border-bottom: 1px solid var(--line); background: #fff; }
.partner-identity { display: flex; flex-direction: column; margin-left: auto; text-align: right; }
.partner-identity span { color: var(--muted); font-size: .76rem; }
.partner-identity strong { color: var(--purple-dark); }
.text-button { padding: 9px 13px; border: 0; border-radius: 9px; color: var(--muted); background: #f3f0f4; font: inherit; cursor: pointer; }
.b2b-shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 46px 0 64px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.welcome-row h1 { margin: 0 0 8px; color: var(--purple-dark); font-size: clamp(2rem, 4vw, 3.2rem); }
.welcome-row p { margin: 0; color: var(--muted); }
.plan-pill { min-width: 230px; padding: 14px 18px; border: 1px solid #ddcfe4; border-radius: 14px; background: var(--purple-soft); }
.plan-pill span, .plan-pill strong { display: block; }
.plan-pill span { margin-bottom: 3px; color: var(--muted); font-size: .76rem; }
.plan-pill strong { color: var(--purple-dark); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 22px; border: 1px solid var(--line); border-top: 4px solid #6d6670; border-radius: 16px; background: #fff; box-shadow: 0 8px 26px rgba(48,24,63,.05); }
.stat-card.amber { border-top-color: var(--amber); }
.stat-card.green { border-top-color: var(--green); }
.stat-card.purple { border-top-color: var(--purple); }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 7px 0 3px; color: var(--purple-dark); font-size: 1.85rem; }

.b2b-card { margin-bottom: 20px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 8px 26px rgba(48,24,63,.05); }
.b2b-card h2 { margin: 0; color: var(--purple-dark); font-size: 1.25rem; }
.b2b-card p { color: var(--muted); line-height: 1.55; }
.referral-box { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr); align-items: center; gap: 24px; border-color: #ddcfe4; }
.copy-row { display: flex; gap: 9px; }
.copy-row input { min-width: 0; flex: 1; padding: 12px 14px; border: 1px solid #d8d0dc; border-radius: 11px; color: #4e4652; background: #faf9fb; }
.referral-code { grid-column: 2; color: var(--muted); font-size: .87rem; }
.referral-code strong { color: var(--purple-dark); letter-spacing: .05em; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.soft-badge { padding: 6px 9px; border-radius: 20px; color: var(--purple); background: var(--purple-soft); font-size: .74rem; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 10px; color: var(--muted); background: #faf9fb; font-size: .74rem; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
td { padding: 13px 10px; border-bottom: 1px solid #eeeaf0; font-size: .91rem; vertical-align: middle; }
td small { display: block; margin-top: 3px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.empty-cell { padding: 34px 12px; color: var(--muted); text-align: center; }
.card-note { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: .84rem; }
.status { display: inline-block; padding: 5px 8px; border-radius: 20px; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.status.success { color: #176149; background: #e6f5ef; }
.status.warning { color: #8a5811; background: #fff1d8; }
.status.danger { color: #922d38; background: #fdebed; }
.status.info { color: #215e78; background: #e8f4f8; }
.status.purple { color: var(--purple); background: var(--purple-soft); }
.status.muted { color: #625b65; background: #efedef; }
.bonus-list { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; padding: 14px; border-radius: 12px; background: #faf7ef; color: #65502c; font-size: .86rem; }
.b2b-footer { padding: 24px; color: var(--muted); background: #fff; border-top: 1px solid var(--line); text-align: center; font-size: .84rem; }
.b2b-product-preview { margin: 24px 0; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #faf9fb; }
.b2b-product-preview img { display: block; width: 100%; height: auto; border-radius: 8px; }
.b2b-product-preview figcaption { padding: 10px 4px 4px; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.b2b-policy-links { margin-top: 24px; color: var(--muted); font-size: .76rem; line-height: 1.8; }

.terms-shell { max-width: 1000px; }
.terms-intro { margin-bottom: 28px; }
.terms-intro h1 { margin: 0 0 14px; color: var(--purple-dark); font-size: clamp(1.8rem, 5vw, 2.5rem); }
.terms-intro p { max-width: 820px; color: var(--muted); line-height: 1.75; }
.terms-document { margin-bottom: 24px; }
.terms-document-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.terms-document-heading h2 { margin-top: 0; }
.terms-document-heading p { font-size: .85rem; }
.terms-print { flex-shrink: 0; }
.terms-parties { display: grid; grid-template-columns: 1.2fr .7fr 1.2fr; gap: 18px; padding: 18px; margin: 22px 0 28px; border: 1px solid var(--line); border-radius: 12px; background: #faf9fb; }
.terms-parties dt { color: var(--muted); font-size: .8rem; margin-bottom: 5px; }
.terms-parties dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.terms-body { line-height: 1.8; }
.terms-body section + section { margin-top: 28px; }
.terms-body h2 { font-size: 1.15rem; line-height: 1.5; margin: 0 0 12px; }
.terms-body p { margin: 0 0 14px; }
.terms-body .terms-important { padding: 22px; border: 1px solid #edd3a9; border-left: 4px solid var(--amber); border-radius: 12px; background: #fffbf3; }
.terms-fingerprint { padding-top: 16px; border-top: 1px solid var(--line); font-size: .72rem; overflow-wrap: anywhere; }
.terms-consent { display: flex; align-items: flex-start; gap: 12px; margin: 20px 0; line-height: 1.7; }
.terms-consent input { flex-shrink: 0; width: 20px; height: 20px; margin: 4px 0 0; accent-color: var(--purple); }
.terms-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.terms-actions .b2b-button { white-space: normal; text-align: center; }
.terms-decline { margin: 22px 0; text-align: center; }
.b2b-alert.success { color: #176149; background: #e6f5ef; border: 1px solid #b9ddce; }
.b2b-button:disabled { cursor: not-allowed; opacity: .5; }
.b2b-terms-page a:focus-visible, .b2b-terms-page button:focus-visible, .terms-consent input:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }

@media (max-width: 640px) {
    .terms-document-heading { flex-direction: column; }
    .terms-parties { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
    .terms-body .terms-important { padding: 15px; }
    .terms-actions .b2b-button { width: 100%; }
}

@media print {
    body.b2b-terms-page { background: #fff; color: #000; font-size: 10pt; }
    .b2b-terms-page .b2b-topbar, .b2b-terms-page .b2b-footer, .terms-intro, .terms-print, .terms-acceptance, .terms-decline, .terms-actions, .b2b-terms-page .b2b-alert { display: none; }
    .b2b-terms-page .terms-shell { width: 100%; max-width: none; margin: 0; padding: 0; }
    .terms-document { border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 0; }
    .terms-body h2 { break-after: avoid; }
    .terms-body p { orphans: 3; widows: 3; }
    .terms-parties { break-inside: avoid; }
}

@media (max-width: 980px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .two-column { grid-template-columns: 1fr; }
    .referral-box { grid-template-columns: 1fr; }
    .referral-code { grid-column: 1; }
}

@media (max-width: 640px) {
    .b2b-login-page, .referral-page { padding: 14px; }
    .b2b-login-card, .referral-card { padding: 30px 20px; border-radius: 20px; }
    .referral-actions { flex-direction: column; }
    .b2b-topbar { gap: 10px; padding: 10px 14px; }
    .b2b-brand.compact img { width: 120px; }
    .partner-identity { display: none; }
    .b2b-topbar form { margin-left: auto; }
    .b2b-shell { width: min(100% - 24px, 1440px); padding-top: 28px; }
    .welcome-row { align-items: stretch; flex-direction: column; }
    .plan-pill { min-width: 0; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-card strong { font-size: 1.35rem; }
    .b2b-card { padding: 17px; }
    .copy-row { flex-direction: column; }
}
