.cpm-account-credits {
    --cpm-surface: #15191d;
    --cpm-surface-alt: #1c2127;
    --cpm-surface-soft: rgba(248, 250, 252, 0.045);
    --cpm-border: rgba(255, 255, 255, 0.12);
    --cpm-ink: #f8fafc;
    --cpm-muted: #cbd5e1;
    --cpm-subtle: #94a3b8;
    --cpm-accent: #f8fafc;
    --cpm-button: #6c6668;
    --cpm-button-hover: #7a7375;
    --cpm-positive: #7ee3a2;
    --cpm-negative: #fca5a5;
    --cpm-pending: #facc6b;
    --cpm-failed: #ff9b8f;
    --cpm-reversed: #c4b5fd;
    margin: 2rem 0;
    padding: 1rem;
    color: var(--cpm-ink);
    background:
        radial-gradient(720px 260px at 16% 12%, rgba(148, 163, 184, 0.16), transparent 60%),
        var(--cpm-surface);
    border: 1px solid var(--cpm-border);
    border-radius: 16px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
}

.cpm-account-credits,
.cpm-account-credits * {
    box-sizing: border-box;
}

.cpm-account-credits h2,
.cpm-account-credits h3,
.cpm-account-credits p {
    color: inherit;
}

.cpm-account-credits h2 {
    margin-top: 0;
    color: var(--cpm-ink);
    font-size: 1.2rem;
    line-height: 1.25;
}

.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: 1.1rem 1.25rem;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.08), rgba(248, 250, 252, 0.035));
    border: 1px solid var(--cpm-border);
    border-radius: 16px;
}

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

.cpm-account-credits .balance {
    display: inline-flex;
    align-items: baseline;
    gap: 0.65rem;
    min-width: min(100%, 420px);
    margin: 0.75rem 0 0;
    padding: 0.95rem 1rem;
    color: var(--cpm-ink);
    background: rgba(10, 13, 17, 0.62);
    border: 1px solid var(--cpm-border);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
    font-size: 0.95rem;
    font-weight: 700;
}

.cpm-account-credits .balance strong {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    line-height: 1;
}

.cpm-credit-purchase {
    margin: 0 0 1.5rem;
    padding: 1rem;
    border: 1px solid var(--cpm-border);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.075), rgba(248, 250, 252, 0.035));
}

.cpm-credit-purchase__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.cpm-credit-purchase__header h2,
.cpm-credit-pack h3 {
    margin-top: 0;
}

.cpm-credit-pack h3 {
    color: var(--cpm-ink);
    font-size: 1.05rem;
    line-height: 1.25;
}

.cpm-credit-purchase__header p,
.cpm-credit-purchase__empty {
    margin-bottom: 0;
    color: var(--cpm-muted);
    line-height: 1.45;
}

.cpm-credit-purchase__return {
    white-space: nowrap;
}

.cpm-credit-topup {
    padding: 1rem;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.08), rgba(248, 250, 252, 0.035)),
        var(--cpm-surface-alt);
    border: 1px solid var(--cpm-border);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cpm-credit-topup__form {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr) auto;
    gap: 1rem;
    align-items: end;
}

.cpm-credit-topup__main label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--cpm-ink);
    font-weight: 700;
}

.cpm-credit-topup__input {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    color: var(--cpm-ink);
    background: rgba(8, 12, 17, 0.72);
    border: 1px solid var(--cpm-border);
    border-radius: 10px;
}

.cpm-credit-topup__input input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--cpm-ink);
    font: inherit;
    font-size: 1.15rem;
    font-weight: 800;
}

.cpm-credit-topup__input input:focus {
    box-shadow: none;
}

.cpm-credit-topup__input span {
    flex: 0 0 auto;
    color: var(--cpm-muted);
    font-weight: 700;
}

.cpm-credit-topup__summary {
    margin: 0.55rem 0 0;
    color: var(--cpm-muted);
    line-height: 1.4;
}

