* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #000000;
    --card-bg: #1B1C1D;
    --input-bg: #222325;
    --text-primary: #CCCCCC;
    --text-light: #888888;
    --text-white: #FFFFFF;
    --accent: #E50539;
    --success: #00C853;
    --warning: #ff9100;
    --danger: #FF1744;
    --green: #28A909;
    --radius: 22px;
    --radius-lg: 24px;
    --radius-sm: 12px;
}

body {
    background-color: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 400;
    padding: 24px 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.card h2,
.change-password-title,
.change-avatar-title,
.referral-title,
.deposits-title,
.settings-title {
    text-align: center;
    padding-bottom: 16px;
}

.card h3,
.referral-subtitle {
    text-align: center;
    padding-bottom: 8px;
}

.referral-text {
    text-align: center;
}

.container {
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
}

.sidebar h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-white);
}

.menu {
    list-style: none;
}

.menu li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.menu li:hover {
    color: var(--text-white);
}

.menu li.active {
    color: var(--accent);
}

/* ==================== CARD ==================== */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 760px;
    position: relative;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
    overflow: visible !important;
}

.close {
    position: fixed;                    /* ← главное изменение */
    top: 1rem;
    right: 1rem;
    z-index: 1000;                      /* выше всего остального */
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid var(--accent);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    text-decoration: none;
}

.close:hover {
    color: white;
    border-color: white;
    transform: scale(1.1);
}

/* ==================== FORMS & BUTTONS ==================== */
.field {
    margin-bottom: 1.125rem;
}

