:root {
  --black: #000; --white: #fff; --blue: #1E63FF; --red: #E53935;
  --grey-05: #F5F5F5; --grey-10: #EAEAEA; --grey-40: #9A9A9A; --grey-60: #666;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --w: 1040px;   /* un solo ancho para header, banner y pasos */
  --gap: 16px;   /* escala de espacios: 8 / 16 / 24 / 32 */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font); color: var(--black); background: var(--grey-05); padding-right: 380px; }
code { font-size: 0.9em; background: var(--grey-10); padding: 1px 5px; border-radius: 2px; }
h1, h2 { margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
.caps { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; color: var(--grey-60); margin: 0; }
.muted { color: var(--grey-60); font-size: 14px; }
p:empty { display: none; }

/* Contenedor común: todo comparte el mismo ancho y los mismos bordes. */
.wrap { max-width: var(--w); margin-inline: auto; padding-inline: 32px; }

.top { background: var(--white); border-bottom: 1px solid var(--grey-10); }
.top .wrap { display: flex; align-items: center; gap: var(--gap); padding-block: 24px; }
.logo { width: 40px; height: 40px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: var(--gap); }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--grey-60); cursor: pointer; }
.status { font-size: 13px; padding: 6px 12px; border-radius: 4px; background: var(--grey-10); }
/* El azul es solo para estados: conectado, identificado, llegaste desde el email. */
.status.ok { background: #E6EEFF; color: #0B3FC4; }
.status.err { background: #FDECEA; color: var(--red); }

.banner-wrap { padding-top: var(--gap); }
#cio-banner:not(:empty) + .banner-hint { display: none; }
.banner-hint { border: 1px dashed var(--grey-40); border-radius: 4px; padding: var(--gap); margin: 0; background: var(--white); text-align: center; }
.callout { margin-top: var(--gap); padding: 14px 18px; border-radius: 4px; background: #E6EEFF; color: #0B3FC4; font-size: 15px; }

/* Los pasos: una columna; cada paso es una fila con la explicación a la izquierda y la acción a la derecha. */
main { display: grid; gap: var(--gap); padding-block: var(--gap) 96px; container-type: inline-size; }
.card { background: var(--white); border: 1px solid var(--grey-10); border-radius: 4px; padding: 32px; }
.step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap) 48px; align-items: start; }
.step-body, .step-action { display: grid; gap: var(--gap); align-content: start; }
.step-body { gap: 8px; }
.step > details { grid-column: 1 / -1; }
.shop { display: grid; gap: var(--gap); }
.shop-head { display: flex; flex-wrap: wrap; gap: 8px 48px; align-items: end; justify-content: space-between; }
.shop-head p.muted { margin: 0; max-width: 52ch; line-height: 1.5; }
.price-old { text-decoration: line-through; }
.cart-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.cart-row p { margin: 0; }
.step p { margin: 0; line-height: 1.5; text-wrap: pretty; }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 10px; background: var(--black); color: var(--white); font-weight: 700; font-size: 13px; letter-spacing: 0; border-radius: 2px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
@container (max-width: 760px) { .step { grid-template-columns: 1fr; } }

form { display: grid; gap: 12px; }
label, .field { display: grid; gap: 4px; font-size: 13px; color: var(--grey-60); }
input, select { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--grey-10); border-radius: 4px; color: var(--black); }
form button { justify-self: start; }
.field-error { color: var(--red); }
/* intl-tel-input con los colores de la demo, como en hyppo.io (src/styles/phone.css de hyppo_landing). */
.iti { width: 100%; font-family: var(--font); --iti-border-color: var(--grey-10); --iti-hover-color: var(--grey-05); --iti-icon-color: var(--grey-60); }
.iti input { width: 100%; }
.iti__dropdown-content, .iti__search-input { font-family: var(--font); font-size: 14px; }
.iti__dial-code { color: var(--grey-60); }

