:root {
    /* Our custom variables */
    --tg-text-color: #ffffff;
    --tg-hint-color: #aaaaaa;
    --tg-bg-color: #212121;
    --tg-secondary-bg-color: #181818;
    
    /* Telegram theme variables (will be set by JavaScript) */
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #aaaaaa;
    --tg-theme-bg-color: #212121;
    --tg-theme-secondary-bg-color: #181818;
    --tg-theme-button-color: #8774e1;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-link-color: #8774e1;
    --tg-theme-header-bg-color: #212121;
    --tg-theme-accent-text-color: #8774e1;
    --tg-theme-section-bg-color: #212121;
    --tg-theme-section-header-text-color: #8774e1;
    --tg-theme-subtitle-text-color: #aaaaaa;
    --tg-theme-destructive-text-color: #ff595a;
    --tg-viewport-height: 100vh;
    --tg-viewport-stable-height: 100vh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 800px;
    margin: auto;
}

/* Text color classes */
.text-primary {
    color: var(--tg-text-color);
}

.text-secondary {
    color: var(--tg-hint-color);
}

.text-accent {
    color: var(--tg-theme-accent-text-color);
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    padding-bottom: 80px;
    position: relative;
}

/* Overlay for darkening content */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    pointer-events: none;
}

.overlay.active {
    display: block;
    pointer-events: auto;
}

/* Header */
.header {
    position: absolute;
    padding: .5rem;
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
}

.settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-text-color);
}

.settings-btn svg {
    width: 24px;
    height: 24px;
}

.language-selector {
    display: flex;
    z-index: 1001;
    position: relative;
}

.lang-btn {
    padding: .5rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: .375rem;
    overflow: hidden;
    gap: .25rem;
    display: flex;
    position: relative;
    outline: none;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    border: none;
}

.lang-btn:hover {
    background-color: var(--tg-theme-secondary-bg-color);
}

.lang-flag {
    font-weight: 600;
    font-size: 14px;
}

.lang-text {
    font-size: 14px;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: absolute;
    left: 20px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

/* Balance Section */
.balance-section {
    text-align: center;
    padding: 32px 20px 2px;
    background-color: var(--tg-theme-bg-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.balance-label {
    font-size: 14px;
    color: var(--tg-theme-subtitle-text-color);
}

.balance-value {
    font-size: 36px;
    font-weight: 400;
    color: var(--tg-theme-text-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 0 20px 20px;
    background-color: var(--tg-theme-bg-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding-top: .5rem;
    padding-bottom: .5rem;
    padding-left: .75rem;
    padding-right: .75rem;
}

.action-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-button-color);
}

.action-icon svg {
    width: 100%;
    height: 100%;
}

.action-text {
    font-size: 14px;
    color: var(--tg-theme-accent-text-color);
}

/* Profile Section */
.profile-section {
    padding: 0 20px 20px;
    margin-top: 8px;
    background-color: var(--tg-theme-bg-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-accent-text-color);
    padding-top: 8px;
    margin-bottom: 10px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-text-color);
}

.info-label {
    font-size: 12px;
    color: var(--tg-hint-color);
}

/* Currencies Section */
.currencies-section {
    padding: 0 20px 20px;
    margin-top: 8px;
    background-color: var(--tg-theme-bg-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.currencies-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.currency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0 0;
}

.currency-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.currency-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 28px;
    color: white;
}

.currency-icon-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.currency-icon.fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: white;
    background-color: var(--tg-secondary-bg-color);
}

.currency-icon.rub {
    background-color: #4caf50;
}

.currency-icon.kzt {
    background-color: #4caf50;
}

.currency-icon.byn {
    background-color: #4caf50;
}

.currency-icon.btc {
    background-color: #f7931a;
}

.currency-icon.usdt {
    background-color: #26a17b;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.currency-icon.ton {
    background-color: #0088cc;
}

.currency-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.currency-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--tg-text-color);
}

.currency-rate {
    font-size: 14px;
    color: var(--tg-hint-color);
}

.currency-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.currency-balance {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-text-color);
}

.currency-value {
    font-size: 14px;
    color: var(--tg-hint-color);
}

.configure-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--tg-text-color);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    margin: auto;
}

