.cp-profile-actions__button--code-payment {
    -webkit-appearance: none;
    appearance: none;
    border-color: #b9cdee;
    background: #f4f7ff;
    color: #173f9f;
}

.cp-profile-actions__button--code-payment .dashicons {
    color: #2457d6;
}

.cp-code-payment-dialog,
.cp-code-summary-dialog,
.cp-code-payment-success-dialog {
    width: min(760px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    color: #172033;
    box-shadow: 0 28px 80px rgba(8, 27, 61, .34);
    overflow: hidden;
}

.cp-code-payment-dialog::backdrop,
.cp-code-summary-dialog::backdrop,
.cp-code-payment-success-dialog::backdrop {
    background: rgba(8, 27, 61, .68);
    backdrop-filter: blur(3px);
}

.cp-code-payment-dialog__shell,
.cp-code-summary-dialog__shell {
    max-height: calc(100vh - 28px);
    overflow-y: auto;
    background: #fff;
}

.cp-code-payment-dialog__header,
.cp-code-summary-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    background: linear-gradient(135deg, #0d2f69, #2457d6);
    color: #fff;
}

.cp-code-payment-dialog__header p,
.cp-code-payment-dialog__header h2,
.cp-code-summary-dialog__header p,
.cp-code-summary-dialog__header h2 {
    margin: 0;
    color: #fff;
}

.cp-code-payment-dialog__header p,
.cp-code-summary-dialog__header p {
    color: #dfc27f;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.cp-code-payment-dialog__header h2,
.cp-code-summary-dialog__header h2 {
    margin-top: 4px;
    font-size: 24px;
}

.cp-code-payment-dialog__close,
.cp-code-summary-dialog__close {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255,255,255,.4) !important;
    border-radius: 50%;
    background: rgba(255,255,255,.12) !important;
    color: #fff !important;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.cp-code-payment-dialog__body {
    display: grid;
    gap: 17px;
    padding: 22px;
}

.cp-code-payment-dialog__intro {
    margin: 0;
    color: #5d6d82;
    line-height: 1.6;
}

.cp-code-payment-form,
.cp-code-payment-form label {
    display: grid;
    gap: 8px;
}

.cp-code-payment-form {
    gap: 17px;
}

.cp-code-payment-form label > span {
    color: #203b62;
    font-weight: 800;
}

.cp-code-payment-form input,
.cp-code-payment-form select {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    padding: 9px 11px;
    border: 1px solid #bfcee4;
    border-radius: 9px;
    background: #fff;
    color: #172033;
}

.cp-code-payment-help {
    justify-self: start;
    padding: 0;
    border: 0;
    background: transparent !important;
    color: #2457d6 !important;
    font-size: 13px;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
}

.cp-code-payment-guide {
    padding: 12px;
    border: 1px solid #d5e1f0;
    border-radius: 13px;
    background: #f5f8fd;
}

.cp-code-payment-guide figure {
    margin: 0;
}

.cp-code-payment-guide figcaption {
    margin-bottom: 10px;
    color: #183d73;
    font-weight: 800;
}

.cp-code-payment-guide img {
    display: block;
    width: min(100%, 540px);
    max-height: 430px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.cp-code-payment-guide p {
    margin: 10px 0 0;
    color: #52677f;
    font-size: 13px;
    line-height: 1.55;
}

.cp-code-payment-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.cp-code-payment-period__controls {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
    gap: 8px;
}

.cp-code-payment-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.cp-code-payment-button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #b9c7da !important;
    border-radius: 9px;
    font-weight: 800;
    cursor: pointer;
}

.cp-code-payment-button--secondary {
    background: #fff !important;
    color: #173b72 !important;
}

.cp-code-payment-button--primary {
    border-color: #173f9f !important;
    background: linear-gradient(135deg, #2d68e7, #173f9f) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.cp-code-payment-button--primary:disabled {
    background: #aeb9d2 !important;
    border-color: #9ca9c5 !important;
    cursor: not-allowed;
}

.cp-code-payment-notice {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.cp-code-payment-notice--success { border: 1px solid #b9e0c7; background: #effaf2; color: #17653a; }
.cp-code-payment-notice--error { border: 1px solid #edc1c1; background: #fff4f4; color: #9b2828; }
.cp-code-payment-notice--warning { border: 1px solid #ead69d; background: #fffaf0; color: #765400; }

.cp-code-payments-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.cp-code-payments-toolbar form {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.cp-code-payments-toolbar label {
    display: grid;
    gap: 5px;
    color: #53677d;
    font-weight: 700;
}

.cp-code-payments-toolbar input[type="month"] {
    min-height: 38px;
    border: 1px solid #bfcee4;
    border-radius: 8px;
}

.cp-code-payments-toolbar .button-primary,
.cp-code-payment-bulk-actions .button-primary {
    border-color: #173f9f !important;
    background: #2457d6 !important;
    color: #fff !important;
}

.cp-code-payment-group + .cp-code-payment-group {
    margin-top: 24px;
}

.cp-code-payment-group__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dce6f2;
    color: #173f72;
}

.cp-code-payment-group__heading h3 { margin: 0; color: #173f72; }
.cp-code-payment-group__heading span { color: #677990; font-size: 13px; }

.cp-code-payment-bulk-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.cp-code-payment-bulk-actions label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    color: #53677d;
    font-weight: 700;
}

.cp-code-payment-table th,
.cp-code-payment-table td { vertical-align: middle; }
.cp-code-payment-table code { white-space: nowrap; }
.cp-code-payment-table .cp-code-payment-actions { white-space: nowrap; }
.cp-code-payment-table .cp-code-payment-actions form { display: inline-block; margin: 0 0 0 4px; }
.cp-code-payment-table .cp-code-payment-actions .button { min-width: 82px; }
.cp-code-payment-table .cp-code-payment-actions .button-primary { border-color: #19734a; background: #218957; color: #fff; }
.cp-code-payment-table .cp-code-payment-actions .button-link-delete { color: #a42b2b; }

.cp-code-payment-success-dialog {
    width: min(420px, calc(100vw - 28px));
    border-radius: 16px;
}

.cp-code-payment-success-dialog__body {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 28px 24px 24px;
    text-align: center;
}

.cp-code-payment-success-dialog__icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 50%;
    background: #e8f7ee;
    color: #18804a;
    font-size: 30px;
}

.cp-code-payment-success-dialog h2,
.cp-code-payment-success-dialog p { margin: 0; }
.cp-code-payment-success-dialog h2 { color: #173f72; font-size: 21px; }
.cp-code-payment-success-dialog p { color: #5d6d82; line-height: 1.55; }
.cp-code-payment-success-dialog .cp-code-payment-button { width: 100%; margin-top: 5px; }

.cp-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.cp-tabs .nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.cp-tab-notification {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 21px;
    padding: 2px 6px 2px 5px;
    border: 1px solid #e2aaaa;
    border-radius: 999px;
    background: #fff0f0;
    color: #a52f2f;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.cp-tab-notification .dashicons { width: 14px; height: 14px; font-size: 14px; }

.cp-code-summary-dialog {
    width: min(780px, calc(100vw - 28px));
}

.cp-code-summary-dialog__body {
    display: grid;
    gap: 22px;
    padding: 22px;
}

.cp-code-summary-dialog__intro { margin: 0; color: #5d6d82; }

.cp-code-summary-chart-wrap {
    display: grid;
    justify-items: center;
    gap: 13px;
}

.cp-code-summary-chart {
    width: min(240px, 65vw);
    aspect-ratio: 1;
    border: 12px solid #fff;
    border-radius: 50%;
    background: conic-gradient(#2e9a62 0 var(--cp-code-accepted-percent), #e9a6a6 var(--cp-code-accepted-percent) 100%);
    box-shadow: 0 8px 22px rgba(23,63,159,.16), inset 0 0 0 1px rgba(23,63,159,.08);
    cursor: pointer;
}

.cp-code-summary-chart:focus-visible {
    outline: 3px solid rgba(36,87,214,.4);
    outline-offset: 4px;
}

.cp-code-summary-legend {
    display: flex;
    justify-content: center;
    gap: 9px;
    flex-wrap: wrap;
}

.cp-code-summary-legend button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid #c8d6e8;
    border-radius: 999px;
    background: #fff;
    color: #264261;
    font-weight: 800;
    cursor: pointer;
}

.cp-code-summary-legend button.is-active { border-color: #2457d6; box-shadow: 0 0 0 2px rgba(36,87,214,.12); }
.cp-code-summary-legend i { width: 11px; height: 11px; border-radius: 50%; }
.cp-code-summary-legend i.is-accepted { background: #2e9a62; }
.cp-code-summary-legend i.is-pending { background: #e9a6a6; }

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

.cp-code-summary-stat {
    padding: 13px;
    border: 1px solid #dce6f2;
    border-radius: 11px;
    background: #f8fafd;
}

.cp-code-summary-stat span,
.cp-code-summary-stat strong { display: block; }
.cp-code-summary-stat span { color: #687a91; font-size: 12px; }
.cp-code-summary-stat strong { margin-top: 4px; color: #173f72; font-size: 20px; }

.cp-code-summary-list {
    padding: 16px;
    border: 1px solid #dce6f2;
    border-radius: 12px;
    background: #fff;
}

.cp-code-summary-list h3 { margin: 0 0 12px; color: #173f72; font-size: 18px; }
.cp-code-summary-list ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cp-code-summary-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f6; }
.cp-code-summary-list li:last-child { border-bottom: 0; }
.cp-code-summary-list small { color: #687a91; }

@media (max-width: 680px) {
    .cp-code-payment-dialog__header,
    .cp-code-summary-dialog__header { padding: 17px; }
    .cp-code-payment-dialog__body,
    .cp-code-summary-dialog__body { padding: 17px; }
    .cp-code-payment-fields,
    .cp-code-summary-stat-grid { grid-template-columns: 1fr; }
    .cp-code-payment-dialog__actions { flex-direction: column-reverse; }
    .cp-code-payment-button { width: 100%; }
    .cp-code-payment-table { min-width: 980px; }
    .cp-code-payment-bulk-actions label { width: 100%; margin-right: 0; }
    .cp-code-payment-group__heading { align-items: flex-start; flex-direction: column; }
    .cp-code-summary-list li { align-items: flex-start; flex-direction: column; gap: 3px; }
}

@media (max-width: 782px) {
    .cp-code-payment-dialog,
    .cp-code-summary-dialog,
    .cp-code-payment-success-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 14px;
    }

    .cp-code-payment-dialog__shell,
    .cp-code-summary-dialog__shell { max-height: calc(100dvh - 20px); }
    .cp-code-payment-dialog__header,
    .cp-code-summary-dialog__header { padding: 15px; }
    .cp-code-payment-dialog__header h2,
    .cp-code-summary-dialog__header h2 { font-size: 20px; }
    .cp-code-payment-dialog__body,
    .cp-code-summary-dialog__body { padding: 15px; gap: 14px; }
    .cp-code-payment-fields { grid-template-columns: 1fr; gap: 12px; }
    .cp-code-payment-period__controls { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
    .cp-code-payment-guide { padding: 8px; }
    .cp-code-payment-guide img { width: 100%; max-height: none; }
    .cp-code-payment-dialog__actions { display: grid; grid-template-columns: 1fr; }
    .cp-code-payment-button { width: 100%; min-height: 46px; }
    .cp-code-payments-toolbar { align-items: stretch; }
    .cp-code-payments-toolbar form { width: 100%; align-items: stretch; }
    .cp-code-payments-toolbar form label { flex: 1 1 170px; }
    .cp-code-payments-toolbar form .button,
    .cp-code-payments-toolbar > .button { width: 100%; text-align: center; }
    .cp-code-payment-bulk-actions { align-items: stretch; }
    .cp-code-payment-bulk-actions label { min-height: 38px; }
    .cp-code-payment-bulk-actions .button { width: 100%; }
    .cp-code-payment-table { min-width: 940px; }
    .cp-code-summary-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
    .cp-code-summary-stat-grid { grid-template-columns: 1fr; }
    .cp-code-payment-success-dialog__body { padding: 24px 17px 18px; }
}
