:root {
  /* Warm/playful re-theme 2026-08-19 (user request) — same token names and
     everywhere they're used, only the values changed, so no selector below
     had to move. rastreo/ and staff/ inherit these too (by design, see the
     comment further down), so they pick up the new palette automatically. */
  --bg: #FFF8EC;
  --panel-bg: #FFFFFF;
  --panel-border: rgba(34, 29, 26, 0.14);
  --text: #221D1A;
  --text-dim: #6B5F55;
  /* M1CAE's own brand pink (the "M1CAE" wordmark color in the logo) —
     2026-08-19 user request to make buttons match the real brand instead of
     the coral used elsewhere in this re-theme. */
  --accent: #E8197A;
  --accent-hover: #FF4FA6;
  --whatsapp: #25d366;
  --pay-online: #3454D1;
  --pay-online-hover: #5470E0;
  --radius: 14px;
  /* Semantic tokens: these are per-theme (not just per-brand) because a
     color tuned to pop on a light panel reads as a barely-there pastel on a
     dark one and vice versa — see the dark override below. */
  --error: #C6382B;
  --res-bad: #C6382B;
  --res-warn: #A8790A;
  --res-ok: #1C7FA6;
  --res-good: #1E9E5A;
  --checker: #EFE6D6;
  --hover-tint: rgba(34, 29, 26, 0.08);
}

/* Auto dark mode 2026-08-19 (user request, to match the design prototype) —
   same token names as :root above, values swapped for a dark ground. Only
   these tokens need theme-specific values; every rule below reads them
   through var(), so this block is the only place light/dark diverge. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171310;
    --panel-bg: #221C18;
    --panel-border: rgba(251, 243, 233, 0.16);
    --text: #FBF3E9;
    --text-dim: #C9BBAE;
    --accent: #FF4FA6;
    --accent-hover: #FF7AC2;
    --pay-online: #7C93FF;
    --pay-online-hover: #93A6FF;
    --error: #ff8577;
    --res-bad: #ff5c5c;
    --res-warn: #f2c811;
    --res-ok: #7ec8e3;
    --res-good: #4fd18a;
    --checker: #2a2e38;
    --hover-tint: rgba(255, 255, 255, 0.08);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3, .step-current, .brand-logo, .btn, .product-btn, .view-btn,
.help-btn, .step-num, .price-estimate, .cart-subtotal, .field span,
.stage-card .label, .rastreo-hero h2, .rastreo-hero-step {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--panel-border);
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.help-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.help-btn svg {
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  height: calc(100vh - 74px);
}

@media (max-width: 900px) {
  /* Mobile: the shirt viewer stays put; only the design panel below it
     scrolls (like a bottom sheet), so you can keep an eye on the shirt
     while uploading/resizing. Achieved with body-as-flex-column so the
     layout's real height is "whatever's left after header+footer",
     without hardcoding their pixel heights. */
  html, body {
    height: 100vh;
    height: 100dvh;
  }

  body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* .site-footer used to be pinned here too (flex-shrink:0, as a sibling of
     .layout) — moved into the scrollable .panel in index.html 2026-08-19 so
     it no longer permanently eats into the small mobile screen's working
     area; it now just scrolls into view at the end of the panel like any
     other content. */
  .topbar {
    flex-shrink: 0;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  .viewer {
    flex-shrink: 0;
    overflow: hidden;
    padding: 8px;
    gap: 6px;
    max-height: 36vh;
  }

  #mockup-canvas {
    max-height: 21vh;
  }

  .panel {
    min-height: 0;
  }
}

/* Real phones rarely give a full-height viewport — Safari's URL bar, an ad
   banner, whatever — so the fixed viewer/progress/action-bar chrome above
   was leaving almost no room for the actual interactive screen underneath
   (reported by a customer: couldn't see the gallery or the upload box).
   Keyed on viewport *height*, not width, since that's the actual constraint;
   stacks with the width-based mobile rules above. */
