/* Transaction and security tools. Loaded after legacy form styles. */
:root {
    --service-blue: #155eaa;
    --service-blue-dark: #104d8c;
    --service-ink: #17233a;
    --service-muted: #68758a;
    --service-line: #dce5ef;
    --service-soft: #f5f8fc;
    --service-teal: #0f766e;
    --service-teal-soft: #eaf7f5;
    --service-red: #c93636;
}

.service-page-container {
    padding-top: 28px;
    padding-bottom: 44px;
}

.transaction-tool,
.account-security-card {
    overflow: hidden;
    border: 1px solid var(--service-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(24, 46, 78, 0.07);
}

.tool-heading,
.account-security-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--service-line);
}

.tool-heading-main {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.tool-heading-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 8px;
    color: var(--service-blue);
    background: #eaf3ff;
}

.tool-heading h1,
.account-security-heading h1 {
    margin: 0;
    color: var(--service-ink);
    font-size: 1.22rem;
    line-height: 1.3;
}

.tool-heading p,
.account-security-heading p {
    margin: 3px 0 0;
    color: var(--service-muted);
    font-size: 0.84rem;
}

.tool-balance {
    flex: 0 0 auto;
    text-align: right;
}

.tool-balance small,
.tool-balance strong {
    display: block;
}

.tool-balance small {
    color: var(--service-muted);
    font-size: 0.72rem;
}

.tool-balance strong {
    margin-top: 2px;
    color: var(--service-blue);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.service-feedback {
    margin: 16px 22px 0;
}

.service-security-notice,
.service-bank-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 22px 0;
    padding: 11px 13px;
    border: 1px solid #b3dad5;
    border-radius: 7px;
    color: #0f6f68;
    background: #edf8f7;
    font-size: 0.82rem;
}

.service-security-notice a,
.service-bank-notice a {
    color: inherit;
    font-weight: 700;
}

.service-bank-notice {
    border-color: #c9d9ec;
    color: var(--service-blue-dark);
    background: #f1f6fc;
}

.transaction-form,
.account-password-form {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    padding: 22px !important;
}

.transaction-form .form-group-custom,
.account-password-form .form-group-modern {
    min-width: 0;
}

.transaction-form .form-control-custom,
.account-password-form .form-control-modern {
    min-height: 46px;
    border-color: var(--service-line);
    border-radius: 7px;
    font-size: 0.9rem;
}

.transaction-form label,
.account-password-form .form-label-modern {
    color: #3d4b61;
    font-size: 0.82rem;
    font-weight: 700;
}

.form-span-full {
    grid-column: 1 / -1;
}

.purchase-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(520px, 100%);
    margin: 0 auto 14px;
    padding: 4px;
    border: 1px solid var(--service-line);
    border-radius: 8px;
    background: #fff;
}

.purchase-mode-tabs a {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    color: #56647a;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.purchase-mode-tabs a.active {
    color: var(--service-blue-dark);
    background: #eaf3ff;
}

.purchase-choice-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.purchase-choice-group legend {
    width: auto;
    margin: 0 0 9px;
    color: #3d4b61;
    font-size: 0.82rem;
    font-weight: 700;
}

.purchase-provider-grid,
.purchase-value-grid,
.withdraw-quick-grid {
    display: grid;
    gap: 8px;
}

.purchase-provider-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.purchase-value-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.purchase-option-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.purchase-provider-option,
.purchase-value-option,
.withdraw-quick-option {
    display: flex;
    min-width: 0;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--service-line);
    border-radius: 7px;
    color: #3d4b61;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.purchase-provider-option img {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    object-fit: contain;
}

.purchase-option-input:focus-visible + label {
    outline: 3px solid rgba(21, 94, 170, 0.18);
    outline-offset: 2px;
}

.purchase-option-input:checked + label {
    border-color: #8cbce9;
    color: var(--service-blue-dark);
    background: #edf6ff;
}

.purchase-option-input:disabled + label,
.purchase-value-option.is-disabled {
    color: #a2adbb;
    background: #f5f7fa;
    cursor: not-allowed;
    opacity: 0.7;
}

.purchase-stepper {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    overflow: hidden;
    border: 1px solid var(--service-line);
    border-radius: 7px;
}

.purchase-stepper button {
    display: grid;
    min-height: 44px;
    padding: 0;
    place-items: center;
    border: 0;
    color: var(--service-blue);
    background: var(--service-soft);
}

.purchase-stepper input {
    width: 100%;
    min-width: 0;
    border: 0;
    border-right: 1px solid var(--service-line);
    border-left: 1px solid var(--service-line);
    border-radius: 0;
    text-align: center;
    appearance: textfield;
}

.purchase-stepper input::-webkit-inner-spin-button,
.purchase-stepper input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.purchase-summary,
.withdraw-fee-preview {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-column: 1 / -1;
    gap: 0 !important;
    margin: 2px 0 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--service-line) !important;
    border-radius: 7px !important;
    background: var(--service-soft) !important;
}

