:root {
    --nav-height: 72px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.account-page { padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px); }
.account-shell { min-height: auto; padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px); }

.account-shell > .auth-alert { margin: 12px 0 0; }

.account-guest-entry { display: flex; min-height: max(65px, calc(50dvh - 171px)); align-items: center; justify-content: center; margin-top: 12px; padding: 4px 0 1px; }
.account-guest-entry .account-auth-button { width: min(68%, 240px); min-height: 60px; }
.account-auth-button { display: flex; min-height: 47px; align-items: center; justify-content: center; border: 1px solid #33445a; border-radius: 10px; color: #c9d3e1; background: #182536; font-size: 13px; font-weight: 800; transition: transform 150ms ease, border-color 150ms ease; }
.account-auth-button--primary { color: #101925; border-color: var(--auth-accent); background: var(--auth-accent); }
.account-auth-button:active { transform: scale(.98); }

.account-overview { overflow: hidden; margin-top: 12px; border: 1px solid var(--auth-line); border-radius: 16px; background: var(--auth-panel); }
.account-overview-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.account-overview-row--balances { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.account-overview-row--balances .overview-item { min-height: 88px; padding-inline: 4px; }
.account-overview-row--balances .overview-item > span { display: flex; min-height: 2.4em; align-items: center; justify-content: center; font-size: clamp(8px,2.7vw,10px); line-height: 1.2; white-space: normal; }
.account-overview-row:first-child { border-bottom: 1px solid var(--auth-line); }
.overview-item { display: flex; width: 100%; min-width: 0; min-height: 94px; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 7px; color: #dce4ef; text-align: center; }
.overview-item:not(:last-child) { border-inline-end: 1px solid var(--auth-line); }
.overview-item svg { width: 21px; height: 21px; color: var(--auth-accent); }
.overview-item .overview-referral-icon { width: 18px; height: 18px; }
.overview-item > span { max-width: 100%; color: var(--auth-muted); font-size: 10px; font-weight: 650; white-space: nowrap; }
.overview-item > strong { display: block; width: 100%; overflow: hidden; color: var(--auth-text); font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.overview-referral-code { display: flex; width: 100%; min-width: 0; align-items: center; justify-content: center; gap: 5px; }
.overview-referral-code strong { min-width: 0; color: var(--auth-text); font-size: clamp(10px,3vw,13px); font-weight: 750; letter-spacing: .015em; white-space: nowrap; }
.overview-referral-code button { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border: 1px solid rgba(242,183,49,.26); border-radius: 7px; color: var(--auth-accent); background: rgba(242,183,49,.08); }
.overview-referral-code button:active { transform: scale(.92); }
.overview-referral-code button:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 1px; }
.overview-referral-code button svg { width: 14px; height: 14px; }
.overview-item > small { color: var(--auth-muted); font-size: 9px; }
.overview-button { border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.overview-button:active { background: rgba(255,255,255,.025); }
.overview-button > strong { color: var(--auth-accent); font-size: 10px; }

.account-function-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 13px; padding: 10px; border: 1px solid var(--auth-line); border-radius: 16px; background: var(--auth-panel); }
.function-card { display: flex; min-height: 60px; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--auth-line); border-radius: 10px; color: #d2dae5; background: #182536; font-size: 13px; font-weight: 750; }
.function-card:active { transform: scale(.98); }
.function-card--deposit,
.function-card--withdrawal,
.function-card--accent { border-color: var(--auth-accent); color: #171106; background: var(--auth-accent); }
.function-card svg { width: 21px; height: 21px; }

.exchange-section { margin-top: 13px; padding: 19px 14px 15px; border: 1px solid var(--auth-line); border-radius: 16px; background: var(--auth-panel); text-align: center; }
.exchange-section h2 { margin: 0; font-size: 15px; }
.exchange-section > p { margin: 7px 0 16px; color: var(--auth-muted); font-size: 11px; }
.exchange-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.exchange-grid a { display: grid; min-height: 62px; grid-template-columns: 34px minmax(0,1fr) 16px; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--auth-line); border-radius: 10px; color: #e6edf6; background: var(--auth-bg); text-align: start; }
.exchange-grid a:active { transform: scale(.98); }
.exchange-grid img { display: block; width: 32px; height: 32px; object-fit: contain; }
.exchange-grid strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.exchange-grid a > svg { width: 15px; height: 15px; color: #64738a; }

.account-form-card { margin-top: 12px; }
.account-settings { padding-bottom: 7px; }
.account-settings > .auth-heading { margin-bottom: 18px; }
.account-credential { display: grid; grid-template-columns: 42px minmax(0,1fr) 20px; align-items: center; gap: 11px; padding: 13px; border: 1px solid rgba(242,183,49,.2); border-radius: 12px; background: linear-gradient(135deg, rgba(242,183,49,.075), rgba(8,13,20,.34)); }
.account-credential__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--auth-accent); background: rgba(242,183,49,.11); }
.account-credential__icon svg { width: 21px; height: 21px; }
.account-credential__body { min-width: 0; }
.account-credential__body small,
.account-credential__body strong,
.account-credential__body em { display: block; }
.account-credential__body small { color: #98a6b8; font-size: 10px; font-weight: 700; }
.account-credential__body strong { overflow: hidden; margin-top: 3px; color: var(--auth-text); font-size: 13px; font-weight: 780; text-overflow: ellipsis; white-space: nowrap; }
.account-credential__body em { margin-top: 4px; color: #80765f; font-size: 9px; font-style: normal; line-height: 1.45; }
.account-credential__lock { width: 18px; height: 18px; color: #7e714e; }
.account-settings-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--auth-line); }
.account-settings-section > header { margin-bottom: 16px; }
.account-settings-section > header h2 { margin: 0; color: #e3eaf4; font-size: 15px; line-height: 1.35; }
.account-settings-section > header p { margin: 5px 0 0; color: var(--auth-muted); font-size: 10px; line-height: 1.55; }
.account-field-note { color: #6f7d90; font-size: 9px; line-height: 1.5; }
.account-referral-editor { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: max(14px,env(safe-area-inset-top,0px)) 14px max(14px,env(safe-area-inset-bottom,0px)); opacity: 0; transition: opacity 170ms ease; }
.account-referral-editor[hidden] { display: none; }
.account-referral-editor.is-open { opacity: 1; }
.account-referral-editor__backdrop { position: absolute; inset: 0; width: 100%; height: 100%; background: rgba(2,6,11,.84); backdrop-filter: blur(5px); }
.account-referral-editor__dialog { position: relative; width: min(100%,420px); max-height: calc(100dvh - 28px); overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 18px; border: 1px solid #2b3d53; border-radius: 18px; outline: 0; background: linear-gradient(155deg,#121d2a 0%,#0d1621 100%); box-shadow: 0 28px 78px rgba(0,0,0,.6); transform: translateY(12px) scale(.985); transition: transform 190ms cubic-bezier(.22,.8,.25,1); }
.account-referral-editor.is-open .account-referral-editor__dialog { transform: translateY(0) scale(1); }
.account-referral-editor__dialog > header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--auth-line); }
.account-referral-editor__dialog > header span { min-width: 0; }
.account-referral-editor__dialog > header h2 { margin: 0; color: var(--auth-text); font-size: 18px; }
.account-referral-editor__dialog > header p { margin: 5px 0 0; color: var(--auth-muted); font-size: 9px; line-height: 1.45; }
.account-referral-editor__close { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid var(--auth-line); border-radius: 10px; color: #91a0b4; background: #172334; }
.account-referral-editor__close svg { width: 18px; height: 18px; }
.account-referral-editor__close:active { transform: scale(.96); }
.account-referral-editor__dialog > .auth-alert { margin: 14px 0 0; }
.account-referral-editor__dialog > .auth-form,
.account-referral-editor__dialog > .account-referral-locked { margin-top: 16px; }
body.account-referral-editor-open { overflow: hidden; }
.account-premium-code-notice { display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: start; gap: 10px; padding: 11px 12px; border: 1px solid rgba(242,183,49,.2); border-radius: 11px; color: #9b8c68; background: rgba(242,183,49,.045); transition: border-color 160ms ease, background 160ms ease; }
.account-premium-code-notice[hidden] { display: none; }
.account-premium-code-notice > svg { width: 22px; height: 22px; margin: 2px auto 0; color: var(--auth-accent); }
.account-premium-code-notice strong,
.account-premium-code-notice small,
.account-premium-code-notice em { display: block; }
.account-premium-code-notice strong { color: #d5bd81; font-size: 11px; line-height: 1.4; }
.account-premium-code-notice small { margin-top: 4px; font-size: 9px; line-height: 1.55; }
.account-premium-code-notice em { width: fit-content; margin-top: 7px; padding: 4px 7px; border-radius: 6px; color: #171006; background: var(--auth-accent); font-size: 9px; font-style: normal; font-weight: 800; }
.account-premium-code-notice.is-active { border-color: rgba(242,183,49,.5); background: rgba(242,183,49,.09); }
.account-premium-code-notice [hidden] { display: none; }
body.account-payment-confirm-open { overflow: hidden; }
.account-payment-confirm { position: fixed; z-index: 130; inset: 0; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) 15px max(16px, env(safe-area-inset-bottom, 0px)); opacity: 0; transition: opacity 170ms ease; }
.account-payment-confirm[hidden] { display: none; }
.account-payment-confirm.is-open { opacity: 1; }
.account-payment-confirm__backdrop { position: absolute; inset: 0; width: 100%; height: 100%; background: rgba(2,6,11,.84); backdrop-filter: blur(5px); }
.account-payment-confirm__dialog { position: relative; width: min(100%, 390px); padding: 25px 18px 17px; border: 1px solid rgba(242,183,49,.38); border-radius: 17px; background: #111b28; box-shadow: 0 24px 70px rgba(0,0,0,.58); text-align: center; transform: translateY(12px) scale(.985); transition: transform 190ms cubic-bezier(.22,.8,.25,1); }
.account-payment-confirm.is-open .account-payment-confirm__dialog { transform: translateY(0) scale(1); }
.account-payment-confirm__close { position: absolute; top: 8px; right: 8px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--auth-line); border-radius: 9px; color: #91a0b4; background: #172334; }
.account-payment-confirm__close svg { width: 17px; height: 17px; }
.account-payment-confirm__mark { display: grid; width: 52px; height: 52px; margin: 4px auto 13px; place-items: center; border-radius: 50%; color: #171006; background: var(--auth-accent); box-shadow: 0 8px 25px rgba(242,183,49,.2); }
.account-payment-confirm__mark svg { width: 27px; height: 27px; }
.account-payment-confirm__dialog h3 { margin: 0; color: var(--auth-text); font-size: 18px; }
.account-payment-confirm__dialog p { margin: 9px 0 0; color: #d8bd7a; font-size: 12px; line-height: 1.55; }
.account-payment-confirm__dialog > small { display: block; margin-top: 7px; color: #77869a; font-size: 9px; line-height: 1.55; }
.account-payment-confirm__actions { display: grid; grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); gap: 9px; margin-top: 19px; }
.account-payment-confirm__actions button { min-height: 46px; border: 1px solid var(--auth-line); border-radius: 10px; color: #aab6c6; background: #182536; font-size: 11px; font-weight: 800; }
.account-payment-confirm__actions button:last-child { color: #151006; border-color: var(--auth-accent); background: var(--auth-accent); }
.account-payment-confirm__actions button:active,
.account-payment-confirm__close:active { transform: scale(.96); }
.account-referral-locked { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 11px; padding: 13px; border: 1px solid rgba(242,183,49,.2); border-radius: 12px; background: rgba(242,183,49,.055); }
.account-referral-locked__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--auth-accent); background: rgba(242,183,49,.1); }
.account-referral-locked__icon svg { width: 20px; height: 20px; }
.account-referral-locked small,
.account-referral-locked strong,
.account-referral-locked em { display: block; }
.account-referral-locked small { color: #98a6b8; font-size: 10px; font-weight: 700; }
.account-referral-locked strong { margin-top: 3px; color: var(--auth-text); font-size: 14px; font-weight: 800; letter-spacing: .03em; }
.account-referral-locked em { margin-top: 4px; color: #b5a170; font-size: 9px; font-style: normal; line-height: 1.45; }
.account-settings-submit { min-height: 48px; margin-top: 1px; font-size: 13px; }

.history-section { margin-top: 12px; overflow: hidden; border: 1px solid var(--auth-line); border-radius: 16px; background: var(--auth-panel); }
.history-section > header { padding: 20px 18px 16px; border-bottom: 1px solid var(--auth-line); }
.history-section > header h1 { margin: 0; font-size: 21px; }
.history-section > header p { margin: 6px 0 0; color: var(--auth-muted); font-size: 12px; }
.history-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; min-height: 72px; padding: 11px 16px; border-bottom: 1px solid var(--auth-line); }
.history-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 10px; color: #15c995; background: rgba(0,192,135,.1); }
.history-icon--withdraw { color: var(--auth-accent); background: rgba(242,183,49,.1); }
.history-icon--referral_code_buyout { color: var(--auth-accent); background: rgba(242,183,49,.1); }
.history-icon svg { width: 20px; height: 20px; }
.history-item > div { min-width: 0; }
.history-item strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { display: block; margin-top: 5px; color: var(--auth-muted); font-size: 10px; }
.history-value { text-align: end; }
.history-empty { display: flex; min-height: 250px; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.history-empty > svg { width: 38px; height: 38px; margin-bottom: 14px; color: #64738a; }
.history-empty strong { font-size: 14px; }
.history-empty p { margin: 7px 0 0; color: var(--auth-muted); font-size: 11px; }
.history-pagination { display: grid; grid-template-columns: repeat(3,1fr); align-items: center; padding: 13px 16px; font-size: 11px; text-align: center; }
.history-pagination a { color: var(--auth-accent); }
.history-pagination span { color: #566479; }
.history-pagination b { font-weight: 650; }

.bottom-nav { position: fixed; z-index: 20; inset-inline: 0; bottom: 0; display: grid; grid-template-columns: repeat(3,1fr); width: min(100%,480px); height: calc(var(--nav-height) + var(--safe-bottom)); margin: 0 auto; padding: 7px 8px var(--safe-bottom); border-top: 1px solid var(--auth-line); background: rgba(10,16,24,.96); backdrop-filter: blur(18px); }
.nav-item { position: relative; display: flex; min-width: 0; margin: 0; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 0; appearance: none; color: #69778a; background: transparent; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.nav-item:not(:last-child)::after { position: absolute; inset-block-start: 50%; inset-inline-end: 0; width: 1px; height: 31px; background: var(--auth-line); content: ""; transform: translateY(-50%); }
.nav-logout-form { min-width: 0; margin: 0; padding: 0; }
.nav-logout-form .nav-item { width: 100%; height: 100%; }
.nav-logout-form .nav-item::after { position: absolute; inset-block-start: 50%; inset-inline-end: 0; width: 1px; height: 31px; background: var(--auth-line); content: ""; transform: translateY(-50%); }
.nav-item svg { width: 25px; height: 25px; }
.nav-item.is-active { color: var(--auth-text); }
.nav-item.is-active::before { position: absolute; top: -7px; width: 26px; height: 2px; border-radius: 0 0 4px 4px; background: var(--auth-accent); content: ""; }
.nav-item.is-active svg { color: var(--auth-accent); }

.account-toast { position: fixed; z-index: 50; inset-inline-start: 50%; bottom: calc(var(--nav-height) + var(--safe-bottom) + 14px); width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; border: 1px solid var(--auth-line); border-radius: 9px; color: #dce4ef; background: #182536; font-size: 12px; transform: translateX(-50%); }
[dir="rtl"] .account-toast { transform: translateX(50%); }
.account-toast[hidden],
.account-message-source { display: none; }

@media (prefers-reduced-motion: reduce) {
    .account-referral-editor,
    .account-referral-editor__dialog,
    .account-payment-confirm,
    .account-payment-confirm__dialog { transition: none; }
}

@media (max-width: 374px) {
    .overview-item { min-height: 88px; padding-inline: 5px; }
    .overview-item > strong { font-size: 11px; }
    .exchange-grid a { padding-inline: 8px; }
}
