*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --colorText: #101828;
    --colorMuted: #667085;
    --colorBorder: #e4e7ec;
    --colorBorderStrong: #d0d5dd;
    --colorPrimary: #2563eb;
    --colorBg: #ffffff;
    --radius: 10px;
    --radiusLg: 12px;
    --fontSans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html,
body {
    margin: 0;
    padding: 0;
    background: #f9fafb;
    color: var(--colorText);
    font-family: var(--fontSans);
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 24px;
}

.checkout {
    width: 100%;
    max-width: 640px;
}

.checkoutHeader h1 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.checkoutHeader p {
    margin: 0 0 20px;
    color: var(--colorMuted);
    font-size: 14px;
}

.methodCard {
    background: var(--colorBg);
    border: 1.5px solid var(--colorBorder);
    border-radius: var(--radiusLg);
    padding: 18px 20px 20px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.methodCard.selected {
    border-color: var(--colorPrimary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.methodHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.methodSelector {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.methodSelector input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--colorBorderStrong);
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.15s ease;
}

.methodSelector input[type="radio"]:checked + .radio {
    border-color: var(--colorPrimary);
}

.methodSelector input[type="radio"]:checked + .radio::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--colorPrimary);
    border-radius: 50%;
}

.cardIcon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.methodText {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.methodTitle {
    font-size: 15px;
    font-weight: 600;
}

.methodSubtitle {
    font-size: 13px;
    color: var(--colorMuted);
    margin-top: 2px;
}

.brandLogos {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    line-height: 1;
}

.logoMada {
    height: 26px;
    width: auto;
    object-fit: contain;
    display: block;
}

.logoMada.small {
    height: 22px;
}

.logoVisa {
    font-family: Arial, sans-serif;
    font-weight: 900;
    font-style: italic;
    font-size: 18px;
    color: #1a1f71;
    letter-spacing: -0.5px;
}

.logoMaster {
    position: relative;
    width: 34px;
    height: 22px;
}

.logoMaster .mcRed,
.logoMaster .mcYellow {
    position: absolute;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.logoMaster .mcRed {
    left: 0;
    background: #eb001b;
}

.logoMaster .mcYellow {
    right: 0;
    background: #f79e1b;
    mix-blend-mode: multiply;
}

.divider {
    height: 1px;
    background: var(--colorBorder);
    margin: 18px -20px 20px;
}

.paymentForm {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.errorBanner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    background: #fef3f2;
    border: 1px solid #fda29b;
    border-radius: var(--radius);
    color: #912018;
    font-size: 13px;
    line-height: 1.4;
}

.errorBanner svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--colorText);
}

.inputWrap {
    position: relative;
    display: flex;
    align-items: center;
}

.inputWrap input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--colorBorderStrong);
    border-radius: var(--radius);
    background: #fff;
    font-size: 14px;
    color: var(--colorText);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.inputWrap input::placeholder {
    color: #98a2b3;
}

.inputWrap input:focus {
    border-color: var(--colorPrimary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.inputAdornment {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.brandSlot {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 48px;
    height: 24px;
}

.brandSlot .brandImg {
    display: none;
    height: 22px;
    align-items: center;
    justify-content: center;
}

.brandSlot .brandMaster {
    width: 34px;
}

.brandSlot[data-brand=""] .brandGeneric,
.brandSlot[data-brand="unknown"] .brandGeneric {
    display: inline-flex;
}

.brandSlot[data-brand="mada"] .brandMada {
    display: inline-block;
}

.brandSlot[data-brand="visa"] .brandVisa {
    display: inline-flex;
}

.brandSlot[data-brand="mastercard"] .brandMaster {
    display: inline-block;
}

.brandSlot[data-brand="amex"] .brandAmex {
    display: inline-flex;
    background: #2e77bb;
    color: #fff;
    font-family: Arial, sans-serif;
    font-weight: 900;
    font-style: italic;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 3px 6px;
    border-radius: 3px;
}

.brandMada {
    object-fit: contain;
}

.pan {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.infoBtn {
    pointer-events: auto;
    background: transparent;
    border: 0;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.infoBtn:hover {
    background: #f2f4f7;
}

.row {
    display: flex;
    gap: 14px;
}

.saveCard {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--colorText);
    cursor: pointer;
    user-select: none;
    margin-top: 4px;
}

.saveCard input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--colorBorderStrong);
    border-radius: 4px;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.saveCard input[type="checkbox"]:checked + .checkbox {
    background: var(--colorPrimary);
    border-color: var(--colorPrimary);
}

.saveCard input[type="checkbox"]:checked + .checkbox::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.payBtn {
    height: 48px;
    border: 0;
    border-radius: var(--radius);
    background: var(--colorPrimary);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.payBtn:hover {
    background: #1d4ed8;
}

.payBtn:active {
    transform: translateY(1px);
}

.payBtn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.payBtn:disabled {
    background: #b6c4ea;
    cursor: not-allowed;
}

.payBtn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: middle;
    animation: spin 0.7s linear infinite;
}

.payBtn.loading .spinner {
    display: inline-block;
}

.payBtn.loading .payLabel {
    opacity: 0.85;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.inputWrap input.invalid {
    border-color: #d92d20;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.secureNote {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--colorMuted);
    font-size: 13px;
}

.ma3roofBadge {
    display: flex;
    justify-content: center;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px dashed var(--colorBorder);
}

.ma3roofBadge img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 520px) {
    .row {
        flex-direction: column;
        gap: 16px;
    }

    .brandLogos {
        gap: 8px;
    }

    .methodCard {
        padding: 16px;
    }

    .divider {
        margin: 16px -16px 18px;
    }
}