.configure-btn svg {
    width: 16px;
    height: 16px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--tg-bg-color);
    border-top: 1px solid var(--tg-secondary-bg-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--tg-text-color);
    cursor: pointer;
    padding: 8px 16px;
}

.nav-item.active {
    color: var(--tg-text-color);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-hint-color);
}

.nav-icon svg {
    width: 100%;
    height: 100%;
}

.nav-item.active .nav-icon {
    color: var(--tg-theme-button-color);
}

.nav-text {
    font-size: 12px;
}

/* Settings Page */
.settings-section {
    padding: 24px 20px;
}

.settings-title {
    font-size: 16px;
    font-weight: 500;
    color: #a0a0a0;
    margin-bottom: 16px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--tg-secondary-bg-color);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    position: relative;
}

.settings-item-left .currency-icon-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.settings-item-left .currency-icon.fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: white;
    background-color: var(--tg-secondary-bg-color);
    position: absolute;
    top: 0;
    left: 0;
}

.settings-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-item-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--tg-text-color);
}

.settings-item-ticker {
    font-size: 14px;
    color: var(--tg-hint-color);
}

.eye-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 32px;
    min-height: 32px;
}

.eye-toggle.active {
    color: var(--tg-text-color);
}

.eye-toggle:not(.active) {
    color: var(--tg-hint-color);
}