/* Botones: negro = la acción que dispara algo real; ghost = ver en Customer.io. */
button, a.btn { display: inline-block; font: inherit; font-size: 14px; font-weight: 500; padding: 10px 16px; border: 1px solid var(--black); border-radius: 4px; background: var(--black); color: var(--white); cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, a.btn:hover { background: #222; }
button.ghost, a.btn.ghost { background: var(--white); color: var(--black); }
button.ghost:hover, a.btn.ghost:hover { background: var(--grey-05); }
button.small, a.btn.small-btn { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
/* Estado de cada clic (lo maneja send() en app.js): enviando → listo ✓, o error. */
button[data-state="busy"] { opacity: 0.6; cursor: progress; }
button[data-state="done"] { background: var(--blue); border-color: var(--blue); color: var(--white); opacity: 1; }
button[data-state="err"] { background: var(--white); border-color: var(--red); color: var(--red); }
button code { background: transparent; color: inherit; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.pill { font-size: 13px; padding: 2px 8px; border-radius: 4px; background: var(--grey-10); }
.pill.ok { background: #E6EEFF; color: #0B3FC4; }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product { position: relative; background: var(--grey-05); border-radius: 4px; padding: 12px; display: grid; gap: 6px; }
.product.highlight { box-shadow: 0 0 0 2px var(--black); }
.thumb { height: 90px; border-radius: 2px; background: var(--white); display: grid; place-items: center; font-weight: 700; color: var(--grey-60); }
.tag { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 2px 6px; border-radius: 2px; background: var(--black); color: var(--white); }

.notes { display: none; font-size: 14px; border-top: 1px solid var(--grey-10); padding-top: 12px; }
body.show-notes .notes { display: block; }
summary { cursor: pointer; font-weight: 500; }
.notes li { margin: 6px 0; line-height: 1.45; }

/* Panel de eventos: arranca minimizado como una pestaña abajo a la derecha. */
.log { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; background: var(--black); color: var(--white); display: flex; flex-direction: column; }
.log .caps { color: var(--grey-40); margin-right: auto; }
.log-tab { display: none; position: fixed; right: 16px; bottom: 16px; z-index: 10; }
body.log-closed { padding-right: 0; }
body.log-closed .log { display: none; }
body.log-closed .log-tab { display: block; }
.log-tab.pulse { animation: pulse 0.6s ease-out; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(30, 99, 255, 0.6); } to { box-shadow: 0 0 0 12px rgba(30, 99, 255, 0); } }

/* Avisos de eventos con el panel minimizado: arriba de la pestaña, se van solos. */
#toasts { position: fixed; right: 16px; bottom: 64px; z-index: 9; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
body:not(.log-closed) #toasts { display: none; }
.toast { display: grid; gap: 2px; padding: 10px 14px; border-radius: 4px; border-left: 3px solid var(--blue); background: var(--black); color: var(--white); font-size: 13px; animation: toast-in 180ms ease-out; transition: opacity 200ms; }
.toast code { background: transparent; color: #8fb2ff; padding: 0; }
.toast span { color: var(--grey-40); }
.toast.err { border-left-color: var(--red); }
.toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) { .toast, .log-tab.pulse { animation: none; } }
.log-head { display: flex; gap: 8px; align-items: center; padding: 16px; border-bottom: 1px solid #222; }
.log-head button { border-color: #444; background: transparent; color: var(--white); flex-shrink: 0; }
#log { list-style: none; margin: 0; padding: 0 16px; overflow-y: auto; flex: 1; font-size: 12px; }
#log li { padding: 10px 0; border-bottom: 1px solid #1a1a1a; }
#log li.err code { color: #ff8a80; }
#log code { background: transparent; color: #8fb2ff; }
#log pre { margin: 6px 0 0; white-space: pre-wrap; color: var(--grey-40); }
.t { color: var(--grey-40); }

@media (max-width: 900px) {
  body { padding-right: 0; }
  .log { position: static; width: auto; max-height: 50vh; }
  .wrap { padding-inline: 16px; }
  .top .wrap, .top-right { flex-wrap: wrap; }
  .card { padding: 24px; }
}

/* Guía para presentar: la misma estructura, más angosta. */
body.guide { padding-right: 0; --w: 860px; }
.guide-main { padding-block: 24px 64px; }
.guide-main .card { margin-bottom: var(--gap); }
.guide-main h2 { margin: 4px 0 var(--gap); }
.guide-main li, .guide-main dd, .guide-main p { line-height: 1.55; max-width: 62ch; text-wrap: pretty; }
.guide-main figure { margin: var(--gap) 0; }
.guide-main figure img { width: 100%; border: 1px solid var(--grey-10); border-radius: 4px; display: block; }
.guide-main dt { font-weight: 700; margin-top: 12px; }
.guide-main dd { margin: 4px 0 0; }
