:root {
    color-scheme: light;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f3f6fb;
    color: #1c2a3a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(0, 81, 173, 0.12), transparent 32rem),
        #f3f6fb;
}

.wrap {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}

.eyebrow,
.step {
    margin: 0 0 0.35rem;
    color: #346798;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.page-header h1,
.panel h2 {
    margin: 0;
    color: #0d396a;
}

.page-header h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -0.045em;
}

.page-header p:not(.eyebrow) {
    max-width: 700px;
    margin: 0.6rem 0 0;
    color: #526579;
    line-height: 1.55;
}

.back-link,
.secondary-link,
.primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-weight: 700;
    text-decoration: none;
}

.back-link {
    flex: 0 0 auto;
    padding: 0.7rem 0.9rem;
    border: 1px solid #b8c8dc;
    background: rgba(255, 255, 255, 0.75);
    color: #174f88;
}

.notice {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #c4d7eb;
    border-left: 4px solid #2468a9;
    border-radius: 10px;
    background: #edf6ff;
    color: #294a6b;
    line-height: 1.5;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.75fr);
    gap: 1rem;
    align-items: start;
}

.panel {
    border: 1px solid #d6e0eb;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 32px rgba(22, 56, 92, 0.08);
}

.checkout-panel,
.session-panel,
.result-panel {
    padding: 1.25rem;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel h2 {
    font-size: 1.25rem;
}

.method-badge,
.response-badge {
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    background: #e9f1fb;
    color: #285a8e;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 700;
}

label {
    display: block;
    margin: 0.9rem 0 0.35rem;
    color: #223d5a;
    font-size: 0.88rem;
    font-weight: 750;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #bfcddd;
    border-radius: 9px;
    background: #fff;
    color: #17293b;
    padding: 0.65rem 0.75rem;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(32, 116, 199, 0.25);
    outline-offset: 2px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.field-help {
    margin: 0.35rem 0 0;
    color: #68798a;
    font-size: 0.79rem;
    line-height: 1.4;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.checkbox-option input {
    width: 1rem;
    min-height: 1rem;
    margin: 0;
}

.selection-details {
    margin-top: 0.55rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #cdddec;
    border-radius: 9px;
    background: #f4f8fc;
    color: #294966;
    font-size: 0.8rem;
}

.selection-details strong { display: block; color: #123f70; }
.selection-details dl { margin: 0.45rem 0 0; }
.selection-details dl div { display: grid; grid-template-columns: 7rem 1fr; gap: 0.5rem; padding: 0.18rem 0; }
.selection-details dt { color: #68798a; }
.selection-details dd { margin: 0; overflow-wrap: anywhere; }

code {
    border-radius: 4px;
    background: #eef2f7;
    padding: 0.1rem 0.25rem;
    color: #254f78;
}

.key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
}

.primary-button,
.secondary-button,
.icon-button {
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 750;
}

.primary-button {
    width: 100%;
    margin-top: 1.1rem;
    padding: 0.75rem 1rem;
    background: #0758a5;
    color: #fff;
}

.primary-button:hover:not(:disabled) {
    background: #064988;
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.secondary-button {
    padding: 0.6rem 0.85rem;
    border: 1px solid #b9c9da;
    background: #eff4fa;
    color: #24517e;
}

.icon-button {
    width: 38px;
    height: 38px;
    background: #eaf2fb;
    color: #175a9a;
    font-size: 1.2rem;
}

.status {
    border-radius: 9px;
    padding: 0.75rem 0.8rem;
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.4;
}

.status-loading {
    background: #eef2f7;
    color: #506174;
}

.status-success {
    background: #e6f7ee;
    color: #17613d;
}

.status-warning {
    background: #fff4da;
    color: #775512;
}

.status-error {
    background: #fdeaea;
    color: #8d2828;
}

.context-list {
    margin: 0.9rem 0;
}

.context-list div {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #edf1f6;
}

.context-list dt {
    color: #6b7a8a;
    font-size: 0.8rem;
}

.context-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #213b57;
    font-size: 0.83rem;
    font-weight: 700;
    text-align: right;
}

.secondary-link {
    padding: 0.62rem 0.8rem;
    border: 1px solid #b8c8da;
    color: #185790;
}

.flow-summary {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid #e3e9f0;
}

.flow-summary h3 {
    margin: 0 0 0.5rem;
    color: #294966;
    font-size: 0.95rem;
}

.flow-summary ol {
    margin: 0;
    padding-left: 1.25rem;
    color: #607185;
    font-size: 0.82rem;
    line-height: 1.75;
}

.result-panel {
    margin-top: 1rem;
}

.response-success {
    background: #e5f7ed;
    color: #17613d;
}

.response-error {
    background: #fde9e9;
    color: #922c2c;
}

.result-summary {
    margin-bottom: 0.75rem;
    color: #42566c;
    line-height: 1.5;
}

#result-json {
    min-height: 145px;
    max-height: 420px;
    margin: 0;
    overflow: auto;
    border-radius: 10px;
    background: #101b29;
    color: #cde8d8;
    padding: 1rem;
    font: 0.8rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.9rem;
}

.billing-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 1rem 0;
}

.summary-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid #d4dfeb;
    border-radius: 12px;
    background: linear-gradient(145deg, #fff, #f4f8fc);
    box-shadow: 0 8px 20px rgba(22, 56, 92, 0.06);
}

.summary-card span,
.summary-card small {
    display: block;
    color: #68798a;
}

.summary-card span {
    margin-bottom: 0.45rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.summary-card strong {
    display: block;
    overflow-wrap: anywhere;
    color: #123f70;
    font-size: 1.25rem;
}

.summary-card small {
    margin-top: 0.35rem;
    font-size: 0.75rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.details-panel {
    padding: 1.25rem;
}

.detail-list {
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: minmax(125px, 0.8fr) minmax(0, 1.4fr);
    gap: 1rem;
    padding: 0.62rem 0;
    border-bottom: 1px solid #edf1f6;
}

.detail-list div:last-child {
    border-bottom: 0;
}

.detail-list dt {
    color: #68798a;
    font-size: 0.78rem;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #203b57;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
}

.records-panel {
    margin-top: 1rem;
}

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

.details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.details-table th,
.details-table td {
    padding: 0.68rem 0.7rem;
    border-bottom: 1px solid #e6edf4;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.details-table th {
    background: #f3f7fb;
    color: #3f5c78;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.details-table td {
    color: #253e57;
}

.empty-cell {
    color: #718092 !important;
    text-align: center !important;
    white-space: normal !important;
}

#provider-json,
#billing-json {
    max-height: 480px;
    margin: 0;
    overflow: auto;
    border-radius: 10px;
    background: #101b29;
    color: #cde8d8;
    padding: 1rem;
    font: 0.78rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.technical-details {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
}

.technical-details summary {
    cursor: pointer;
    color: #174f88;
    font-size: 0.9rem;
    font-weight: 750;
}

.technical-details[open] summary {
    margin-bottom: 1rem;
}

.primary-link {
    padding: 0.68rem 0.9rem;
    background: #0758a5;
    color: #fff;
}

@media (max-width: 820px) {
    .layout {
        grid-template-columns: 1fr;
    }

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

    .page-header {
        flex-direction: column;
    }

    .header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .wrap {
        width: min(100% - 20px, 1120px);
        padding-top: 1rem;
    }

    .field-grid,
    .key-row,
    .billing-summary,
    .details-grid {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .detail-list dd {
        text-align: left;
    }
}
