* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #1d4ed8;
  --radius: 18px;
  --shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.35);
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--primary);
}

.container {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  background:
    radial-gradient(1100px 380px at 12% -20%, rgba(96, 165, 250, 0.35), transparent 60%),
    linear-gradient(135deg, #0b1c33 0%, #12325c 60%, #174a86 100%);
  color: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 8px 20px -8px rgba(37, 99, 235, 0.9);
}

.brand-name {
  font-size: 17px;
}

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

.lang-select {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(203, 213, 225, 0.25);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.lang-select:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

.lang-select option {
  background: #ffffff;
  color: #0f172a;
}

.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(203, 213, 225, 0.25);
  transition: 0.2s;
  white-space: nowrap;
}

.site-nav a:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.8);
}

/* ---------- 首页 Hero ---------- */
.hero {
  padding: 40px 0 56px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.5px;
}

.hero p {
  margin: 0 0 28px;
  color: #bcd0ea;
  font-size: 15px;
}

.search-box {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px;
  border-radius: 16px;
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #fff;
  padding: 12px 16px;
  font-size: 16px;
  font-family: inherit;
}

.search-box input::placeholder {
  color: #93a9c7;
}

.search-box button {
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 11px;
  transition: 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.search-box button:hover {
  filter: brightness(1.1);
}

.hero .hero-tip {
  margin: 40px 0 0;
  font-size: 13px;
  color: #8fb0d8;
}

.hero-tip a {
  color: #bfdbfe;
}

/* ---------- 结果区 ---------- */
.page-body {
  padding-bottom: 48px;
}

.result-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-card {
  padding: 26px 28px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.kicker {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.result-head h2 {
  margin: 6px 0 0;
  font-size: 26px;
  letter-spacing: 1px;
}

.badge {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-block;
}

.badge--transit {
  background: #e8efff;
  color: #1d4ed8;
}

.badge--delivered {
  background: #e6f7ee;
  color: #0f8a4f;
}

.badge--out {
  background: #fff4e0;
  color: #b45309;
}

.badge--pending {
  background: #eef2f7;
  color: #64748b;
}

.route {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 26px 0 22px;
}

.route-point {
  min-width: 96px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-point--end {
  text-align: end;
}

.route-label {
  font-size: 12px;
  color: var(--muted);
}

.route-point strong {
  font-size: 19px;
}

.route-country {
  font-size: 13px;
  color: var(--muted);
}

.route-track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #e9eef6;
  overflow: hidden;
}

.route-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #1d4ed8);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: #f8fafd;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.meta-item span {
  font-size: 12px;
  color: var(--muted);
}

.meta-item strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 时间轴 ---------- */
.timeline-card {
  padding: 24px 28px 28px;
}

.timeline-card h3 {
  margin: 0;
  font-size: 16px;
}

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

.tl-item {
  display: grid;
  grid-template-columns: 132px 24px 1fr;
  gap: 0 14px;
  position: relative;
  padding-bottom: 22px;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-time {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  padding-top: 1px;
}

.tl-time span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.tl-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.tl-rail::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: -22px;
  width: 2px;
  background: #e2e8f0;
}

.tl-item:last-child .tl-rail::before {
  display: none;
}

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 0 0 3px #f1f5f9;
  margin-top: 3px;
  z-index: 1;
}

.tl-item--latest .tl-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px #dbeafe;
}

.tl-item--latest .tl-status {
  color: var(--primary);
}

.tl-body {
  padding-bottom: 2px;
  min-width: 0;
}

.tl-status {
  font-size: 15px;
  font-weight: 600;
}

.tl-desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  word-break: break-word;
}

.tl-loc {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.timeline-empty {
  margin: 18px 0 0;
  padding: 18px;
  border-radius: 12px;
  background: #f8fafd;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---------- 提示 / 加载 ---------- */
.notice {
  padding: 44px 28px;
  text-align: center;
}

.notice-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #eef2f7;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  color: #64748b;
}

.notice h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.notice p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.notice .hint-links {
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 22px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.footer-admin-link {
  color: inherit;
  text-decoration: none;
}

.footer-admin-link:hover {
  color: var(--primary);
}

/* ---------- 后台管理 ---------- */
.admin-main {
  padding: 36px 0 56px;
}

.admin-main .container {
  width: min(1440px, calc(100% - 40px));
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.admin-head h1 {
  margin: 0;
  font-size: 24px;
}

.admin-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

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

/* 列表表格放宽后压缩留白，尽量一屏展示完整运单信息 */
.list-card table {
  font-size: 13px;
}

.list-card th {
  padding: 9px 10px;
}

.list-card td {
  padding: 10px;
}

.list-card .btn--sm {
  padding: 5px 9px;
  font-size: 12px;
}

.list-card .badge {
  white-space: normal;
  text-align: center;
  line-height: 1.35;
}

.list-card .actions {
  gap: 4px;
  max-width: 210px;
}

.form-card,
.list-card {
  padding: 24px;
}

.form-card h2,
.list-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.form-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  font-family: inherit;
  transition: 0.2s;
  color: var(--text);
}

.field input:focus,
.field select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 10px;
  transition: 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: #334155;
}

.btn--ghost:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.btn--danger {
  background: #fff;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.btn--danger:hover {
  background: #fef2f2;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn--block {
  width: 100%;
}

.create-result {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 14px;
  line-height: 1.7;
  color: #1e3a8a;
  word-break: break-all;
}

.create-result.show {
  display: block;
}

.create-result a {
  color: var(--primary);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.tno {
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.route-cell {
  font-size: 13px;
  color: #475569;
  min-width: 220px;
}

.route-cell span {
  color: var(--muted);
  margin: 0 4px;
}

.progress-cell {
  min-width: 96px;
  font-size: 13px;
  color: #475569;
}

.mini-bar {
  height: 6px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 5px;
}

.mini-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #1d4ed8);
  border-radius: 999px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.table-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

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

.table-toolbar input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  min-width: 200px;
}

.table-toolbar input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.auth-wrap {
  min-height: calc(100vh - 220px);
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.auth-card {
  width: min(420px, 100%);
  padding: 32px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.auth-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.auth-card .hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 50;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.8);
  max-width: calc(100% - 40px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast--error {
  background: #b91c1c;
}

.days-dialog {
  border: none;
  border-radius: 16px;
  padding: 24px;
  width: min(420px, calc(100% - 32px));
  box-shadow: 0 30px 60px -30px rgba(15, 23, 42, 0.6);
  color: var(--text);
}

.days-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.days-dialog h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.days-dialog p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.days-dialog p strong {
  color: var(--text);
}

.days-dialog .dialog-tracking {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .container {
    width: calc(100% - 28px);
  }

  .hero {
    padding: 28px 0 40px;
  }

  .search-box {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .search-box button {
    width: 100%;
  }

  .summary-card,
  .timeline-card {
    padding: 20px;
  }

  .result-head h2 {
    font-size: 22px;
  }

  .route {
    gap: 12px;
  }

  .route-point {
    min-width: 74px;
  }

  .route-point strong {
    font-size: 16px;
  }

  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tl-item {
    grid-template-columns: 82px 20px 1fr;
    gap: 0 10px;
  }

  .tl-time {
    font-size: 13px;
  }

  .tl-status {
    font-size: 14px;
  }

  .tl-desc {
    font-size: 13px;
  }

  .brand-name {
    font-size: 15px;
  }

  .admin-head h1 {
    font-size: 20px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
