:root {
    --accent: #e43d63;
    --accent-dark: #c92f52;
    --accent-soft: #fff1f4;
    --page: #f1f3f7;
    --card: #ffffff;
    --text: #172033;
    --muted: #687386;
    --line: #e4e8ef;
    --success: #14804a;
    --warning: #b85d00;
    --danger: #c93434;
    --radius: 16px;
    --shadow: 0 18px 45px rgba(28, 39, 58, .11);
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-width: 0;
    background: var(--page);
}

body {
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background: var(--page);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.app-shell {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    margin: 0 auto;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
    background: var(--page);
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    height: 58px;
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    align-items: center;
    border-bottom: 1px solid rgba(23, 32, 51, .06);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(14px);
}

.topbar h1 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #111827;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.2px;
}

.icon-button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    color: #172033;
    background: transparent;
    text-decoration: none;
}

.icon-button svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.history-link {
    max-width: 132px;
    padding: 17px 14px 17px 8px;
    overflow: hidden;
    color: #263043;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
}

.topbar-spacer {
    width: 50px;
}

.content {
    width: 100%;
    min-width: 0;
    padding: 0 14px 24px;
}

.balance-card {
    position: relative;
    min-height: 154px;
    padding: 20px 22px;
    overflow: hidden;
    color: #ffffff;
    border-radius: 0 0 18px 18px;
    background: linear-gradient(135deg, #17384d 0%, #175d67 56%, #197a74 100%);
    box-shadow: 0 15px 32px rgba(17, 72, 81, .18);
}

.balance-card::before,
.balance-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.balance-card::before {
    width: 190px;
    height: 190px;
    top: -118px;
    right: -54px;
    border: 34px solid rgba(255, 255, 255, .06);
}

.balance-card::after {
    width: 150px;
    height: 150px;
    left: -70px;
    bottom: -110px;
    background: rgba(255, 255, 255, .05);
}

.balance-label,
.balance-row,
.masked-number {
    position: relative;
    z-index: 1;
}

.balance-label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, .9);
    font-size: 14px;
    font-weight: 600;
}

.wallet-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: #d9ffef;
}

.wallet-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.balance-row {
    display: flex;
    align-items: center;
    margin-top: 11px;
}

.balance-row .currency {
    margin-right: 3px;
    font-size: 33px;
    line-height: 1;
}

.balance-row strong {
    min-width: 0;
    font-size: clamp(29px, 8vw, 36px);
    line-height: 1;
    letter-spacing: -.7px;
}

.refresh-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-left: 5px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: rgba(255, 255, 255, .08);
}

.refresh-button:active {
    background: rgba(255, 255, 255, .15);
}

.refresh-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.refresh-button.spinning svg {
    animation: spin .8s linear infinite;
}

.masked-number {
    position: absolute;
    right: 20px;
    bottom: 17px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
}

