:root {
  --primary: #003a9b;
  --primary-soft: #eef2fb;
  --accent: #ff8c00;
  --accent-dark: #e67e00;
  --green: #079679;
  --text: #0a0a0a;
  --muted: #6b7280;
  --border: #e6e8ec;
  --bg: #f7f8fa;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(16, 24, 40, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

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

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1140px;
  height: 68px;
  margin: 0 auto;
  padding: 0 24px;
}

.results-header .nav-inner {
  max-width: 1440px;
  padding-right: 0;
  padding-left: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand img {
  height: 28px;
  width: auto;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-actions[hidden] {
  display: none;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 64px 24px 88px;
  background: radial-gradient(
      900px 460px at 50% -12%,
      rgba(0, 58, 155, 0.11),
      transparent 68%
    ),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    rgba(0, 58, 155, 0.09) 1px,
    transparent 1px
  );
  background-size: 26px 26px;
  mask-image: radial-gradient(620px 340px at 50% 18%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(
    620px 340px at 50% 18%,
    #000 0%,
    transparent 78%
  );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
}

.hero-sub {
  max-width: 790px;
  margin: 0 auto 30px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
}

.batch-form {
  text-align: left;
}

.batch-box {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.textarea-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 220px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d6dae1;
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textarea-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 58, 155, 0.08);
}

.batch-textarea {
  width: 100%;
  height: 100%;
  padding: 14px 16px 42px 48px;
  font-size: 15px;
  line-height: 26px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
}

.batch-textarea::placeholder {
  color: #8b93a1;
}

.line-numbers {
  position: absolute;
  top: 0;
  bottom: 42px;
  left: 0;
  width: 40px;
  padding: 14px 8px 0 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 26px;
  text-align: right;
  color: #a7aebb;
  pointer-events: none;
}

.line-numbers span {
  display: block;
}

.batch-tools {
  position: absolute;
  right: 14px;
  bottom: 8px;
  left: 48px;
  display: flex;
  gap: 16px;
}

.batch-tools[hidden] {
  display: none;
}

.batch-tools button {
  padding: 2px 0;
  font-size: 12px;
  color: #747c8b;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.batch-tools button:hover {
  color: var(--primary);
}

.batch-side {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 12px;
  width: 112px;
}

.carrier-box {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #333;
  text-align: center;
  background: #fff;
  border: 1px solid #d6dae1;
  border-radius: 8px;
}

.carrier-box svg {
  width: 28px;
  height: 28px;
}

.carrier-title {
  font-size: 13px;
  font-weight: 600;
}

.carrier-sub {
  font-size: 12px;
  color: #747c8b;
}

.batch-track {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-transform: uppercase;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.batch-track svg {
  width: 30px;
  height: 30px;
}

.batch-track:hover {
  background: var(--accent-dark);
}

.tracked-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.tracked-row[hidden] {
  display: none;
}

.tracked-label {
  font-size: 13px;
  color: #333;
}

.tracked-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tracked-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 12px;
  font-size: 12.5px;
  background: #f3f4f6;
  border: 1px solid #e3e6eb;
  border-radius: 999px;
}

.chip-number {
  padding: 0;
  font-size: 12.5px;
  color: #333;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.chip-number:hover {
  color: var(--primary);
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 1;
  color: #fff;
  background: #d9dde4;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.chip-remove:hover {
  background: #b9bfc9;
}

.more-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  font-size: 12.5px;
  color: #333;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.more-btn[hidden] {
  display: none;
}

.more-btn svg {
  transition: transform 0.2s ease;
}

.more-btn.is-expanded svg {
  transform: rotate(180deg);
}

.error-text {
  display: none;
  margin: 12px 2px 0;
  font-size: 13px;
  font-weight: 500;
  color: #d14343;
}

.error-text.show {
  display: block;
}

.results-page {
  padding: 18px 24px 60px;
}

.track-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.filter-tab:hover {
  color: #0a0a0a;
  background: #f6f7f9;
}

.filter-tab.is-active {
  color: #0a0a0a;
  background: #f1f3f6;
}

.tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.filter-count {
  font-weight: 400;
  color: #6b7280;
}

.filter-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #4b5563;
  background: #fff;
  border: 1px solid #e3e6eb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  color: #0a0a0a;
  background: #f6f7f9;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.filter-actions .icon-btn svg {
  transition: transform 0.2s ease;
}

.filter-actions .icon-btn.is-collapsed svg {
  transform: rotate(180deg);
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 56px 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.state-card[hidden] {
  display: none;
}

.state-card h3 {
  margin: 12px 0 0;
  font-size: 18px;
}

.state-card p {
  margin: 0;
  max-width: 460px;
  color: var(--muted);
  font-size: 14px;
}

.state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}

.state-icon svg {
  width: 26px;
  height: 26px;
}

.spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  border: 3px solid #e2e8f3;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.package-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  animation: rise 0.3s ease both;
}

.package-card[hidden] {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.package-summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 52px 12px 14px;
}

.summary-left {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  width: 310px;
}

.status-avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #fff;
  border-radius: 8px;
}

.status-avatar svg {
  width: 24px;
  height: 24px;
}

.summary-number {
  min-width: 0;
}

