:root {
    --deep-purple: #5e35b1;
    --accent: #5e35b1;
    --muted: #6b7280;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #f7f7fb;
    --card: #ffffff;
    --glass: rgba(255, 255, 255, 0.6);
    --radius: 12px;
    --gap: 12px;
    --max-width: 1200px;
    --shadow: 0 8px 30px rgba(16, 24, 40, 0.06);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* {
    box-sizing: border-box
}

/* html,
body {
    height: 100%
} */

body {
    display: flex;
    margin: 0;
    background: linear-gradient(180deg, #fbfbff 0%, var(--bg) 100%);
    color: #111827;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    /* align-items: center; */
}

/* Container */
.container {
    width: 100%;
    /* max-width: var(--max-width); */
    padding: 12px;
}

/* Header */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 16px;
}

.menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-wrapper #profileMenuBtn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: blueviolet;
    width: 34px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.menu-wrapper #profileMenuBtn:focus,
/* .menu-wrapper #profileMenuBtn[aria-expanded="true"] {
    background: #ede7f6;
} */

.menu {
    position: absolute;
    top: 110%;
    right: 0;
    min-width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16,24,40,0.13);
    padding: 8px 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #ede7f6;
    animation: fadeInMenu 0.18s;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu[hidden] {
    display: none !important;
}

.menu-item {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 10px 18px;
    font-size: 15px;
    color: #5e35b1;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    border-radius: 0;
    gap: 8px;
    align-items: center;
    outline: none;
}
.menu-item:hover, .menu-item:focus {
    background: #ede7f6;
    color: #311b92;
}
.menu-item.logout {
    color: #dc2626;
}
.menu-item.delete {
    color: #fff;
    background: #dc2626;
    border-radius: 0 0 12px 12px;
}
.menu-item.delete:hover, .menu-item.delete:focus {
    background: #b91c1c;
}

.profile-left {
    display: flex;
    gap: 16px;
    align-items: center
}

.avatar {
    width: 84px;
    height: 84px;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent), #7c4dff);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.icon-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    border: none;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

/* Profile meta */
.profile-meta h1 {
    margin: 0;
    font-size: 20px
}

.profile-meta .sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px
}

.badges {
    margin-top: 8px;
    display: flex;
    gap: 8px
}

.badge {
    background: var(--glass);
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--muted);
    border: 1px solid rgba(0, 0, 0, 0.04)
}

.badge.agent {
    background: linear-gradient(90deg, #fff2, #fff0);
    color: var(--accent);
    border: 1px solid rgba(94, 53, 177, 0.12)
}

.badge.vip {
    background: #fff2e5;
    color: #c16200;
    border: 1px solid rgba(193, 98, 0, 0.12)
}

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: transparent;
    cursor: pointer;
    font-size: 14px;
}

.btn.primary {
    background: var(--accent);
    color: white;
    border: none;
}

.btn.small {
    padding: 6px 8px;
    font-size: 13px
}

.link {
    background: transparent;
    color: var(--muted);
    border: none
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer
}

/* Grid layout for overview */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px 12px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card h2 {
    margin: 0;
    font-size: 16px
}

.card-body {
    color: var(--muted)
}

/* Responsive placements */
.orders-card {
    grid-column: span 12;
    display: flex;
    flex-direction: column;
}

.profile-card {
    grid-column: span 4;
}

.agent-card {
    grid-column: span 7;
}

.addresses-card {
    grid-column: span 4;
}

.payments-card {
    grid-column: span 4;
}

/* .agent-card-root {
    grid-column: span 12;
    margin: 0;
    padding: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
} */

.referrals-card {
    grid-column: span 12;
}

/* Small screens */
@media (max-width:900px) {
    .orders-card {
        grid-column: span 12
    }

    .activity-card {
        grid-column: span 12
    }

    .profile-card {
        grid-column: span 12
    }

    .agent-card {
        grid-column: span 12
    }

    .addresses-card {
        grid-column: span 12
    }

    .payments-card {
        grid-column: span 12
    }

    .referrals-card {
        grid-column: span 12
    }
}

/* List and items */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px
}


.order-left {
    display: flex;
    gap: 12px;
    align-items: flex-start
}

.order-id {
    font-weight: 600
}

.order-meta {
    color: var(--muted);
    font-size: 13px
}

.order-right {
    display: flex;
    gap: 12px;
    align-items: center
}

.order-amount {
    font-weight: 700
}

/* Profile details grid */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: center
}

.profile-grid div {
    font-size: 14px;
    gap: 4px;
}

@media (max-width:600px) {
    .profile-grid {
        grid-template-columns: 1fr
    }
}

/* Address/payment lists */
.address-card,
.payment-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.03);
    margin-bottom: 8px
}

.ref-box {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

.ref-box input {
    border: 1px dashed rgba(0, 0, 0, 0.06);
    padding: 8px;
    border-radius: 8px;
    width: 220px
}

.ref-stats {
    display: flex;
    gap: 12px;
    margin-left: auto;
    align-items: center
}

.ref-stats div {
    text-align: center
}

/* Modal & backdrop */
.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 80
}

.hidden {
    display: none
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90
}

.modal-card {
    background: var(--card);
    padding: 18px;
    border-radius: 12px;
    width: min(720px, 95%);
    box-shadow: var(--shadow)
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px
}

@media (max-width:600px) {
    .form-grid {
        grid-template-columns: 1fr
    }
}

/* Tiny helpers */
.tiny {
    padding: 6px 8px;
    font-size: 12px
}

.order-actions .btn {
    margin-left: 6px
}

/* Footer */
.footer-actions {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: var(--muted)
}

/* Utilities */
.text-muted {
    color: var(--muted)
}

.wallet-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 10px;
    min-height: 34px;
    border: 1px solid rgba(94, 53, 177, 0.2);
    background: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
}

.wallet-pill-icon {
    font-size: 14px;
    color: #5e35b1;
}

.wallet-pill-value {
    font-weight: 700;
    color: #1f2937;
    font-size: 13px;
}

.wallet-pill-currency,
.wallet-pill-sub {
    font-weight: 600;
    color: #5e35b1;
    font-size: 12px;
}

.credits-pill {
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(90deg, rgba(254, 243, 199, 0.9), rgba(255, 255, 255, 0.95));
}

.credits-pill .wallet-pill-icon {
    color: #d97706;
}

.gift-card-pill {
    border-color: rgba(16, 185, 129, 0.45);
    background: linear-gradient(90deg, rgba(209, 250, 229, 0.95), rgba(255, 255, 255, 0.95));
}

.gift-card-pill .wallet-pill-icon {
    color: #059669;
}

.loyalty-pill {
    border-color: rgba(236, 72, 153, 0.35);
    background: linear-gradient(90deg, rgba(251, 207, 232, 0.95), rgba(255, 255, 255, 0.95));
}

.loyalty-pill .wallet-pill-icon {
    color: #db2777;
}