.method-section {
    padding: 18px 0;
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.method-card {
    min-width: 0;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: #4c566a;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(28, 39, 58, .055);
    transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.method-card:active {
    transform: scale(.985);
}

.method-card.selected {
    border-color: rgba(228, 61, 99, .42);
    color: #b72c4d;
    background: var(--accent-soft);
    box-shadow: 0 7px 20px rgba(228, 61, 99, .12);
}

.method-logo-wrap {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(28, 39, 58, .10);
}

.method-logo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.method-name {
    font-size: 14px;
    font-weight: 650;
}

.panel {
    min-width: 0;
    margin-bottom: 20px;
    padding: 18px 16px 22px;
    border: 1px solid rgba(23, 32, 51, .045);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 8px 24px rgba(28, 39, 58, .055);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-title h2 {
    margin: 0;
    color: #172033;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.25px;
}

.title-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--accent);
    background: var(--accent-soft);
}

.title-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.amount-button {
    min-width: 0;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 7px;
    border: 1px solid #dce1e9;
    border-radius: 9px;
    color: #df3d5f;
    background: #ffffff;
    font-size: 16px;
    font-weight: 650;
    transition: border-color .15s ease, color .15s ease, background .15s ease, transform .15s ease;
}

.amount-button:active {
    transform: scale(.98);
}

.amount-button span {
    color: #a6afbd;
    font-size: 15px;
    font-weight: 500;
}

.amount-button.selected {
    border-color: var(--accent);
    color: #ffffff;
    background: var(--accent);
    box-shadow: 0 7px 16px rgba(228, 61, 99, .2);
}

.amount-button.selected span {
    color: #ffffff;
}

.field-label {
    display: block;
    margin: 18px 1px 8px;
    color: #2c3649;
    font-size: 13px;
    font-weight: 700;
}

.input-wrap {
    width: 100%;
    min-width: 0;
    height: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid #dce1e8;
    border-radius: 10px;
    background: #ffffff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input-wrap:focus-within {
    border-color: rgba(228, 61, 99, .7);
    box-shadow: 0 0 0 3px rgba(228, 61, 99, .10);
}

.input-wrap span {
    flex: 0 0 auto;
    color: #8f99a8;
    font-size: 17px;
}

.input-wrap input {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    color: #172033;
    background: transparent;
    font-size: 16px;
}

.input-wrap input::placeholder {
    color: #a5adba;
}

.phone-wrap span {
    font-size: 14px;
    font-weight: 700;
}

.field-help {
    margin: 7px 2px 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.deposit-bar {
    position: fixed;
    z-index: 25;
    left: 0;
    right: 0;
    bottom: 0;
    min-width: 0;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px max(14px, env(safe-area-inset-left)) calc(11px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    border-top: 1px solid rgba(23, 32, 51, .06);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -10px 28px rgba(28, 39, 58, .08);
    backdrop-filter: blur(12px);
}

.selected-summary {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.selected-summary span {
    color: var(--muted);
    font-size: 11.5px;
}

.selected-summary strong {
    overflow: hidden;
    color: #172033;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.deposit-button {
    min-width: 108px;
    height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 11px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    box-shadow: 0 9px 20px rgba(228, 61, 99, .24);
    font-size: 15px;
    font-weight: 750;
    transition: transform .15s ease, opacity .15s ease;
}

.deposit-button:active:not(:disabled) {
    transform: translateY(1px);
}

.deposit-button:disabled {
    color: #88919e;
    background: #dfe3e9;
    box-shadow: none;
}

.toast[hidden] {
    display: none;
}

.toast {
    position: fixed;
    z-index: 80;
    left: 50%;
    bottom: calc(94px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100% - 28px);
    padding: 11px 15px;
    transform: translateX(-50%);
    border-radius: 10px;
    color: #ffffff;
    background: #172033;
    box-shadow: var(--shadow);
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
}

.history-shell {
    padding-bottom: 0;
}

.history-content {
    padding-top: 16px;
    padding-bottom: 30px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(23, 32, 51, .05);
    border-radius: 15px;
    background: #ffffff;
    box-shadow: 0 7px 22px rgba(28, 39, 58, .055);
}

.history-card-head {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf0f4;
}

.history-order {
    min-width: 0;
}

.history-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.order-text {
    display: block;
    min-width: 0;
    margin-top: 5px;
    overflow-wrap: anywhere;
    color: #253044;
    font-size: 12.5px;
    line-height: 1.45;
}

.history-status-wrap {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.status-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.status-pending {
    color: var(--warning);
    background: #fff4df;
}

.status-success {
    color: var(--success);
    background: #eaf8f0;
}

.status-failed,
.status-rejected {
    color: var(--danger);
    background: #fff0f0;
}

.reopen-button {
    min-width: 78px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(228, 61, 99, .34);
    border-radius: 9px;
    color: #c52f52;
    background: var(--accent-soft);
    font-size: 12px;
    font-weight: 750;
}

.reopen-button[hidden] {
    display: none;
}

.reopen-button:disabled {
    opacity: .65;
}

.history-details {
    display: grid;
    gap: 11px;
    padding-top: 14px;
}

.history-details div {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.history-details span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.history-details strong {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #283347;
    text-align: right;
    font-size: 12.5px;
    line-height: 1.4;
}

.empty-state {
    margin-top: 64px;
    padding: 30px 20px;
    text-align: center;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(28, 39, 58, .05);
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    border-radius: 50%;
    color: var(--accent);
    background: var(--accent-soft);
    font-size: 27px;
}

.empty-state h2 {
    margin: 16px 0 7px;
    font-size: 19px;
}

.empty-state p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
}

.primary-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border-radius: 10px;
    color: #ffffff;
    background: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 600px) {
    body {
        padding: 24px 0;
    }

    .app-shell {
        max-width: 560px;
        min-height: calc(100dvh - 48px);
        overflow: hidden;
        border-radius: 22px;
        box-shadow: var(--shadow);
    }

    .topbar {
        position: relative;
    }

    .balance-card {
        margin-top: 0;
        border-radius: 0 0 18px 18px;
    }

    .deposit-bar {
        left: 50%;
        right: auto;
        width: 560px;
        transform: translateX(-50%);
        bottom: 24px;
        border-radius: 0 0 22px 22px;
    }

    .history-shell {
        min-height: calc(100dvh - 48px);
    }
}

@media (max-width: 380px) {
    .content {
        padding-right: 10px;
        padding-left: 10px;
    }

    .history-link {
        max-width: 108px;
        padding-right: 10px;
        font-size: 11.5px;
    }

    .balance-card {
        padding-right: 18px;
        padding-left: 18px;
    }

    .method-grid {
        gap: 9px;
    }

    .method-card {
        min-height: 102px;
        padding: 10px;
    }

    .method-logo-wrap {
        width: 52px;
        height: 52px;
    }

    .panel {
        padding-right: 12px;
        padding-left: 12px;
    }

    .amount-grid {
        gap: 7px;
    }

    .amount-button {
        height: 42px;
        gap: 4px;
        padding: 0 4px;
        font-size: 14px;
    }

    .amount-button span {
        font-size: 13px;
    }

    .deposit-bar {
        gap: 10px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .deposit-button {
        min-width: 96px;
        padding: 0 15px;
    }

    .history-card-head {
        gap: 8px;
    }

    .history-details div {
        gap: 10px;
    }
}
