:root {
    --account-bg: #f4f5ef;
    --account-surface: #ffffff;
    --account-surface-soft: #f8f9f3;
    --account-ink: #20251c;
    --account-muted: #73796d;
    --account-border: #dfe3d8;
    --account-lemon: #e2ec67;
    --account-lemon-strong: #c6d83b;
    --account-deep: #273018;
    --account-danger: #a64235;
    --account-shadow: 0 18px 45px rgba(49, 57, 35, 0.08);
}

.account-page {
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 9% 12%, rgba(226, 236, 103, 0.19), transparent 28rem),
        var(--account-bg);
    color: var(--account-ink);
}

.account-page button,
.account-page input {
    font: inherit;
}

.account-header {
    box-shadow: none;
}

.account-header .nav-balance {
    cursor: pointer;
}

.account-main {
    min-height: calc(100vh - 64px);
    padding: 54px 32px 72px;
}

.account-shell {
    --account-desktop-columns: minmax(0, 1.65fr) minmax(340px, 0.75fr);
    width: min(1160px, 100%);
    margin: 0 auto;
}

.account-intro {
    margin-bottom: 28px;
}

.account-kicker,
.panel-eyebrow {
    margin: 0 0 8px;
    color: #7b861e;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    line-height: 1;
}

.account-intro h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    font-weight: 820;
    letter-spacing: -0.055em;
    line-height: 1;
}

.account-intro > p:last-child {
    margin: 12px 0 0;
    color: var(--account-muted);
    font-size: 15px;
}

.account-overview {
    display: grid;
    grid-template-columns: var(--account-desktop-columns);
    align-items: stretch;
    gap: 18px;
    margin-bottom: 18px;
}

.identity-panel,
.records-panel,
.security-panel {
    border: 1px solid var(--account-border);
    border-radius: 18px;
    background: var(--account-surface);
    box-shadow: var(--account-shadow);
}

.identity-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-height: 262px;
    padding: 34px;
    column-gap: 22px;
    height: 100%;
}

.identity-avatar-wrap {
    position: relative;
}

.identity-avatar {
    display: block;
    width: 82px;
    height: 82px;
    padding: 5px;
    border: 1px solid #dddca8;
    border-radius: 50%;
    background: #fafae8;
    object-fit: contain;
}

.identity-status {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 16px;
    height: 16px;
    border: 3px solid var(--account-surface);
    border-radius: 50%;
    background: #7db242;
}

.identity-label {
    margin: 0 0 4px;
    color: var(--account-muted);
    font-size: 12px;
    font-weight: 650;
}

.identity-copy h2 {
    overflow: hidden;
    margin: 0;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 780;
    letter-spacing: -0.035em;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.identity-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.identity-name-row h2 {
    min-width: 0;
}

.identity-name-edit {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 11px;
    color: #586719;
    border: 1px solid #dce4ad;
    border-radius: 10px;
    background: #f7f9e9;
    cursor: pointer;
    font-size: 12px;
    font-weight: 720;
}

.identity-name-edit:hover {
    border-color: #c5d273;
    background: #f0f5d6;
}

.identity-meta {
    margin: 7px 0 0;
    color: var(--account-muted);
    font-size: 13px;
}

.identity-details {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 30px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--account-border);
}

.identity-details div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.identity-details dt {
    color: var(--account-muted);
    font-size: 13px;
}

.identity-details dd {
    margin: 0;
    color: var(--account-ink);
    font-size: 13px;
    font-weight: 680;
}

.status-badge {
    color: #52792b;
}

.status-badge i {
    margin-right: 4px;
    font-size: 10px;
}

.wallet-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 262px;
    padding: 32px;
    border-radius: 18px;
    background: var(--account-deep);
    box-shadow: 0 22px 48px rgba(39, 48, 24, 0.2);
    color: #f7f9e8;
    height: 100%;
}

