:root {
  --qb-bg: #fff7e8;
  --qb-card: #ffffff;
  --qb-navy: #06245c;
  --qb-muted: #6b7280;
  --qb-yellow: #f9b400;
  --qb-orange: #ff6a00;
  --qb-blue: #1268b3;
  --qb-blue-dark: #07569c;
  --qb-green: #18a34a;
  --qb-red: #ef4444;
  --qb-border: rgba(6, 36, 92, 0.08);
  --qb-shadow: 0 14px 35px rgba(6, 36, 92, 0.08);
  --secondary: #18a34a;
  --surface: #1e293b;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--qb-navy);
  font-family: Inter, Nunito, Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.9), transparent 35%),
    linear-gradient(180deg, #fff4d8 0%, #fffaf0 100%);
}

.qr-portal {
  min-height: 100dvh;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.content-state {
  animation: pageIn 320ms ease both;
}

.browser-bar {
  height: 50px;
  border-radius: 17px;
  margin: 0 auto 16px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  color: rgba(6, 36, 92, 0.68);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(6, 36, 92, 0.04);
  backdrop-filter: blur(12px);
  font-weight: 800;
}

.browser-host {
  justify-self: center;
  color: #1f2937;
  font-size: 20px;
}

.browser-refresh {
  justify-self: end;
  color: var(--qb-blue);
  font-size: 28px;
}

.business-header {
  text-align: center;
  margin: 2px 0 14px;
}

.business-header h1 {
  margin: 0;
  color: var(--qb-navy);
  font-family: Nunito, Manrope, system-ui, sans-serif;
  font-size: clamp(38px, 11vw, 48px);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: 0;
}

.business-header p {
  margin: 6px 0 0;
  color: var(--qb-muted);
  font-size: clamp(17px, 5vw, 21px);
  font-weight: 900;
}

.token-card {
  background: var(--qb-card);
  border-radius: 30px;
  padding: 26px 18px 22px;
  box-shadow: var(--qb-shadow);
  border: 1px solid var(--qb-border);
  text-align: center;
}

.token-display {
  font-family: Nunito, Manrope, system-ui, sans-serif;
  font-size: clamp(54px, 17vw, 88px);
  line-height: 0.92;
  font-weight: 900;
  color: var(--qb-yellow);
  letter-spacing: 0;
  white-space: nowrap;
}

.status-pill {
  width: fit-content;
  max-width: 100%;
  margin: 20px auto 12px;
  padding: 10px 22px;
  border-radius: 999px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  animation: pillIn 240ms ease both;
}

.status-pill.waiting {
  color: #93620a;
  background: #fff7dc;
  border: 1px solid #f6df94;
}

.status-pill.info {
  color: var(--qb-blue);
  background: #eef7ff;
  border: 1px solid #cfe7fb;
}

.status-pill.danger {
  color: #fff;
  background: linear-gradient(135deg, #ff2f68, #f45d4f);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.25);
}

.status-pill.success {
  color: #fff;
  background: linear-gradient(135deg, #18a34a, #29c36a);
}

.status-pill.warning,
.status-pill.neutral {
  color: #5b6472;
  background: #f1f3f6;
  border: 1px solid #e3e6eb;
}

.pill-icon {
  font-size: 28px;
  line-height: 1;
}

.primary-message {
  margin: 0;
  color: var(--qb-navy);
  font-size: clamp(21px, 6vw, 28px);
  line-height: 1.16;
  font-weight: 900;
}

.instruction {
  max-width: 330px;
  margin: 6px auto 0;
  color: var(--qb-muted);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--steps), minmax(0, 1fr));
  gap: 0;
  margin-top: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 26px;
  left: calc(100% / var(--steps) / 2);
  right: calc(100% / var(--steps) / 2);
  height: 4px;
  border-radius: 999px;
  background: #e6e8ec;
}

.timeline-step {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 9px;
  min-width: 0;
  color: #8a909a;
  font-size: 15px;
  font-weight: 900;
}

.timeline-step span {
  max-width: 100%;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.timeline-dot {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #8d95a1;
  background: #f8f9fb;
  border: 1px solid #e7e9ee;
  font-size: 24px;
}

.timeline-step.done .timeline-dot {
  color: var(--qb-orange);
  background: #fff7db;
  border-color: #f6d675;
}

.timeline-step.done span {
  color: var(--qb-muted);
}

.timeline-step.current .timeline-dot {
  color: var(--qb-blue);
  background: #f2f8ff;
  border-color: var(--qb-blue);
  box-shadow: 0 0 0 8px rgba(18, 104, 179, 0.08);
  animation: softPulse 1800ms ease-in-out infinite;
}

.token-card.danger .timeline-step.current .timeline-dot {
  color: #fff;
  background: var(--qb-red);
  border-color: var(--qb-red);
  box-shadow: 0 0 0 9px rgba(239, 68, 68, 0.16);
}

.timeline-step.current span {
  color: var(--qb-navy);
}

.timeline.expired .timeline-dot {
  color: #a1a7b1;
  background: #f2f3f5;
  border-color: #e4e6ea;
  box-shadow: none;
  animation: none;
}

.context-chip {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--qb-navy);
  background: #fffdf8;
  border: 1px solid rgba(6, 36, 92, 0.08);
  text-align: left;
  font-size: 16px;
  font-weight: 900;
}

.context-chip span {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--qb-yellow);
  background: #fff6db;
}

.info-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.info-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 21px;
  color: var(--qb-navy);
  background: var(--qb-card);
  border: 1px solid var(--qb-border);
  box-shadow: 0 10px 24px rgba(6, 36, 92, 0.06);
}