.cpm-credit-topup__presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cpm-credit-topup__pill {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-height: 2.35rem;
    padding: 0.48rem 0.8rem;
    color: var(--cpm-ink);
    background: rgba(248, 250, 252, 0.08);
    border: 1px solid var(--cpm-border);
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.cpm-credit-topup__pill-value {
    line-height: 1.05;
}

.cpm-credit-topup__pill-credits {
    color: var(--cpm-muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
}

.cpm-credit-topup__pill:hover,
.cpm-credit-topup__pill:focus,
.cpm-credit-topup__pill.is-active {
    color: #ffffff;
    background: rgba(108, 102, 104, 0.9);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.cpm-credit-topup__pill:hover .cpm-credit-topup__pill-credits,
.cpm-credit-topup__pill:focus .cpm-credit-topup__pill-credits,
.cpm-credit-topup__pill.is-active .cpm-credit-topup__pill-credits {
    color: rgba(255, 255, 255, 0.78);
}

.cpm-credit-topup__button {
    min-height: 2.65rem;
    white-space: nowrap;
}

.cpm-credit-purchase__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
    gap: 0.9rem;
}

.cpm-credit-pack {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid var(--cpm-border);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.08), rgba(248, 250, 252, 0.035)),
        var(--cpm-surface-alt);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cpm-credit-pack--recommended {
    border-color: rgba(248, 250, 252, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 18px 36px rgba(0, 0, 0, 0.18);
}

.cpm-credit-pack__badge {
    align-self: flex-start;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    background: rgba(248, 250, 252, 0.12);
    color: var(--cpm-ink);
    border: 1px solid var(--cpm-border);
    font-size: 12px;
    font-weight: 700;
}

.cpm-credit-pack__credits,
.cpm-credit-pack__price,
.cpm-credit-pack__qty {
    margin: 0;
}

.cpm-credit-pack__credits {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 2.8rem;
    margin-top: 0.35rem;
    padding: 0.7rem 0.85rem;
    color: var(--cpm-ink);
    background: rgba(8, 12, 17, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.26);
    font-weight: 700;
}

.cpm-credit-pack__price,
.cpm-credit-pack__qty {
    color: var(--cpm-muted);
}

.cpm-credit-pack__button {
    margin-top: auto;
    text-align: center;
}

.cpm-account-credits .button,
.cpm-account-credits .cpm-credit-pack__button,
#load-more-credits,
.js-cpm-load-more {
    border: 0;
    border-radius: 10px;
    background: var(--cpm-button);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.cpm-account-credits .button:hover,
.cpm-account-credits .button:focus,
.cpm-account-credits .cpm-credit-pack__button:hover,
.cpm-account-credits .cpm-credit-pack__button:focus,
#load-more-credits:hover,
#load-more-credits:focus,
.js-cpm-load-more:hover,
.js-cpm-load-more:focus {
    background: var(--cpm-button-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

.cpm-account-credits table.cpm-transactions {
    width: 100%;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1.5rem;
    color: var(--cpm-ink);
    background: rgba(28, 33, 39, 0.72);
    border: 1px solid var(--cpm-border);
    border-radius: 14px;
}

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

.cpm-account-credits th {
    color: #e2e8f0;
    background-color: rgba(248, 250, 252, 0.06);
    font-weight: 600;
}

.cpm-account-credits tbody tr:last-child td {
    border-bottom: 0;
}

#load-more-credits,
.js-cpm-load-more {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    margin-top: 1rem;
}

.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;
    border: 1px solid transparent;
}

.cpm-type-badge {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.24);
}

.cpm-status-badge--completed {
    background: rgba(126, 227, 162, 0.14);
    color: var(--cpm-positive);
    border-color: rgba(126, 227, 162, 0.24);
}

.cpm-status-badge--pending {
    background: rgba(250, 204, 107, 0.14);
    color: var(--cpm-pending);
    border-color: rgba(250, 204, 107, 0.24);
}

.cpm-status-badge--failed {
    background: rgba(255, 155, 143, 0.14);
    color: var(--cpm-failed);
    border-color: rgba(255, 155, 143, 0.24);
}

.cpm-status-badge--reversed,
.cpm-status-badge--cancelled {
    background: rgba(196, 181, 253, 0.14);
    color: var(--cpm-reversed);
    border-color: rgba(196, 181, 253, 0.24);
}

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

.cpm-tx-details__body {
    margin-top: 0.75rem;
    font-size: 0.95em;
    line-height: 1.45;
    color: var(--cpm-ink);
    background: rgba(8, 12, 17, 0.6);
    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: rgba(248, 250, 252, 0.06);
    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-subtle);
    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;
    }

    .cpm-credit-topup__form {
        grid-template-columns: 1fr;
    }

    .cpm-credit-purchase__header {
        display: block;
    }

    .cpm-credit-purchase__return {
        display: inline-block;
        margin-top: 0.75rem;
    }
}

@media (max-width: 600px) {
    .cpm-account-credits {
        padding: 0.75rem;
    }

    .cpm-credit-purchase__grid {
        grid-template-columns: 1fr;
    }

    .cpm-account-credits table.cpm-transactions {
        display: block;
        overflow-x: auto;
    }
}
