/* ==================== QUINTALLE · checkout ==================== */
:root { --acc: #f26a21; --acc-d: #c9500f; --acc-l: #fff1e8; --green: #2f5a3f; --green-dk: #1f3d2b; --green-l: #e9f1ec; --ok: #16a34a; --err: #dc2626; --ink: #1d2320; --muted: #66706a; --line: #e3e7e4; }
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; touch-action: manipulation; }
body { font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif; background: #f3f5f2; color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
[hidden] { display: none !important; }

/* Topo */
.header { background: #0d1912; border-bottom: 3px solid var(--acc); }
.header-content { max-width: 1100px; margin: 0 auto; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 9px; color: #f3efe6; text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
.brand-name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 22px; letter-spacing: -.01em; font-variation-settings: "opsz" 72; }
.secure { display: flex; align-items: center; gap: 8px; color: #fff; }
.secure svg { width: 22px; height: 22px; color: #4ade80; }
.secure span { display: flex; flex-direction: column; line-height: 1.15; font-size: 11px; color: #b9c6bd; }
.secure b { font-size: 13px; color: #4ade80; }
.test { background: #fff4d6; color: #7a5600; text-align: center; font-size: 12.5px; padding: 7px; font-weight: 600; }

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
.checkout-wrapper { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.checkout-sidebar { position: sticky; top: 16px; }

/* Cards / etapas */
.card { background: #fff; border-radius: 12px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.05); overflow: hidden; border: 1px solid var(--line); }
.step-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; user-select: none; }
.step-header:hover { background: #fafbfa; }
.step-number { width: 28px; height: 28px; background: #e2e6e3; color: #8a948e; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; transition: .25s; }
.step-number.active, .step-number.completed { background: var(--acc); color: #fff; }
.step-number.completed { font-size: 0; }
.step-number.completed::after { content: ''; width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2.6px 2.6px; transform: rotate(-45deg) translate(1px, -1px); }
.step-title { font-size: 14.5px; font-weight: 700; flex: 1; }
.step-title.inactive { color: #9aa39d; }
.step-sum { font-size: 12.5px; color: var(--muted); font-weight: 500; display: block; }
.step-edit { color: var(--acc-d); font-size: 13px; font-weight: 600; display: none; }
.step-edit.show { display: block; }
.step-content { padding: 0 20px 20px; display: none; animation: fadeIn .25s ease; }
.step-content.open { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Formulário */
.form-group { margin-bottom: 12px; position: relative; }
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.form-label span { font-size: 11px; color: #999; font-weight: 400; }
.form-input { width: 100%; padding: 12px 14px; border: 1px solid #d7ddd9; border-radius: 8px; font-size: 15px; background: #fff; font-family: inherit; transition: border-color .2s, box-shadow .2s; }
.form-input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(242,106,33,.14); }
.form-input.error { border-color: var(--err); background: #fff8f8; }
.form-input::placeholder { color: #a8b0ab; }
.error-message { color: var(--err); font-size: 11.5px; margin-top: 4px; display: none; }
.form-input.error ~ .error-message { display: block; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.number-input-wrapper { position: relative; }
.number-input-wrapper .form-input { padding-right: 62px; }
.sn-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 4px 8px; border-radius: 4px; background: #eef1ef; font-size: 11px; font-weight: 700; color: #666; cursor: pointer; border: 0; }
.sn-toggle.active { background: var(--acc); color: #fff; }
.cep-loading { position: absolute; right: 12px; top: 38px; width: 18px; height: 18px; border: 2px solid #eee; border-top-color: var(--acc); border-radius: 50%; animation: spin 1s linear infinite; display: none; }
.cep-loading.on { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.address-fields { display: none; margin-top: 4px; }
.address-fields.visible { display: block; animation: fadeIn .25s ease; }

/* Frete */
.ship { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px solid var(--acc); background: #fffaf6; border-radius: 10px; box-shadow: 0 0 0 1px var(--acc); margin-top: 4px; }
.ship-ico { width: 52px; height: 52px; border-radius: 10px; background: var(--green-l); color: var(--green); display: grid; place-items: center; flex: none; }
.ship-ico svg { width: 28px; height: 28px; }
.ship-copy { flex: 1; min-width: 0; }
.ship-copy b { display: block; font-size: 14px; }
.ship-copy span { font-size: 12px; color: var(--muted); }
.ship-price { font-size: 13px; font-weight: 800; white-space: nowrap; }
.ship-price.free { color: var(--ok); }

/* Botões */
.btn { width: 100%; padding: 15px 22px; border: 0; border-radius: 8px; font-size: 15px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; color: #fff; background: linear-gradient(180deg, #ff8034 0%, #f26a21 55%, #d65812 100%); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 22px -12px rgba(242,106,33,.9); transition: filter .2s; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .7; cursor: wait; }
.btn-continue { margin-top: 16px; }
.btn-pay { background: linear-gradient(180deg, #22c55e 0%, #16a34a 60%, #12873d 100%); box-shadow: 0 10px 22px -12px rgba(22,163,74,.9); margin-top: 16px; }
.btn .spin { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: none; }
.btn.loading .spin { display: block; }
.btn.loading .lbl { display: none; }

/* Pagamento */
.payment-method-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.payment-method-option { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 13px 10px; border: 2px solid #e0e4e1; border-radius: 10px; cursor: pointer; background: #fff; }
.payment-method-option:hover { border-color: var(--acc); }
.payment-method-option.selected { border-color: var(--acc); background: var(--acc); }
.payment-method-option svg { width: 28px; height: 28px; color: #4b5a51; }
.payment-method-option.selected svg { color: #fff; }
.pm-label { font-size: 13px; font-weight: 700; }
.pm-sub { font-size: 11.5px; color: var(--muted); }
.payment-method-option.selected .pm-label, .payment-method-option.selected .pm-sub { color: #fff; }
.info-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; display: grid; gap: 10px; }
.info-item { display: flex; gap: 10px; font-size: 13px; color: #555; line-height: 1.4; }
.info-item svg { flex: 0 0 18px; width: 18px; height: 18px; color: #22c55e; margin-top: 1px; }
.info-item strong { color: #333; }
.cpf-section { margin-bottom: 4px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f0; }
.cpf-label { font-size: 12px; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.cpf-label span { font-size: 11px; color: #999; font-weight: 400; text-transform: none; }
.alert { background: #fdecea; color: var(--err); border-radius: 10px; padding: 12px; font-size: 13.5px; font-weight: 600; margin-top: 14px; }

/* Resumo no passo 3 */
.ps-box { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.ps-head { font-size: 14px; font-weight: 700; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid #f0f0f0; }
.ps-item { display: flex; gap: 12px; padding: 10px; background: #fafbfa; border: 1px solid #f0f0f0; border-radius: 10px; }
.ps-item img { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid #eee; }
.ps-item b { display: block; font-size: 14px; line-height: 1.3; }
.ps-item small { display: block; font-size: 12px; color: var(--muted); }
.ps-item .now { font-size: 16px; font-weight: 800; color: #13803d; }
.ps-row { display: flex; justify-content: space-between; font-size: 13.5px; color: #555; padding-top: 10px; }
.ps-row.total { border-top: 1px solid #f0f0f0; margin-top: 10px; font-size: 15px; font-weight: 800; color: #111; }
.ps-row .free { color: var(--ok); font-weight: 700; }

/* Barra lateral */
.summary-card { background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: 0 2px 8px rgba(0,0,0,.05); border: 1px solid var(--line); }
.summary-title { font-size: 14px; font-weight: 700; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid var(--acc); display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.summary-title-total { margin-left: auto; font-weight: 800; }
.summary-toggle { width: 24px; height: 24px; border: 1.5px solid #ccc; border-radius: 5px; background: #fafafa; font-weight: 700; color: #666; line-height: 1; cursor: pointer; }
.summary-card.collapsed .summary-body { display: none; }
.summary-card.collapsed .summary-title { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.summary-product { display: flex; gap: 12px; }
.summary-product img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; }
.summary-product b { display: block; font-size: 14px; line-height: 1.35; }
.summary-product small { display: block; font-size: 12px; color: var(--muted); }
.vars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.vars button { border: 1.5px solid #d7ddd9; border-radius: 8px; background: #fff; padding: 6px 4px; font-weight: 800; font-size: 13px; cursor: pointer; line-height: 1.2; }
.vars button small { display: block; font-weight: 600; font-size: 10.5px; color: var(--muted); }
.vars button.on { border-color: var(--acc); background: var(--acc-l); color: var(--acc-d); box-shadow: 0 0 0 1px var(--acc); }
.qty { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; background: #f4f6f4; border: 1px solid #e0e4e1; border-radius: 6px; padding: 4px 6px; }
.qty button { width: 24px; height: 24px; border: 0; border-radius: 4px; background: var(--acc); color: #fff; font-weight: 700; cursor: pointer; line-height: 1; }
.qty button:disabled { background: #ccc; cursor: not-allowed; }
.qty b { min-width: 16px; text-align: center; font-size: 13px; }
.summary-totals { margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0f0f0; display: grid; gap: 8px; font-size: 14px; }
.summary-row { display: flex; justify-content: space-between; }
.summary-row .free { color: var(--ok); font-weight: 600; }
.summary-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 16px; padding-top: 8px; border-top: 1px solid #f0f0f0; }
.summary-trust { list-style: none; margin-top: 14px; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.summary-trust li::before { content: '✓'; color: var(--ok); font-weight: 800; margin-right: 8px; }

/* Rodapé */
.payment-footer { text-align: center; padding: 16px; border-top: 1px solid var(--line); background: #fff; font-size: 11.5px; color: var(--muted); }
.payment-footer .pill { display: inline-flex; align-items: center; gap: 5px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 20px; padding: 4px 12px; margin-bottom: 6px; color: var(--ok); font-weight: 700; font-size: 12px; }

/* Tela de carregamento */
.loading-screen { display: none; position: fixed; inset: 0; z-index: 9999; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(180deg, #eef5f0 0%, #fff 50%, #eef5f0 100%); text-align: center; padding: 24px; }
.loading-screen.active { display: flex; }
.loading-ring { width: 64px; height: 64px; margin-bottom: 22px; border-radius: 50%; border: 4px solid #d5e5da; border-top-color: var(--acc); animation: spin .75s linear infinite; }
.loading-title { font-size: 1.35rem; font-weight: 800; color: var(--green-dk); }
.loading-hint { margin-top: 10px; font-size: .9rem; color: var(--muted); }

/* Tela do Pix */
.pix-screen { display: none; }
.pix-screen.active { display: block; position: fixed; inset: 0; z-index: 10040; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #e9f1ec; }
body.pix-active { overflow: hidden; }
.pix-container { max-width: 28rem; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(48px + env(safe-area-inset-bottom, 0px)); }
.pix-head { text-align: center; margin-bottom: 16px; }
.pix-head .brand { justify-content: center; color: var(--green-dk); margin-bottom: 10px; }
.pix-head h1 { font-size: 1.1rem; font-weight: 800; }
.pix-head p { font-size: .875rem; color: #6b7280; margin-top: 4px; }
.pix-card { background: #fff; border-radius: 1rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.pix-timer { background: #f9fafb; border-bottom: 1px solid #f3f4f6; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .875rem; color: #6b7280; font-weight: 500; }
.pix-digits { display: flex; align-items: center; gap: 5px; }
.pix-digits b { display: grid; place-items: center; width: 24px; height: 32px; background: var(--green); color: #fff; font-size: .875rem; border-radius: 4px; }
.pix-digits i { font-style: normal; font-weight: 700; color: var(--green); }
.pix-value { border-bottom: 1px solid #f3f4f6; padding: 14px 20px; text-align: center; }
.pix-value small { font-size: .75rem; color: #6b7280; display: block; }
.pix-value b { font-size: 1.4rem; font-weight: 800; }
.pix-value span { display: block; font-size: .75rem; color: #6b7280; }
.pix-qr { display: flex; flex-direction: column; align-items: center; padding: 22px; }
.pix-waiting { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: .8125rem; font-weight: 600; color: #6b7280; }
.pix-waiting::before { content: ''; width: 16px; height: 16px; border: 2px solid #e5e7eb; border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; }
.pix-qr-wrap { position: relative; border: 2px dashed #e5e7eb; border-radius: 12px; padding: 14px; }
.pix-qr-wrap img { display: block; width: 220px; height: 220px; }
.pix-qr-wrap small { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #fff; padding: 2px 12px; font-size: 10px; color: #6b7280; border-radius: 99px; border: 1px solid #e5e7eb; }
.pix-buttons { padding: 18px 22px 22px; display: grid; gap: 12px; max-width: 22rem; margin: 0 auto; }
.pix-buttons label { font-size: .75rem; font-weight: 600; color: #6b7280; }
.pix-copy-field { width: 100%; min-height: 72px; resize: none; border: 1px solid #e5e7eb; border-radius: .75rem; padding: 10px 12px; font-size: 11px; line-height: 1.4; background: #f9fafb; font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.pix-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: .75rem; font-size: .9rem; font-weight: 700; height: 48px; border: 0; cursor: pointer; width: 100%; }
.pix-btn svg { width: 20px; height: 20px; }
.pix-btn-primary { background: var(--acc); color: #fff; }
.pix-btn-primary.copied { background: #22c55e; }
.pix-btn-secondary { background: var(--green-l); color: var(--green-dk); }
.pix-btn-secondary:disabled { opacity: .6; cursor: wait; }
.pix-msg { font-size: .8125rem; text-align: center; color: #b45309; font-weight: 600; }
.pix-msg.bad { color: var(--err); }
.pix-divider { position: relative; border-top: 2px dashed #e5e7eb; }
.pix-divider::before, .pix-divider::after { content: ''; position: absolute; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; background: #e9f1ec; border-radius: 50%; }
.pix-divider::before { left: -12px; } .pix-divider::after { right: -12px; }
.pix-how { padding: 22px; }
.pix-how h2 { text-align: center; font-size: .9rem; font-weight: 700; margin-bottom: 16px; }
.pix-how ol { list-style: none; counter-reset: s; display: grid; gap: 14px; }
.pix-how li { counter-increment: s; display: flex; gap: 12px; font-size: .875rem; }
.pix-how li::before { content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; min-width: 22px; border-radius: 50%; background: var(--green-l); font-size: .75rem; font-weight: 700; color: var(--green-dk); }
.pix-how li span { display: block; font-size: .75rem; color: #6b7280; }
.pix-foot { margin-top: 16px; display: flex; justify-content: space-between; gap: 6px; padding: 14px 12px; background: #fff; border-radius: 12px; }
.pix-foot div { flex: 1; text-align: center; font-size: 10px; color: #6b7280; line-height: 1.25; }
.pix-foot b { display: block; font-size: 12px; color: #1f2937; }
.pix-foot div + div { border-left: 1px solid #e5e7eb; }

.approved-loading { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.97); z-index: 10050; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.approved-loading.active { display: flex; }
.approved-loading .loading-ring { border-top-color: var(--ok); }
.approved-loading b { font-size: 20px; }
.approved-loading span { font-size: 14px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .loading-ring, .pix-waiting::before { animation: none; } }
@media (max-width: 960px) { .checkout-wrapper { grid-template-columns: 1fr; gap: 14px; } .checkout-sidebar { position: static; order: -1; } }
@media (max-width: 600px) {
    .container { padding: 12px; }
    .form-grid-2 { grid-template-columns: 1fr; gap: 0; }
    .step-header { padding: 14px 16px; } .step-content { padding: 0 16px 16px; }
    .form-input { font-size: 16px; }
    .secure span { display: none; }
}
