:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --dark: #0f172a;
  --soft: #f8fafc;
  --accent: #2563eb;
  --ok: #16a34a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 400px at 50% -120px, #dbeafe 0%, rgba(219, 234, 254, 0) 70%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.trackShell {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.heroCard, .lookupCard, .statusCard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06);
}

.heroCard {
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
  font-size: 11px;
  color: var(--muted);
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 4.5vw, 40px); margin-bottom: 6px; line-height: 1.05; letter-spacing: -.02em; }
h2 { margin-bottom: 6px; }
h3 { font-size: 16px; margin-bottom: 10px; }
.subtext, .muted { color: var(--muted); }
.subtext { margin: 0; }
.muted { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }

.homeLink, button, .carrierLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--dark);
  color: #fff;
  text-decoration: none;
  border: 0;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease;
}
.homeLink:hover, button:hover, .carrierLink:hover { background: #1e293b; transform: translateY(-1px); }

.lookupCard, .statusCard { padding: 22px 24px; }
.lookupCard { margin-bottom: 16px; }
.lookupCard h2 { font-size: 20px; }
.lookupCard p { color: var(--muted); font-size: 14px; }
.lookupGrid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
input {
  min-height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  background: var(--soft);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }

/* ── Order header ─────────────────────────────────────────────────────────── */
.orderTop {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}
.orderThumb {
  width: 112px;
  height: 128px;
  border: 1px solid var(--line);
  border-radius: 16px;
  object-fit: contain;
  background: var(--soft);
}
.orderHead { min-width: 0; }
.statusPill {
  display: inline-flex;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  margin-bottom: 10px;
}
.orderLabel {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
/* Checkout session ids (cs_live_…) are ~70 characters with no spaces. */
.orderId {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(15px, 2.2vw, 20px);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin-bottom: 8px;
}

/* ── Progress ─────────────────────────────────────────────────────────────── */
.timeline {
  --progress: 0%;
  position: relative;
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  grid-auto-flow: column;
}
.timeline::before, .timeline::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 10%;
  height: 3px;
  border-radius: 3px;
}
.timeline::before { right: 10%; background: var(--line); }
.timeline::after { width: calc(80% * var(--progress) / 100%); background: var(--ok); }
.step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 0 4px;
}
.dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid #cbd5e1;
  background: #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}
.step.complete .dot { background: var(--ok); border-color: var(--ok); }
.step.active .dot { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(37, 99, 235, .15); }
.stepTitle { font-weight: 800; font-size: 13px; line-height: 1.3; }
.step:not(.complete):not(.active) .stepTitle { color: var(--muted); font-weight: 700; }
.stepDate { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Tracking + items ─────────────────────────────────────────────────────── */
.trackingBox {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.trackingBox h3 { margin-bottom: 6px; }
.trackingFacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.trackingFacts dt { font-size: 12px; color: var(--muted); font-weight: 700; }
.trackingFacts dd { margin: 2px 0 0; font-weight: 800; overflow-wrap: anywhere; }

.itemsHeading { margin-top: 24px; }
.itemGrid { display: grid; gap: 10px; }
.itemRow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.itemThumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: contain;
  background: var(--soft);
  border: 1px solid var(--line);
}
.itemText { flex: 1 1 auto; min-width: 0; }
.itemText strong { display: block; overflow-wrap: anywhere; }
.itemQty { color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; }

.error { color: #b91c1c; font-weight: 800; margin: 0; }
.loading { color: var(--muted); }

@media (max-width: 700px) {
  .trackShell { padding-top: 16px; }
  .heroCard { flex-direction: column; align-items: stretch; }
  .homeLink { width: 100%; }
  .lookupGrid { grid-template-columns: 1fr; }
  .orderTop { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: start; }
  .orderThumb { width: 72px; height: 84px; border-radius: 12px; }
  /* Vertical progress on phones: five labels don't fit across. */
  .timeline { grid-auto-flow: row; grid-template-columns: 1fr; gap: 14px; }
  .timeline::before, .timeline::after { top: 16px; left: 15px; right: auto; width: 3px; }
  .timeline::before { bottom: 16px; height: auto; }
  .timeline::after { height: calc((100% - 32px) * var(--progress) / 100%); width: 3px; }
  .step { flex-direction: row; text-align: left; align-items: center; gap: 12px; }
}
