@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@500;600&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --navy:        #2B388F;
  --navy-light:  #EBEDF7;
  --navy-deep:   #1F2A70;
  --sky:         #25A9E1;
  --sky-light:   #E7F6FC;
  --sky-dark:    #14789F;
  --green:       #27AE60;
  --green-light: #E8F8EF;
  --orange:      #E67E22;
  --orange-light:#FEF5EC;
  --red:         #E74C3C;
  --red-light:   #FFF0EE;
  --grey:        #666;
  --border:      #E0E7F0;
  --bg:          #F5F7FC;
  --blue:        var(--navy);
  --blue-light:  var(--navy-light);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: #1a1a1a;
}

header {
  background: var(--navy);
  border-bottom: 3px solid var(--sky);
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}
.logo { display: flex; align-items: baseline; gap: 6px; }
.logo-chs   { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.logo-group { font-size: 9px; color: rgba(255,255,255,0.65); letter-spacing: 2.5px; text-transform: uppercase; }
.header-label { font-size: 12px; color: rgba(255,255,255,0.65); }
.header-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.header-tagline .rule {
  width: 8px;
  height: 1px;
  background: rgba(255,255,255,0.45);
  flex-shrink: 0;
}
.header-tagline .text {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
}

.scroll-area {
  position: fixed;
  top: 68px; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
}

main {
  width: 100%;
  padding: 16px 0 8px;
}

.status-hero {
  background: #fff;
  padding: 20px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.do-number {
  font-size: 12px;
  color: var(--grey);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.do-number span { font-weight: 600; color: var(--blue); font-size: 14px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
.status-badge.completed    { background: var(--green-light); color: var(--green); }
.status-badge.partial      { background: var(--orange-light); color: var(--orange); }
.status-badge.failed       { background: var(--red-light); color: var(--red); }
.status-badge.out_delivery { background: var(--sky-light); color: var(--sky-dark); }
.status-badge.pending      { background: #EEF0F4; color: var(--grey); }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}
.completed .status-dot, .failed .status-dot { animation: none; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.state-msg {
  text-align: center;
  padding: 80px 20px;
  color: var(--grey);
  font-size: 14px;
}
.state-msg .big { font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 6px; }

.truck-wrap {
  width: 72px;
  margin: 0 auto 18px;
}
.truck-svg {
  display: block;
  margin: 0 auto;
  animation: pulse 1.8s ease-in-out infinite;
}
.load-track {
  width: 100%;
  height: 3px;
  margin-top: 12px;
  border-radius: 2px;
  background: var(--navy-light);
  overflow: hidden;
}
.load-fill {
  width: 36%;
  height: 100%;
  border-radius: 2px;
  background: var(--sky);
  animation: loadSweep 1.4s ease-in-out infinite;
}
@keyframes loadSweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(370%); }
}
.load-tagline {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sky-dark);
}
@media (prefers-reduced-motion: reduce) {
  .truck-svg, .load-fill { animation: none !important; }
}

.hidden { display: none !important; }

.info-primary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.info-item label {
  display: block;
  font-size: 10px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 3px;
}
.info-primary .val { font-size: 15px; font-weight: 600; color: #1a1a1a; }

.info-secondary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.info-secondary .val { font-size: 12px; font-weight: 500; color: var(--grey); }

.card {
  background: #fff;
  padding: 20px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.milestones-h {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  gap: 0;
}

.ms-step {
  flex-direction: row;
  align-items: flex-start;
  display: flex;
  position: relative;
  text-align: left;
  gap: 14px;
  padding-bottom: 20px;
  width: 100%;
}

.ms-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 24px;
  left: 11px;
  width: 2px;
  height: 100%;
  background: var(--green);
  z-index: 0;
}
.ms-connector-red::after   { background: var(--red) !important; }
.ms-connector-orange::after{ background: var(--orange) !important; }

.ms-dot-h {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--green);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.ms-dot-h svg { width: 11px; height: 11px; }
.ms-step-failed .ms-dot-h  { background: var(--red);    box-shadow: 0 0 0 2px var(--red); }
.ms-step-partial .ms-dot-h{ background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }

.ms-label-h {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
}
.ms-step-failed .ms-label-h { color: var(--red); }
.ms-step-partial .ms-label-h { color: var(--orange); }
.ms-time-h {
  font-size: 11px;
  color: var(--grey);
  margin-top: 3px;
}

#map {
  width: 100%;
  height: 280px;
  overflow: hidden;
}
.map-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--grey);
}
.map-meta strong { color: #1a1a1a; }

footer {
  text-align: center; font-size: 12px; color: #aaa;
  padding: 20px 16px 32px;
}
footer a { color: var(--blue); text-decoration: none; }

@media (min-width: 641px) {
  main { padding: 24px 0 12px; }
  header { padding: 0 32px; }
  .status-hero, .card { padding: 28px 32px; }

  .header-tagline .rule { width: 16px; }
  .header-tagline .text { font-size: 11px; letter-spacing: 1.4px; }

  .info-primary {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  .info-secondary {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 32px;
  }

  .milestones-h {
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
  }

  .ms-step {
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    padding-bottom: 0;
    width: auto;
  }

  .ms-step:not(:last-child)::after {
    top: 12px;
    left: 50%;
    width: 100%;
    height: 2px;
  }

  .ms-dot-h { margin-bottom: 10px; flex-shrink: 0; }

  .ms-label-h, .ms-time-h { padding: 0 4px; }

  #map { height: 420px; }
}