.eye-toggle .eye-open,
.eye-toggle .eye-closed {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.eye-toggle.active .eye-open {
    display: block !important;
}

.eye-toggle.active .eye-closed {
    display: none !important;
}

.eye-toggle:not(.active) .eye-open {
    display: none !important;
}

.eye-toggle:not(.active) .eye-closed {
    display: block !important;
}

.eye-toggle svg {
    stroke: currentColor;
    fill: none;
}

/* Responsive adjustments */
@media (max-width: 375px) {
    .balance-value {
        font-size: 32px;
    }
    
    .action-buttons {
        gap: 16px;
    }
    
    .action-icon {
        width: 48px;
        height: 48px;
    }
}

/* =============================================
   TRADE LIST PAGE
   ============================================= */
.trade-list-section {
    padding-bottom: 80px;
}

.trade-list-header {
    padding: 12px 16px 8px;
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.trade-pairs-list {
    display: flex;
    flex-direction: column;
}

.trade-pair-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.trade-pair-item:active {
    background-color: rgba(255, 255, 255, 0.03);
}

.trade-pair-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trade-pair-logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.trade-pair-logo img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.trade-pair-logo-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--tg-theme-secondary-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: var(--tg-theme-text-color);
}

.trade-pair-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trade-pair-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.trade-pair-sub {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.trade-pair-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.trade-pair-right .trade-pair-price {
    font-size: 15px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.trade-pair-change {
    font-size: 13px;
}

.trade-pair-change.positive {
    color: #26a69a;
}

.trade-pair-change.negative {
    color: #ef5350;
}

/* =============================================
   TRADE DETAIL PAGE
   ============================================= */
.trade-detail-container {
    padding-bottom: 16px;
    background-color: var(--tg-theme-secondary-bg-color);
}

.chart-section {
    background-color: var(--tg-theme-secondary-bg-color);
}

.chart-container {
    width: 100%;
    height: 400px;
}

/* Pair info bar */
.trade-pair-info-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: var(--tg-theme-bg-color);
    margin-top: 8px;
    border-radius: 8px;
    margin-left: 8px;
    margin-right: 8px;
}

.trade-pair-selector {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background-color: var(--tg-theme-bg-color);
}

.trade-pair-selector .trade-pair-logo {
    width: 36px;
    height: 36px;
    padding: 4px;
}

.trade-pair-details {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 2px;
}

.trade-pair-symbol {
    font-size: 15px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
}

.trade-pair-price-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.trade-pair-price-row .trade-pair-price {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.trade-pair-price-row .trade-pair-change {
    font-size: 13px;
}

.timeframe-btn {
    background-color: var(--tg-theme-bg-color);
    border: none;
    color: var(--tg-theme-text-color);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

/* Timeframe selector */
.timeframe-selector {
    display: flex;
    gap: 4px;
    padding: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.tf-option {
    background: none;
    border: none;
    color: var(--tg-theme-hint-color);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
}

.tf-option.active {
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

/* Buy / Sell buttons */
.trade-actions {
    display: flex;
    gap: 8px;
    padding: 8px;
    margin-top: 8px;
}

.trade-buy-btn,
.trade-sell-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #ffffff;
}

.trade-buy-btn {
    background-color: #26a69a;
}

.trade-sell-btn {
    background-color: #ef5350;
}

/* Deals section */
.trade-deals-section {
    margin-top: 8px;
    padding: 0 8px;
}

.trade-deals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.trade-deals-tabs {
    display: flex;
    gap: 4px;
}

.trade-deal-tab {
    background: none;
    border: none;
    color: var(--tg-theme-hint-color);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
}

.trade-deal-tab.active {
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.trade-deals-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0;
}

/* Accent text helper */
.text-accent {
    color: var(--tg-theme-accent-text-color);
}

/* =============================================
   STAKING LIST PAGE
   ============================================= */
.staking-list-section {
    padding-bottom: 80px;
}

.staking-list-header {
    padding: 12px 16px 8px;
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.staking-pools-list {
    display: flex;
    flex-direction: column;
}

.staking-pool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.staking-pool-item:active {
    background-color: rgba(255, 255, 255, 0.03);
}

.staking-pool-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.staking-pool-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.staking-pool-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.staking-pool-name {
    font-size: 15px;
    font-weight: 500;
}

.staking-pool-rate {
    font-size: 13px;
}

.staking-pool-arrow {
    display: flex;
    align-items: center;
}

/* =============================================
   STAKING DETAIL PAGE
   ============================================= */
.staking-detail-container {
    padding-bottom: 16px;
}

.staking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.staking-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.staking-coin-name {
    font-size: 18px;
    font-weight: 600;
}

.staking-form-section {
    padding: 0 16px;
}

.staking-form-title {
    font-size: 14px;
    margin-bottom: 16px;
}

.staking-amount-row {
    margin-bottom: 12px;
}

.staking-amount-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 32px;
    font-weight: 500;
    margin-bottom: 4px;
}

.staking-currency-label {
    font-size: 20px;
    font-weight: 400;
    color: var(--tg-theme-text-color);
    margin-left: 4px;
}

.staking-available {
    font-size: 13px;
}

.staking-amount-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--tg-theme-text-color);
    font-size: 18px;
    padding: 8px 0;
    margin-bottom: 20px;
    outline: none;
    -moz-appearance: textfield;
}

.staking-amount-input::-webkit-outer-spin-button,
.staking-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.staking-amount-wrapper {
    display: inline-block;
    position: relative;
}

.staking-amount-inline-input {
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color);
    font-size: 24px;
    font-weight: 600;
    outline: none;
    width: 20px;
    min-width: 20px;
    max-width: 300px;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.staking-amount-measure {
    position: absolute;
    visibility: hidden;
    white-space: pre;
    font-size: 24px;
    font-weight: 600;
    pointer-events: none;
}

.staking-amount-inline-input::-webkit-outer-spin-button,
.staking-amount-inline-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.staking-amount-inline-input::placeholder {
    color: var(--tg-theme-hint-color);
}

.staking-error {
    color: #ff4444;
    font-size: 13px;
    margin-top: 4px;
}

.staking-duration-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.staking-duration-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: none;
    cursor: pointer;
    gap: 4px;
}

.staking-duration-btn.active {
    background-color: #26a69a;
    border-color: #26a69a;
}

.staking-dur-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
}

.staking-dur-rate {
    font-size: 11px;
    color: var(--tg-theme-hint-color);
}

.staking-duration-btn.active .staking-dur-label,
.staking-duration-btn.active .staking-dur-rate {
    color: #ffffff;
}

.staking-create-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.7;
}

/* Orders */
.staking-orders-section {
    margin-top: 24px;
    padding: 0 16px;
}

.staking-orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0;
}

.staking-orders-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.staking-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-radius: 8px;
    background-color: var(--tg-theme-bg-color);
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.staking-order-item:active {
    opacity: 0.8;
}

.staking-order-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.staking-order-coin {
    font-size: 15px;
    font-weight: 500;
}

.staking-order-duration {
    font-size: 12px;
}

.staking-order-right {
    text-align: right;
}

.staking-order-amount {
    font-size: 15px;
    font-weight: 500;
}

/* Modal */
.staking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
}

