:root {
  --bg: #0a0a0a;
  --bg-elev: #111;
  --bg-card: #161616;
  --line: #242424;
  --text: #f4f4f4;
  --muted: #8a8a8a;
  --accent: #ff5a1f;
  --accent-soft: rgba(255, 90, 31, 0.12);
  --ok: #22c55e;
  --pending: #3a3a3a;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-soft:     cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes barFill {
  from { width: 0; }
  to   { width: var(--w, 0%); }
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
@keyframes spinDots {
  to { transform: rotate(360deg); }
}
@keyframes ringPulse {
  0%   { box-shadow: 0 0 0 1px var(--accent), 0 0 0 0   rgba(255, 90, 31, 0.45); }
  70%  { box-shadow: 0 0 0 1px var(--accent), 0 0 0 14px rgba(255, 90, 31, 0); }
  100% { box-shadow: 0 0 0 1px var(--accent), 0 0 0 0   rgba(255, 90, 31, 0); }
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1a1a1a 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  border-bottom: 1px solid var(--line);
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
}

.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.header .meta {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 56px 24px 80px;
}

.container {
  width: 100%;
  max-width: 880px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero .eyebrow {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  animation: fadeUp 0.6s var(--ease-out-expo) both;
}

.hero h1 {
  font-size: 44px;
  line-height: 1.05;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #c8c8c8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fadeUp 0.7s 0.08s var(--ease-out-expo) both;
}

.hero p {
  color: var(--muted);
  margin: 0 auto;
  max-width: 540px;
  animation: fadeUp 0.7s 0.16s var(--ease-out-expo) both;
}

.card { animation: fadeUp 0.8s 0.18s var(--ease-out-expo) both; }
.brand { animation: fadeIn 0.6s var(--ease-soft) both; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.lookup-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.field-input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 14px 14px;
  font-size: 15px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.25s var(--ease-soft),
              box-shadow 0.25s var(--ease-soft),
              transform 0.25s var(--ease-soft),
              background-color 0.25s var(--ease-soft);
}
@media (hover: hover) {
  .field-input:hover { border-color: #3a3a3a; }
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
  background-color: #141414;
}

.btn {
  position: relative;
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 15px 22px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ff7642 0%, var(--accent) 100%);
  color: #0a0a0a;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 8px 24px -8px rgba(255, 90, 31, 0.55), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.18s var(--ease-soft),
              filter 0.2s ease,
              box-shadow 0.25s var(--ease-soft);
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-soft);
  z-index: -1;
}
@media (hover: hover) {
  .btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 14px 32px -10px rgba(255, 90, 31, 0.7), inset 0 1px 0 rgba(255,255,255,0.3);
  }
  .btn:hover::before { transform: translateX(100%); }
}
.btn:active { transform: translateY(1px) scale(0.98); filter: brightness(0.95); }
.btn[disabled], .btn.is-loading { cursor: progress; opacity: 0.85; }
.btn.is-loading .btn-label { visibility: hidden; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(10, 10, 10, 0.35);
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: spinDots 0.7s linear infinite;
}

.error {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  font-size: 14px;
  animation: shake 0.6s var(--ease-soft) both, fadeIn 0.4s ease both;
}

.errorlist {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  color: #fecaca;
  font-size: 12px;
}

.result {
  margin-top: 32px;
  animation: fadeUp 0.6s var(--ease-out-expo) both;
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.order-number {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.05em;
}

.order-meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: scaleIn 0.5s 0.15s var(--ease-out-back) both, badgePulse 3.6s 1.5s ease-in-out infinite;
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.6);
  animation: ringPulse 1.6s ease-out infinite;
}
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-danger .dot { background: var(--danger); }

.progress-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 28px;
}
.progress-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), #ffb38a);
  border-radius: inherit;
  width: var(--w, 0%);
  animation: barFill 1.1s 0.25s var(--ease-out-expo) both;
}
.progress-bar > span::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
  animation: shimmer 2.4s 1.5s linear infinite;
  border-radius: inherit;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  position: relative;
}

.step {
  position: relative;
  padding-top: 28px;
  text-align: center;
  animation: fadeUp 0.55s calc(var(--i, 0) * 90ms + 350ms) var(--ease-out-expo) both;
}
.step::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--pending);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--line);
}
.step::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: -1;
}
.step:last-child::after { display: none; }