@media (max-height: 700px) {
  .viewer {
    max-height: 30vh;
    padding: 6px;
    gap: 4px;
  }

  #mockup-canvas {
    max-height: 17vh;
  }

  .product-tabs {
    gap: 6px;
  }

  .product-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .view-toggle {
    padding: 3px;
  }

  .view-btn {
    padding: 4px 12px;
    font-size: 0.72rem;
  }

  .step-progress {
    padding: 8px 16px 6px;
  }

  /* The dots alone already show progress — the "Paso X de 3 · Label" line
     underneath is nice-to-have, not essential, and costs a full text row. */
  .step-current {
    display: none;
  }

  .sticky-action-bar {
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  }

  .btn {
    min-height: 40px;
    padding: 10px 14px;
  }
}

.viewer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(circle at 50% 40%, #4a4d54, #35373c 70%);
  padding: 20px;
}

.view-toggle {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 999px;
}

.view-btn {
  min-height: 38px;
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  /* Sits on .viewer's own dark backdrop (kept dark on purpose so dark
     garment colors stay visible — see #mockup-canvas's filter comment),
     which is a different surface than --panel-bg, so it needs its own
     light-on-dark color rather than the (now warm/dark) --text-dim token. */
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.view-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Product picker (Camiseta / Bolsa / …). Deliberately its own chip row
   instead of reusing .view-toggle's pill-switch look: that style reads as
   "one of two states" (like Frente/Espalda below it), which stops making
   sense once there are 5-6 products — a wrapping row of individual chips
   scales to any count without the container turning into a giant misshapen
   pill. New products just need another .product-btn here; no CSS changes
   needed as the catalog grows. */
.product-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.product-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.product-btn svg {
  flex-shrink: 0;
}

.product-btn:hover {
  border-color: var(--accent);
  color: #fff;
}

.product-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* The banderola "same design on both sides" checkbox is the one .field
   inside .viewer (everything else lives in the light .panel) — same
   dark-backdrop reasoning as .view-btn/.product-btn above. */
.viewer .field span,
.viewer .checkbox-field span {
  color: rgba(255, 255, 255, 0.85);
}

#viewer-canvas {
  max-width: 100%;
  max-height: calc(100% - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#mockup-canvas {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  /* Without this, touch browsers treat a drag on the canvas as a page-scroll
     gesture instead of feeding pointermove events to reposition the design. */
  touch-action: none;
  /* Light rim + soft ambient shadow, both alpha-aware (unlike box-shadow) so they
     hug the shirt's actual silhouette. Needed now that .viewer's background is
     dark gray again — without this, dark shirt colors (Negro, Vino, Azul Marino,
     Verde Botella, Café) lose almost all contrast against it, the exact "no sale
     la camisa" bug fixed 2026-07-19 by switching to a light background instead. */
  filter:
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.35))
    drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}

/* Screen-by-screen navigation, 2026-08-19 (user request, to match the design
   prototype) — .panel used to be one continuously-scrolling column stacking
   all 3 panel-sections; now each section is its own full-size "screen"
   (absolutely positioned, independently scrollable) and only one is shown
   at a time, cross-faded/slid in by step-progress.js toggling `.active`.
   #mockup-canvas stays in .viewer above (not moved into a screen) since a
   customer needs to see and drag their design onto it right after
   uploading, in step 1 — not only once they reach a later step. */
.panel {
  border-left: 1px solid var(--panel-border);
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.step-screens {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.panel-section {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.panel-section.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .panel-section {
    transition: none;
  }
}

.panel-section h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 12px;
}

/* Step 3 is split into two internal parts (talla/cantidad, then contact +
   pago) rather than its own extra numbered step — same reasoning as the
   design prototype's unnumbered confirmation screen: it's a continuation of
   "completá tu pedido", not a separate decision point. */
#step3-part-b.hidden {
  display: none;
}

.field {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.field select,
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="number"],
.field textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.field textarea {
  resize: vertical;
}

