:root {
  --page: #ffffff;
  --card: #ffffff;
  --ink: #171c37;
  --muted: #68728a;
  --border: #dfe5f0;
  --primary: #151a98;
  --primary-dark: #0d1277;
  --mint: #eaf3ff;
  --mint-line: #bcdcff;
  --inactive: #e4ebf0;
  --tile: #f5f8fc;
  --coral: #ff3b0a;
  --blue: #1182f2;
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); }

body {
  min-height: 100vh;
  margin: 0;
  background: #ffffff;
}

button,
input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tracking-header {
  width: min(calc(100% - 48px), 1440px);
  min-height: 164px;
  margin: 0 auto;
  padding: 20px 8px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.bedee-brand {
  display: block;
  width: 350px;
  max-width: 55vw;
  padding: 7px 8px 5px;
  background: rgba(255, 255, 255, .84);
  text-decoration: none;
}

.bedee-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.tracking-center-label {
  padding-top: 8px;
  color: #59647c;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.tracking-shell {
  width: min(calc(100% - 48px), 1440px);
  margin: 0 auto;
  padding: 0 0 44px;
}

.tracking-intro h1 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: 46px;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0;
}

.tracking-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
}

.tracking-search-card,
.shipment-card,
.history-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 7px 20px rgba(42, 67, 85, .025);
}

.tracking-search-card {
  margin-top: 22px;
  padding: 22px;
}

.tracking-search-form > label {
  display: block;
  margin-bottom: 9px;
  color: #39445a;
  font-size: 17px;
  font-weight: 800;
}

.tracking-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
}

.tracking-search-row input,
.tracking-search-row button {
  min-height: 60px;
  border-radius: 10px;
}

.tracking-search-row input {
  width: 100%;
  min-width: 0;
  padding: 0 18px;
  border: 1px solid #ccd9e2;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .015em;
  text-transform: uppercase;
}

.tracking-search-row input::placeholder {
  color: #9aa6b5;
  font-weight: 600;
  text-transform: none;
}

.tracking-search-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 5px rgba(17, 130, 242, .14);
}

.tracking-search-row button {
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 9px 18px rgba(21, 26, 152, .14);
  transition: background .16s ease, transform .16s ease;
}

.tracking-search-row button:hover { background: var(--primary-dark); }
.tracking-search-row button:active { transform: translateY(1px); }
.tracking-search-row button:focus-visible { outline: 4px solid rgba(23, 111, 232, .35); outline-offset: 3px; }
.tracking-search-row button:disabled { opacity: .7; cursor: wait; transform: none; }

.customer-error {
  margin-top: 16px;
  padding: 14px 17px;
  border: 1px solid #f4c6c0;
  border-radius: 10px;
  background: #fff2f0;
  color: #9b3025;
  font-size: 16px;
  font-weight: 700;
}

.tracking-results {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(350px, 1fr);
  gap: 20px;
  margin-top: 20px;
  scroll-margin-top: 24px;
}

.tracking-results.not-found-mode { grid-template-columns: 1fr; }

.shipment-card,
.history-card {
  min-height: 470px;
}

.shipment-card { padding: 28px; }

.shipment-card-header h2,
.history-card h2 {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

.shipment-card-header h2 { font-size: 32px; line-height: 1.2; }

.shipment-card-header p {
  margin: 7px 0 0;
  color: #5d6880;
  font-size: 17px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.shipment-warning {
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid #f0cb92;
  border-radius: 10px;
  background: #fff8e9;
  color: #805313;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
}

.tracking-progress {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 32px 0 27px;
  padding: 0;
  list-style: none;
}

.tracking-progress::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 44px;
  left: 12.5%;
  right: 12.5%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint-line) var(--progress-fill, 0%), #d5dfe8 var(--progress-fill, 0%));
}

.tracking-progress li {
  position: relative;
  z-index: 1;
  min-width: 0;
  color: #8b96aa;
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.28;
}

.stage-icon {
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  margin: 0 auto 12px;
  place-items: center;
  border: 4px solid #e5ebf0;
  border-radius: 22px;
  background: #f9fbfc;
  color: #8ea8a5;
  box-shadow: 0 14px 30px rgba(36, 68, 82, .055);
}

.stage-icon svg { width: 55px; height: 55px; overflow: visible; }
.stage-icon svg rect,
.stage-icon svg path,
.stage-icon svg circle { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.stage-icon svg .accent { stroke: none; }
.stage-icon svg .accent-blue,
.stage-icon svg .fill-blue { fill: var(--blue); stroke: none; }
.stage-icon svg .accent-coral,
.stage-icon svg .fill-coral { fill: var(--coral); stroke: none; }

.stage-check {
  position: absolute;
  top: -16px;
  right: -13px;
  display: none;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--primary-dark);
  color: #fff;
  font-size: 23px;
  line-height: 1;
}