.step.done::before { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.step.done::after { background: var(--ok); }
.step.current::before {
  background: var(--accent);
  animation: ringPulse 1.8s ease-out infinite;
}
.step.done::before {
  transition: background 0.4s var(--ease-soft);
}

.step .label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.step.done .label { color: var(--text); }
.step.current .label { color: var(--accent); font-weight: 600; }

.details,
.suborder-body {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.order-summary {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.order-total {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  animation: fadeUp 0.5s 0.1s var(--ease-out-expo) both;
}
.order-ship { color: var(--muted); font-size: 12px; letter-spacing: 0.05em; }

.suborder {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.012), transparent);
  animation: fadeUp 0.7s calc(var(--i, 0) * 140ms + 200ms) var(--ease-out-expo) both;
  transition: border-color 0.3s var(--ease-soft), box-shadow 0.3s var(--ease-soft);
}
@media (hover: hover) {
  .suborder:hover {
    border-color: rgba(255, 90, 31, 0.25);
    box-shadow: 0 30px 60px -40px rgba(255, 90, 31, 0.4);
  }
}
.suborder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.suborder-title {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.suborder-sub {
  font-family: var(--mono);
  font-size: 15px;
  margin-top: 4px;
}

.detail-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  transition: transform 0.3s var(--ease-soft), border-color 0.3s var(--ease-soft), box-shadow 0.3s var(--ease-soft);
}
@media (hover: hover) {
  .detail-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 90, 31, 0.35);
    box-shadow: 0 18px 40px -20px rgba(255, 90, 31, 0.35);
  }
}
.detail-card:active { transform: scale(0.99); }
.detail-card h3 {
  margin: 0 0 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 600;
}

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-family: var(--mono); font-size: 13px; }

.items { margin: 0; padding: 0; list-style: none; }
.items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  animation: fadeUp 0.45s calc(var(--i, 0) * 70ms + 600ms) var(--ease-out-expo) both;
}
.items li:last-child { border-bottom: 0; }
.items .name { font-size: 14px; }
.items .sku { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.items .qty { font-family: var(--mono); color: var(--accent); font-weight: 600; }

.notes {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg-elev);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 24px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 720px) {
  /* Layout */
  .header { padding: 14px 16px; }
  .header .meta { font-size: 11px; }
  .footer { padding: 22px 16px; }
  .main { padding: 24px 14px calc(56px + env(safe-area-inset-bottom, 0px)); }

  /* Brand */
  .brand img { height: 22px; }

  /* Hero */
  .hero { margin-bottom: 26px; }
  .hero .eyebrow { font-size: 10px; letter-spacing: 0.28em; }
  .hero h1 { font-size: 30px; line-height: 1.08; }
  .hero p { font-size: 14px; }

  /* Card */
  .card { padding: 18px; border-radius: 18px; box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.55); }

  /* Form: stacked, full-width button */
  .lookup-form { grid-template-columns: 1fr; gap: 14px; }
  .field-input { font-size: 16px; padding: 14px 14px; }   /* 16px prevents iOS focus-zoom */
  .btn { width: 100%; min-height: 50px; font-size: 13px; padding: 16px; }

  /* Result head: stack info above summary */
  .result { margin-top: 26px; }
  .result-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 16px;
    margin-bottom: 18px;
  }
  .order-number { font-size: 19px; }
  .order-meta { gap: 4px 14px; font-size: 12px; }
  .order-summary {
    text-align: left;
    align-items: flex-start;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
  .order-total { font-size: 20px; }

  /* Suborder: tighter, badge wraps below title */
  .suborder { padding: 18px; margin-top: 22px; border-radius: 14px; }
  .suborder-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .suborder-body { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
  .details { grid-template-columns: 1fr; }
  .detail-card { padding: 16px; }

  /* Vertical timeline (UPS-style) */
  .timeline {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 4px 0;
  }
  .step {
    padding: 14px 0 14px 36px;
    text-align: left;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .step::before {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
  }
  /* Vertical connector line through the dots */
  .step::after {
    top: 0;
    left: 6px;
    width: 2px;
    height: 100%;
    transform: none;
  }
  .step:last-child::after {
    display: block;
    height: 50%;   /* stop at last dot center */
  }
  .step .label { font-size: 14px; }
  .step.current .label { font-size: 14px; }

  /* Stagger feels nice with vertical layout — slight slide from left */
  .step { animation-name: fadeUpLeft; }

  /* Bigger tap-target for items */
  .items li { padding: 14px 0; }
  .items .name { font-size: 15px; }
}

@keyframes fadeUpLeft {
  from { opacity: 0; transform: translate3d(-10px, 6px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (max-width: 380px) {
  /* iPhone SE-class: tighten more */
  .header .meta { display: none; }
  .hero h1 { font-size: 26px; }
  .order-number { font-size: 17px; }
  .order-total { font-size: 18px; }
  .card, .suborder { padding: 16px; }
}
