:root {
  --ink: #0b0e14;
  --ink-2: #11161f;
  --panel: #151b26;
  --panel-2: #1b2230;
  --line: #26303f;
  --text: #eef2f8;
  --muted: #9aa7ba;
  --faint: #6c7a8f;
  --accent: #f6b23c;
  --accent-2: #ffce74;
  --green: #4bd08b;
  --blue: #56a8ff;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

/* the hidden attribute must always win over display rules below */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(246, 178, 60, 0.13), transparent 60%),
    radial-gradient(900px 520px at 8% 4%, rgba(86, 168, 255, 0.08), transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 56px);
  max-width: 1200px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-name {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: 18px;
}
.top-nav { display: flex; gap: 26px; }
.top-nav a {
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.2s;
}
.top-nav a:hover { color: var(--text); }

main { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 56px) 80px; }

/* hero */
.hero { padding: 48px 0 40px; max-width: 720px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 14px;
}
.hero h1 {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.lede { color: var(--muted); font-size: 17px; margin: 0 0 28px; max-width: 520px; }

.search {
  display: flex;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
  max-width: 560px;
}
.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 17px;
  font-family: "Sora", sans-serif;
  letter-spacing: 0.08em;
  padding: 12px 14px;
}
.search input::placeholder { color: var(--faint); letter-spacing: 0.14em; }
.search button {
  border: none;
  border-radius: 9px;
  padding: 0 26px;
  font-weight: 600;
  font-size: 15px;
  color: #1a1204;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  cursor: pointer;
  transition: transform 0.15s, filter 0.2s;
}
.search button:hover { filter: brightness(1.05); }
.search button:active { transform: translateY(1px); }
.hint { color: var(--faint); font-size: 13.5px; margin: 14px 2px 0; }
.hint a { color: var(--muted); border-bottom: 1px solid var(--line); }

/* result */
.result { animation: rise 0.5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.status-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.status-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.status-eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 10px;
}
.status-label {
  font-family: "Sora", sans-serif;
  font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.02;
  background: linear-gradient(180deg, #ffffff, #cfd7e3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.status-label.delivered {
  background: linear-gradient(180deg, #7ce6ab, #37b877);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.status-label.exception {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* action / hold note banner */
.hold-note {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(110deg, rgba(246, 178, 60, 0.18), rgba(246, 178, 60, 0.05));
  border: 1px solid rgba(246, 178, 60, 0.45);
  overflow: hidden;
  animation: note-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both, note-glow 2.8s ease-in-out infinite;
}
.hold-note::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 224, 160, 0.28), transparent);
  animation: note-sheen 3.6s ease-in-out infinite;
}
.hold-note-icon {
  color: #1a1204;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 0 5px rgba(246, 178, 60, 0.14);
}
.hold-note-cap {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10.5px;
  color: var(--accent);
  margin-bottom: 3px;
  font-weight: 600;
}
.hold-note-text { font-size: 15.5px; font-weight: 600; color: var(--text); }
@keyframes note-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes note-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246, 178, 60, 0); }
  50% { box-shadow: 0 0 22px 0 rgba(246, 178, 60, 0.22); }
}
@keyframes note-sheen {
  0% { left: -60%; }
  55%, 100% { left: 130%; }
}

/* ship-to + barcode */
.ship-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.ship-to-body { font-size: 14px; line-height: 1.55; color: var(--muted); margin-top: 6px; }
.ship-to-body .st-name { font-weight: 600; font-size: 15px; color: var(--text); }
.ship-to-body .muted { color: var(--faint); }
.barcode-box {
  background: #f4f6fa;
  border-radius: 10px;
  padding: 12px 16px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 220px;
}
.barcode { width: 220px; height: 52px; }
.barcode-num {
  font-family: "Sora", sans-serif;
  letter-spacing: 0.18em;
  font-size: 12.5px;
  color: #12161d;
  font-weight: 600;
}
@media (max-width: 620px) {
  .ship-meta { grid-template-columns: 1fr; }
}
.status-detail { color: var(--muted); margin: 6px 0 0; font-size: 14.5px; }
.status-eta { text-align: right; }
.eta-cap {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 4px;
}
.eta-val { font-family: "Sora", sans-serif; font-weight: 600; font-size: 18px; }

/* progress */
.progress { margin: 28px 0 8px; }
.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-fill.exception { background: linear-gradient(90deg, #e0762f, #ff9a6b); }
.progress-steps.exception li.current span {
  background: #ff9a6b;
  box-shadow: 0 0 0 5px rgba(255, 143, 107, 0.2);
}
.progress-steps {
  list-style: none;
  display: flex;
  justify-content: space-between;
  padding: 0;
  margin: 16px 0 0;
}
.progress-steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
  flex: 1;
  text-align: center;
}
.progress-steps li span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--line);
  border: 2px solid var(--ink-2);
  transition: background 0.3s, box-shadow 0.3s;
}
.progress-steps li.done { color: var(--muted); }
.progress-steps li.done span { background: var(--accent); }
.progress-steps li.current { color: var(--text); font-weight: 600; }
.progress-steps li.current span {
  background: var(--accent-2);
  box-shadow: 0 0 0 5px rgba(246, 178, 60, 0.18);
}