.purchase-summary > div,
.withdraw-fee-preview > div {
    display: flex;
    min-width: 0;
    min-height: 64px;
    padding: 12px 14px !important;
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 3px !important;
    border: 0 !important;
    border-right: 1px solid var(--service-line) !important;
    border-radius: 0 !important;
    background: transparent !important;
}

.purchase-summary > div:last-child,
.withdraw-fee-preview > div:last-child {
    border-right: 0 !important;
}

.purchase-summary span,
.withdraw-fee-preview span {
    color: var(--service-muted);
    font-size: 0.72rem;
}

.purchase-summary strong,
.withdraw-fee-preview strong {
    color: var(--service-blue) !important;
    font-size: 0.94rem !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.purchase-summary .purchase-total strong,
.withdraw-fee-preview .withdraw-fee-total strong {
    color: var(--service-red) !important;
}

.transaction-submit,
.account-password-submit {
    display: inline-flex;
    grid-column: 1 / -1;
    min-height: 46px;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: var(--service-blue);
    font-size: 0.9rem;
    font-weight: 700;
}

.transaction-submit:hover,
.account-password-submit:hover {
    background: var(--service-blue-dark);
}

.transaction-submit:disabled,
.account-password-submit:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.purchase-fees {
    margin-top: 16px;
}

.purchase-fees .fee-table-wrapper {
    margin: 0;
    border: 1px solid var(--service-line);
    border-radius: 8px;
    box-shadow: none;
}

.purchase-fees .fee-header {
    padding: 13px 16px;
    background: var(--service-blue);
}

/* Exchange card page */
.exchange-policy-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 16px 22px 0;
    padding: 11px 13px;
    border: 1px solid #d6e1ed;
    border-radius: 7px;
    color: #56647a;
    background: #f7f9fc;
    font-size: 0.78rem;
    line-height: 1.5;
}

.exchange-policy-note .ui-icon {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--service-blue);
}

.exchange-provider-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.exchange-field-hint {
    display: block;
    margin-top: 6px;
    color: #7a879a;
    font-size: 0.71rem;
    line-height: 1.4;
}

.exchange-summary .exchange-receive strong {
    color: var(--service-teal) !important;
}

.exchange-empty-option {
    grid-column: 1 / -1;
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--service-line);
    border-radius: 7px;
    color: var(--service-muted);
    text-align: center;
}

.exchange-form-error {
    margin: -4px 0 0;
    color: var(--service-red);
    font-size: 0.78rem;
    font-weight: 600;
}

.exchange-history {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--service-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(24, 46, 78, 0.05);
}

.exchange-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--service-line);
}

.exchange-section-heading > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.exchange-section-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 7px;
    color: var(--service-blue);
    background: #eaf3ff;
}

.exchange-section-heading h2 {
    margin: 0;
    color: var(--service-ink);
    font-size: 1rem;
}

.exchange-section-heading p {
    margin: 2px 0 0;
    color: var(--service-muted);
    font-size: 0.73rem;
}

.exchange-section-heading > a {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    color: var(--service-blue);
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
}

.exchange-history-table {
    width: 100%;
    min-width: 880px;
    margin: 0;
    border-collapse: collapse;
}

.exchange-history-table th {
    padding: 10px 13px;
    border-bottom: 1px solid var(--service-line);
    color: #647187;
    background: #f7f9fc;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
}

.exchange-history-table td {
    padding: 12px 13px;
    border-bottom: 1px solid #e8eef5;
    color: #455268;
    font-size: 0.78rem;
    vertical-align: middle;
}

.exchange-history-table tbody tr:last-child td {
    border-bottom: 0;
}

.exchange-card-data {
    display: grid;
    gap: 5px;
}

.exchange-card-data > span {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
}

.exchange-card-data small {
    color: #8490a2;
    font-size: 0.65rem;
}

.exchange-card-data code {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    color: #9b3434;
    font-size: 0.72rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exchange-amount {
    color: var(--service-teal);
    font-weight: 700;
    white-space: nowrap;
}

.exchange-muted {
    color: #94a0b1;
    font-size: 0.72rem;
}

.exchange-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 700;
    white-space: nowrap;
}

