:root {
    --bg: #ffffff;
    --ink: #1a1a1a;
    --muted: #8a8f98;
    --line: #e7e8ec;
    --field-border: #e0e2e7;
    --field-focus: #1a1a1a;
    --accent: #111111;
    --ok: #1f9d55;
    --radius: 12px;
    --max: 560px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: #f3f4f6;
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

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

/* Card around the checkout */
.checkout {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 36px 36px 44px;
    background: var(--bg);
    border-radius: 20px;
    border: 1px solid var(--line);
    box-shadow: 0 4px 24px rgba(17, 17, 17, .06);
    overflow: hidden;
}

/* Test-mode banner (DEV_AUTOFILL) — bleeds to the card edges */
.test-banner {
    margin: -36px -36px 28px;
    padding: 10px 24px;
    background: #fff4d6;
    color: #7a5a00;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid #f0e0a8;
}
@media (max-width: 480px) {
    body { padding: 20px 14px; }
    .checkout { padding: 28px 22px 36px; border-radius: 16px; }
    .test-banner { margin: -28px -22px 22px; padding: 10px 18px; }
}

/* Test mode: hide the contact form (data is generated in the backend). Inputs
   stay in the DOM for the production path — only visually hidden here. */
.test-mode #contact-form { display: none; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 28px;
}
.brand-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.logo {
    width: 86px;
    height: 86px;
    border-radius: 12px;
    object-fit: contain;
    flex: none;
}
.brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.secure-badge svg { color: var(--muted); }

/* Summary */
.summary {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-bottom: 36px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    color: var(--muted);
    padding: 9px 0;
}
.summary-row.total {
    color: var(--ink);
    font-weight: 700;
    font-size: 17px;
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 14px;
}

/* Blocks / steps */
.block { margin-bottom: 32px; }
.block-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
}
.step {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
}

/* Fields */
.field {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}
.field-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}
.field input {
    width: 100%;
    padding: 15px 16px 15px 44px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--muted); }
.field input:focus {
    border-color: var(--field-focus);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, .06);
}
.field input[aria-invalid="true"] {
    border-color: #e0584f;
}

.field-error {
    color: #d6453c;
    font-size: 13px;
    margin: 4px 2px 0;
}

/* Pay button */
.pay-button {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .15s ease, transform .05s ease;
}
.pay-button:hover { opacity: .9; }
.pay-button:active { transform: translateY(1px); }
.pay-button:disabled { opacity: .55; cursor: default; }

/* SPEI panel */
.spei-intro { font-size: 14px; color: var(--ink); margin: 0 0 14px; }
.spei-clabe {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    background: #fafafb;
}
.clabe-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 18px;
    letter-spacing: 0.04em;
    word-break: break-all;
}
.copy-button {
    flex: none;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--field-border);
    border-radius: 8px;
    cursor: pointer;
}
.copy-button:hover { background: #f4f4f5; }
.copy-button.copied { color: var(--ok); border-color: var(--ok); }

.spei-meta {
    margin: 16px 0 0;
    display: grid;
    gap: 10px;
}
.spei-meta > div {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}
.spei-meta dt { color: var(--muted); margin: 0; }
.spei-meta dd { margin: 0; font-weight: 500; text-align: right; }

.spei-wait {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin: 18px 0 0;
}

/* Spinner */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--line);
    border-top-color: var(--muted);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Paid */
#paid-panel { text-align: center; padding: 12px 0; }
.paid-check { color: var(--ok); }
.paid-title { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.paid-sub { font-size: 14px; color: var(--muted); margin: 0; }

/* Footer */
.foot {
    border-top: 1px solid var(--line);
    padding-top: 22px;
    margin-top: 8px;
}
.foot-secure {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}
.foot-legal, .foot-links {
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
    margin: 0 0 8px;
}
.foot-links a { color: var(--ink); text-decoration: underline; }

@media (max-width: 480px) {
    .clabe-value { font-size: 16px; }
}
