/* ==================================================================
   app.css —— Tailwind 之外的补充样式
   1) 品牌色变量
   2) 时间轴 / 进度条等自定义组件
   3) 打印样式（客户喜欢直接打印轨迹页）
   4) 兜底样式：万一 tailwind.js 没加载（离线且文件缺失），
      页面仍保持基本可读（通过 html.no-tw 类启用）
   ================================================================== */

:root {
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --ink:       #0f172a;
  --muted:     #64748b;
  --line:      #e2e8f0;
}

html, body { -webkit-text-size-adjust: 100%; }
body { font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif; }

/* ---------- 顶部导航渐变 ---------- */
.nav-brand { background: linear-gradient(135deg, var(--brand-700), var(--brand-500)); }

/* ---------- 卡片阴影（统一，比 Tailwind 默认更柔） ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.12);
}

/* ---------- 时间轴 ---------- */
.timeline { position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(180deg, var(--brand-200), var(--brand-500));
}
.tl-item { position: relative; padding-left: 44px; }
.tl-dot {
  position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  background: #fff; border: 2px solid var(--brand-500); color: var(--brand-700); z-index: 1;
}
.tl-item.is-current .tl-dot {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.18);
}
.tl-item.is-future { opacity: .55; }
.tl-item.is-future .tl-dot { border-color: #cbd5e1; color: #94a3b8; }

/* ---------- 阶段进度条（订舱→装柜→开船→中转→到港→清关→提货） ---------- */
.stage-bar { display: flex; align-items: flex-start; }
.stage-seg { flex: 1; text-align: center; position: relative; }
.stage-seg::before {
  content: ""; position: absolute; top: 11px; left: 0; right: 0; height: 3px; background: #e2e8f0;
}
.stage-seg:first-child::before { left: 50%; border-radius: 999px 0 0 999px; }
.stage-seg:last-child::before  { right: 50%; border-radius: 0 999px 999px 0; }
.stage-seg.done::before { background: var(--brand-500); }
.stage-node {
  position: relative; z-index: 1; width: 24px; height: 24px; margin: 0 auto; border-radius: 9999px;
  background: #fff; border: 3px solid #e2e8f0;
}
.stage-seg.done .stage-node { border-color: var(--brand-600); background: var(--brand-600); }
.stage-seg.current .stage-node {
  border-color: var(--brand-600); background: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.18);
}

/* ---------- 状态标签 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 9999px; font-size: 12px; font-weight: 600; line-height: 20px; }
.badge-slate   { background:#f1f5f9; color:#475569; }
.badge-indigo  { background:#eef2ff; color:#4338ca; }
.badge-blue    { background:#eff6ff; color:#1d4ed8; }
.badge-amber   { background:#fffbeb; color:#b45309; }
.badge-purple  { background:#f5f3ff; color:#6d28d9; }
.badge-green   { background:#ecfdf5; color:#047857; }
.badge-red     { background:#fef2f2; color:#b91c1c; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { background: #f8fafc; color: #475569; font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr:hover { background: #f8fbff; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; z-index: 9999; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 10px; color: #fff; font-size: 14px; box-shadow: 0 8px 24px -8px rgba(15,23,42,.35); animation: toastIn .22s ease; }
.toast-ok { background:#0f766e; } .toast-err { background:#b91c1c; } .toast-info { background:#1d4ed8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px);} to {opacity:1; transform:none;} }

/* ---------- 加载遮罩 ---------- */
.loading-mask { position: fixed; inset: 0; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; z-index: 9998; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--brand-200); border-top-color: var(--brand-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 打印：只保留轨迹主体 ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #cbd5e1; }
  a[href]::after { content: ""; }
}

/* ==================================================================
   兜底样式：仅当 tailwind.js 未加载时生效（html.no-tw）
   ================================================================== */
html.no-tw body { margin: 0; background: #f8fafc; color: var(--ink); }
html.no-tw .container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
html.no-tw .card { padding: 16px; margin-bottom: 16px; }
html.no-tw input, html.no-tw select, html.no-tw textarea {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; width: 100%; box-sizing: border-box;
}
html.no-tw button { background: var(--brand-600); color:#fff; border:0; border-radius:8px; padding:8px 16px; cursor:pointer; }