.wallet-glow {
    position: absolute;
    z-index: -1;
    top: -80px;
    right: -60px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: rgba(226, 236, 103, 0.18);
    filter: blur(4px);
}

.wallet-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #dce2c8;
    font-size: 13px;
    font-weight: 650;
}

.wallet-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.wallet-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.wallet-value {
    margin-top: 21px;
    color: #f6f9d5;
    font-size: clamp(45px, 6vw, 64px);
    font-weight: 820;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.055em;
    line-height: 0.95;
}

.wallet-panel > p {
    margin: 14px 0 24px;
    color: #bfc6ac;
    font-size: 12px;
}

.wallet-recharge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 17px;
    border: 0;
    border-radius: 10px;
    background: var(--account-lemon);
    color: #263014;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
}

.wallet-recharge i {
    margin-left: 22px;
    font-size: 11px;
}

.wallet-recharge:hover {
    background: #eef684;
}

.wallet-recharge:active {
    transform: translateY(1px);
}

.account-body {
    display: grid;
    grid-template-columns: var(--account-desktop-columns);
    align-items: start;
    gap: 18px;
}

.records-panel,
.security-panel {
    min-width: 0;
    padding: 28px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.panel-heading h2 {
    margin: 0;
    color: var(--account-ink);
    font-size: 20px;
    font-weight: 760;
    letter-spacing: -0.025em;
}

.records-list {
    margin-top: 22px;
    border-top: 1px solid var(--account-border);
}

.record-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    min-height: 74px;
    border-bottom: 1px solid var(--account-border);
}

.record-row:last-child {
    border-bottom: 0;
}

.record-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    background: #f0f3df;
    color: #71801a;
    font-size: 13px;
}

.record-icon.negative {
    background: #f2f2ef;
    color: #70746a;
}

.record-copy {
    min-width: 0;
}