.staking-overlay.active {
    display: block;
}

.staking-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--tg-theme-bg-color);
    border-radius: 16px 16px 0 0;
    padding: 12px 20px 32px;
    z-index: 2001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.staking-modal.active {
    transform: translateY(0);
}

.staking-modal-handle {
    width: 40px;
    height: 4px;
    background-color: var(--tg-theme-hint-color);
    border-radius: 2px;
    margin: 0 auto 20px;
    opacity: 0.3;
}

.staking-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.staking-modal-row:last-child {
    border-bottom: none;
}

.staking-modal-coin {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =============================================
   FINANCE PAGES (Deposit, Withdrawal, Asset)
   ============================================= */
.finance-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    background-color: var(--tg-theme-secondary-bg-color);
    overflow-y: auto;
}

.finance-container {
    min-height: 100vh;
    padding-bottom: 40px;
}

.finance-title {
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: var(--tg-theme-hint-color);
    padding: 24px 20px 20px;
}

/* Method selection */
.finance-method-list {
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    gap: 4px;
}

.finance-method-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: var(--tg-theme-text-color);
    -webkit-tap-highlight-color: transparent;
}

.finance-method-item:active {
    opacity: 0.7;
}

.finance-method-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.finance-method-icon {
    flex-shrink: 0;
}

.finance-method-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.finance-method-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.finance-method-desc {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.finance-method-arrow {
    color: var(--tg-theme-hint-color);
}

/* Currency selection */
.finance-currency-list {
    display: flex;
    flex-direction: column;
    padding: 0 16px;
}

.finance-currency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: var(--tg-theme-text-color);
    -webkit-tap-highlight-color: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.finance-currency-item:last-child {
    border-bottom: none;
}

.finance-currency-item:active {
    opacity: 0.7;
}

.finance-currency-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.finance-currency-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.finance-currency-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.finance-currency-ticker {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.finance-currency-arrow {
    color: var(--tg-theme-hint-color);
}

.finance-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    width: 100%;
    background: none;
    border: none;
    color: var(--tg-theme-hint-color);
    font-size: 13px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.finance-expand-btn svg {
    transition: transform 0.2s;
}

/* Amount input page */
.finance-amount-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.finance-amount-header {
    padding: 24px 20px;
}

.finance-amount-label {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 8px;
}

.finance-amount-value-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 6px;
}

.finance-amount-wrapper {
    display: inline-block;
    position: relative;
}

.finance-amount-input {
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color);
    font-size: 36px;
    font-weight: 600;
    outline: none;
    width: 20px;
    min-width: 20px;
    max-width: 300px;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.finance-amount-input::-webkit-outer-spin-button,
.finance-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.finance-amount-input::placeholder {
    color: var(--tg-theme-text-color);
}

.finance-amount-measure {
    position: absolute;
    visibility: hidden;
    white-space: pre;
    font-size: 36px;
    font-weight: 600;
    pointer-events: none;
}

.finance-amount-currency {
    font-size: 20px;
    font-weight: 400;
    color: var(--tg-theme-text-color);
}

.finance-amount-balance {
    font-size: 13px;
    color: var(--tg-theme-accent-text-color);
}

.finance-amount-footer {
    padding: 16px 20px;
    margin-top: auto;
}

.finance-payment-method {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tg-theme-text-color);
    -webkit-tap-highlight-color: transparent;
}

.finance-payment-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tg-theme-bg-color);
    border-radius: 50%;
    color: var(--tg-theme-hint-color);
}

.finance-payment-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.finance-payment-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.finance-payment-name {
    font-size: 14px;
    color: var(--tg-theme-text-color);
}

.finance-payment-method-label {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    text-align: center;
}

/* QR Code page */
.finance-qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.finance-qr-warning {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background-color: rgba(255, 152, 0, 0.12);
    border-radius: 12px;
    margin: 20px 0;
    width: 100%;
    max-width: 360px;
}

.finance-qr-warning-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.finance-qr-warning-text {
    font-size: 13px;
    color: var(--tg-theme-text-color);
    line-height: 1.4;
}

.finance-qr-code {
    margin: 32px 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.finance-qr-code img,
.finance-qr-code canvas {
    border-radius: 8px;
}

.finance-qr-address {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    text-align: center;
    word-break: break-all;
    padding: 0 20px;
    margin-bottom: 24px;
}

.finance-qr-copy-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}

