:root {
  --bg: #ffffff;
  --bg-off: #f8f9fa;
  --bg-deep: #1A0A2E;
  --ink: #222222;
  --muted: #636363;
  --edge: #e8e8e8;
  --edge-light: #f0f0f0;
  --accent: #4ADE80;
  --accent-dark: #16A34A;
  --collecting: #8B5CF6;
  --production: #F59E0B;
  --forwarder: #06B6D4;
  --transit: #6366F1;
  --delivered: #4ADE80;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 3px rgba(26, 10, 46, 0.06), 0 4px 16px rgba(26, 10, 46, 0.04);
  --shadow-card-hover: 0 2px 6px rgba(26, 10, 46, 0.08), 0 8px 24px rgba(26, 10, 46, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Urbanist', sans-serif;
  background: var(--bg);
  color: var(--muted);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Hero / header area ── */
.hero {
  background: linear-gradient(170deg, rgba(26, 10, 46, 0.04) 0%, rgba(99, 102, 241, 0.03) 40%, transparent 70%);
  border-bottom: 1px solid var(--edge);
  margin: 0 -24px 36px;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-glow { display: none; }

.hero-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 24px 44px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  position: relative;
}

.hero-title-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.hero-mascot {
  width: 80px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(26, 10, 46, 0.12));
  transition: transform 300ms ease;
}

.hero-mascot:hover {
  transform: rotate(-3deg) scale(1.05);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
  color: var(--collecting);
  margin: 0 0 8px;
}

h1, h2, h3 { margin: 0 0 8px; color: var(--ink); }

h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 24px;
  font-weight: 700;
}

h3 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hero-text {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.muted, #current-step-description, .support-card p {
  color: var(--muted);
  line-height: 1.55;
}

/* ── Lookup card ── */
.lookup-card {
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 24px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.lookup-card label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.lookup-card input {
  width: 100%;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Urbanist', sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.lookup-card input::placeholder {
  color: #b0b0b0;
}

.lookup-card input:focus {
  outline: none;
  border-color: var(--collecting);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.lookup-card button {
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Urbanist', sans-serif;
  cursor: pointer;
  background: var(--ink);
  color: var(--bg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 200ms ease, box-shadow 200ms ease, transform 100ms ease;
}

.lookup-card button:hover {
  background: var(--bg-deep);
  box-shadow: 0 4px 14px rgba(26, 10, 46, 0.2);
}

.lookup-card button:active {
  transform: scale(0.98);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: #dc2626;
  font-weight: 500;
  font-size: 13px;
}

/* ── Results ── */
.result-shell {
  display: grid;
  gap: 32px;
}

.hidden { display: none !important; }

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 24px;
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.result-header .eyebrow {
  margin-bottom: 4px;
}

.step-chip {
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Preview cards ── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.preview-card {
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  align-items: start;
  min-height: 120px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.preview-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.preview-card img {
  width: 80px;
  height: 112px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-sm);
  background: var(--bg-off);
  padding: 4px;
}

.preview-card .placeholder {
  width: 80px;
  height: 112px;
  border-radius: var(--radius-sm);
  background: var(--bg-off);
  display: grid;
  place-items: center;
  color: #b0b0b0;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 14px;
  text-transform: uppercase;
  border: 1px solid var(--edge-light);
}

.preview-copy { min-width: 0; }

.preview-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.preview-descriptor {
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-meta {
  display: grid;
  gap: 6px;
}

.preview-variant,
.preview-qty {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-off);
  border: 1px solid var(--edge-light);
  font-size: 12px;
  color: var(--muted);
}

.preview-variant {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.preview-variant--muted {
  color: #b0b0b0;
}

.preview-qty {
  color: var(--ink);
  font-weight: 700;
  width: fit-content;
  white-space: nowrap;
}

/* ── Status panel ── */
.status-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 22px 24px;
  align-items: start;
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.status-panel h3 {
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  font-size: 16px;
}

.latest-tracking {
  min-width: 240px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-off);
  border: 1px solid var(--edge-light);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.latest-tracking strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 4px;
}

.latest-tracking div {
  font-size: 13px;
}

.carrier-brand {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--edge);
}

.carrier-brand img {
  width: 56px;
  height: 34px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--edge-light);
  padding: 3px;
}

.carrier-brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.carrier-brand-copy strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 0;
}

.carrier-brand-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

/* ── Timeline ── */
.timeline-shell {
  display: grid;
  gap: 14px;
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 0;
  padding: 48px 6px 8px;
  overflow-x: auto;
  overflow-y: visible;
  --timeline-progress: 0%;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 44px;
  right: 44px;
  top: 64px;
  height: 4px;
  border-radius: 999px;
  background: var(--edge);
}

.timeline::after {
  content: "";
  position: absolute;
  left: 44px;
  top: 64px;
  height: 4px;
  width: var(--timeline-progress);
  max-width: calc(100% - 88px);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--collecting), var(--transit), var(--delivered));
}

