.referral-page {
    min-height: 100vh;
}

.referral-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.referral-header {
    margin-bottom: 0;
}

.referral-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.referral-summary-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.referral-card-label {
    color: var(--wk-muted, #49618a);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.referral-summary-card strong {
    color: var(--wk-text, #061b45);
    font-size: 1.7rem;
    line-height: 1;
}

.referral-card-head {
    align-items: center;
    justify-content: space-between;
}

.referral-invite-body {
    display: grid;
    grid-template-columns: minmax(260px, 460px);
    gap: 16px;
}

.referral-wide {
    min-width: 0;
}

.referral-copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.referral-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: 16px;
}

.referral-settlement-body {
    display: grid;
    gap: 14px;
}

.referral-settlement-form {
    border: 1px solid var(--wk-border, #d8e1f0);
    border-radius: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
}

.referral-settlement-form strong,
.referral-rules strong {
    display: block;
    color: var(--wk-text, #061b45);
    margin-top: 4px;
}

.referral-settlement-form small {
    display: block;
    color: var(--wk-muted, #49618a);
    margin-top: 4px;
}

.referral-tax-check {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--wk-muted, #49618a);
    font-size: 0.9rem;
}

.referral-rules {
    display: grid;
    gap: 12px;
}

.referral-rules div {
    border-bottom: 1px solid var(--wk-border, #d8e1f0);
    padding-bottom: 10px;
}

.referral-rules div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.referral-table-card {
    overflow: hidden;
}

.referral-table-wrap {
    overflow-x: auto;
}

.referral-table {
    min-width: 840px;
}

.referral-code-pill {
    border: 1px solid #bcd0ff;
    border-radius: 999px;
    background: #f3f7ff;
    color: #0b45c4;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 5px 9px;
}

.referral-settings-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 14px;
    align-items: end;
}

.referral-settings-save {
    min-height: 42px;
}

.referral-actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.referral-paid-form {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

@media (max-width: 1100px) {
    .referral-summary-grid,
    .referral-invite-body,
    .referral-two-column,
    .referral-settings-grid,
    .referral-payout-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .referral-summary-grid,
    .referral-invite-body,
    .referral-two-column,
    .referral-settings-grid,
    .referral-copy-row,
    .referral-settlement-form,
    .referral-paid-form,
    .referral-payout-grid {
        grid-template-columns: 1fr;
    }
}

.referral-payout-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.referral-payout-wide {
    grid-column: 1 / -1;
}

.referral-payout-save {
    justify-self: start;
}

.referral-payout-admin {
    display: grid;
    gap: 4px;
    min-width: 190px;
    color: var(--wk-muted, #49618a);
    font-size: 0.88rem;
}

.referral-payout-admin strong {
    color: var(--wk-text, #061b45);
    font-size: 0.95rem;
}

.referral-muted {
    color: var(--wk-muted, #49618a);
}

/* referral payout mobile override */
@media (max-width: 720px) {
    .referral-payout-grid {
        grid-template-columns: 1fr;
    }
}

/* Referral layout refresh */
body.page-referral {
    position: static;
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--waker-current-page-bg);
}

body.page-referral.sa-modal-open {
    overflow: hidden;
}

body.page-referral #main-content {
    height: auto !important;
    min-height: calc(100dvh - var(--waker-desktop-header-height));
    overflow: visible !important;
    padding-bottom: 64px;
    background: var(--waker-current-page-bg);
}

.referral-shell {
    width: 100%;
    max-width: none;
    padding: var(--waker-space-9) var(--waker-space-9) 72px;
    gap: 18px;
}

.referral-top-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    padding: 22px 24px 20px;
    border: 1px solid var(--sa-border, #d7e0ea);
    border-radius: 8px;
    background: var(--sa-panel-bg, #ffffff);
    box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
}

.referral-top-left {
    display: flex;
    align-items: center;
    gap: 22px;
    min-width: 0;
    flex: 1 1 auto;
}

.referral-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 170px;
    flex: 0 0 auto;
}

.referral-title-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    border-radius: 6px;
    background: linear-gradient(180deg, #2d63ea 0%, #426fff 100%);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(32, 77, 176, 0.18);
}

.referral-title-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.referral-title {
    margin: 0;
    color: #10254d;
    font-family: var(--sa-font, "Aptos", "Segoe UI", sans-serif);
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
}

.referral-header-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(118px, 1fr));
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.referral-stat-card {
    min-width: 0;
    min-height: 58px;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 9px 12px;
    border: 1px solid #dbe5f0;
    border-radius: 8px;
    background: #f8fbff;
}

.referral-stat-label {
    overflow: hidden;
    color: #5b7198;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.referral-stat-value {
    overflow: hidden;
    color: #061b45;
    font-size: 19px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.referral-header-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border: 1px solid #bfcbda;
    border-radius: 7px;
    background: #ffffff;
    color: #15315f;
    font: 800 14px/1 var(--sa-font, "Aptos", "Segoe UI", sans-serif);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.referral-header-button:hover {
    border-color: #a9bfdc;
    background: #f4f8fd;
    transform: translateY(-1px);
}

.referral-header-button--primary {
    border-color: #1a63ef;
    background: #1765ff;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(23, 101, 255, 0.18);
}

.referral-header-button--primary:hover {
    border-color: #1157df;
    background: #1157df;
}

.referral-rules-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.referral-rule-card {
    min-height: 82px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid var(--waker-border, #d8e1f0);
    border-radius: 8px;
    background: var(--waker-color-surface, #ffffff);
    box-shadow: var(--waker-shadow-panel, 0 1px 3px rgba(18, 38, 68, 0.05));
}

.referral-rule-card span {
    color: var(--wk-muted, #49618a);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.referral-rule-card strong {
    color: var(--wk-text, #061b45);
    font-size: 1.2rem;
    line-height: 1.1;
}

.referral-invite-card,
.referral-table-card {
    width: 100%;
}

.referral-invite-body {
    grid-template-columns: minmax(260px, 520px);
}

.referral-table {
    width: 100%;
}

.referral-modal {
    width: min(760px, calc(100vw - 32px));
}

.referral-modal--wide {
    max-width: 820px;
}

.referral-modal-body {
    padding: 24px;
}

.referral-modal .referral-payout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.referral-modal .referral-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
}

.referral-modal .referral-settlement-form {
    grid-template-columns: minmax(0, 1fr) auto;
}

@media (max-width: 1320px) {
    .referral-top-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .referral-top-left,
    .referral-header-actions {
        width: 100%;
    }

    .referral-header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 1040px) {
    .referral-top-left {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

    .referral-header-stats,
    .referral-rules-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .referral-shell {
        padding: 14px 12px 48px;
    }

    .referral-top-panel {
        padding: 18px;
    }

    .referral-title {
        font-size: 26px;
    }

    .referral-header-stats,
    .referral-rules-grid,
    .referral-modal .referral-payout-grid,
    .referral-modal .referral-settings-grid,
    .referral-modal .referral-settlement-form {
        grid-template-columns: 1fr;
    }

    .referral-header-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .referral-header-button {
        width: 100%;
    }
}

/* Referral header parity with Alerts */
.referral-top-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 14px 16px 12px;
    border: 1px solid #c9d4df;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
}

.referral-top-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.referral-top-title {
    flex: 1 1 auto;
    min-width: 0;
}

.referral-top-panel .referral-title {
    font-size: 30px;
}

.referral-top-panel .referral-title-icon {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
}

.referral-top-panel .referral-title-icon svg {
    width: 18px;
    height: 18px;
}

.referral-top-panel .referral-header-stats {
    grid-template-columns: repeat(4, minmax(152px, 1fr));
    min-width: 720px;
    gap: 12px;
    flex: 0 1 auto;
}

.referral-top-panel .referral-stat-card {
    min-height: 72px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    align-content: normal;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d6dee8;
    border-radius: 6px;
    background: #f6f8fb;
}

.referral-stat-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #5f7ea8;
}

.referral-stat-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.referral-stat-card--companies .referral-stat-icon {
    color: #5d789f;
}

.referral-stat-card--credits .referral-stat-icon {
    color: #4c7edd;
}

.referral-stat-card--cash .referral-stat-icon {
    color: #3f9562;
}

.referral-stat-card--pending .referral-stat-icon {
    color: #c98718;
}

.referral-top-panel .referral-stat-label {
    display: block;
    margin-bottom: 4px;
    color: #7085a6;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-transform: uppercase;
}

.referral-top-panel .referral-stat-value {
    display: block;
    color: #10254d;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.1;
}

.referral-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #d9e2ec;
}

.referral-toolbar-left,
.referral-toolbar-right {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.referral-toolbar-right {
    margin-left: auto;
    justify-content: flex-end;
}

.referral-top-controls .referral-header-button {
    height: var(--waker-desktop-control-height);
    min-height: var(--waker-desktop-control-height);
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 6px;
    font-size: var(--sa-desktop-control-font-size, 15px);
    font-weight: 400;
    line-height: 1;
}

.referral-top-controls .referral-header-button--primary {
    min-width: 150px;
}

@media (max-width: 1520px) {
    .referral-top-panel .referral-header-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
    }
}

@media (max-width: 1220px) {
    .referral-top-main,
    .referral-top-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .referral-top-controls {
        margin-top: 10px;
        padding-top: 10px;
    }

    .referral-toolbar-left,
    .referral-toolbar-right {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .referral-top-panel {
        padding: 12px 14px;
    }

    .referral-top-panel .referral-header-stats {
        grid-template-columns: 1fr;
    }

    .referral-top-controls,
    .referral-toolbar-left,
    .referral-toolbar-right {
        gap: 12px;
    }

    .referral-toolbar-left {
        align-items: stretch;
    }
}

@media (max-width: 720px) {
    .referral-top-controls .referral-header-button {
        width: 100%;
    }
}

/* Referral header exact Alerts alignment */
.referral-top-panel {
    align-items: stretch;
}

.referral-top-main,
.referral-top-controls {
    width: 100%;
}

.referral-top-main {
    align-items: center;
}

.referral-top-title {
    margin-right: auto;
}

.referral-top-panel .referral-header-stats {
    width: min(672px, 100%);
    min-width: 0;
    margin-left: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.referral-top-controls {
    justify-content: flex-start;
}

.referral-toolbar-left {
    justify-content: flex-start;
}

@media (max-width: 1520px) {
    .referral-top-panel .referral-header-stats {
        width: min(672px, 100%);
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .referral-top-panel .referral-header-stats {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .referral-top-panel .referral-header-stats {
        grid-template-columns: 1fr;
    }
}

/* Referral header action/modal consolidation */
.referral-top-controls .referral-header-button,
.referral-top-controls .referral-header-button--primary {
    min-width: 150px;
    border-color: #1a63ef;
    background: #1765ff;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(23, 101, 255, 0.18);
}

.referral-top-controls .referral-header-button:hover,
.referral-top-controls .referral-header-button--primary:hover {
    border-color: #1157df;
    background: #1157df;
    color: #ffffff;
}

.referral-share-modal-body .referral-copy {
    border-color: #1a63ef;
    background: #1765ff;
    color: #ffffff;
}

.referral-share-modal-body .referral-copy:hover {
    border-color: #1157df;
    background: #1157df;
    color: #ffffff;
}

.referral-payout-panel {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--wk-border, #d8e1f0);
    border-radius: 8px;
    background: #f8fbff;
}

.referral-payout-panel__head strong {
    display: block;
    margin-top: 4px;
    color: var(--wk-text, #061b45);
}

.referral-payout-panel__save {
    justify-self: start;
}

.referral-modal .referral-payout-panel .referral-payout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
    .referral-modal .referral-payout-panel .referral-payout-grid {
        grid-template-columns: 1fr;
    }

    .referral-payout-panel__save {
        width: 100%;
    }
}

/* Referral modals match Billing company info modal */
.referral-modal,
.referral-modal--wide {
    width: min(760px, 100%);
    max-height: calc(100dvh - 48px);
    overflow: auto;
    border: 1px solid #c9d6e6;
    border-radius: 10px;
    background: #ffffff;
    color: #0b2857;
    box-shadow: 0 18px 50px rgba(11, 31, 64, 0.26);
    font-family: var(--waker-current-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
}

.referral-modal .sa-modal-header {
    padding: 22px 24px 12px;
}

.referral-modal h2 {
    margin: 0;
    color: #10254d;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.12;
}

.referral-modal .sa-modal-subtitle {
    margin: 8px 0 0;
    color: #5d7295;
    font-size: 15px;
    line-height: 1.45;
}

.referral-modal-body {
    padding: 0 24px 20px;
}

.referral-share-modal-body,
.referral-settlement-body,
.referral-modal .referral-settings-grid {
    gap: var(--waker-space-6);
}

.referral-modal .referral-payout-grid,
.referral-modal .referral-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--waker-space-6);
}

.referral-modal .wk-label,
.referral-modal .referral-card-label {
    color: var(--waker-color-ink-muted);
    font-size: var(--waker-modal-label-font-size);
    font-weight: var(--waker-modal-label-font-weight);
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.referral-modal .wk-input,
.referral-modal .wk-select,
.referral-modal .wk-textarea {
    height: 46px;
    min-height: 46px;
    border: 1px solid #b9cce4;
    border-radius: 7px;
    background: #ffffff;
    color: var(--waker-color-ink-soft);
    font: var(--waker-modal-control-font-weight) var(--waker-modal-control-font-size)/1.2 var(--waker-current-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
}

.referral-modal .wk-input,
.referral-modal .wk-select {
    padding: 0 13px;
}

.referral-modal .wk-input:focus,
.referral-modal .wk-select:focus,
.referral-modal .wk-textarea:focus {
    border-color: #2d6df6;
    box-shadow: 0 0 0 3px rgba(45, 109, 246, 0.14);
}

.referral-payout-panel {
    gap: var(--waker-space-6);
    padding: 0 0 18px;
    border: 0;
    border-bottom: 1px solid #dbe4ee;
    border-radius: 0;
    background: transparent;
}

.referral-payout-panel__head strong,
.referral-settlement-form strong {
    color: #10254d;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.referral-settlement-form {
    min-height: 74px;
    padding: 14px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #f8fbff;
}

.referral-settlement-form small,
.referral-tax-check {
    color: #5d7295;
    font-size: 14px;
    line-height: 1.4;
}

.referral-modal .sa-modal-button {
    min-height: 40px;
    border-radius: 7px;
    padding: 0 18px;
    font: 800 15px/1 var(--sa-font, "Aptos", "Segoe UI", sans-serif);
}

.referral-payout-panel__save {
    min-width: 160px;
}

.referral-modal .sa-modal-actions {
    padding: 16px 24px 22px;
}

@media (max-width: 860px) {
    .referral-modal,
    .referral-modal--wide {
        width: 100%;
        max-height: calc(100dvh - 28px);
    }
}

@media (max-width: 720px) {
    .referral-modal .referral-payout-grid,
    .referral-modal .referral-settings-grid,
    .referral-modal .referral-payout-panel .referral-payout-grid {
        grid-template-columns: 1fr;
    }
}
/* Referral payout history modal */
.referral-history-modal {
    width: min(980px, 100%);
}

.referral-history-modal-body {
    padding-bottom: 18px;
}

.referral-modal-table-scroll {
    max-height: min(58vh, 520px);
    overflow: auto;
    border: 1px solid #d3deec;
    border-radius: 8px;
    background: #ffffff;
}

.referral-modal-table-scroll .referral-table {
    min-width: 760px;
    margin: 0;
}

.referral-modal-table-scroll .referral-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #e8eef6;
}

@media (max-width: 720px) {
    .referral-history-modal {
        width: 100%;
    }

    .referral-modal-table-scroll {
        max-height: 62vh;
    }
}

/* Referral payout history modal sizing override loaded before shared desktop modal CSS */
body.page-referral .referral-history-modal.sa-modal {
    width: min(1180px, calc(100vw - 64px));
    max-width: min(1180px, calc(100vw - 64px));
    height: min(760px, calc(100dvh - 64px));
    max-height: calc(100dvh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.page-referral .referral-history-modal .sa-modal-header,
body.page-referral .referral-history-modal .sa-modal-actions {
    flex: 0 0 auto;
}

body.page-referral .referral-history-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    padding-bottom: 18px;
}

body.page-referral .referral-history-modal .referral-modal-table-scroll {
    flex: 1 1 auto;
    width: 100%;
    min-height: 360px;
    max-height: none;
    overflow: auto;
}

body.page-referral .referral-history-modal .referral-table {
    min-width: 960px;
}

body.page-referral .referral-history-modal .referral-table th,
body.page-referral .referral-history-modal .referral-table td {
    white-space: nowrap;
}

body.page-referral .referral-history-modal .referral-table th:nth-child(6),
body.page-referral .referral-history-modal .referral-table td:nth-child(6) {
    min-width: 220px;
}

@media (max-width: 720px) {
    body.page-referral .referral-history-modal.sa-modal {
        width: calc(100vw - 28px);
        max-width: calc(100vw - 28px);
        height: min(720px, calc(100dvh - 28px));
        max-height: calc(100dvh - 28px);
    }

    body.page-referral .referral-history-modal .referral-modal-table-scroll {
        min-height: 320px;
    }
}

/* Referral payout history table matches Alerts table */
body.page-referral .referral-history-modal .referral-modal-table-scroll {
    border: 1px solid #c9d4df;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
}

body.page-referral .referral-history-modal .referral-table {
    width: 100%;
    min-width: 960px;
    border-collapse: separate;
    border-spacing: 0;
    color: #17315f;
    font-family: var(--waker-current-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
    font-size: 14px;
}

body.page-referral .referral-history-modal .referral-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #cdd7e3;
    background: #e9eef5;
    color: #111111;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

body.page-referral .referral-history-modal .referral-table thead th + th {
    border-left: 1px solid #d7e0ea;
}

body.page-referral .referral-history-modal .referral-table tbody td {
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #dce4ee;
    background: #ffffff;
    color: #17315f;
    font-size: 14px;
    line-height: 1.25;
    vertical-align: middle;
    white-space: nowrap;
}

body.page-referral .referral-history-modal .referral-table tbody td + td {
    border-left: 1px solid #edf2f7;
}

body.page-referral .referral-history-modal .referral-table tbody tr:hover td {
    background: #f8fafc;
}

body.page-referral .referral-history-modal .referral-table tbody tr:last-child td {
    border-bottom: 0;
}

body.page-referral .referral-history-modal .referral-table .billing-empty-cell {
    padding: 20px;
    color: #6f84a7;
    text-align: center;
}

body.page-referral .referral-history-modal .wk-status-pill {
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

body.page-referral .referral-history-modal .referral-table th:nth-child(1),
body.page-referral .referral-history-modal .referral-table td:nth-child(1) {
    min-width: 170px;
}

body.page-referral .referral-history-modal .referral-table th:nth-child(2),
body.page-referral .referral-history-modal .referral-table td:nth-child(2) {
    min-width: 150px;
}

body.page-referral .referral-history-modal .referral-table th:nth-child(3),
body.page-referral .referral-history-modal .referral-table td:nth-child(3),
body.page-referral .referral-history-modal .referral-table th:nth-child(4),
body.page-referral .referral-history-modal .referral-table td:nth-child(4) {
    min-width: 120px;
}

body.page-referral .referral-history-modal .referral-table th:nth-child(5),
body.page-referral .referral-history-modal .referral-table td:nth-child(5) {
    min-width: 145px;
}

body.page-referral .referral-history-modal .referral-table th:nth-child(6),
body.page-referral .referral-history-modal .referral-table td:nth-child(6) {
    min-width: 260px;
}

@media (max-width: 720px) {
    body.page-referral .referral-history-modal .referral-table {
        min-width: 860px;
        font-size: 13px;
    }

    body.page-referral .referral-history-modal .referral-table thead th,
    body.page-referral .referral-history-modal .referral-table tbody td {
        padding: 10px 12px;
    }
}

/* Referral companies table with Alerts-style earnings sub-table */
body.page-referral .referral-company-card {
    border: 1px solid #c9d4df;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
    overflow: hidden;
}

body.page-referral .referral-company-card .referral-card-head {
    padding: 14px 16px;
    border-bottom: 1px solid #d5dee9;
}

body.page-referral .referral-company-card .referral-table-wrap {
    padding: 0;
    overflow-x: auto;
}

body.page-referral .referral-company-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: separate;
    border-spacing: 0;
    color: #17315f;
    font-family: var(--waker-current-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
    font-size: 14px;
}

body.page-referral .referral-company-table > thead > tr > th {
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #cdd7e3;
    background: #e9eef5;
    color: #111111;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

body.page-referral .referral-company-table > thead > tr > th + th {
    border-left: 1px solid #d7e0ea;
}

body.page-referral .referral-company-row > td {
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #dce4ee;
    background: #ffffff;
    color: #17315f;
    font-size: 14px;
    line-height: 1.25;
    vertical-align: middle;
    white-space: nowrap;
}

body.page-referral .referral-company-row > td + td {
    border-left: 1px solid #edf2f7;
}

body.page-referral .referral-company-row:hover > td,
body.page-referral .referral-company-row.is-expanded > td {
    background: #f8fafc;
}

body.page-referral .referral-inline-company {
    min-height: 30px;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #cad6e3;
    border-radius: 6px;
    background: #ffffff;
    color: #2b63e4;
    padding: 6px 10px;
    font: 700 14px/1.15 var(--waker-current-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
    cursor: pointer;
}

body.page-referral .referral-inline-company:hover {
    border-color: #aebdd0;
    background: #f8fafc;
}

body.page-referral .referral-inline-company-arrow {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    color: #1f55c8;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-1px);
}

body.page-referral .referral-inline-company[aria-expanded="true"] .referral-inline-company-arrow {
    transform: translateY(-1px) rotate(180deg);
}

body.page-referral .referral-earnings-row[hidden] {
    display: none !important;
}

body.page-referral .referral-earnings-row > td {
    padding: 0;
    border: 0;
    border-bottom: 1px solid #dce4ee;
    background: #f8fafc;
}

body.page-referral .referral-earnings-card {
    margin: 0 12px 12px;
    border: 1px solid #d4dde8;
    border-radius: 6px;
    background: #fbfcfe;
    padding: 8px 10px;
    box-shadow: none;
}

body.page-referral .referral-earnings-table-wrap {
    overflow-x: auto;
}

body.page-referral .referral-earnings-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    color: #17315f;
    font-size: 14px;
}

body.page-referral .referral-earnings-table th,
body.page-referral .referral-earnings-table td {
    padding: 10px 10px;
    border: 0;
    border-bottom: 1px solid #dfe6f0;
    background: #ffffff;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

body.page-referral .referral-earnings-table th + th,
body.page-referral .referral-earnings-table td + td {
    border-left: 1px solid #ecf1f6;
}

body.page-referral .referral-earnings-table th {
    background: #edf3f8;
    color: #17315f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

body.page-referral .referral-earnings-table tbody tr:hover td {
    background: #f8fafc;
}

body.page-referral .referral-earnings-table tbody tr:last-child td {
    border-bottom: 0;
}

body.page-referral .referral-earnings-empty {
    padding: 20px;
    color: #6f84a7;
    text-align: center;
}

body.page-referral .referral-company-table .wk-status-pill,
body.page-referral .referral-earnings-table .wk-status-pill {
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

body.page-referral .referral-company-table > thead > tr > th:nth-child(1),
body.page-referral .referral-company-row > td:nth-child(1) {
    min-width: 310px;
}

body.page-referral .referral-company-table > thead > tr > th:nth-child(2),
body.page-referral .referral-company-row > td:nth-child(2) {
    min-width: 150px;
}

body.page-referral .referral-company-table > thead > tr > th:nth-child(4),
body.page-referral .referral-company-row > td:nth-child(4),
body.page-referral .referral-company-table > thead > tr > th:nth-child(5),
body.page-referral .referral-company-row > td:nth-child(5) {
    min-width: 175px;
}

@media (max-width: 720px) {
    body.page-referral .referral-company-table {
        min-width: 940px;
        font-size: 13px;
    }

    body.page-referral .referral-company-row > td,
    body.page-referral .referral-company-table > thead > tr > th {
        padding: 10px 12px;
    }
}

/* Referral rule cards explanatory refresh */
body.page-referral .referral-rules-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

body.page-referral .referral-rule-card {
    min-height: 148px;
    align-content: stretch;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    padding: 16px;
    border: 1px solid #d7e2ef;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
    position: relative;
    overflow: hidden;
}

body.page-referral .referral-rule-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #2d63ea;
}

body.page-referral .referral-rule-card--signup::before {
    background: #2d63ea;
}

body.page-referral .referral-rule-card--company::before {
    background: #1f8f4d;
}

body.page-referral .referral-rule-card--cash::before {
    background: #8a63d2;
}

body.page-referral .referral-rule-card--period::before {
    background: #c57916;
}

body.page-referral .referral-rule-card--hold::before {
    background: #4d6f9f;
}

body.page-referral .referral-rule-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9e5f4;
    border-radius: 8px;
    background: #f3f7ff;
    color: #2d63ea;
    letter-spacing: 0;
    text-transform: none;
}

body.page-referral .referral-rule-card--company .referral-rule-icon {
    background: #eef8f2;
    border-color: #cde8d7;
    color: #1f8f4d;
}

body.page-referral .referral-rule-card--cash .referral-rule-icon {
    background: #f4f0ff;
    border-color: #ded1ff;
    color: #7a55c7;
}

body.page-referral .referral-rule-card--period .referral-rule-icon {
    background: #fff6e9;
    border-color: #ead5b6;
    color: #c57916;
}

body.page-referral .referral-rule-card--hold .referral-rule-icon {
    background: #f3f6fb;
    border-color: #d2deeb;
    color: #4d6f9f;
}

body.page-referral .referral-rule-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.page-referral .referral-rule-copy {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 6px;
}

body.page-referral .referral-rule-card .referral-rule-label {
    color: #5b7198;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-transform: uppercase;
}

body.page-referral .referral-rule-card strong {
    color: #061b45;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

body.page-referral .referral-rule-card p {
    margin: 0;
    color: #536b91;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
}

@media (max-width: 1320px) {
    body.page-referral .referral-rules-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    body.page-referral .referral-rules-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    body.page-referral .referral-rules-grid {
        grid-template-columns: 1fr;
    }

    body.page-referral .referral-rule-card {
        min-height: 0;
    }
}

/* Referral reward choice info bubbles */
body.page-referral .referral-rule-card {
    overflow: visible;
}

body.page-referral .referral-rule-card:hover,
body.page-referral .referral-rule-card:focus-within {
    z-index: 4;
}

body.page-referral .referral-rule-info {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c9d7eb;
    border-radius: 999px;
    background: #ffffff;
    color: #2f5fae;
    font: 900 14px/1 var(--sa-font, "Aptos", "Segoe UI", sans-serif);
    cursor: help;
    box-shadow: 0 1px 3px rgba(18, 38, 68, 0.08);
}

body.page-referral .referral-rule-card--company .referral-rule-info {
    color: #1f8f4d;
    border-color: #bfe2cc;
}

body.page-referral .referral-rule-card--cash .referral-rule-info {
    color: #7a55c7;
    border-color: #d9cbff;
}

body.page-referral .referral-rule-info:hover,
body.page-referral .referral-rule-info:focus-visible {
    outline: none;
    border-color: #2d6df6;
    box-shadow: 0 0 0 3px rgba(45, 109, 246, 0.14);
}

body.page-referral .referral-rule-info-bubble {
    position: absolute;
    top: 34px;
    right: 0;
    width: min(300px, calc(100vw - 48px));
    display: block;
    padding: 10px 12px;
    border: 1px solid #c9d7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #17315f;
    box-shadow: 0 12px 28px rgba(18, 38, 68, 0.18);
    font: 700 13px/1.35 var(--sa-font, "Aptos", "Segoe UI", sans-serif);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
    z-index: 10;
}

body.page-referral .referral-rule-info:hover .referral-rule-info-bubble,
body.page-referral .referral-rule-info:focus-visible .referral-rule-info-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 620px) {
    body.page-referral .referral-rule-info-bubble {
        right: -2px;
        width: min(280px, calc(100vw - 40px));
    }
}

/* Referral header final Alerts parity */
body.page-referral .referral-shell {
    padding: 18px 18px 72px;
}

body.page-referral .referral-top-panel {
    padding: 14px 16px 12px;
}

body.page-referral .referral-top-main {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

body.page-referral .referral-top-title {
    flex: 1 1 auto;
    min-width: 0;
    margin-right: auto;
}

body.page-referral .referral-top-panel .referral-title-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
}

body.page-referral .referral-top-panel .referral-title-icon svg {
    width: 18px;
    height: 18px;
}

body.page-referral .referral-top-panel .referral-title {
    font-size: 30px;
    line-height: 1;
}

body.page-referral .referral-top-panel .referral-header-stats {
    grid-template-columns: repeat(4, minmax(152px, 1fr));
    width: auto;
    min-width: 720px;
    gap: 12px;
    flex: 0 0 auto;
    margin-left: auto;
}

body.page-referral .referral-top-panel .referral-stat-card {
    min-height: 72px;
    height: 72px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    align-content: normal;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d6dee8;
    border-radius: 6px;
    background: #f6f8fb;
    box-sizing: border-box;
}

body.page-referral .referral-top-panel .referral-stat-label {
    margin-bottom: 4px;
    font-size: 10px;
    letter-spacing: 0.035em;
    line-height: 1.12;
}

body.page-referral .referral-top-panel .referral-stat-value {
    font-size: 18px;
    line-height: 1.1;
}

@media (max-width: 1520px) {
    body.page-referral .referral-top-main {
        align-items: stretch;
        flex-direction: column;
    }

    body.page-referral .referral-top-panel .referral-header-stats {
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-left: 0;
    }
}

@media (max-width: 860px) {
    body.page-referral .referral-shell {
        padding: 18px 18px 48px;
    }

    body.page-referral .referral-top-panel {
        padding: 12px 14px;
    }
}

@media (max-width: 640px) {
    body.page-referral .referral-top-panel .referral-header-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.page-referral .referral-top-panel .referral-stat-card {
        height: auto;
        min-height: 68px;
    }
}

/* Referral inline header share */
.referral-inline-share {
    min-height: var(--waker-desktop-control-height);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px 5px 10px;
    border: 1px solid #cfe0f4;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    box-sizing: border-box;
}

.referral-inline-share-label {
    color: #637897;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.referral-inline-share-code {
    min-width: 0;
    max-width: 180px;
    overflow: hidden;
    padding: 6px 10px;
    border: 1px solid #bdd1ff;
    border-radius: 999px;
    background: #f1f6ff;
    color: #0b45c4;
    font-size: 13px;
    font-weight: 850;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-top-controls .referral-copy-invite {
    min-width: 136px;
    border-color: #13964f !important;
    background: #149a55 !important;
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(20, 154, 85, 0.2) !important;
}

.referral-top-controls .referral-copy-invite:hover,
.referral-top-controls .referral-copy-invite:focus-visible {
    border-color: #0d7d41 !important;
    background: #0f8849 !important;
    color: #ffffff !important;
}

.referral-top-controls .referral-copy-invite:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.referral-dollar-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

@media (max-width: 860px) {
    .referral-inline-share {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .referral-inline-share {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .referral-inline-share-code {
        max-width: none;
    }

    .referral-top-controls .referral-copy-invite {
        width: 100%;
    }
}
/* End Referral inline header share */
/* Referral inline code controls polish */
body.page-referral .referral-top-controls,
body.page-referral .referral-toolbar-left,
body.page-referral .referral-toolbar-right {
    align-items: center;
}

body.page-referral .referral-inline-share {
    min-height: var(--waker-desktop-control-height);
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 9px;
}

body.page-referral .referral-inline-share-code {
    padding: 6px 10px;
}

body.page-referral .referral-top-controls .referral-copy-invite {
    min-width: 128px;
    gap: 9px;
    border-width: 1px !important;
    border-color: rgba(20, 154, 85, 0.72) !important;
    background: rgba(20, 154, 85, 0.035) !important;
    color: #0f8849 !important;
    box-shadow: 0 0 0 1px rgba(20, 154, 85, 0.08), 0 0 14px rgba(20, 154, 85, 0.24) !important;
}

body.page-referral .referral-top-controls .referral-copy-invite:hover,
body.page-referral .referral-top-controls .referral-copy-invite:focus-visible {
    border-color: #0f8849 !important;
    background: rgba(20, 154, 85, 0.09) !important;
    color: #0a6d3a !important;
    box-shadow: 0 0 0 1px rgba(20, 154, 85, 0.18), 0 0 18px rgba(20, 154, 85, 0.34) !important;
}

body.page-referral .referral-dollar-icon {
    margin-right: 1px;
    border: 1px solid rgba(20, 154, 85, 0.2);
    background: rgba(20, 154, 85, 0.12);
    color: #0f8849;
    flex: 0 0 auto;
}

@media (max-width: 860px) {
    body.page-referral .referral-inline-share {
        width: 100%;
        justify-content: flex-start;
    }
}
/* End Referral inline code controls polish */
/* Referral stacked code label */
body.page-referral .referral-inline-share {
    display: inline-grid;
    grid-template-columns: auto auto;
    grid-template-areas:
        "label copy"
        "code copy";
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
}

body.page-referral .referral-inline-share-label {
    grid-area: label;
    align-self: end;
    font-size: 9px;
    line-height: 1;
}

body.page-referral .referral-inline-share-code {
    grid-area: code;
    justify-self: start;
}

body.page-referral .referral-top-controls .referral-copy-invite {
    grid-area: copy;
    align-self: center;
}

@media (max-width: 640px) {
    body.page-referral .referral-inline-share {
        grid-template-columns: 1fr;
        grid-template-areas:
            "label"
            "code"
            "copy";
    }
}
/* End Referral stacked code label */
/* Align stacked referral label with code text */
body.page-referral .referral-inline-share-label {
    margin-left: 11px;
}
/* End align stacked referral label with code text */
/* Referral copy invitation button width */
body.page-referral .referral-top-controls .referral-copy-invite {
    min-width: 156px;
}
/* End Referral copy invitation button width */
/* Referral header control order */
body.page-referral .referral-inline-share--code-only {
    grid-template-columns: auto;
    grid-template-areas:
        "label"
        "code";
    column-gap: 0;
    flex: 0 0 auto;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-label,
body.page-referral .referral-inline-share--code-only .referral-inline-share-code {
    justify-self: start;
}

@media (max-width: 640px) {
    body.page-referral .referral-inline-share--code-only {
        width: 100%;
    }
}
/* End Referral header control order */
/* Referral code badge polish */
body.page-referral .referral-inline-share--code-only {
    min-height: var(--waker-desktop-control-height);
    position: relative;
    align-content: center;
    row-gap: 3px;
    padding: 3px 4px;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-label {
    margin-left: 12px;
    color: #5a72a0;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.075em;
    opacity: 0.92;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-code {
    max-width: 210px;
    padding: 7px 13px;
    border: 1px solid rgba(37, 99, 235, 0.38);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 246, 255, 0.96)),
        linear-gradient(90deg, rgba(37, 99, 235, 0.12), rgba(20, 154, 85, 0.08));
    color: #1044b8;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.025em;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.06), 0 6px 16px rgba(37, 99, 235, 0.13);
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-code::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border-radius: 999px;
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
    vertical-align: 1px;
}
/* End Referral code badge polish */
/* Referral horizontal code control */
body.page-referral .referral-inline-share--code-only {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    height: var(--waker-desktop-control-height);
    min-height: var(--waker-desktop-control-height);
    min-width: 250px;
    padding: 0 14px;
    border: 1px solid rgba(37, 99, 235, 0.26);
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.04), 0 5px 14px rgba(16, 68, 184, 0.08);
    box-sizing: border-box;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-label {
    margin: 0;
    color: #667c9f;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    white-space: nowrap;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-code {
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #1044b8;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.025em;
    line-height: 1;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-code::before {
    content: none;
    display: none;
}

@media (max-width: 640px) {
    body.page-referral .referral-inline-share--code-only {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }
}
/* End Referral horizontal code control */
/* Referral horizontal code with status dot */
body.page-referral .referral-inline-share--code-only {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    height: var(--waker-desktop-control-height);
    min-height: var(--waker-desktop-control-height);
    min-width: 250px;
    padding: 0 14px;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-label,
body.page-referral .referral-inline-share--code-only .referral-inline-share-code {
    display: inline-flex !important;
    align-items: center !important;
    align-self: center !important;
    justify-self: auto !important;
    margin: 0 !important;
    line-height: 1 !important;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-label {
    flex: 0 0 auto;
    color: #667c9f;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-code {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #1044b8;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.025em;
}

body.page-referral .referral-inline-share--code-only .referral-inline-share-code::before {
    content: "" !important;
    display: inline-block !important;
    width: 6px;
    height: 6px;
    margin: 0 8px 0 1px;
    border-radius: 999px;
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    body.page-referral .referral-inline-share--code-only {
        min-width: 0;
        width: 100%;
        justify-content: center !important;
    }
}
/* End Referral horizontal code with status dot */
/* Referral payout admin actions */
.referral-payout-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 360px;
}

.referral-payout-actions .referral-paid-form {
    flex: 1 1 auto;
}

.referral-decline-form {
    flex: 0 0 auto;
}

.referral-decline-button {
    border-color: #dc2626 !important;
    background: #fff5f5 !important;
    color: #b91c1c !important;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.08) !important;
}

.referral-decline-button:hover,
.referral-decline-button:focus-visible {
    border-color: #b91c1c !important;
    background: #fee2e2 !important;
    color: #991b1b !important;
}

@media (max-width: 760px) {
    .referral-payout-actions {
        min-width: 0;
        align-items: stretch;
        flex-direction: column;
    }
}
/* End Referral payout admin actions */
/* Referral payout shared reference/comment input */
.referral-payout-action-form {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    min-width: 430px;
}

@media (max-width: 760px) {
    .referral-payout-action-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }
}
/* End Referral payout shared reference/comment input */
/* Referral declined payout reversible actions */
.referral-payout-action-form .wk-button {
    white-space: nowrap;
}

@media (max-width: 1120px) {
    .referral-payout-action-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }
}
/* End Referral declined payout reversible actions */

/* Referral mobile: shared app shell, touch-first actions, and card-based data views. */
.referral-title-copy {
    min-width: 0;
}

.referral-mobile-intro {
    display: none;
}

@media (max-width: 1023px) {
    body.page-referral {
        background: var(--sa-mobile-bg, #eff5fb) !important;
    }

    body.page-referral.sa-modal-open {
        overflow: hidden !important;
    }

    body.page-referral #main-content {
        padding: 0 0 max(32px, env(safe-area-inset-bottom)) !important;
        background: var(--sa-mobile-bg, #eff5fb) !important;
    }

    body.page-referral .referral-page {
        min-height: 100vh;
        background: var(--sa-mobile-bg, #eff5fb);
    }

    body.page-referral .referral-mobile-shell {
        display: block !important;
        min-height: 0 !important;
        background: transparent !important;
        position: relative;
        z-index: 1002;
    }

    body.page-referral .referral-shell {
        min-height: calc(100vh - var(--waker-mobile-header-height, 100px));
        gap: 18px;
        padding: 18px 16px 36px;
        background: var(--sa-mobile-bg, #eff5fb);
        box-sizing: border-box;
    }

    body.page-referral .referral-top-panel {
        gap: 16px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.page-referral .referral-top-main {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        justify-content: stretch;
        gap: 16px;
    }

    body.page-referral .referral-top-title {
        width: 100%;
        margin: 0;
    }

    body.page-referral .referral-top-panel .referral-title-icon {
        display: none;
    }

    body.page-referral .referral-title-copy {
        display: grid;
        gap: 8px;
    }

    body.page-referral .referral-top-panel .referral-title {
        color: #08265a;
        font-family: var(--sa-mobile-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
        font-size: 36px;
        font-weight: 800;
        line-height: 1.06;
        letter-spacing: 0;
    }

    body.page-referral .referral-top-panel .referral-header-stats {
        width: 100%;
        max-width: none;
        margin: 0;
        justify-self: stretch;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    body.page-referral .referral-top-panel .referral-stat-card {
        min-width: 0;
        min-height: 64px;
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 12px 14px;
        border: 1px solid #d5e0ed;
        border-radius: 16px;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
    }

    body.page-referral .referral-top-panel .referral-stat-icon {
        display: none;
    }

    body.page-referral .referral-top-panel .referral-stat-card > div {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
    }

    body.page-referral .referral-top-panel .referral-stat-label {
        min-width: 0;
        margin: 0;
        overflow: visible;
        font-size: 10px;
        line-height: 1.25;
        text-overflow: clip;
        white-space: normal;
    }

    body.page-referral .referral-top-panel .referral-stat-value {
        justify-self: end;
        margin: 0;
        font-size: 22px;
        line-height: 1;
    }

    body.page-referral .referral-top-controls {
        margin: 0;
        padding: 16px;
        border: 1px solid #d5e0ed;
        border-radius: 18px;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
    }

    body.page-referral .referral-toolbar-left {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }

    body.page-referral .referral-toolbar-left > * {
        width: 100%;
        grid-area: auto !important;
        grid-column: 1;
    }

    body.page-referral .referral-top-controls .referral-header-button,
    body.page-referral .referral-top-controls .referral-header-button--primary {
        width: 100%;
        min-width: 0;
        height: 54px;
        min-height: 54px;
        padding: 0 18px;
        border: 1px solid #c6d3e1;
        border-radius: 14px;
        background: #ffffff;
        color: #15315f;
        box-shadow: none;
        font-family: var(--sa-mobile-font, var(--sa-font, "Aptos", "Segoe UI", sans-serif));
        font-size: 16px;
        font-weight: 700;
        order: 30;
    }

    body.page-referral .referral-top-controls .referral-header-button:hover,
    body.page-referral .referral-top-controls .referral-header-button:focus-visible {
        border-color: #9fb6d2;
        background: #f5f9ff;
        color: #0d326d;
        transform: none;
    }

    body.page-referral .referral-top-controls [data-referral-modal-open="settle_rewards"] {
        border-color: #1765ff;
        background: #1765ff;
        color: #ffffff;
        box-shadow: 0 8px 18px rgba(23, 101, 255, 0.18);
        order: 20;
    }

    body.page-referral .referral-top-controls [data-referral-modal-open="settle_rewards"]:hover,
    body.page-referral .referral-top-controls [data-referral-modal-open="settle_rewards"]:focus-visible {
        border-color: #1157df;
        background: #1157df;
        color: #ffffff;
    }

    body.page-referral .referral-top-controls [data-referral-modal-open="payout_history"] {
        order: 21;
    }

    body.page-referral .referral-top-controls [data-referral-modal-open="admin_settings"] {
        order: 31;
    }

    body.page-referral .referral-top-controls .referral-copy-invite {
        min-width: 0;
        min-height: 54px;
        order: 11;
    }

    body.page-referral .referral-inline-share--code-only {
        width: 100%;
        min-width: 0;
        height: 58px;
        min-height: 58px;
        justify-content: space-between !important;
        padding: 0 16px;
        border-radius: 14px;
        order: 10;
    }

    body.page-referral .referral-inline-share--code-only .referral-inline-share-label {
        font-size: 10px;
    }

    body.page-referral .referral-inline-share--code-only .referral-inline-share-code {
        max-width: 58%;
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.page-referral .referral-rules-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body.page-referral .referral-rule-card {
        min-height: 0;
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 14px;
        padding: 18px;
        border-radius: 18px;
    }

    body.page-referral .referral-rule-icon {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    body.page-referral .referral-rule-card strong {
        font-size: 25px;
    }

    body.page-referral .referral-rule-card p {
        font-size: 14px;
        line-height: 1.45;
    }

    body.page-referral .referral-rule-info {
        top: 8px;
        right: 8px;
        width: 44px;
        height: 44px;
    }

    body.page-referral .referral-rule-info-bubble {
        top: 48px;
        right: 0;
        width: min(300px, calc(100vw - 48px));
        padding: 12px 14px;
        border-radius: 12px;
        font-size: 14px;
        line-height: 1.45;
    }

    body.page-referral .referral-table-card,
    body.page-referral .referral-company-card {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.page-referral .referral-card-head,
    body.page-referral .referral-company-card .referral-card-head {
        padding: 2px 2px 10px;
        border: 0;
        background: transparent;
    }

    body.page-referral .referral-card-head .wk-card__title {
        color: #08265a;
        font-size: 22px;
        font-weight: 800;
        line-height: 1.2;
    }

    body.page-referral .referral-table-wrap,
    body.page-referral .referral-company-card .referral-table-wrap {
        padding: 0;
        overflow: visible;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) {
        display: block;
        width: 100%;
        min-width: 0;
        border: 0;
        background: transparent;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > thead {
        display: none;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > tbody {
        display: grid;
        gap: 14px;
        width: 100%;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > tbody > tr {
        display: grid;
        width: 100%;
        padding: 16px 18px;
        border: 1px solid #d5e0ed;
        border-radius: 18px;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(18, 38, 68, 0.05);
        box-sizing: border-box;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > tbody > tr > td {
        width: 100%;
        min-width: 0 !important;
        display: grid;
        grid-template-columns: minmax(104px, 0.62fr) minmax(0, 1fr);
        align-items: center;
        gap: 12px;
        padding: 10px 0;
        border: 0;
        border-bottom: 1px solid #e5ebf2;
        background: transparent;
        color: #17315f;
        font-size: 14px;
        line-height: 1.4;
        text-align: left;
        white-space: normal;
        box-sizing: border-box;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > tbody > tr > td::before {
        content: attr(data-label);
        min-width: 0;
        color: #667c9f;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.06em;
        line-height: 1.25;
        text-transform: uppercase;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > tbody > tr > td:last-child {
        border-bottom: 0;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-history-table) > tbody > tr > .billing-empty-cell {
        display: block;
        padding: 24px 12px;
        border: 0;
        text-align: center;
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-history-table) > tbody > tr > .billing-empty-cell::before {
        content: none;
    }

    body.page-referral .referral-inline-company {
        width: 100%;
        min-height: 48px;
        justify-content: flex-start;
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 15px;
        text-align: left;
        white-space: normal;
    }

    body.page-referral .referral-inline-company span:last-child {
        min-width: 0;
        overflow: hidden;
        text-align: left;
        text-overflow: ellipsis;
    }

    body.page-referral .referral-code-pill {
        max-width: 100%;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    body.page-referral .referral-earnings-row {
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.page-referral .referral-earnings-row > td {
        display: block !important;
        padding: 0 !important;
        border: 0 !important;
    }

    body.page-referral .referral-earnings-row > td::before {
        content: none !important;
    }

    body.page-referral .referral-earnings-card {
        margin: 0;
        padding: 14px;
        border-radius: 18px;
        background: #f8fbff;
    }

    body.page-referral .referral-earnings-table-wrap {
        overflow: visible;
    }

    body.page-referral .referral-earnings-table > tbody > tr {
        padding: 14px 16px;
        border-radius: 14px;
    }

    body.page-referral .referral-actions-cell > form {
        grid-column: 2;
        margin: 0;
    }

    body.page-referral .referral-actions-cell .wk-button,
    body.page-referral .referral-payout-action-form .wk-button {
        width: 100%;
        min-height: 48px;
        border-radius: 12px;
        font-size: 15px;
    }

    body.page-referral .referral-payout-action-form {
        grid-column: 2;
        width: 100%;
        min-width: 0;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body.page-referral .referral-payout-action-form .wk-input {
        width: 100%;
        min-width: 0;
        min-height: 50px;
        border-radius: 12px;
        box-sizing: border-box;
        font-size: 16px;
    }

    body.page-referral .referral-payout-admin {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    body.page-referral .referral-modal-backdrop.sa-modal-backdrop--center {
        align-items: flex-end;
        padding: 0;
    }

    body.page-referral .referral-modal,
    body.page-referral .referral-modal--wide,
    body.page-referral .referral-history-modal.sa-modal {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 12px);
        margin: 0;
        border-radius: 24px 24px 0 0;
        box-sizing: border-box;
    }

    body.page-referral .referral-history-modal.sa-modal {
        height: min(92dvh, 760px);
    }

    body.page-referral .referral-modal .sa-modal-header {
        padding: 20px 18px 12px;
    }

    body.page-referral .referral-modal h2 {
        font-size: 24px;
    }

    body.page-referral .referral-modal .sa-modal-close {
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
        border-radius: 14px;
    }

    body.page-referral .referral-modal-body {
        padding: 0 18px 18px;
    }

    body.page-referral .referral-modal .referral-payout-grid,
    body.page-referral .referral-modal .referral-settings-grid,
    body.page-referral .referral-modal .referral-payout-panel .referral-payout-grid,
    body.page-referral .referral-modal .referral-settlement-form {
        grid-template-columns: 1fr;
    }

    body.page-referral .referral-modal .wk-input,
    body.page-referral .referral-modal .wk-select,
    body.page-referral .referral-modal .wk-textarea {
        min-height: 50px;
        border-radius: 12px;
        font-size: 16px;
    }

    body.page-referral .referral-modal .sa-modal-actions {
        padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
    }

    body.page-referral .referral-modal .sa-modal-button {
        min-height: 50px;
        border-radius: 12px;
        font-size: 16px;
    }

    body.page-referral .referral-history-modal-body {
        min-height: 0;
        padding: 0 14px 14px;
    }

    body.page-referral .referral-history-modal .referral-modal-table-scroll {
        min-height: 0;
        padding: 0 4px 4px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body.page-referral .referral-history-modal .referral-history-table {
        width: 100% !important;
        min-width: 0 !important;
    }

    body.page-referral .referral-history-modal .referral-history-table > tbody,
    body.page-referral .referral-history-modal .referral-history-table > tbody > tr {
        width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 420px) {
    body.page-referral .referral-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    body.page-referral .referral-top-panel .referral-header-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.page-referral :is(.referral-company-table, .referral-admin-table, .referral-earnings-table, .referral-history-table) > tbody > tr > td {
        grid-template-columns: minmax(92px, 0.56fr) minmax(0, 1fr);
    }
}
/* End Referral mobile */