/* Asset detail page */
.finance-asset-container {
    padding-bottom: 0;
}

.finance-asset-header {
    text-align: center;
    padding: 32px 20px 16px;
}

.finance-asset-balance-label {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 4px;
}

.finance-asset-balance-value {
    font-size: 32px;
    font-weight: 400;
    color: var(--tg-theme-text-color);
}

.finance-asset-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 0 20px 20px;
}

.finance-asset-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--tg-theme-accent-text-color);
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
}

.finance-asset-action-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-button-color);
}

.finance-asset-action-icon svg {
    width: 100%;
    height: 100%;
}

/* Transactions */
.finance-asset-transactions {
    padding: 0 16px;
}

.finance-asset-transactions-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--tg-theme-hint-color);
    margin-bottom: 8px;
}

.finance-asset-transactions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.finance-transaction-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.finance-transaction-item:active {
    opacity: 0.7;
}

.finance-transaction-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.finance-transaction-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.finance-transaction-amount {
    font-size: 15px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.finance-transaction-status {
    font-size: 12px;
}

.finance-transactions-empty {
    text-align: center;
    padding: 32px;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

.finance-loading {
    text-align: center;
    padding: 32px;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

/* Withdrawal fields */
.finance-withdraw-fields {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.finance-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.finance-field-label {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.finance-field-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--tg-theme-text-color);
    font-size: 16px;
    padding: 8px 0;
    outline: none;
    -moz-appearance: textfield;
}

.finance-field-input::-webkit-outer-spin-button,
.finance-field-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.finance-field-input::placeholder {
    color: var(--tg-theme-hint-color);
}

.finance-submit-btn {
    width: calc(100% - 40px);
    margin: 16px 20px;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* =============================================
   TRADE MODAL (Buy/Sell overlay)
   ============================================= */
.trade-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 6000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.trade-modal-overlay.active {
    display: block;
    opacity: 1;
}

.trade-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80%;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: 16px 16px 0 0;
    z-index: 6001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.trade-modal.active {
    transform: translateY(0);
}

.trade-modal-handle {
    width: 40px;
    height: 4px;
    background-color: var(--tg-theme-hint-color);
    border-radius: 2px;
    margin: 12px auto 0;
    opacity: 0.3;
    flex-shrink: 0;
}

.trade-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 0;
    overflow-y: auto;
}

.trade-modal-label {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 12px;
}

.trade-modal-label span {
    color: var(--tg-theme-link-color);
}

.trade-modal-amount-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.trade-modal-amount-input {
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color);
    font-size: 48px;
    font-weight: 700;
    outline: none;
    width: 40px;
    min-width: 40px;
    max-width: 300px;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.trade-modal-amount-input::-webkit-outer-spin-button,
.trade-modal-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.trade-modal-amount-input::placeholder {
    color: var(--tg-theme-text-color);
}

.trade-modal-amount-currency {
    font-size: 24px;
    font-weight: 400;
    color: var(--tg-theme-hint-color);
}

.trade-modal-amount-measure {
    position: absolute;
    visibility: hidden;
    white-space: pre;
    font-size: 48px;
    font-weight: 700;
    pointer-events: none;
}

.trade-modal-available {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 20px;
}

/* Duration selector */
.trade-modal-durations {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.trade-modal-dur-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--tg-theme-text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.trade-modal-dur-btn.active {
    background-color: var(--tg-theme-button-color);
    border-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

/* Trade modal footer */
.trade-modal-footer {
    padding: 16px 20px 24px;
    margin-top: auto;
    flex-shrink: 0;
}

.trade-modal-back {
    display: block;
    text-align: center;
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    margin-bottom: 12px;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    padding: 8px;
}

.trade-modal-submit {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #ffffff;
}

.trade-modal-submit.buy {
    background-color: #26a69a;
}

.trade-modal-submit.sell {
    background-color: #ef5350;
}

/* =============================================
   EXCHANGE PAGES
   ============================================= */

/* Exchange pair selection */
.exchange-page-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    padding: 24px 20px 24px;
}

.exchange-pair-list {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.exchange-pair-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.exchange-pair-item:last-child {
    border-bottom: none;
}

.exchange-pair-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tg-theme-bg-color);
}

.exchange-pair-icon img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.exchange-pair-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exchange-pair-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.exchange-pair-balance {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.exchange-swap-btn {
    margin-left: auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background-color: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.exchange-continue-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px 24px;
    background-color: var(--tg-theme-secondary-bg-color);
}

.exchange-continue-btn button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background-color: #26a69a;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Exchange amount page */
.exchange-amount-header {
    padding: 24px 20px;
}

.exchange-amount-title {
    font-size: 14px;
    color: var(--tg-theme-link-color);
    margin-bottom: 12px;
}

.exchange-amount-title span {
    color: var(--tg-theme-link-color);
}

.exchange-amount-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.exchange-amount-input {
    background: transparent;
    border: none;
    color: var(--tg-theme-text-color);
    font-size: 48px;
    font-weight: 700;
    outline: none;
    width: 40px;
    min-width: 40px;
    max-width: 300px;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.exchange-amount-input::-webkit-outer-spin-button,
.exchange-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.exchange-amount-input::placeholder {
    color: var(--tg-theme-text-color);
}

.exchange-amount-currency {
    font-size: 24px;
    font-weight: 400;
    color: var(--tg-theme-hint-color);
}

.exchange-amount-measure {
    position: absolute;
    visibility: hidden;
    white-space: pre;
    font-size: 48px;
    font-weight: 700;
    pointer-events: none;
}

.exchange-amount-available {
    font-size: 13px;
    color: var(--tg-theme-link-color);
    margin-bottom: 20px;
}

.exchange-submit-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px 24px;
    background-color: var(--tg-theme-secondary-bg-color);
}

.exchange-submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background-color: #26a69a;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Trade deals list items */
.trade-deal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background-color: var(--tg-theme-bg-color);
    margin-bottom: 4px;
}

.trade-deal-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trade-deal-item-side {
    font-size: 14px;
    font-weight: 500;
}

.trade-deal-item-side.buy {
    color: #26a69a;
}

.trade-deal-item-side.sell {
    color: #ef5350;
}

.trade-deal-item-time {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.trade-deal-item-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trade-deal-item-amount {
    font-size: 14px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.trade-deal-item-status {
    font-size: 12px;
}

.trade-deal-item-status.win {
    color: #26a69a;
}

.trade-deal-item-status.loss {
    color: #ef5350;
}

.trade-deal-item-status.open {
    color: var(--tg-theme-hint-color);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background-color: var(--tg-theme-bg-color);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.hiding {
    transform: translateY(-20px);
    opacity: 0;
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.toast-icon.success {
    background-color: rgba(38, 166, 154, 0.15);
    color: #26a69a;
}

.toast-icon.error {
    background-color: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}

.toast-icon.warning {
    background-color: rgba(255, 152, 0, 0.15);
    color: #ff9800;
}

.toast-icon.info {
    background-color: rgba(135, 116, 225, 0.15);
    color: var(--tg-theme-button-color);
}

.toast-text {
    font-size: 14px;
    color: var(--tg-theme-text-color);
    line-height: 1.4;
    flex: 1;
}

/* Exchange currency picker overlay */
.exchange-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 8000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.exchange-picker-overlay.active {
    display: block;
    opacity: 1;
}

.exchange-picker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70%;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: 16px 16px 0 0;
    z-index: 8001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding-bottom: 24px;
}

.exchange-picker.active {
    transform: translateY(0);
}

.exchange-picker-handle {
    width: 40px;
    height: 4px;
    background-color: var(--tg-theme-hint-color);
    border-radius: 2px;
    margin: 12px auto;
    opacity: 0.3;
}

.exchange-picker-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    text-align: center;
    padding: 0 16px 16px;
}

.exchange-picker-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    color: var(--tg-theme-text-color);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.exchange-picker-item:active {
    background-color: rgba(255, 255, 255, 0.04);
}

.exchange-picker-item.selected {
    background-color: rgba(135, 116, 225, 0.1);
}

.exchange-picker-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tg-theme-bg-color);
    flex-shrink: 0;
}

.exchange-picker-item-icon img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.exchange-picker-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exchange-picker-item-name {
    font-size: 15px;
    font-weight: 500;
}

.exchange-picker-item-ticker {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}
