.cpm-account-credits {
    --cpm-surface: #ffffff;
    --cpm-surface-alt: #f6f7fb;
    --cpm-border: #d8deea;
    --cpm-ink: #18202a;
    --cpm-muted: #5f6b7a;
    --cpm-accent: #0b6bcb;
    --cpm-positive: #0f7a43;
    --cpm-negative: #a12f2f;
    --cpm-pending: #8a5b00;
    --cpm-failed: #b42318;
    --cpm-reversed: #6e3bb8;
    margin: 2rem 0;
}

.cpm-account-credits__hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f3f7fd 0%, #ffffff 100%);
    border: 1px solid var(--cpm-border);
    border-radius: 16px;
}

.cpm-account-credits__caption {
    margin: 0;
    color: var(--cpm-muted);
}

.cpm-account-credits .balance {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
}

.cpm-account-credits table.cpm-transactions {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.cpm-account-credits th,
.cpm-account-credits td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--cpm-border);
    text-align: left;
    vertical-align: top;
}

.cpm-account-credits th {
    background-color: rgba(11, 107, 203, 0.06);
    font-weight: 600;
}

#load-more-credits,
.js-cpm-load-more {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    text-align: center;
    background: #f2b53d;
    color: #2f250b;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin-top: 1rem;
}

#load-more-credits:hover,
.js-cpm-load-more:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.cpm-delta {
    font-weight: 700;
}

.cpm-delta--positive {
    color: var(--cpm-positive);
}

.cpm-delta--negative {
    color: var(--cpm-negative);
}

.cpm-delta--neutral {
    color: var(--cpm-muted);
}

.cpm-status-badge,
.cpm-type-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.cpm-type-badge {
    background: #eef4ff;
    color: #184f97;
}

.cpm-status-badge--completed {
    background: #e8f7ee;
    color: var(--cpm-positive);
}

.cpm-status-badge--pending {
    background: #fff3dc;
    color: var(--cpm-pending);
}

.cpm-status-badge--failed {
    background: #fdeaea;
    color: var(--cpm-failed);
}

.cpm-status-badge--reversed,
.cpm-status-badge--cancelled {
    background: #f2eafe;
    color: var(--cpm-reversed);
}

.cpm-tx-details summary {
    cursor: pointer;
    user-select: none;
    color: var(--cpm-accent);
    font-weight: 600;
}

.cpm-tx-details__body {
    margin-top: 0.75rem;
    font-size: 0.95em;
    line-height: 1.45;
    background: var(--cpm-surface-alt);
    border: 1px solid var(--cpm-border);
    border-radius: 12px;
    padding: 0.85rem;
}

.cpm-tx-details__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cpm-tx-details__fact {
    background: var(--cpm-surface);
    border: 1px solid var(--cpm-border);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
}

.cpm-tx-details__fact-label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--cpm-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.cpm-tx-details__section + .cpm-tx-details__section,
.cpm-tx-details__meta {
    margin-top: 0.75rem;
}

.cpm-tx-details__section strong,
.cpm-tx-details__meta summary {
    display: block;
    margin-bottom: 0.35rem;
}

.cpm-tx-details__section--failure {
    border-left: 4px solid var(--cpm-failed);
    padding-left: 0.75rem;
}

.cpm-tx-details__prompt,
.cpm-tx-details__meta pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    background: #121826;
    color: #eff3f8;
    border-radius: 10px;
    padding: 0.8rem;
    overflow: auto;
}

.cpm-tx-details__image {
    margin-top: 0.5rem;
}

.cpm-tx-details__image img {
    max-width: 120px;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--cpm-border);
}

.cpm-tx-details__links {
    margin: 0;
    padding-left: 1.1rem;
}

.cpm-tx-details__link-meta {
    display: inline-block;
    margin-left: 0.35rem;
    color: var(--cpm-muted);
    font-size: 12px;
}

@media (max-width: 800px) {
    .cpm-account-credits__hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .cpm-account-credits table.cpm-transactions {
        display: block;
        overflow-x: auto;
    }
}