.timeline.is-transit-expanded {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: max-content;
}

.timeline.is-transit-expanded::before,
.timeline.is-transit-expanded::after {
  display: none;
}

/* ── Timeline points ── */
.timeline-point {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  background: none;
  border: none;
  padding: 0 6px 10px;
  cursor: pointer;
  color: inherit;
  font-family: 'Urbanist', sans-serif;
}

.timeline-point[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -100%);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.timeline-point[data-tooltip]:hover::after,
.timeline-point[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 6px));
}

.timeline-point.is-compact {
  width: 78px;
  padding-left: 3px;
  padding-right: 3px;
}

.timeline-point.is-compact .timeline-label {
  font-size: 11px;
}

.timeline-point.is-compact .timeline-date {
  font-size: 10px;
}

.timeline-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--edge);
  background: var(--tone, var(--collecting));
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.timeline-point:hover .timeline-dot,
.timeline-point.is-active .timeline-dot {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.timeline-label {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.15;
}

.timeline-point.is-current .timeline-label,
.timeline-point.is-completed .timeline-label,
.timeline-point.is-active .timeline-label {
  color: var(--ink);
}

.timeline-point.is-upcoming .timeline-label,
.timeline-point.is-upcoming .timeline-date {
  color: #c0c0c0;
}

.timeline-point.is-upcoming .timeline-dot {
  background: transparent;
  border: 2px dashed var(--edge);
  box-shadow: none;
}

.timeline-point.is-route-open .timeline-dot {
  transform: scale(1.2);
}

.timeline-date {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}

.timeline-eta {
  font-size: 10px;
  color: #b0b0b0;
  text-align: center;
  font-weight: 500;
  font-style: italic;
}

/* ── Transit route strip ── */
.timeline-route {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 0 6px 12px;
  min-width: max-content;
}

.timeline-route.is-dense {
  gap: 8px;
}

.timeline-route.is-very-dense {
  gap: 6px;
}

.timeline-route.is-snake {
  display: grid;
  grid-template-columns: repeat(var(--snake-columns, 6), minmax(72px, 1fr));
  grid-template-rows: repeat(auto-fill, auto);
  gap: 28px 8px;
  width: min(100%, 720px);
  min-width: 0;
  padding: 16px 10px 24px;
}

.timeline-route::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 13px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(74, 222, 128, 0.15));
}

.timeline-route.is-snake::before,
.timeline-route.is-snake::after {
  display: none;
}

/* ── Route points ── */
.route-point {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 120px;
  flex: 0 0 120px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font-family: 'Urbanist', sans-serif;
}

.timeline-route.is-dense .route-point {
  width: 105px;
  flex-basis: 105px;
}

.timeline-route.is-very-dense .route-point {
  width: 86px;
  flex-basis: 86px;
}

.timeline-route.is-snake .route-point,
.timeline-route.is-snake.is-dense .route-point,
.timeline-route.is-snake.is-very-dense .route-point {
  width: auto;
  min-width: 0;
  flex-basis: auto;
}

.route-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid white;
  background: var(--transit);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: white;
  line-height: 1;
  letter-spacing: -0.02em;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.route-point.is-active .route-dot,
