:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1b2733;
  --muted: #6b7785;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --done: #16a34a;
  --active: #2563eb;
  --pending: #cbd5e1;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.header { text-align: center; margin-bottom: 28px; }
.brand-logo { max-height: 52px; width: auto; margin: 0 auto 18px; display: block; }
.header h1 { margin: 0 0 6px; font-size: 1.9rem; }
.subtitle { margin: 0; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9rem; }

.field input {
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  margin-top: 4px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: var(--btn-radius, 10px);
  cursor: pointer;
  transition: background 0.15s;
}
button:hover { background: var(--brand-dark); }
button:disabled { opacity: 0.6; cursor: progress; }

.error {
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.result { margin-top: 28px; }
.result[hidden] { display: none; }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: baseline;
  margin-bottom: 20px;
}
.summary .order-no { font-size: 1.3rem; font-weight: 700; }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: capitalize;
  background: #eef2ff;
  color: var(--brand-dark);
}
.badge.delivered { background: #dcfce7; color: #15803d; }
.badge.processing { background: #fef9c3; color: #a16207; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.meta-item .meta-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.meta-item .meta-value { font-weight: 600; }
.meta-item a { color: var(--brand); }

.track-action { margin-top: 4px; }
.track-link {
  display: inline-block;
  padding: 12px 20px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border-radius: var(--btn-radius, 10px);
  text-decoration: none;
  transition: background 0.15s;
}
.track-link:hover { background: var(--brand-dark); }
.track-note { color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }

.timeline-title { font-size: 1rem; margin: 0 0 14px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.event { position: relative; padding: 0 0 22px 36px; }
.event:last-child { padding-bottom: 0; }
.event .dot {
  position: absolute;
  left: 2px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--done);
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--line);
}
.event.latest .dot { background: var(--active); }
.event .event-label { font-weight: 600; }
.event .event-detail { color: var(--muted); font-size: 0.92rem; }
.event .event-time { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a; --card: #1e293b; --ink: #e2e8f0;
    --muted: #94a3b8; --line: #334155;
  }
}
