/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #1457b8;
  --primary-dark: #0f2740;
  --accent: #e63946;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #eef0f4;
  --green: #16a34a;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 39, 64, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; }
.page { padding-bottom: calc(72px + var(--safe-b)); animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ========== 顶栏 ========== */
.topbar {
  background: linear-gradient(135deg, #16395f 0%, #0f2740 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 36px;
}
.topbar .title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.topbar .sub { font-size: 12px; opacity: .72; margin-top: 3px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; }
.back-btn {
  display: inline-flex; align-items: center; color: #fff; opacity: .9;
  font-size: 14px; text-decoration: none; padding: 4px 0;
}
.back-btn::before { content: "‹"; font-size: 26px; line-height: 1; margin-right: 2px; margin-top: -2px; }

/* ========== 卡片/通用 ========== */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 12px; padding: 16px;
}
.card h3 { font-size: 14px; color: var(--text-2); font-weight: 600; margin-bottom: 12px; }
.muted { color: var(--text-2); font-size: 12.5px; }
.empty { text-align: center; color: var(--text-3); padding: 48px 0; font-size: 14px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid #d7e0ec; border-top-color: var(--primary);
  border-radius: 50%; margin: 44px auto; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-blue   { background: #e8f0fe; color: #1457b8; }
.badge-green  { background: #e7f6ec; color: #15803d; }
.badge-amber  { background: #fdf2e2; color: #b45309; }
.badge-gray   { background: #eef0f4; color: #6b7280; }
.badge-purple { background: #f1ecfb; color: #7c3aed; }

/* ========== 登录 ========== */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 0 34px; background: linear-gradient(160deg, #16395f 0%, #0f2740 55%, #0a1b2e 100%); }
.login-logo { text-align: center; color: #fff; margin-bottom: 40px; }
.login-logo .mark {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #2f74d0, #1457b8);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; box-shadow: 0 8px 24px rgba(47,116,208,.45);
}
.login-logo h1 { font-size: 21px; letter-spacing: 1px; }
.login-logo p { font-size: 13px; opacity: .6; margin-top: 8px; }
.login-card { background: #fff; border-radius: 18px; padding: 26px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.login-card label { font-size: 13px; color: var(--text-2); display: block; margin-bottom: 8px; }
.login-card input {
  width: 100%; border: 1.5px solid #e2e7ef; border-radius: 10px; padding: 13px 14px;
  font-size: 16px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--primary); }
.btn-primary {
  width: 100%; margin-top: 18px; border: none; border-radius: 10px; padding: 14px;
  background: linear-gradient(135deg, #2f74d0, #1457b8); color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:active { opacity: .85; }
.btn-primary:disabled { opacity: .55; }
.login-err { color: var(--accent); font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }
.login-foot { text-align: center; color: rgba(255,255,255,.45); font-size: 11.5px; margin-top: 30px; }

/* ========== 看板 ========== */
.total-card { margin-top: -24px; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; }
.total-card .num { font-size: 40px; font-weight: 800; color: var(--primary-dark); line-height: 1; }
.total-card .lbl { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.total-card .right { text-align: right; }
.ring { width: 74px; height: 74px; }
.ring-bg { fill: none; stroke: #eef2f7; stroke-width: 8; }
.ring-fg { fill: none; stroke: url(#grad); stroke-width: 8; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s; }

.today-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.today-item { text-align: center; background: #f7f9fc; border-radius: 10px; padding: 12px 4px; }
.today-item .n { font-size: 21px; font-weight: 800; color: var(--primary-dark); }
.today-item .t { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.today-item.hot .n { color: var(--accent); }

.stage-row { display: flex; align-items: center; padding: 10px 0; text-decoration: none; color: inherit; }
.stage-row + .stage-row { border-top: 1px solid var(--line); }
.stage-row .name { width: 88px; flex: none; font-size: 13.5px; line-height: 1.25; }
.stage-row .track { flex: 1; height: 9px; background: #f0f3f8; border-radius: 5px; overflow: hidden; margin: 0 10px; }
.stage-row .fill { display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, #3b82f6, #1457b8);
  width: 0; transition: width .5s ease; }
.stage-row.done .fill { background: linear-gradient(90deg, #34d399, #16a34a); }
.stage-row .cnt { width: 30px; flex: none; text-align: right; font-weight: 700; font-size: 14px; }
.stage-row .cnt.zero { color: var(--text-3); font-weight: 400; }

/* ========== 查询 ========== */
.search-bar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 12px 4px; }
.search-box { display: flex; background: #fff; border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.search-box input { flex: 1; border: none; outline: none; padding: 12px 16px; font-size: 15px; background: transparent; }
.search-box button { border: none; background: var(--primary); color: #fff; padding: 0 20px; font-size: 14px; font-weight: 600; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 13px; border-radius: 16px; background: #fff; color: var(--text-2);
  font-size: 12.5px; box-shadow: var(--shadow); cursor: pointer; border: 1.5px solid transparent; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.veh-card { display: block; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 10px 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.veh-card:active { background: #f8fafc; }
.veh-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.veh-lot { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.veh-series { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.veh-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px;
  font-size: 12px; color: var(--text-2); }
.veh-meta b { color: var(--text); font-weight: 600; }
.veh-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 11px;
  padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--text-2); }
.load-more { text-align: center; padding: 14px 0 20px; }
.load-more button { border: 1.5px solid var(--primary); background: #fff; color: var(--primary);
  border-radius: 20px; padding: 9px 28px; font-size: 13.5px; font-weight: 600; }

/* ========== 详情 ========== */
.detail-hero { margin: -26px 12px 0; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; }
.detail-hero .lot { font-size: 24px; font-weight: 800; letter-spacing: 1px; }
.detail-hero .series { color: var(--text-2); font-size: 13.5px; margin-top: 6px; }
.detail-hero .stage-line { margin-top: 12px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.info-item .k { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.info-item .v { font-size: 14px; font-weight: 600; word-break: break-all; }
.info-item.full { grid-column: 1 / -1; }

.timeline { padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 18px 26px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: #e6ebf2; }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #d4dbe6; border: 3px solid #eef2f7; }
.tl-item.done .tl-dot { background: #16a34a; border-color: #d9f2e1; }
.tl-item.current .tl-dot { background: var(--accent); border-color: #fde2e5;
  box-shadow: 0 0 0 4px rgba(230,57,70,.12); }
.tl-name { font-size: 14px; font-weight: 600; }
.tl-item.current .tl-name { color: var(--accent); }
.tl-item.pending .tl-name { color: var(--text-3); font-weight: 400; }
.tl-time { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.tl-item.pending .tl-time { color: var(--text-3); }

.collapse { border-top: 1px solid var(--line); }
.collapse summary { list-style: none; padding: 14px 0; font-size: 14px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.collapse summary::after { content: "›"; color: var(--text-3); font-size: 20px; transition: transform .2s; }
.collapse[open] summary::after { transform: rotate(90deg); }
.long-text { font-size: 12.5px; color: var(--text-2); line-height: 1.7; white-space: pre-wrap;
  word-break: break-all; padding-bottom: 14px; }

/* ========== 底部导航 ========== */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b); z-index: 50;
}
.tab { flex: 1; text-align: center; padding: 9px 0 8px; text-decoration: none; color: var(--text-3); font-size: 11.5px; }
.tab .ico { font-size: 21px; line-height: 1.3; display: block; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ========== Toast ========== */
#toast {
  position: fixed; left: 50%; top: 38%; transform: translateX(-50%) translateY(10px);
  background: rgba(17,24,39,.92); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
  max-width: 80%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