.phone-input {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.phone-input .phone-prefix {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
  white-space: nowrap;
}

.phone-input input[type="tel"] {
  flex: 1 1 auto;
  min-width: 0;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.field input[type="range"]:disabled {
  opacity: 0.4;
}

.size-value {
  float: right;
  color: var(--text);
  font-weight: 600;
}

.file-field input[type="file"] {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

#design-gallery {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.gallery-category {
  margin: 14px 0 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.gallery-category:first-child {
  margin-top: 0;
}

.gallery-grid {
  display: grid;
  /* minmax(0, 1fr), not plain 1fr: without the explicit 0 minimum, a grid
     track's minimum width defaults to its content's natural size, so one
     long unbroken caption can force that whole column wider than the
     sidebar — pushing images out of the panel and misaligning other cells. */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.gallery-item:hover {
  border-color: var(--accent);
}

.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #ffffff;
  border-radius: 4px;
}

.gallery-item span {
  width: 100%;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.ink-colors {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.inline-field span {
  margin-bottom: 0;
}

.inline-field input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--bg);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  margin: 0;
}

.checkbox-field span {
  margin-bottom: 0;
  color: var(--text);
}

.hint-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 6px 0 12px;
  line-height: 1.4;
}

.hint-error {
  color: var(--error);
}

.hint-success {
  color: var(--res-good);
}

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row .btn {
  margin-top: 0;
}

#mockup-canvas {
  cursor: grab;
}

#mockup-canvas.dragging {
  cursor: grabbing;
}

#mockup-canvas.rotating {
  cursor: crosshair;
}

.design-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.design-preview span {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.resolution-status {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  min-height: 1.2em;
}

.resolution-status.res-bad {
  color: var(--res-bad);
}

.resolution-status.res-warn {
  color: var(--res-warn);
}

.resolution-status.res-ok {
  color: var(--res-ok);
}

.resolution-status.res-good {
  color: var(--res-good);
}

.design-preview canvas {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background:
    linear-gradient(45deg, var(--checker) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.btn {
  display: inline-block;
  width: 100%;
  min-height: 46px;
  padding: 13px 16px;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent),
              0 14px 26px color-mix(in srgb, var(--accent) 30%, transparent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 16%, transparent),
              0 16px 30px color-mix(in srgb, var(--accent) 34%, transparent);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  margin-top: 6px;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  margin-top: 12px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--whatsapp) 14%, transparent),
              0 14px 26px color-mix(in srgb, var(--whatsapp) 30%, transparent);
}

.btn-pay-online {
  background: var(--pay-online);
  color: #fff;
  margin-top: 12px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--pay-online) 14%, transparent),
              0 14px 26px color-mix(in srgb, var(--pay-online) 30%, transparent);
}

.btn-pay-online:hover {
  background: var(--pay-online-hover);
}

.btn-pay-online:disabled {
  opacity: 0.6;
  cursor: wait;
  box-shadow: none;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  box-shadow: 0 0 0 1px var(--panel-border);
  cursor: pointer;
}

.swatch.active {
  border-color: var(--text);
  transform: scale(1.08);
}

.size-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.size-btn {
  flex: 1 1 60px;
  min-height: 40px;
  padding: 9px 0;
  border-radius: 10px;
  border: 1.5px solid var(--panel-border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.size-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.size-btn-sub {
  display: block;
  font-size: 0.65rem;
  opacity: 0.7;
  margin-top: 2px;
}

.order-form {
  display: flex;
  flex-direction: column;
}

.order-summary {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

.order-summary h3 {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.order-summary dl {
  margin: 0;
  font-size: 0.85rem;
}

.order-summary dt {
  color: var(--text-dim);
  float: left;
  clear: left;
  margin-right: 6px;
}

.order-summary dd {
  margin: 0 0 6px;
}

.order-summary-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--panel-border);
}

.order-summary-item:last-child {
  border-bottom: none;
}

.cupon-block {
  padding: 10px 0;
  border-bottom: 1px solid var(--panel-border);
}

.cupon-block .field {
  margin: 0;
}

.cupon-input-row {
  display: flex;
  gap: 8px;
}

.cupon-input-row input {
  flex: 1;
  min-width: 0;
}

.cupon-input-row .btn {
  /* .btn's base width:100% would otherwise claim the row's whole flex-basis
     and squash the input next to it down to a sliver. */
  width: auto;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 0 16px;
  white-space: nowrap;
}

.cupon-block .hint-text {
  margin-bottom: 0;
}

#order-totals dt:last-of-type,
#order-totals dd:last-of-type {
  font-weight: 700;
  color: var(--text);
}

.order-summary-item h4 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--accent);
}