.record-title {
    overflow: hidden;
    margin: 0;
    color: var(--account-ink);
    font-size: 13px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-meta {
    overflow: hidden;
    margin: 4px 0 0;
    color: var(--account-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-value {
    color: #60711a;
    font-size: 14px;
    font-weight: 780;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.record-value.negative {
    color: var(--account-ink);
}

.order-value {
    display: block;
    color: var(--account-ink);
    font-size: 13px;
}

.order-status {
    display: block;
    margin-top: 3px;
    color: var(--account-muted);
    font-size: 11px;
    font-weight: 600;
}

.order-status.paid {
    color: #5f7e2c;
}

.order-status.failed {
    color: var(--account-danger);
}

.records-empty,
.records-error {
    display: grid;
    min-height: 236px;
    padding: 40px 18px;
    place-items: center;
    text-align: center;
}

.records-empty i,
.records-error i {
    display: block;
    margin-bottom: 12px;
    color: #aeb5a5;
    font-size: 24px;
}

.records-empty strong,
.records-error strong {
    display: block;
    color: var(--account-ink);
    font-size: 14px;
}

.records-empty span,
.records-error span {
    display: block;
    margin-top: 5px;
    color: var(--account-muted);
    font-size: 12px;
}

.records-retry {
    margin-top: 16px;
    padding: 7px 12px;
    border: 1px solid var(--account-border);
    border-radius: 8px;
    background: var(--account-surface);
    color: var(--account-ink);
    cursor: pointer;
}

.record-skeleton {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 74px;
    border-bottom: 1px solid var(--account-border);
}

.record-skeleton span {
    width: 46%;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #eceee8 25%, #f7f8f4 45%, #eceee8 65%);
    background-size: 240% 100%;
    animation: account-shimmer 1.3s infinite linear;
}

.record-skeleton span:last-child {
    width: 14%;
}

@keyframes account-shimmer {
    to { background-position: -240% 0; }
}

.security-panel {
    position: sticky;
    top: 86px;
}

.security-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}

.security-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 10px;
    background: var(--account-surface-soft);
    color: #677215;
    font-size: 13px;
}

.security-item strong,
.security-item span {
    display: block;
}

.security-item strong {
    color: var(--account-ink);
    font-size: 13px;
}

.security-item div > span {
    overflow: hidden;
    max-width: 210px;
    margin-top: 3px;
    color: var(--account-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-inline-action {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 6px 9px;
    border: 1px solid var(--account-border);
    border-radius: 8px;
    background: var(--account-surface-soft);
    color: #667215;
    font-size: 11px;
    font-weight: 720;
    cursor: pointer;
}

.security-inline-action:hover {
    border-color: #cbd48a;
    background: #f4f6de;
}

.security-action,
.logout-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    margin-top: 22px;
    padding: 0 13px;
    border-radius: 10px;
    cursor: pointer;
}

.security-action {
    border: 1px solid var(--account-border);
    background: var(--account-surface);
    color: var(--account-ink);
    font-size: 13px;
    font-weight: 680;
}

.security-action:hover {
    background: var(--account-surface-soft);
}

.security-action i {
    color: var(--account-muted);
    font-size: 10px;
}

.security-divider {
    margin: 24px 0 0;
    border-top: 1px solid var(--account-border);
}

.logout-action {
    justify-content: flex-start;
    gap: 9px;
    margin-top: 14px;
    border: 0;
    background: transparent;
    color: var(--account-danger);
    font-size: 12px;
    font-weight: 650;
}

.logout-action:hover {
    background: #fff4f1;
}

.password-dialog {
    width: min(480px, calc(100vw - 28px));
    max-height: calc(100vh - 40px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--account-border);
    border-radius: 18px;
    background: var(--account-surface);
    box-shadow: 0 28px 80px rgba(28, 32, 21, 0.28);
    color: var(--account-ink);
}

.password-dialog::backdrop {
    background: rgba(21, 25, 16, 0.62);
    backdrop-filter: blur(5px);
}

.email-verification-block {
    padding: 13px;
    border: 1px solid #e1e5c8;
    border-radius: 12px;
    background: #fafbea;
}

.email-verification-block[hidden] {
    display: none;
}

.dialog-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.dialog-code-button {
    min-width: 108px;
    padding: 0 12px;
    border: 1px solid var(--account-border);
    border-radius: 9px;
    background: var(--account-surface-soft);
    color: #536018;
    font-size: 12px;
    font-weight: 720;
    cursor: pointer;
}

.dialog-code-button:hover:not(:disabled) {
    border-color: #c6d83b;
    background: #f4f6de;
}

.dialog-code-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

@media (max-width: 520px) {
    .dialog-code-row {
        grid-template-columns: 1fr;
    }

    .dialog-code-button {
        min-height: 42px;
    }
}

.password-dialog-card {
    padding: 28px;
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.dialog-heading h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 780;
    letter-spacing: -0.03em;
}

.dialog-heading p:last-child {
    margin: 7px 0 0;
    color: var(--account-muted);
    font-size: 12px;
}

.dialog-close {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--account-border);
    border-radius: 50%;
    background: transparent;
    color: var(--account-muted);
    place-items: center;
    cursor: pointer;
}

.password-field {
    display: block;
    margin-top: 16px;
}

.password-field > span {
    display: block;
    margin-bottom: 7px;
    color: var(--account-ink);
    font-size: 12px;
    font-weight: 680;
}

.password-field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--account-border);
    border-radius: 10px;
    outline: 0;
    background: var(--account-surface-soft);
    color: var(--account-ink);
    font-size: 14px;
}

.password-field input:focus {
    border-color: #a9ba27;
    box-shadow: 0 0 0 3px rgba(198, 216, 59, 0.18);
}

.password-hint,
.form-error {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.5;
}

.password-hint {
    color: var(--account-muted);
}

.form-error {
    color: var(--account-danger);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 26px;
}