.route-point:hover .route-dot {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.route-label {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-route.is-very-dense .route-label {
  font-size: 10.5px;
  -webkit-line-clamp: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.route-date {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-off);
  border: 1px solid var(--edge-light);
}

.timeline-route.is-very-dense .route-date {
  display: none;
}

/* ── Snake SVG ── */
.timeline-route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.timeline-route-path-bg {
  fill: none;
  stroke: var(--edge);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-route-path {
  fill: none;
  stroke: rgba(99, 102, 241, 0.5);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-route-tail {
  fill: none;
  stroke: rgba(74, 222, 128, 0.3);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 6 8;
}

/* ── Timeline detail ── */
.timeline-detail {
  padding: 16px 20px;
  min-height: 100px;
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.timeline-detail h4 {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.timeline-detail p,
.timeline-detail small {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.timeline-detail small {
  display: block;
  margin-top: 8px;
  font-weight: 500;
  font-size: 12px;
}

/* ── Route map ── */
.route-map-panel {
  padding: 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--bg);
  box-shadow: var(--shadow-card);
}

.route-map-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.route-map-header h4 {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.route-map-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.route-map-canvas {
  width: 100%;
  height: clamp(320px, 42vw, 480px);
  border-radius: var(--radius-md);
  border: 1px solid var(--edge);
  overflow: hidden;
  background: linear-gradient(180deg, #1a1535 0%, #0d0920 100%);
}

.route-map-canvas .leaflet-container {
  background: transparent;
}

.route-map-canvas .leaflet-control-attribution {
  background: rgba(26, 10, 46, 0.8);
  color: rgba(255, 255, 255, 0.5);
  border-radius: 8px 0 0 0;
  padding: 2px 8px;
  font-size: 10px;
  font-family: 'Urbanist', sans-serif;
}

.route-map-canvas .leaflet-control-attribution a {
  color: rgba(255, 255, 255, 0.6);
}

.route-map-canvas .leaflet-control-zoom a {
  background: rgba(26, 10, 46, 0.85);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(99, 102, 241, 0.2);
  font-family: 'Urbanist', sans-serif;
  font-weight: 700;
}

.route-map-canvas .leaflet-control-zoom a:hover {
  background: rgba(45, 27, 105, 0.95);
  color: white;
}

.route-map-canvas .leaflet-image-layer {
  filter: saturate(0.65) contrast(1.1) brightness(0.8);
}

.route-map-canvas .leaflet-overlay-pane svg {
  overflow: visible;
}

.route-map-tooltip {
  background: rgba(26, 10, 46, 0.9);
  color: white;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Urbanist', sans-serif;
}

.route-map-tooltip::before {
  display: none;
}

.route-map-empty {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-off);
  color: var(--muted);
  font-size: 14px;
}

/* ── Support card ── */
.support-card {
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  background: var(--bg-deep);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(26, 10, 46, 0.15);
}

.support-card h3 {
  color: #ffffff;
  text-transform: none;
  letter-spacing: normal;
  font-size: 18px;
  font-weight: 700;
}

.support-card p {
  color: rgba(255, 255, 255, 0.65) !important;
}

.support-link {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Urbanist', sans-serif;
  cursor: pointer;
  background: transparent;
  color: #ffffff;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background 200ms ease, border-color 200ms ease;
}

.support-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ── Links ── */
.latest-tracking a {
  color: var(--transit);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  transition: border-color 200ms ease;
}

.latest-tracking a:hover {
  border-color: var(--transit);
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .hero-inner {
    grid-template-columns: 1fr;
    padding: 28px 24px 32px;
  }

  .hero {
    margin: 0 -24px 24px;
  }

  .hero-mascot {
    width: 64px;
  }

  .result-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-panel {
    grid-template-columns: 1fr;
  }

  .support-card {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px;
  }

  .preview-grid { grid-template-columns: 1fr; }

  .timeline {
    grid-template-columns: repeat(5, minmax(100px, 100px));
    padding-bottom: 2px;
  }

  .timeline.is-transit-expanded {
    flex-wrap: wrap;
    gap: 2px;
    min-width: 0;
  }

  .timeline.is-transit-expanded .timeline-route {
    flex-basis: 100%;
    width: 100%;
    min-width: 0;
  }

  .timeline-route {
    gap: 8px;
  }

  .timeline-route.is-snake {
    gap: 22px 4px;
    padding: 14px 6px 20px;
    width: 100%;
  }

  .timeline-route.is-snake .route-label {
    font-size: 10px;
  }

  .route-point {
    width: 100px;
    flex-basis: 100px;
  }

  .route-map-header {
    display: grid;
  }

  .route-map-canvas {
    height: clamp(260px, 65vw, 360px);
  }
}