/* --- Cart (step 4: add current shirt, then step 5 shows this list) --- */
.cart-count {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

.cart-item-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 6px;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.cart-item-info strong {
  display: block;
  font-size: 0.8rem;
  color: var(--text);
}

.cart-item-info span {
  color: var(--text-dim);
}

.cart-item-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.cart-item-remove:hover {
  border-color: var(--error);
  color: var(--error);
}

.price-estimate {
  margin: 4px 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.cart-item-price {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  color: var(--accent);
}

.cart-subtotal {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
  text-align: right;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.hidden {
  display: none;
}

/* Advanced-options disclosure (manga/texto, preparar diseño, multi-item
   cart) — collapsed by default so the simplified 3-step flow stays simple;
   added 2026-08-19 when the wizard went from 6 steps to 3. */
.advanced-disclosure {
  margin: 16px 0;
  border: 1.5px dashed var(--panel-border);
  border-radius: var(--radius);
  padding: 2px 14px;
}

.advanced-disclosure summary {
  padding: 12px 0;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Fredoka', sans-serif;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}

.advanced-disclosure summary::-webkit-details-marker {
  display: none;
}

.advanced-disclosure summary::before {
  content: "+ ";
}

.advanced-disclosure[open] summary::before {
  content: "− ";
}

.advanced-disclosure[open] summary {
  border-bottom: 1px solid var(--panel-border);
}

.advanced-disclosure .advanced-body {
  padding: 14px 0 6px;
}

#contact-block {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1.5px solid var(--panel-border);
}

#contact-block h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 12px;
}

/* --- First-run tutorial dialog --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
}

/* Both rules have equal specificity (one class each); without this, whichever
   is declared later in the file wins, which broke closing the dialog — the
   "hidden" class was being added by JS but "display: flex" above kept winning. */
.modal-overlay.hidden {
  display: none;
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 28px 24px 24px;
}

.modal-box h2 {
  margin: 0 0 18px;
  padding-right: 24px;
  font-size: 1.2rem;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--hover-tint);
  color: var(--text);
}

.tutorial-steps {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tutorial-steps li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.tutorial-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 10px;
}

.tutorial-icon svg {
  width: 22px;
  height: 22px;
}

.tutorial-steps strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.tutorial-steps p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand-logo {
    height: 32px;
  }

  .help-btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }

  .viewer {
    padding: 8px;
    gap: 6px;
  }

  .view-toggle {
    padding: 3px;
  }

  .view-btn {
    padding: 5px 14px;
    font-size: 0.75rem;
  }

  .product-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .product-btn svg {
    width: 15px;
    height: 15px;
  }

  #mockup-canvas {
    max-height: 20vh;
  }

  .panel {
    padding: 16px;
  }

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

  .modal-box {
    padding: 22px 18px 18px;
  }

  .btn {
    padding: 12px 14px;
  }
}

.site-footer {
  padding: 10px 24px;
  text-align: center;
  background: var(--panel-bg);
  border-top: 1px solid var(--panel-border);
}

.site-footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: underline;
}

/* Calibration mode (?calibrar in the URL) — hidden dev tool, never shown to
   normal visitors. See the CALIBRATE block at the bottom of js/main.js. */
#calibrate-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 50;
  max-width: 280px;
  padding: 12px 14px;
  background: rgba(15, 17, 21, 0.92);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.75rem;
  line-height: 1.4;
  color: #e8e9ec;
}

#calibrate-panel strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
}

#calibrate-panel p {
  margin: 0 0 8px;
  color: var(--text-dim);
}

#calibrate-panel code {
  display: block;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: #000;
  border-radius: 6px;
  color: #7ee787;
  font-size: 0.7rem;
  word-break: break-all;
}

.calibrate-actions {
  display: flex;
  gap: 6px;
}

.calibrate-actions button {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.7rem;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text);
  cursor: pointer;
}

.calibrate-actions button:hover {
  border-color: var(--accent);
}

