* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #0f1419;
    color: #e7edf3;
}

a {
    color: #8cc7ff;
    text-decoration: none;
}

pre,
.mono {
    font-family: Consolas, "Courier New", monospace;
}

.shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar,
.hero,
.panel-head,
.card-head,
.actions,
.nav,
.hero-actions,
.inline-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar {
    padding: 18px 22px;
    border: 1px solid #263341;
    background: #141c24;
    margin-bottom: 20px;
}

.topbar h1,
.hero h2,
.panel h2,
.panel h3,
.card h4 {
    margin: 0;
}

.eyebrow {
    color: #7ea1bf;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.page,
.stack,
.stack-lg,
.flash-list,
.card-list {
    display: grid;
    gap: 12px;
}

.center-panel {
    min-height: calc(100vh - 180px);
    display: grid;
    place-items: center;
}

.panel,
.card {
    background: #141c24;
    border: 1px solid #263341;
    padding: 16px;
}

.card .meta-grid {
    margin-top: 10px;
}

.panel.narrow {
    width: min(480px, 100%);
}

.hero {
    margin-bottom: 16px;
}

.grid {
    display: grid;
    gap: 16px;
}

.two-col {
    margin-bottom: 16px;
}

.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.choice-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid #263341;
    background: #101820;
    cursor: pointer;
}

.choice-card input {
    margin: 0;
}

.choice-title {
    font-size: 18px;
    font-weight: 700;
}

.choice-desc,
.muted {
    color: #92a6b8;
}

label {
    display: grid;
    gap: 8px;
}

input,
select,
textarea,
button {
    width: 100%;
    border: 1px solid #314152;
    background: #0d1319;
    color: #e7edf3;
    padding: 12px 14px;
    font-size: 14px;
}

textarea {
    resize: vertical;
}

button,
.button {
    background: #2d7dd2;
    border-color: #2d7dd2;
    color: #fff;
    cursor: pointer;
    text-align: center;
}

.button.secondary {
    background: transparent;
    border: 1px solid #4e647a;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid #314152;
    color: #bfd2e5;
    font-size: 12px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    margin: 0;
}

.meta-grid dt {
    color: #92a6b8;
    font-size: 11px;
    margin-bottom: 4px;
}

.meta-grid dd {
    margin: 0;
    word-break: break-word;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid #263341;
    text-align: left;
    padding: 12px 10px;
    vertical-align: top;
}

th {
    color: #92a6b8;
    font-size: 13px;
}

.sub-row td {
    color: #ffb8b8;
    background: #19151a;
}

.flash {
    padding: 12px 14px;
    border: 1px solid #314152;
}

.flash-error {
    border-color: #8d3d3d;
    background: #251516;
    color: #ffb8b8;
}

.flash-success {
    border-color: #2f6b4f;
    background: #102117;
    color: #b9f2cf;
}

.empty {
    padding: 18px;
    border: 1px dashed #314152;
    color: #92a6b8;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input {
    width: auto;
}

.hidden {
    display: none !important;
}

.danger-text {
    color: #ffb8b8;
}

/* ---- 可用余额突出显示 ---- */
.card-balance {
    text-align: right;
    flex-shrink: 0;
}

.balance-label {
    display: block;
    font-size: 12px;
    color: #92a6b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.balance-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #4aeb9b;
    line-height: 1.1;
}

.balance-value.low-balance {
    color: #92a6b8;
    font-size: 22px;
}

/* ---- 账户卡片紧凑布局 ---- */
.card-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ---- 低余额账户切换区域 ---- */
.hidden-accounts-section {
    margin-top: 16px;
}

.toggle-hidden-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: #1a2330;
    border: 1px dashed #314152;
    color: #92a6b8;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.toggle-hidden-btn:hover {
    background: #1c2835;
    color: #bfd2e5;
}

.toggle-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.card-low-balance {
    border-left: 3px solid #5a4a1a;
    opacity: 0.85;
}

.card-low-balance:hover {
    opacity: 1;
}

/* ---- 账户卡片底部按钮区 ---- */
.card-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #263341;
    flex-wrap: wrap;
}

.card-actions .inline-form {
    flex-wrap: wrap;
    gap: 10px;
}

.card-actions .inline-form label {
    gap: 4px;
}

.card-actions .inline-form label span {
    font-size: 11px;
    color: #92a6b8;
}

.card-actions .inline-form input {
    padding: 8px 10px;
    font-size: 13px;
    width: auto;
    min-width: 130px;
}

.card-actions .inline-form button {
    width: auto;
    padding: 9px 18px;
    font-size: 13px;
    background: transparent;
    border: 1px solid #4e647a;
}

.btn-primary {
    width: auto;
    padding: 9px 22px;
    font-size: 14px;
    background: #2d7dd2;
    border-color: #2d7dd2;
    color: #fff;
    cursor: pointer;
}

/* ---- 收款人付款按钮 ---- */
.btn-pay {
    width: auto;
    padding: 6px 14px;
    font-size: 13px;
    background: #2d7dd2;
    border-color: #2d7dd2;
    color: #fff;
    cursor: pointer;
}

/* ---- 付款方式标签 ---- */
.method-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.method-badge.ach { background: #1a3a5c; color: #8cc7ff; }
.method-badge.check { background: #3a3a1a; color: #ffe08c; }
.method-badge.domesticWire { background: #3a1a3a; color: #e08cff; }
.method-badge.internationalWire { background: #1a3a2a; color: #8cffb8; }

/* ---- 可折叠原始数据 ---- */
summary.panel-head.clickable {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

details.panel {
    padding: 0;
}

details.panel pre {
    margin: 0;
    padding: 16px 20px;
}

details.panel > .panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid #263341;
}

/* ======== 弹框 ======== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-box {
    width: min(540px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #141c24;
    border: 1px solid #314152;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #263341;
}

.modal-head h3 {
    margin: 0;
}

.modal-close {
    width: auto;
    padding: 4px 10px;
    font-size: 20px;
    line-height: 1;
    background: transparent;
    border: none;
    color: #92a6b8;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

#payment-form {
    padding: 20px 22px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    width: auto;
    flex: 1;
}

@media (max-width: 980px) {
    .compact,
    .meta-grid,
    .card-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .card-actions .inline-form {
        flex-direction: column;
    }

    .card-actions .inline-form input {
        width: 100%;
    }

    .card-actions .inline-form button,
    .btn-primary {
        width: 100%;
    }

    .topbar,
    .hero,
    .panel-head,
    .card-head,
    .actions,
    .nav,
    .hero-actions,
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
}