/* route line */
.route-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.route-cap {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 3px;
}
.route-end.right { text-align: right; }
.route-city { font-family: "Sora", sans-serif; font-weight: 600; font-size: 17px; }
.route-mid { text-align: center; }
.track-num {
  display: block;
  font-family: "Sora", sans-serif;
  letter-spacing: 0.12em;
  font-size: 14px;
  color: var(--accent);
}
.service { display: block; color: var(--faint); font-size: 12.5px; margin-top: 3px; }

/* facts strip */
.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.facts .fact-cap {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  color: var(--faint);
  margin-bottom: 5px;
}
.facts b { font-weight: 600; font-size: 14.5px; }

@media (max-width: 620px) {
  .facts { grid-template-columns: 1fr 1fr; }
}

/* panels */
.panels {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
}
.map-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 460px;
}
#map { position: absolute; inset: 0; background: #0d1117; }
.map-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 500;
  background: rgba(11, 14, 20, 0.82);
  border: 1px solid var(--line);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 7px;
  backdrop-filter: blur(6px);
}
.map-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(75, 208, 139, 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(75, 208, 139, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(75, 208, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(75, 208, 139, 0); }
}
.map-badge.delivered { color: var(--green); }
.map-badge.delivered::before { animation: none; box-shadow: none; }
.map-badge.held { color: var(--accent); }
.map-badge.held::before { background: var(--accent); animation: none; box-shadow: none; }

.timeline-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.timeline-wrap h2 {
  font-family: "Sora", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 18px;
  color: var(--muted);
  text-transform: uppercase;
}
.timeline { list-style: none; margin: 0; padding: 0; position: relative; max-height: 520px; overflow-y: auto; }
.timeline li {
  position: relative;
  padding: 0 4px 24px 28px;
  border-left: 2px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--faint);
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line);
}
.timeline li.tl-done::before { background: var(--green); }
.timeline li.tl-hold::before { background: var(--accent); }
.timeline li.tl-out::before { background: var(--accent-2); }
.timeline li.tl-move::before { background: var(--blue); }
.timeline li.top::before {
  width: 16px; height: 16px; left: -9px;
  box-shadow: 0 0 0 5px rgba(246, 178, 60, 0.14);
}
.timeline li.top .tl-status { color: var(--text); }
.tl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.tl-status { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; }
.tl-time { color: var(--faint); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.tl-loc { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }
.tl-detail { color: var(--faint); font-size: 12.5px; margin: 4px 0 0; line-height: 1.45; }
.timeline li.tl-hold .tl-detail { color: var(--accent-2); }

/* empty */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  animation: rise 0.4s ease both;
}
.empty p {
  font-family: "Sora", sans-serif;
  font-size: 18px;
}

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px clamp(20px, 5vw, 56px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--faint);
  font-size: 12.5px;
  flex-wrap: wrap;
}

/* leaflet dark tweaks */
.leaflet-container { background: #0d1117; font-family: "Inter", sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.leaflet-popup-content { font-size: 13px; }
.leaflet-bar a, .leaflet-control-attribution {
  background: rgba(17, 22, 31, 0.9) !important;
  color: var(--muted) !important;
  border-color: var(--line) !important;
}
.leaflet-control-attribution a { color: var(--faint) !important; }

.pkg-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}
.pkg-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #1a1204;
  box-shadow: 0 0 0 6px rgba(246, 178, 60, 0.22);
}
.pkg-marker::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(246, 178, 60, 0.5);
  animation: ripple 2s infinite ease-out;
}
@keyframes ripple {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(1.15); opacity: 0; }
}
.end-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #0d1117;
}
.end-dot.origin { background: var(--blue); }
.end-dot.dest { background: var(--green); }

/* status label floating above the moving marker */
.leaflet-tooltip.pkg-tip {
  background: rgba(11, 14, 20, 0.92);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 5px 11px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  animation: tip-pulse 1.8s ease-in-out infinite;
}
.leaflet-tooltip.pkg-tip::before { border-top-color: var(--accent); }
.leaflet-tooltip.pkg-tip.hold { border-color: var(--accent); color: var(--accent-2); }
.leaflet-tooltip.pkg-tip.done {
  border-color: var(--green); color: var(--green); animation: none;
}
.leaflet-tooltip.pkg-tip.done::before { border-top-color: var(--green); }
@keyframes tip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (max-width: 880px) {
  .panels { grid-template-columns: 1fr; }
  .map-wrap { min-height: 380px; }
  .top-nav { gap: 16px; }
}