/* Step progress bar: a fixed header above the screen-swapping .step-screens
   (see 2026-08-19 restructure comment on .panel above) so customers always
   see where they are (1-3) and how many steps remain. Originally a
   sticky-scroll hack (added 2026-08-12) — simplified to a plain flex child
   once .panel stopped being one continuously-scrolling column. */
.step-progress {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 12px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
}

.step-progress-main {
  flex: 1;
  min-width: 0;
}

.step-back-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
}

.step-back-btn.show {
  visibility: visible;
}

.step-dots {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.step-dot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--panel-border);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--panel-bg);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.step-dot:hover {
  border-color: var(--accent);
  color: var(--text);
}

.step-line {
  flex: 1 1 auto;
  height: 2px;
  background: var(--panel-border);
  min-width: 6px;
}

.step-dot.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.step-dot.done {
  border-color: var(--accent);
  color: var(--accent);
}

.step-dot.done .step-num {
  font-size: 0;
}

.step-dot.done .step-num::before {
  content: "✓";
  font-size: 0.8rem;
}

.step-line.done {
  background: var(--accent);
}

.step-current {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.btn-next-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-next-step:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.step-advance {
  margin-top: 18px;
}

#continue-to-contact-btn {
  margin-top: 6px;
}

@media (max-width: 600px) {
  .step-progress {
    padding: 12px 16px 10px;
  }

  .step-dot {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
}

/* Mascot-logo greeting bubble, one per screen — same treatment as the design
   prototype, reusing the real brand logo (assets/m1cae-logo.png) instead of
   re-embedding it. */
.step-bubble-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.mascot-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex: none;
  background: var(--bg);
  border: 1.5px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.mascot-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.step-bubble {
  background: var(--bg);
  border-radius: 14px 14px 14px 4px;
  padding: 11px 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  flex: 1;
  color: var(--text);
}

.step-bubble b {
  color: var(--accent);
}

/* Sticky action bar: holds whichever "next" control is relevant for the
   active screen (real DOM buttons moved in/out by simple-flow.js, not
   copies — so main.js's click/submit listeners keep working no matter where
   the button currently sits). */
.sticky-action-bar {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--panel-bg);
  border-top: 1.5px solid var(--panel-border);
}

.sticky-action-bar > * {
  flex: 1;
}

/* ============================================================
   Rastreo de pedido (/app/rastreo/) + panel de staff (/app/staff/).
   Standalone pages, not the two-column designer layout — new component
   classes are prefixed `rastreo-`/`staff-` to avoid colliding with it.
   Reuses the same color tokens defined at the top of this file.
   Added 2026-08-12.
   ============================================================ */
.rastreo-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.rastreo-main {
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rastreo-search-card,
.rastreo-picker,
.rastreo-pending,
.rastreo-notfound {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px;
}

.rastreo-search-card h1 {
  font-size: 1.3rem;
  margin: 0 0 8px;
}

.rastreo-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.rastreo-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-family: inherit;
}

.rastreo-form input::placeholder {
  color: var(--text-dim);
}

.rastreo-form .btn {
  width: auto;
  white-space: nowrap;
}

.rastreo-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.rastreo-picker-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.rastreo-picker-item:hover {
  border-color: var(--accent);
}

.rastreo-picker-item span {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.rastreo-pending p,
.rastreo-notfound p {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.rastreo-hero {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.rastreo-hero-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent-hover), var(--accent) 65%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 14%, transparent),
              0 18px 34px -10px color-mix(in srgb, var(--accent) 55%, transparent);
}

.rastreo-hero-icon svg {
  width: 38px;
  height: 38px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: no-preference) {
  .rastreo-hero-icon {
    animation: rastreo-float 3.4s ease-in-out infinite;
  }
}

@keyframes rastreo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.rastreo-hero-step {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.rastreo-hero h2 {
  margin: 0;
  font-size: 1.25rem;
}

.rastreo-hero p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  max-width: 32ch;
  line-height: 1.5;
}

.rastreo-hero-bar {
  display: flex;
  gap: 5px;
  width: 100%;
  margin-top: 4px;
}

.rastreo-tick {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--panel-border);
}