.field label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.field input {
    width: 100%;
    height: 44px;
    background: var(--input-bg);
    border: none;
    border-radius: var(--radius);
    padding: 0 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.field input::placeholder {
    color: #666666;
    opacity: 0.7;
}

.button {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.button button {
    min-width: 174px;
    height: 35px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0 1.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.button button:hover {
    background: var(--text-white);
    color: var(--accent);
}

.select-display {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    background: #222325;
    border-radius: 22px;
    padding: 0 16px;
    cursor: pointer;
    user-select: none;
}

.select-display img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.select-display span {
    font-size: 16px;
    color: #FFFFFF;
}

.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #222325;
    border-radius: 12px;
    margin-top: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    list-style: none;
    padding: 8px 0;
}

.select-options li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.select-options li:hover {
    background: #2a2b2d;
}

.custom-select {
    position: relative;
    width: 100%;
}
/* ==================== AVATAR CHANGE ==================== */
.current-avatar-wrapper {
    text-align: center;
    margin-bottom: 1rem;
}

.current-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-block;
}

.current-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.avatar-option {
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.avatar-option:hover,
.avatar-option.selected {
    border-color: var(--accent);
    transform: scale(1.1);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==================== REFERRAL ==================== */
.referral-code-field {
    position: relative;
    max-width: 340px;
    margin: 1.1rem auto 0;
    background: var(--input-bg);
    border-radius: var(--radius);
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.referral-code {
    font-weight: 700;
    color: var(--green);
    letter-spacing: 0.5px;
}

.copy-btn {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.copy-btn img {
    transition: transform 0.2s;
}

.copy-btn:hover img {
    transform: scale(1.15);
}

/* ==================== DEPOSITS ==================== */
.deposits-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.deposits-header,
.deposit-row {
    display: grid;
    grid-template-columns: 0.8fr 1.7fr 1.35fr 1.2fr 1.45fr 0.9fr;
    gap: 1.1rem;
    padding: 0.85rem 1.2rem;
    font-size: 0.9375rem;
    align-items: center;
}

.deposits-header {
    color: var(--text-light);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.deposit-row {
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    align-items: center;
}

.deposits-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 12px 0;
}

.make-deposit-btn {
    height: 36px;
    padding: 0 18px;
    border: 1px solid #99d978;
    border-radius: 18px;
    background: #2f9e0b;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.deposit-status {
    display: inline-flex;
    min-width: 82px;
    height: 26px;
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    font-size: 12px;
}

.status-pending { background: #575b61; color: #fff; }
.status-waiting { background: #917a2c; color: #fff; }
.status-cancelled { background: #6d3a3a; color: #fff; }
.status-approved { background: #257d2f; color: #fff; }

.deposit-pay-btn {
    min-width: 54px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: #8b929c;
    color: #fff;
    cursor: pointer;
}

.deposit-pay-placeholder {
    color: #70757c;
}

.deposit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 1200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.deposit-modal-dialog {
    width: min(700px, 96vw);
    border-radius: 16px;
    background: #121315;
    border: 1px solid #22262b;
    overflow: hidden;
}

.deposit-modal-header {
    height: 48px;
    background: #1b1d20;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
}

.deposit-modal-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.deposit-modal-body {
    padding: 16px;
}

.deposit-method-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.deposit-method-tab {
    height: 42px;
    min-width: 110px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #40454d;
    background: #202329;
    color: #fff;
    cursor: pointer;
}

.deposit-method-tab.active {
    border-color: #8bc34a;
    background: #2a3125;
}

.deposit-field label {
    display: block;
    margin: 8px 0;
}

.deposit-amount-wrap {
    display: flex;
    align-items: center;
    background: #222325;
    border-radius: 8px;
    padding: 0 12px;
}

.deposit-amount-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    height: 44px;
    font-size: 18px;
}

.deposit-amount-wrap span {
    color: #b6bcc4;
}

.deposit-quick-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 16px;
}

.deposit-quick-btn {
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    background: #17191d;
    border: 1px solid #3a4047;
    color: #fff;
    cursor: pointer;
}

.deposit-submit-btn,
.payment-copy-btn,
.payment-paid-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #82b70b;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.payment-qr-wrap {
    display: flex;
    justify-content: center;
    margin: 6px 0 10px;
}

.payment-qr-wrap img {
    width: 220px;
    height: 220px;
    border-radius: 8px;
    background: #fff;
}

.payment-amount-line {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.payment-amount-line #payment-amount-value {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
}

.payment-details-line {
    height: 44px;
    border-radius: 6px;
    background: #2b2d31;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    margin-bottom: 10px;
    word-break: break-all;
    text-align: center;
}

.payment-copy-btn {
    margin-bottom: 10px;
}

.payment-note {
    text-align: center;
    color: #babfc8;
    font-size: 14px;
    margin-bottom: 10px;
}

.payment-waiting {
    text-align: center;
    color: #d4d7db;
    font-size: 16px;
    padding: 10px 0;
}

/* ==================== TOAST ==================== */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 4000;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--accent);
    color: var(--text-white);
    font-size: 0.9375rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(120%);
    opacity: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
    transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }

/* ==================== MEDIA QUERIES ==================== */
@media (max-width: 960px) {
    .container {
        gap: 0.7rem;
    }

    .sidebar {
        width: 100%;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .menu {
        display: flex;
        flex-wrap: wrap;
        gap: 1.25rem 2rem;
        justify-content: center;
    }

    .menu li {
        margin-bottom: 0;
        flex-direction: column;
        font-size: 0.875rem;
    }

    .card {
        max-width: none;
        width: 100%;
        padding-top: 2rem;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .close {
        position: fixed;
        transform: none;
        left: auto;
        top: 1rem;
        right: 1rem;
        background-color: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(4px);
        border-width: 2px;
        width: 2.125rem;
        height: 2.125rem;
        font-size: 1.125rem;
    }

    .close:hover {
        border-color: var(--text-white);
        color: var(--text-white);
    }
}

@media (max-width: 680px) {
    body {
        padding: 16px 12px;
    }

    .sidebar {
        width: 100%;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .sidebar h2 {
        margin: 0 0 1.5rem 0;
        font-size: 1.375rem;
    }

    .menu {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem 1.5rem;
        margin: 0;
    }

    .menu li {
        margin-bottom: 0;
        flex-direction: column;
        font-size: 0.8125rem;
        gap: 0.375rem;
    }

    .card {
        position: relative;
        padding-top: 3.5rem;
    }

    .close {
        position: absolute;
        left: auto;
        top: 1rem;
        right: 1rem;
        transform: none;
        z-index: 10;
        background-color: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        width: 2.125rem;
        height: 2.125rem;
        font-size: 1.125rem;
        border-width: 2px;
    }

    .close:hover {
        border-color: var(--text-white);
    }

    .change-password-title,
    .change-avatar-title,
    .referral-title,
    .referral-subtitle,
    .deposits-title,
    .settings-title {
        text-align: center !important;
    }

    .field label {
        font-size: 0.875rem;
    }

    .button button {
        width: 100%;
        max-width: 320px;
        height: 52px;
        font-size: 1rem;
    }

    .deposits-list {
        max-height: 50vh;
    }

    .deposits-actions {
        justify-content: center;
        margin: 0 0 10px 0;
    }

    .make-deposit-btn {
        min-width: 160px;
        height: 36px;
        font-size: 14px;
        border-radius: 18px;
        padding: 0 14px;
    }

    .deposits-header,
    .deposit-row {
        grid-template-columns: 0.62fr 1.08fr 0.98fr 1.05fr 1.05fr 0.35fr;
        gap: 0.45rem;
        padding: 0.65rem 0.7rem;
        font-size: 0.8rem;
    }

    .deposits-header {
        font-size: 0.78rem;
    }

    .deposit-status {
        min-width: 64px;
        height: 22px;
        border-radius: 11px;
        padding: 0 8px;
        font-size: 11px;
    }

    .deposit-pay-btn {
        min-width: 44px;
        height: 24px;
        font-size: 12px;
        border-radius: 5px;
    }

    .deposit-row {
        padding: 0.65rem 0.7rem;
        font-size: 0.8rem;
    }

    .avatar-grid {
        gap: 0.75rem;
    }

    .avatar-option {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 420px) {
    .close {
        top: 0.8rem;
        right: 0.8rem;
        width: 2.125rem;
        height: 2.125rem;
        font-size: 1.125rem;
    }

    .sidebar h2 {
        font-size: 1.25rem;
    }

    .deposits-header,
    .deposit-row {
        grid-template-columns: 0.56fr 1fr 0.85fr 0.95fr 0.95fr 0.28fr;
        gap: 0.35rem;
        padding: 0.55rem 0.55rem;
        font-size: 0.74rem;
    }

    .deposits-header {
        font-size: 0.72rem;
    }

    .deposit-status {
        min-width: 58px;
        height: 20px;
        font-size: 10px;
    }

    .make-deposit-btn {
        min-width: 148px;
        height: 34px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .close {
        top: 0.7rem;
        right: 0.7rem;
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
}