.tracking-progress li.complete { color: #6e7f9d; }
.tracking-progress li.complete .stage-icon { border-color: #c9ddf8; background: #f3f8ff; color: #6e87aa; }
.tracking-progress li.current { color: var(--primary-dark); }
.tracking-progress li.current .stage-icon {
  border-color: var(--primary-dark);
  background: #e7f2ff;
  color: var(--primary-dark);
  box-shadow: 0 18px 38px rgba(21, 26, 152, .13);
}
.tracking-progress li.complete .stage-check,
.tracking-progress li.current .stage-check { display: grid; }

.shipment-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.shipment-facts > div {
  min-width: 0;
  min-height: 94px;
  padding: 16px;
  border: 1px solid #d8e1eb;
  border-radius: 12px;
  background: var(--tile);
}

.shipment-facts dt {
  color: #6d788e;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.shipment-facts dd {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.history-card { padding: 28px 26px; }
.history-card h2 { font-size: 30px; line-height: 1.2; }

.shipment-timeline {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(90px, .72fr) 56px minmax(0, 2.2fr);
  min-height: 74px;
  align-items: start;
}

.timeline-when {
  padding: 8px 15px 0 0;
  color: #647087;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.timeline-when span { display: block; }

.timeline-rail {
  position: relative;
  display: flex;
  justify-content: center;
  align-self: stretch;
}

.timeline-rail::after {
  content: "";
  position: absolute;
  top: 46px;
  bottom: 0;
  width: 5px;
  border-radius: 99px;
  background: #d5e8ff;
}

.timeline-item:last-child .timeline-rail::after { display: none; }

.timeline-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 4px solid #dcecff;
  border-radius: 16px;
  background: #f5f9ff;
  color: #6e87aa;
  font-size: 19px;
  font-weight: 900;
}

.timeline-item:first-child .timeline-dot {
  border-color: var(--primary-dark);
  background: #fff7df;
  color: var(--primary-dark);
}

.timeline-event {
  padding: 5px 0 24px 14px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.timeline-event small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.history-note {
  margin: 18px 0 0;
  padding: 13px 15px;
  border-radius: 10px;
  background: #f3f6f8;
  color: #68758a;
  font-size: 14px;
  line-height: 1.55;
}

.customer-empty {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 42px;
  padding: 34px;
  border: 1px dashed #cbd7e1;
  border-radius: 14px;
  background: #f8fafc;
}

.empty-icon {
  display: grid;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 20px;
  background: #e6edf2;
  color: #718095;
  font-size: 31px;
  font-weight: 900;
}

.customer-empty strong {
  display: block;
  color: #17212e;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.35;
}

.customer-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.tracking-footer {
  padding: 0 20px 34px;
  color: #7b8798;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

@media (min-width: 761px) {
  .tracking-header {
    width: min(calc(100% - 40px), 1280px);
    min-height: 112px;
    padding: 10px 4px 6px;
    gap: 18px;
  }

  .bedee-brand {
    width: 250px;
    padding: 4px;
  }

  .tracking-center-label {
    padding-top: 5px;
    font-size: 14px;
  }

  .tracking-shell {
    width: min(calc(100% - 40px), 1280px);
    padding-bottom: 24px;
  }

  .tracking-intro h1 {
    margin: 0 0 3px;
    font-size: 34px;
  }

  .tracking-intro p {
    font-size: 16px;
    line-height: 1.35;
  }

  .tracking-search-card {
    margin-top: 14px;
    padding: 14px;
  }

  .tracking-search-form > label {
    margin-bottom: 6px;
    font-size: 14px;
  }

  .tracking-search-row {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 10px;
  }

  .tracking-search-row input,
  .tracking-search-row button {
    min-height: 48px;
    border-radius: 8px;
  }

  .tracking-search-row input {
    padding: 0 15px;
    font-size: 16px;
  }

  .tracking-search-row button { font-size: 16px; }

  .customer-error {
    margin-top: 10px;
    padding: 10px 13px;
    font-size: 14px;
  }

  .tracking-results {
    gap: 14px;
    margin-top: 14px;
  }

  .shipment-card,
  .history-card {
    min-height: 350px;
  }

  .shipment-card { padding: 20px; }
  .shipment-card-header h2 { font-size: 25px; }

  .shipment-card-header p {
    margin-top: 3px;
    font-size: 14px;
  }

  .shipment-warning {
    margin-top: 11px;
    padding: 9px 11px;
    font-size: 14px;
  }

  .tracking-progress {
    margin: 19px 0 17px;
  }

  .tracking-progress::before {
    top: 35px;
    height: 5px;
  }

  .tracking-progress li { font-size: 14px; }

  .stage-icon {
    width: 70px;
    height: 70px;
    margin-bottom: 8px;
    border-width: 3px;
    border-radius: 18px;
  }

  .stage-icon svg {
    width: 44px;
    height: 44px;
  }

  .stage-check {
    top: -11px;
    right: -10px;
    width: 30px;
    height: 30px;
    border-width: 3px;
    font-size: 18px;
  }

  .shipment-facts { gap: 8px; }
  .shipment-facts.has-location {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .shipment-facts > div {
    min-height: 74px;
    padding: 11px 12px;
    border-radius: 9px;
  }

  .shipment-facts dt { font-size: 13px; }

  .shipment-facts dd {
    margin-top: 3px;
    font-size: 16px;
  }

  .history-card { padding: 20px; }
  .history-card h2 { font-size: 25px; }

  .shipment-timeline { margin-top: 14px; }

  .timeline-item {
    grid-template-columns: minmax(72px, .72fr) 46px minmax(0, 2.2fr);
    min-height: 60px;
  }

  .timeline-when {
    padding: 6px 10px 0 0;
    font-size: 12px;
  }

  .timeline-rail::after {
    top: 38px;
    width: 4px;
  }

  .timeline-dot {
    width: 38px;
    height: 38px;
    border-width: 3px;
    border-radius: 12px;
    font-size: 16px;
  }

  .timeline-event {
    padding: 3px 0 16px 10px;
    font-size: 15px;
  }

  .timeline-event small {
    margin-top: 3px;
    font-size: 13px;
  }

  .history-note {
    margin-top: 11px;
    padding: 9px 11px;
    font-size: 12px;
  }
}

@media (max-width: 1120px) {
  .tracking-results { grid-template-columns: 1fr; gap: 24px; }
  .shipment-card,
  .history-card { min-height: auto; }
  .history-card { padding-bottom: 36px; }
  .timeline-item { grid-template-columns: 150px 62px 1fr; }
}

@media (max-width: 760px) {
  .tracking-header {
    width: 100%;
    min-height: 142px;
    padding: 22px 16px 14px;
    align-items: flex-start;
  }
  .bedee-brand { width: min(396px, 66vw); padding: 7px 8px 5px; }
  .tracking-center-label { padding-top: 8px; font-size: 14px; }
  .tracking-shell { width: 100%; padding: 0 12px 38px; }
  .tracking-intro h1 { margin-top: 8px; font-size: 34px; letter-spacing: 0; }
  .tracking-intro p { font-size: 15px; line-height: 1.55; }
  .tracking-search-card { margin-top: 27px; padding: 21px; }
  .tracking-search-form > label { margin-bottom: 9px; }
  .tracking-search-row { grid-template-columns: 1fr; gap: 11px; }
  .tracking-search-row input,
  .tracking-search-row button { min-height: 58px; border-radius: 10px; }
  .tracking-search-row input { padding: 0 16px; font-size: 18px; }
  .tracking-search-row button { font-size: 19px; }
  .tracking-results { margin-top: 22px; }
  .shipment-card { padding: 27px 20px 25px; }
  .shipment-card-header h2 { font-size: 28px; }
  .shipment-card-header p { font-size: 15px; }
  .tracking-progress {
    margin: 38px -3px 35px;
  }
  .tracking-progress::before { top: 37px; height: 5px; }
  .tracking-progress li { font-size: 14px; }
  .stage-icon {
    width: 74px;
    height: 74px;
    margin-bottom: 10px;
    border-width: 4px;
    border-radius: 21px;
  }
  .stage-icon svg { width: 48px; height: 48px; }
  .stage-check {
    top: -10px;
    right: -9px;
    width: 30px;
    height: 30px;
    border-width: 3px;
    font-size: 18px;
  }
  .shipment-facts { grid-template-columns: 1fr; gap: 10px; }
  .shipment-facts > div { min-height: auto; padding: 17px 18px; }
  .shipment-facts dt { font-size: 16px; }
  .shipment-facts dd { font-size: 20px; }
  .history-card { padding: 28px 20px 26px; }
  .history-card h2 { font-size: 27px; }
  .timeline-item { grid-template-columns: 84px 48px minmax(0, 1fr); min-height: 75px; }
  .timeline-when { padding-right: 8px; font-size: 13px; }
  .timeline-dot { width: 42px; height: 42px; border-radius: 13px; font-size: 18px; }
  .timeline-rail::after { top: 42px; width: 4px; }
  .timeline-event { padding-left: 9px; font-size: 17px; }
  .customer-empty { margin-top: 28px; padding: 23px; align-items: flex-start; }
}

@media (max-width: 470px) {
  .tracking-header { min-height: 146px; }
  .bedee-brand { width: 76vw; max-width: 300px; }
  .tracking-center-label { display: none; }
  .tracking-intro h1 { font-size: 32px; letter-spacing: 0; }
  .tracking-intro p { font-size: 15px; }
  .tracking-progress { margin-left: -9px; margin-right: -9px; }
  .tracking-progress::before { top: 31px; }
  .stage-icon { width: 62px; height: 62px; border-radius: 18px; }
  .stage-icon svg { width: 41px; height: 41px; }
  .tracking-progress li { font-size: 13px; }
  .timeline-item { grid-template-columns: 68px 43px minmax(0, 1fr); }
  .timeline-when { font-size: 12px; }
  .timeline-event { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