.rastreo-tick.done {
  background: var(--accent);
}

.rastreo-tick.current {
  background: linear-gradient(90deg, var(--accent), var(--panel-border) 60%);
}

.rastreo-cards-wrap {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 6px;
}

.card-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 14px 10px;
  scroll-snap-type: x proximity;
}

.card-track::-webkit-scrollbar {
  height: 5px;
}

.card-track::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 999px;
}

.stage-card {
  scroll-snap-align: center;
  flex: 0 0 108px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  opacity: 0.55;
  transform: scale(0.94);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.stage-card.done {
  opacity: 0.85;
}

.stage-card.current {
  opacity: 1;
  transform: scale(1.04);
  border-color: var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, transparent), var(--bg) 70%);
  box-shadow: 0 14px 26px -12px color-mix(in srgb, var(--accent) 50%, transparent);
}

.stage-card .stage-icon {
  width: 26px;
  height: 26px;
  color: var(--text-dim);
}

.stage-card .stage-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage-card.current .stage-icon,
.stage-card.done .stage-icon {
  color: var(--accent);
}

.stage-card .num {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.stage-card.current .num {
  color: var(--accent);
}

.stage-card .label {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-dim);
}

.stage-card.current .label,
.stage-card.done .label {
  color: var(--text);
}

.card-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.card-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--panel-border);
}

.card-dots span.active {
  background: var(--accent);
  width: 14px;
  border-radius: 999px;
}

.rastreo-order-meta {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.rastreo-order-meta strong {
  color: var(--text);
}

#rastreo-whatsapp {
  margin-top: -4px;
}

@media (max-width: 480px) {
  .rastreo-main {
    padding: 24px 16px 48px;
  }
}

/* ---- staff panel (/app/staff/) ---- */
.staff-main {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.staff-login-card {
  max-width: 420px;
  margin: 40px auto 0;
}

.staff-filter {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
}

.staff-orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.staff-order-row {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.15s ease;
}

.staff-order-row-busy {
  opacity: 0.5;
  pointer-events: none;
}

.staff-order-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.staff-order-head strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.staff-order-head span {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.staff-order-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.staff-stage-row {
  display: flex;
  gap: 6px;
}

.staff-stage-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.staff-stage-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.staff-stage-btn.done {
  border-color: var(--accent);
  color: var(--accent);
}

.staff-stage-btn.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.staff-stage-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* display set only via :not(.hidden) — a bare ".staff-tabs { display: flex }"
   would tie with ".hidden { display: none }" on specificity (0,1,0 each)
   and win on source order, showing the tab bar before login. */
.staff-tabs:not(.hidden) {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--panel-border);
}

.staff-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}

.staff-tab-btn.current {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* .rastreo-form is row-direction flex (built for its one password input +
   button) — override to column so this multi-field form stacks instead of
   cramming type/valor/nota/expira/usos/button into one horizontal row. */
.staff-cupon-form {
  flex-direction: column;
  gap: 10px;
}

.staff-cupon-form-row {
  display: flex;
  gap: 10px;
}

.staff-cupon-form-row select,
.staff-cupon-form-row input {
  flex: 1;
  min-width: 0;
}

/* :not(.hidden), same reasoning as .staff-tabs above — a bare "display: flex"
   here would tie with and beat ".hidden { display: none }" on source order. */
.cupon-result:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: -4px 0 16px;
}

.cupon-result #cupon-result-code {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.cupon-result .btn {
  width: auto;
  margin-top: 0;
  padding: 8px 16px;
  min-height: unset;
}

.staff-cupones-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.staff-cupon-row {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staff-cupon-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.staff-cupon-head strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.staff-cupon-head span {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.staff-cupon-status {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.staff-cupon-status.status-active {
  color: var(--res-good);
}

.staff-cupon-status.status-inactive,
.staff-cupon-status.status-expired,
.staff-cupon-status.status-exhausted {
  color: var(--text-dim);
}

.staff-cupon-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.staff-cupon-deactivate {
  width: auto;
  align-self: flex-start;
  margin-top: 0;
  padding: 8px 16px;
  min-height: unset;
  font-size: 0.8rem;
}
