:root {
  --lime: #AFD139;
  --ink: #040707;
  --ink-soft: #2C3320;
  --paper: #FFFFFF;
  --text: #15181A;
  --muted: #5B6168;
  --line: #D5D8DB;
  --desk: #EDEFE8;
  --focus: #040707;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1F21;
    --text: #F2F3F4;
    --muted: #A5ABB1;
    --line: #3C4145;
    --desk: #101214;
    --focus: #F2F3F4;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--desk);
  color: var(--text);
  font: 400 1.0625rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 env(safe-area-inset-bottom);
}
.ticket { width: 100%; max-width: 480px; }
@media (min-width: 520px) {
  body { padding-top: 40px; }
  .ticket { border-radius: 20px; overflow: hidden; }
}

/* La parte de arriba es el talón del ticket: lo único que importa es el estado. */
.stub {
  background: var(--lime);
  color: var(--ink);
  padding: 28px 24px 40px;
  padding-top: calc(28px + env(safe-area-inset-top));
  min-height: 46dvh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 520px) { .stub { min-height: 340px; } }
.shop { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.code { margin: 2px 0 0; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.status {
  margin: auto 0 0;
  padding-top: 32px;
  font-size: clamp(2.75rem, 13.5vw, 3.75rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.stub-logo { border-radius: 14px; }

/* Línea de corte del ticket */
.body {
  position: relative;
  background: var(--paper);
  padding: 28px 24px 24px;
}
.body::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -7px;
  height: 14px;
  background: radial-gradient(circle at 7px 7px, var(--paper) 5px, transparent 5.5px) 0 0 / 22px 14px repeat-x;
}
.body p { margin: 0 0 16px; }
.body p:last-child { margin-bottom: 0; }

.facts { margin: 0; }
.fact { padding: 14px 0; border-bottom: 1px solid var(--line); }
.fact:first-child { padding-top: 0; }
.fact dt { color: var(--muted); font-size: 0.9375rem; }
.fact dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.call {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 18px;
  border-radius: 10px;
  background: var(--lime);
  color: var(--ink);
  text-decoration: none;
}
.call[hidden] { display: none; }

.history h2 { margin: 26px 0 12px; font-size: 1.0625rem; font-weight: 700; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  position: relative;
  padding: 0 0 16px 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
}
.steps li::before {
  content: "";
  position: absolute;
  left: 0; top: .45em;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.steps li:first-child::before { background: var(--lime); box-shadow: 0 0 0 1px var(--ink-soft); }
.steps li::after {
  content: "";
  position: absolute;
  left: 4px; top: 1.1em; bottom: -.3em;
  width: 2px;
  background: var(--line);
}
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.step-name { font-weight: 600; overflow-wrap: anywhere; }
.step-when { color: var(--muted); font-size: 0.9375rem; }
.history:not([hidden]) + .refresh { margin-top: 14px; border-top: 1px solid var(--line); }

.refresh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.9375rem;
}
button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  flex: none;
}
button.primary { width: 100%; background: var(--lime); border-color: var(--lime); color: var(--ink); }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: inherit; font-weight: 600; }
.support { color: var(--muted); font-size: 0.9375rem; }

.brand[hidden] { display: none; }
.stub-logo[hidden] { display: none; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: var(--muted);
  font-size: 0.875rem;
}
.brand img { border-radius: 5px; }
.noscript { padding: 24px; text-align: center; }
.is-loading .status { opacity: .45; }
@media (prefers-reduced-motion: no-preference) {
  .status { transition: opacity .2s; }
}