.info-icon {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: var(--qb-yellow);
  background: #fff6db;
  font-size: 24px;
}

.info-row-label,
.info-row-value {
  font-size: 20px;
  font-weight: 900;
}

.info-row-value {
  justify-self: end;
  white-space: nowrap;
}

.portal-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 60px;
  border-radius: 20px;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.primary-action {
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, var(--qb-blue), #1b75c9);
  box-shadow: 0 12px 26px rgba(18, 104, 179, 0.2);
}

.secondary-action {
  color: var(--qb-blue);
  border: 2px solid var(--qb-blue);
  background: #fff;
}

.primary-action:active,
.secondary-action:active,
.promo-button:active {
  transform: scale(0.98);
}

.primary-action .icon,
.secondary-action .icon {
  font-size: 28px;
  line-height: 1;
}

.spinning {
  animation: spin 700ms linear infinite;
}

.powered-by {
  margin: 12px 0;
  color: var(--qb-muted);
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}

.powered-by strong {
  color: var(--qb-navy);
  font-weight: 900;
}

.promo-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 128px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: var(--qb-card);
  border: 1px solid var(--qb-border);
  box-shadow: var(--qb-shadow);
}

.slip-illustration {
  width: 78px;
  height: 78px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fdf4d6 0%, #06306d 72%);
}

.slip {
  width: 47px;
  min-height: 58px;
  padding: 11px 4px;
  border-radius: 7px;
  display: block;
  color: var(--qb-navy);
  background: #fff;
  box-shadow: 0 2px 0 var(--qb-yellow);
  transform: rotate(-4deg);
  text-align: center;
  font-size: 17px;
  font-weight: 900;
}

.slip small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 1px;
}

.promo-copy h2 {
  margin: 0 0 5px;
  color: var(--qb-navy);
  font-size: 21px;
  line-height: 1.05;
  font-weight: 900;
}

.promo-copy p {
  margin: 0;
  color: #1d2d4f;
  font-size: 15px;
  line-height: 1.32;
  font-weight: 700;
}

.promo-button {
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 18px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  color: #051d4c;
  background: linear-gradient(135deg, #ffd94c, #ffb21a);
  text-decoration: none;
  text-align: center;
  font-size: 15px;
  line-height: 1.12;
  font-weight: 900;
}

.promo-button span {
  font-size: 28px;
}

.privacy-footer {
  max-width: 390px;
  margin: 10px auto 0;
  color: rgba(6, 36, 92, 0.58);
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

.loading-state,
.error-state {
  min-height: calc(100dvh - 32px);
  display: grid;
  align-content: center;
  gap: 12px;
  text-align: center;
}

.loading-state p,
.error-state p {
  margin: 4px 0 0;
  color: var(--qb-muted);
  font-size: 16px;
  font-weight: 800;
}

.error-state {
  padding: 20px;
}

.error-mark {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--qb-red);
  font-size: 28px;
  font-weight: 900;
}

.error-state h1 {
  margin: 8px 0 0;
  color: var(--qb-navy);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
}

.skeleton {
  border-radius: 20px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.5));
  background-size: 220% 100%;
  animation: shimmer 1200ms ease-in-out infinite;
}

.browser-skeleton { height: 50px; }
.title-skeleton { width: 78%; height: 46px; margin: 10px auto 0; }
.subtitle-skeleton { width: 48%; height: 22px; margin: 0 auto; }
.token-skeleton { height: 250px; border-radius: 30px; }
.row-skeleton { height: 70px; }

@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pillIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 390px) {
  .qr-portal {
    padding-left: 12px;
    padding-right: 12px;
  }

  .token-card {
    border-radius: 28px;
    padding: 22px 14px 19px;
  }

  .status-pill {
    font-size: 23px;
    padding: 9px 18px;
  }

  .timeline-dot {
    width: 48px;
    height: 48px;
    font-size: 21px;
  }

  .timeline::before {
    top: 24px;
  }

  .timeline-step {
    font-size: 12px;
  }

  .info-row-label,
  .info-row-value {
    font-size: 18px;
  }

  .promo-card {
    grid-template-columns: 76px minmax(0, 1fr) 118px;
    padding: 12px;
  }

  .promo-copy h2 {
    font-size: 19px;
  }

  .promo-copy p,
  .promo-button {
    font-size: 14px;
  }
}

@media (max-width: 370px) {
  .business-header h1 {
    font-size: 34px;
  }

  .token-display {
    font-size: clamp(50px, 16vw, 60px);
  }

  .info-row {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    min-height: 72px;
  }

  .info-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .info-row-value {
    grid-column: 2;
    justify-self: start;
    font-size: 17px;
  }

  .primary-action,
  .secondary-action {
    min-height: 56px;
    font-size: 18px;
  }

  .promo-card {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .promo-button {
    grid-column: 1 / -1;
    min-height: 54px;
  }
}

.tv-board {
  max-width: none;
  height: 100vh;
  display: flex;
  padding: 4rem;
  background: #0f172a;
  color: #f8fafc;
}

.tv-main {
  display: flex;
  width: 100%;
  gap: 4rem;
}

.tv-serving,
.tv-upcoming {
  flex: 1;
  background: var(--surface);
  border-radius: 40px;
  padding: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.3);
}

.tv-serving {
  border: 4px solid var(--secondary);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(16, 185, 129, 0.1));
}

.tv-serving h1 {
  font-size: 4rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-bottom: 1rem;
}

.tv-serving .tv-token {
  font-size: 14rem;
  font-weight: 800;
  line-height: 1;
}

.tv-upcoming h2 {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.tv-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tv-upcoming-item {
  font-size: 4rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 1.5rem;
}
