:root {
    --affiliate-page-bg: #f4f1ea;
    --affiliate-surface: rgba(255, 255, 255, 0.82);
    --affiliate-surface-strong: #ffffff;
    --affiliate-surface-muted: #f6efe4;
    --affiliate-line: rgba(16, 33, 43, 0.10);
    --affiliate-text: #10212b;
    --affiliate-text-soft: #53616d;
    --affiliate-brand: #b45a31;
    --affiliate-brand-deep: #7f3417;
    --affiliate-accent: #1f5f5b;
    --affiliate-shadow: 0 24px 60px rgba(39, 30, 22, 0.12);
    --affiliate-radius-xl: 28px;
    --affiliate-radius-lg: 20px;
    --affiliate-radius-md: 14px;
}

body.affiliate-dashboard {
    background:
        radial-gradient(circle at top left, rgba(180, 90, 49, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(31, 95, 91, 0.18), transparent 25%),
        linear-gradient(180deg, #fbf8f2 0%, var(--affiliate-page-bg) 100%);
    font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
    color: var(--affiliate-text);
    min-height: 100vh;
}

body.affiliate-dashboard .main-wrapper {
    min-height: 100vh;
    background-color: transparent;
    display: flex;
    flex-direction: column;
}

body.affiliate-dashboard .dashboard-header {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1040;
}

body.affiliate-dashboard .dashboard-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

body.affiliate-dashboard .dashboard-header .btn {
    border: 1px solid rgba(16, 33, 43, 0.12);
    color: var(--affiliate-text);
    background: rgba(255, 255, 255, 0.6);
}

body.affiliate-dashboard .dashboard-header .btn:hover,
body.affiliate-dashboard .dashboard-header .btn:focus {
    background: rgba(255, 255, 255, 0.95);
}

body.affiliate-dashboard .affiliate-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(16, 33, 43, 0.06);
    color: var(--affiliate-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.affiliate-dashboard .affiliate-layout {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-height: 0;
}

body.affiliate-dashboard .affiliate-sidebar {
    width: 240px;
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.7);
    padding: 28px 0;
    position: sticky;
    top: 68px;
    height: calc(100vh - 68px);
    overflow-y: auto;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    z-index: 1035;
}

body.affiliate-dashboard .sidebar-inner {
    padding: 0 14px;
}

body.affiliate-dashboard .sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

body.affiliate-dashboard .sidebar-menu ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--affiliate-text);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body.affiliate-dashboard .sidebar-menu ul li a:hover,
body.affiliate-dashboard .sidebar-menu ul li a:focus,
body.affiliate-dashboard .sidebar-menu ul li a.active {
    background: linear-gradient(135deg, #10212b 0%, #21433f 100%);
    color: #ffffff;
    box-shadow: 0 16px 28px rgba(16, 33, 43, 0.18);
    transform: translateY(-1px);
}

body.affiliate-dashboard .affiliate-content {
    flex: 1 1 auto;
    padding: 28px 32px 44px;
    background: transparent;
    min-height: calc(100vh - 68px);
    overflow: auto;
}

body.affiliate-dashboard .affiliate-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

body.affiliate-dashboard .affiliate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s ease;
    z-index: 1030;
}

body.affiliate-dashboard.sidebar-open .affiliate-overlay {
    opacity: 1;
    pointer-events: auto;
}

.affiliate-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.affiliate-page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    flex-wrap: wrap;
    padding: 28px 32px;
    border-radius: 32px;
    background:
        linear-gradient(135deg, rgba(255, 250, 245, 0.94), rgba(255, 255, 255, 0.74)),
        linear-gradient(120deg, rgba(180, 90, 49, 0.10), rgba(31, 95, 91, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--affiliate-shadow);
}

.affiliate-page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--affiliate-brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.affiliate-page-kicker::before {
    content: "";
    width: 26px;
    height: 2px;
    background: currentColor;
}

.affiliate-page-title {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 3rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
}

.affiliate-page-copy {
    margin: 12px 0 0;
    max-width: 58ch;
    color: var(--affiliate-text-soft);
    line-height: 1.75;
    font-size: 15px;
}

.affiliate-page-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(16, 33, 43, 0.08);
    color: var(--affiliate-accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.affiliate-stat-grid,
.affiliate-panel-grid,
.affiliate-two-col {
    display: grid;
    gap: 20px;
}

.affiliate-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.affiliate-panel-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.affiliate-two-col {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    align-items: start;
}

.affiliate-stat-card,
.affiliate-panel,
.affiliate-table-wrap,
.affiliate-form-card,
.affiliate-message-card,
.affiliate-auth-card {
    background: var(--affiliate-surface);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(35, 25, 18, 0.08);
    backdrop-filter: blur(10px);
}

.affiliate-stat-card,
.affiliate-panel,
.affiliate-form-card,
.affiliate-message-card {
    padding: 24px;
}

.affiliate-stat-card {
    min-height: 164px;
}

.affiliate-label {
    display: block;
    margin-bottom: 10px;
    color: var(--affiliate-text-soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.affiliate-value {
    display: block;
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.affiliate-subtext {
    margin-top: 10px;
    color: var(--affiliate-text-soft);
    font-size: 14px;
    line-height: 1.7;
}

.affiliate-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.affiliate-panel-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.affiliate-link {
    color: var(--affiliate-accent);
    font-weight: 700;
    text-decoration: none;
}

.affiliate-link:hover {
    text-decoration: underline;
}

.affiliate-table-wrap {
    overflow: hidden;
    padding: 0;
}

.affiliate-table-head {
    padding: 22px 24px 14px;
}

.affiliate-table-body {
    padding: 0 16px 16px;
}

.affiliate-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.affiliate-table thead th {
    padding: 14px 14px;
    background: rgba(246, 239, 228, 0.9);
    border-bottom: 1px solid rgba(16, 33, 43, 0.08);
    color: var(--affiliate-brand-deep);
    text-align: left;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.affiliate-table thead th:first-child {
    border-top-left-radius: 14px;
}

.affiliate-table thead th:last-child {
    border-top-right-radius: 14px;
}

.affiliate-table tbody td {
    padding: 14px 14px;
    font-size: 14px;
    color: var(--affiliate-text);
    border-bottom: 1px solid rgba(16, 33, 43, 0.06);
}

.affiliate-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.65);
}

.affiliate-table tbody tr:last-child td {
    border-bottom: none;
}

.affiliate-empty {
    padding: 18px 8px 4px;
    color: var(--affiliate-text-soft);
    font-size: 14px;
    line-height: 1.7;
}

.affiliate-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.affiliate-pill.success {
    background: #dcf3e7;
    color: #245b34;
}

.affiliate-pill.pending {
    background: #fdf0d5;
    color: #8b5b14;
}

.affiliate-form-card form,
.affiliate-message-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.affiliate-field,
.affiliate-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.affiliate-field-group {
    gap: 16px;
}

.affiliate-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.affiliate-field label {
    color: var(--affiliate-text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.affiliate-field input[type="text"],
.affiliate-field input[type="password"],
.affiliate-field input[type="number"],
.affiliate-field select,
.affiliate-field textarea,
.affiliate-auth-card input[type="text"],
.affiliate-auth-card input[type="password"] {
    width: 100%;
    border: 1px solid rgba(16, 33, 43, 0.14);
    border-radius: 14px;
    background: #fffdf9;
    padding: 14px 16px;
    font: inherit;
    color: var(--affiliate-text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.affiliate-field input:focus,
.affiliate-field select:focus,
.affiliate-field textarea:focus,
.affiliate-auth-card input:focus {
    outline: none;
    border-color: rgba(180, 90, 49, 0.55);
    box-shadow: 0 0 0 4px rgba(180, 90, 49, 0.12);
    transform: translateY(-1px);
}

.affiliate-field textarea {
    min-height: 120px;
    resize: vertical;
}

.affiliate-readonly {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(16, 33, 43, 0.08);
    color: var(--affiliate-text);
}

.affiliate-helper {
    color: var(--affiliate-text-soft);
    font-size: 13px;
    line-height: 1.6;
}

.affiliate-button {
    border: 0;
    border-radius: 999px;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--affiliate-brand) 0%, #cf7c44 100%);
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(180, 90, 49, 0.24);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.affiliate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(180, 90, 49, 0.28);
}

.affiliate-button.secondary {
    background: linear-gradient(135deg, #10212b 0%, #21433f 100%);
    box-shadow: 0 14px 28px rgba(16, 33, 43, 0.2);
}

.affiliate-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.affiliate-message {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
}

.affiliate-message.success {
    background: #edf7f0;
    border: 1px solid rgba(40, 113, 65, 0.18);
    color: #245b34;
}

.affiliate-message.error,
.affiliate-message.danger {
    background: #fff0ee;
    border: 1px solid rgba(158, 42, 43, 0.18);
    color: #8e2f30;
}

.affiliate-message.info {
    background: #eef7fb;
    border: 1px solid rgba(31, 95, 91, 0.16);
    color: #1d5e5b;
}

.affiliate-auth-page {
    min-height: 100vh;
    padding: 28px 16px;
    background:
        radial-gradient(circle at top left, rgba(180, 90, 49, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(31, 95, 91, 0.18), transparent 25%),
        linear-gradient(180deg, #fbf8f2 0%, var(--affiliate-page-bg) 100%);
    color: var(--affiliate-text);
    font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
}

.affiliate-auth-wrap {
    width: min(1080px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 500px);
    gap: 28px;
    align-items: start;
    padding-top: 24px;
}

.affiliate-auth-aside,
.affiliate-auth-card {
    border-radius: 28px;
    box-shadow: var(--affiliate-shadow);
}

.affiliate-auth-aside {
    padding: 32px;
    background:
        linear-gradient(135deg, rgba(255, 250, 245, 0.94), rgba(255, 255, 255, 0.74)),
        linear-gradient(120deg, rgba(180, 90, 49, 0.10), rgba(31, 95, 91, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.65);
}

.affiliate-auth-title {
    margin: 14px 0 12px;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 0.96;
    letter-spacing: -0.05em;
}

.affiliate-auth-copy {
    margin: 0;
    max-width: 56ch;
    color: var(--affiliate-text-soft);
    line-height: 1.8;
}

.affiliate-auth-points {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.affiliate-auth-point {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(16, 33, 43, 0.08);
}

.affiliate-auth-point strong {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
}

.affiliate-auth-point span {
    display: block;
    color: var(--affiliate-text-soft);
    font-size: 14px;
    line-height: 1.6;
}

.affiliate-auth-card {
    padding: 24px;
    background: var(--affiliate-surface-strong);
    border: 1px solid rgba(16, 33, 43, 0.08);
}

.affiliate-auth-head {
    padding: 0 0 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(16, 33, 43, 0.08);
}

.affiliate-auth-head h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.affiliate-auth-head p {
    margin: 8px 0 0;
    color: var(--affiliate-text-soft);
    line-height: 1.7;
    font-size: 14px;
}

.affiliate-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.affiliate-auth-links {
    margin-top: 18px;
    color: var(--affiliate-text-soft);
    font-size: 13px;
    line-height: 1.8;
}

.affiliate-auth-links a {
    color: var(--affiliate-accent);
    text-decoration: none;
    font-weight: 700;
}

.affiliate-auth-links a:hover {
    text-decoration: underline;
}

@media (max-width: 1199px) {
    body.affiliate-dashboard .affiliate-content {
        padding: 24px 24px 40px;
    }
}

@media (max-width: 991px) {
    body.affiliate-dashboard .dashboard-header {
        padding: 12px 16px;
    }

    body.affiliate-dashboard .affiliate-layout {
        flex-direction: column;
    }

    body.affiliate-dashboard .affiliate-sidebar {
        position: fixed;
        top: 68px;
        left: 0;
        height: calc(100vh - 68px);
        width: 280px;
        max-width: 88vw;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.7);
        transform: translateX(-100%);
        box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
    }

    body.affiliate-dashboard .affiliate-sidebar.open {
        transform: translateX(0);
    }

    body.affiliate-dashboard .affiliate-content {
        padding: 22px 14px 34px;
        min-height: auto;
    }

    .affiliate-auth-wrap,
    .affiliate-two-col {
        grid-template-columns: 1fr;
    }

    .affiliate-auth-aside {
        order: 2;
    }
}

@media (max-width: 575px) {
    body.affiliate-dashboard .dashboard-header .logo img {
        height: 28px;
    }

    body.affiliate-dashboard .affiliate-content {
        padding: 18px 10px 30px;
    }

    body.affiliate-dashboard .sidebar-menu ul {
        padding: 0 2px 24px;
    }

    body.affiliate-dashboard .sidebar-menu ul li a {
        padding: 12px 12px;
        font-size: 15px;
    }

    .affiliate-page-head,
    .affiliate-stat-card,
    .affiliate-panel,
    .affiliate-form-card,
    .affiliate-message-card,
    .affiliate-auth-card,
    .affiliate-auth-aside {
        padding: 18px;
        border-radius: 22px;
    }

    .affiliate-field-row,
    .affiliate-auth-points,
    .affiliate-panel-grid {
        grid-template-columns: 1fr;
    }

    .affiliate-table thead {
        display: none;
    }

    .affiliate-table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid rgba(16, 33, 43, 0.08);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.6);
        overflow: hidden;
    }

    .affiliate-table tbody td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        border: none;
    }

    .affiliate-table tbody td::before {
        content: attr(data-label);
        font-weight: 800;
        color: var(--affiliate-brand-deep);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        font-size: 11px;
    }
}