.dialog-secondary,
.dialog-primary {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.dialog-secondary {
    border: 1px solid var(--account-border);
    background: transparent;
    color: var(--account-ink);
}

.dialog-primary {
    border: 1px solid var(--account-deep);
    background: var(--account-deep);
    color: #f7f9e8;
}

.dialog-primary:disabled {
    cursor: wait;
    opacity: 0.65;
}

.account-toast {
    position: fixed;
    z-index: 5000;
    right: 24px;
    bottom: 24px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 16px;
    border: 1px solid rgba(226, 236, 103, 0.35);
    border-radius: 10px;
    background: #273018;
    box-shadow: 0 14px 34px rgba(28, 32, 21, 0.24);
    color: #f7f9e8;
    font-size: 13px;
}

.account-toast.error {
    border-color: rgba(255, 173, 156, 0.4);
    background: #542d27;
}

.account-page :focus-visible {
    outline: 3px solid rgba(174, 192, 39, 0.42);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .account-overview,
    .account-body {
        grid-template-columns: 1fr;
    }

    .security-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .account-main {
        padding: 34px 14px 54px;
    }

    .account-intro {
        margin-bottom: 22px;
    }

    .account-intro h1 {
        font-size: 36px;
    }

    .account-intro > p:last-child {
        font-size: 13px;
    }

    .identity-panel,
    .wallet-panel,
    .records-panel,
    .security-panel {
        border-radius: 14px;
    }

    .identity-panel {
        grid-template-columns: auto minmax(0, 1fr);
        min-height: auto;
        padding: 24px 20px;
        column-gap: 15px;
    }

    .identity-avatar {
        width: 64px;
        height: 64px;
    }

    .identity-copy h2 {
        font-size: 22px;
    }

    .identity-details {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 23px;
        padding-top: 18px;
    }

    .wallet-panel {
        min-height: 245px;
        padding: 26px 22px;
    }

    .records-panel,
    .security-panel {
        padding: 22px 18px;
    }

    .record-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 10px;
    }

    .record-icon {
        width: 34px;
        height: 34px;
    }

    .record-title {
        max-width: 46vw;
    }

    .password-dialog-card {
        padding: 22px 18px;
    }

    .account-toast {
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 420px) {
    .account-header .nav-balance-label,
    .account-header .dropdown-arrow {
        display: none;
    }

    .account-header .nav-balance {
        padding: 0 8px;
    }

    .account-header .user-avatar {
        padding-inline: 3px;
    }

    .identity-details div {
        align-items: flex-start;
    }

    .identity-name-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .account-page *,
    .account-page *::before,
    .account-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --account-bg: #151812;
        --account-surface: #1e221a;
        --account-surface-soft: #252a20;
        --account-ink: #eef1e6;
        --account-muted: #a4aa9c;
        --account-border: #353b2f;
        --account-deep: #303b1c;
        --account-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    }

    .account-page {
        background:
            radial-gradient(circle at 9% 12%, rgba(198, 216, 59, 0.09), transparent 27rem),
            var(--account-bg);
    }

    .account-header,
    .account-header .user-dropdown {
        border-color: var(--account-border);
        background: #1a1e16;
    }

    .account-header .brand-link,
    .account-header .nav-item,
    .account-header .dropdown-item,
    .account-header .username {
        color: #e8ecdf;
    }

    .account-header .nav-item:hover,
    .account-header .dropdown-item:hover,
    .account-header .dropdown-item.active {
        background: #2b311f;
        color: #dce767;
    }

    .account-header .user-avatar:hover,
    .account-header .dropdown-divider,
    .account-header .dropdown-header {
        border-color: var(--account-border);
        background-color: transparent;
    }

    .identity-avatar {
        border-color: #555a36;
        background: #2b301f;
    }

    .record-icon {
        background: #2b311f;
    }

    .record-skeleton span {
        background: linear-gradient(90deg, #2a2f25 25%, #33392e 45%, #2a2f25 65%);
        background-size: 240% 100%;
    }

    .logout-action:hover {
        background: #35221e;
    }

    .password-dialog::backdrop {
        background: rgba(0, 0, 0, 0.72);
    }
}