.number-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.number-line .number {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number-line .icon-btn {
  width: 22px;
  height: 22px;
  border: 0;
}

.number-line .icon-btn svg {
  width: 13px;
  height: 13px;
}

.summary-status {
  margin-top: 2px;
  font-size: 14px;
  color: #0a0a0a;
}

.summary-route {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
  width: 35%;
  max-width: 340px;
  min-width: 240px;
  padding: 0 8px;
}

.route-point {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.route-point:last-child {
  text-align: left;
}

.route-country {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-carrier {
  display: block;
  overflow: hidden;
  font-size: 12px;
  color: #2563eb;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-arrow {
  flex-shrink: 0;
  font-size: 18px;
  color: #9aa2b1;
}

.summary-latest {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  font-size: 14px;
}

.summary-latest .latest-time {
  color: #0a0a0a;
}

.summary-latest .latest-event {
  overflow: hidden;
  color: #0a0a0a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  margin-top: -17px;
}

.summary-toggle svg {
  transition: transform 0.2s ease;
}

.summary-toggle.is-collapsed svg {
  transform: rotate(180deg);
}

.package-details {
  padding: 16px 18px 20px;
  border-top: 1px solid var(--border);
}

.package-details[hidden] {
  display: none;
}

.progress-block {
  margin-bottom: 18px;
}

.progress-title {
  margin-bottom: 10px;
  font-size: 20px;
  font-weight: 600;
  color: #0a0a0a;
}

.progress-track {
  position: relative;
  height: 24px;
  margin-bottom: 8px;
}

.progress-bar {
  position: absolute;
  top: 9px;
  right: 0;
  left: 0;
  height: 6px;
  background: #e6e8ec;
  border-radius: 999px;
}

.progress-fill {
  position: absolute;
  top: 9px;
  left: 0;
  width: 0;
  height: 6px;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-nodes {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.progress-node {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #fff;
  background: #fff;
  border: 2px solid #cfd5de;
  border-radius: 50%;
}

.progress-node.is-active {
  border-color: var(--green);
}

.progress-node.is-end.is-done {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 0 6px rgba(7, 150, 121, 0.16);
}

.progress-node svg {
  width: 14px;
  height: 14px;
}

.progress-desc {
  font-size: 14px;
  color: #4b5563;
}

.tracking-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tracking-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.tracking-links {
  display: flex;
  gap: 20px;
}

.link-btn {
  padding: 0;
  font-size: 14px;
  color: #2563eb;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.carrier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.carrier-logo {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  background: #f1f3f6;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.carrier-name {
  font-size: 14px;
  color: #0a0a0a;
}

.carrier-sync {
  margin-left: 8px;
  font-size: 12px;
  color: #6b7280;
}

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

.timeline-row {
  display: flex;
  gap: 12px;
  position: relative;
}

.timeline-rail {
  position: relative;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  width: 20px;
}

.timeline-row:not(:last-child) .timeline-rail::before {
  position: absolute;
  top: 18px;
  bottom: -2px;
  left: 50%;
  content: "";
  border-left: 1px dashed #d6dae1;
  transform: translateX(-50%);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  color: #fff;
  background: #fff;
  border: 2px solid #cfd5de;
  border-radius: 50%;
}

.timeline-row.is-latest .timeline-dot {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  background: var(--green);
  border: 0;
}

.timeline-dot svg {
  width: 10px;
  height: 10px;
}

.timeline-content {
  display: flex;
  flex: 1;
  gap: 14px;
  align-items: baseline;
  min-width: 0;
  padding: 2px 0 14px;
}

.timeline-time {
  flex-shrink: 0;
  width: 130px;
  font-size: 13px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.timeline-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #4b5563;
  word-break: break-word;
}

.timeline-row.is-latest .timeline-text {
  font-weight: 500;
  color: #0a0a0a;
}

.site-footer {
  padding: 26px 24px 34px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: #fff;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 1488px) {
  .results-header .nav-inner {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 1100px) {
  .package-summary {
    flex-wrap: wrap;
  }

  .summary-left {
    width: 100%;
  }

  .summary-route {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .summary-latest {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    height: 60px;
    gap: 12px;
    padding: 0 16px;
  }

  .results-header .nav-inner {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand img {
    height: 24px;
  }

  .nav-links {
    justify-content: flex-end;
  }

  .nav-link {
    padding: 7px 11px;
    font-size: 13px;
  }

  .btn-ghost {
    padding: 7px 14px;
    font-size: 13px;
  }

  .hero {
    padding: 44px 16px 64px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-sub {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .batch-box {
    flex-direction: column;
  }

  .textarea-wrap {
    width: 100%;
    height: 200px;
  }

  .batch-textarea {
    padding-left: 44px;
    font-size: 14px;
    line-height: 24px;
  }

  .line-numbers {
    width: 34px;
    font-size: 14px;
    line-height: 24px;
  }

  .batch-tools {
    left: 44px;
  }

  .batch-side {
    flex-direction: row;
    width: 100%;
  }

  .carrier-box,
  .batch-track {
    flex-direction: row;
    min-height: 72px;
  }

  .carrier-sub {
    display: none;
  }

  .results-page {
    padding: 12px 12px 40px;
  }

  .filter-bar {
    gap: 6px;
    padding: 6px;
  }

  .filter-tab {
    padding: 7px 8px;
    font-size: 13px;
  }

  .tab-icon {
    width: 16px;
    height: 16px;
  }

  .filter-actions {
    gap: 4px;
  }

  .filter-actions .icon-btn {
    width: 30px;
    height: 30px;
  }

  .state-card {
    padding: 44px 18px;
  }

  .package-summary {
    padding: 12px 46px 14px 12px;
    align-items: flex-start;
  }

  .summary-route {
    padding: 8px 0;
  }

  .summary-latest {
    padding: 0;
  }

  .package-details {
    padding: 14px 14px 18px;
  }

  .progress-title {
    font-size: 18px;
  }

  .timeline-content {
    flex-direction: column-reverse;
    gap: 2px;
    align-items: flex-start;
  }

  .timeline-time {
    width: auto;
  }
}