.exchange-status.is-pending { color: #8a5b08; background: #fff5d8; }
.exchange-status.is-success { color: #0b6f55; background: #e4f7ef; }
.exchange-status.is-failed { color: #a52d2d; background: #fdecec; }

.exchange-history-empty td {
    padding: 30px !important;
    color: var(--service-muted);
    text-align: center;
}

.exchange-history-empty td,
.exchange-history-empty span {
    align-items: center;
}

.exchange-history-empty .ui-icon {
    display: block;
    margin: 0 auto 8px;
    color: #9eabba;
}

.exchange-pagination {
    padding: 12px 16px;
    border-top: 1px solid var(--service-line);
    background: #fbfcfe;
}

.exchange-pagination nav {
    margin: 0;
}

.exchange-fees {
    margin-top: 16px;
}

.withdraw-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.withdraw-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 8px;
}

.withdraw-quick-option {
    min-height: 36px;
    padding: 6px 8px;
    border: 0;
    color: var(--service-blue-dark);
    background: #edf6ff;
}

.withdraw-note-wrapper.service-note {
    margin: 16px 0 0;
    overflow: hidden;
    border: 1px solid var(--service-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
}

.service-note .withdraw-note-header {
    padding: 13px 16px;
    color: var(--service-ink);
    background: var(--service-soft);
    font-size: 0.9rem;
}

.service-note .withdraw-note-content {
    padding: 16px;
    color: #4d5b70;
    font-size: 0.84rem;
    line-height: 1.65;
}

.password-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.55fr);
}

.account-security-main {
    min-width: 0;
}

.account-security-aside {
    padding: 22px;
    border-left: 1px solid var(--service-line);
    background: var(--service-soft);
}

.account-security-aside h2 {
    margin: 0 0 12px;
    color: var(--service-ink);
    font-size: 0.94rem;
}

.password-requirements {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.password-requirements li {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    color: var(--service-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.password-requirements .ui-icon {
    margin-top: 1px;
    color: var(--service-teal);
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap input {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    transform: translateY(-50%);
    place-items: center;
    border: 0;
    border-radius: 6px;
    color: #637188;
    background: transparent;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--service-blue);
    background: #edf6ff;
}

.password-toggle .icon-hidden {
    display: none;
}

@media (max-width: 991.98px) {
    .purchase-provider-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .exchange-provider-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .purchase-value-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .password-layout { grid-template-columns: minmax(0, 1fr); }
    .account-security-aside { border-top: 1px solid var(--service-line); border-left: 0; }
}

@media (max-width: 767.98px) {
    .service-page-container { padding-top: 14px; padding-bottom: 28px; }
    .tool-heading,
    .account-security-heading { padding: 16px; align-items: flex-start; }
    .tool-heading-icon { width: 38px; height: 38px; flex-basis: 38px; }
    .tool-heading h1,
    .account-security-heading h1 { font-size: 1.06rem; }
    .tool-balance { padding-top: 2px; }
    .tool-balance strong { font-size: 0.88rem; }
    .service-feedback,
    .service-security-notice,
    .service-bank-notice,
    .exchange-policy-note { margin-right: 16px; margin-left: 16px; }
    .transaction-form,
    .account-password-form { grid-template-columns: minmax(0, 1fr) !important; padding: 16px !important; }
    .purchase-provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .exchange-provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .purchase-value-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .purchase-summary,
    .withdraw-fee-preview { grid-template-columns: minmax(0, 1fr) !important; }
    .purchase-summary > div,
    .withdraw-fee-preview > div {
        min-height: 48px;
        padding: 9px 12px !important;
        flex-direction: row;
        align-items: center !important;
        justify-content: space-between !important;
        border-right: 0 !important;
        border-bottom: 1px solid var(--service-line) !important;
    }
    .purchase-summary > div:last-child,
    .withdraw-fee-preview > div:last-child { border-bottom: 0 !important; }
    .withdraw-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-security-aside { padding: 16px; }

    .exchange-section-heading { padding: 13px 14px; }
    .exchange-section-heading > a span { display: none; }
    .exchange-history .table-responsive { overflow: visible; }
    .exchange-history-table { min-width: 0; }
    .exchange-history-table thead { display: none; }
    .exchange-history-table,
    .exchange-history-table tbody,
    .exchange-history-table tr,
    .exchange-history-table td { display: block; width: 100%; }
    .exchange-history-table tbody { padding: 0 14px 4px; }
    .exchange-history-table tr {
        margin: 12px 0;
        padding: 3px 12px;
        border: 1px solid var(--service-line);
        border-radius: 7px;
        background: #fff;
    }
    .exchange-history-table td {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 10px;
        padding: 8px 0;
        border-bottom: 1px solid #edf1f6;
        font-size: 0.76rem;
        text-align: right;
    }
    .exchange-history-table td::before {
        content: attr(data-label);
        color: #758196;
        font-size: 0.68rem;
        font-weight: 700;
        text-align: left;
    }
    .exchange-history-table td:last-child { border-bottom: 0; }
    .exchange-card-data { justify-items: end; }
    .exchange-card-data > span { grid-template-columns: 38px minmax(0, 1fr); text-align: left; }
    .exchange-history-empty { padding: 0 !important; border: 0 !important; }
    .exchange-history-empty td { display: block; padding: 28px 10px !important; }
    .exchange-history-empty td::before { display: none; }
}

@media (max-width: 399.98px) {
    .tool-heading { display: grid; grid-template-columns: minmax(0, 1fr); }
    .tool-balance { padding-top: 10px; border-top: 1px solid var(--service-line); text-align: left; }
    .tool-balance small,
    .tool-balance strong { display: inline; }
    .tool-balance strong { margin-left: 6px; }
    .purchase-mode-tabs a { gap: 6px; font-size: 0.78rem; }
    .purchase-provider-option { padding: 7px; font-size: 0.74rem; }
    .purchase-provider-option img { width: 24px; height: 24px; flex-basis: 24px; }
    .purchase-value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
