:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4c8bf5;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
}
* { box-sizing: border-box; }
select, input, button, a { min-height: 44px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
header {
  padding: 1rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
header h1 { margin: 0 0 .25rem; font-size: 1.25rem; }
#batch-summary { margin: 0; color: var(--muted); font-size: .85rem; word-break: break-all; }
#state {
  padding: .5rem 1.25rem;
  font-size: .9rem;
  border-bottom: 1px solid var(--line);
}
#state[data-state="ready"] { background: #ecfdf5; color: var(--ok); }
#state[data-state="live-blocked"] { background: #fffbeb; color: var(--warn); }
#state[data-state="structure-blocked"],
#state[data-state="loading"],
#state[data-state="empty"],
#state[data-state="history-only"] { background: #fef2f2; color: var(--bad); }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  padding: .75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.filters label { font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.filters input, .filters select {
  font: inherit;
  padding: .3rem .45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  max-width: 160px;
}
.filters input[type="search"] { max-width: 200px; }
.filters button {
  font: inherit;
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.filters button:hover { background: #f3f4f6; }
main { padding: 1rem 1.25rem; display: grid; gap: 1.25rem; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .75rem;
}
.cards article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem;
}
.cards h2 { margin: 0 0 .35rem; font-size: .95rem; }
.cards p { margin: .2rem 0; font-size: .85rem; color: var(--muted); }
.cards .card-meta { color: var(--ink); }
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  /* 横向滚动条默认隐藏，鼠标进入表格范围时浮现（2026-08-11 用户要求：
     不要等竖向滚到底部才看到横向滚动条） */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .2s ease;
}
.table-wrap:hover { scrollbar-color: var(--line) transparent; }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.table-wrap:hover::-webkit-scrollbar-thumb { background: var(--line); }
.table-wrap::-webkit-scrollbar-corner { background: transparent; }
/* 浮动横向滚动条（2026-08-11 用户要求：鼠标进入表格范围即浮现，
   无需竖向滚到底部；fixed 在视口底部，可拖动双向同步） */
.hscroll-float {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(600px, 82vw); height: 12px; display: none; z-index: 120;
  background: rgba(22, 24, 36, .92); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 6px; padding: 1px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.hscroll-track { position: relative; width: 100%; height: 100%; }
.hscroll-thumb {
  position: absolute; top: 0; left: 0; height: 100%; min-width: 72px;
  background: rgba(168, 178, 208, .78); border-radius: 4px; cursor: grab;
}
.hscroll-float.dragging .hscroll-thumb { cursor: grabbing; background: rgba(198, 208, 235, .92); }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafafa; position: sticky; top: 0; }
tbody tr:hover { background: #f9fafb; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.trend-panel, .history-panel, .deals-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .9rem;
}
.trend-panel label { font-size: .85rem; color: var(--muted); margin-right: .5rem; }
.trend-chart { margin-top: .6rem; overflow-x: auto; }
.trend-chart svg { width: 100%; max-width: 720px; height: auto; }
.history-panel ol, .deals-panel ol { margin: .6rem 0 0; padding-left: 1.2rem; max-height: 300px; overflow-y: auto; }
.history-panel li, .deals-panel li { font-size: .85rem; margin: .25rem 0; }
.history-pager { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; }
.history-pager button { font: inherit; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.history-pager button:disabled { opacity: .5; cursor: default; }
.deals-note { font-size: .8rem; color: var(--muted); margin: .3rem 0 0; }
.deals-meta { color: var(--muted); font-size: .8rem; }
@media (max-width: 640px) {
  .filters { gap: .4rem; }
  .filters input, .filters select { max-width: 120px; }
}

/* 多级排序面板（仿 Excel） */
.sort-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: #f6f8fa;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin-bottom: 10px;
}
.sort-title {
  font-weight: 600;
  color: #333;
}
.sort-rule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #d8dee4;
  border-radius: 4px;
  padding: 3px 8px;
}
.sort-rule span {
  font-size: 12px;
  color: #666;
}
.sort-rule select {
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 13px;
}
.sort-rule button {
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}
.sort-rule button:hover {
  background: #e0e0e0;
}
.sort-rule .sort-remove {
  color: #b00;
  font-weight: 700;
}

/* 线路徽章 + 北京快高亮 */
.route-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 3px;
  font-size: 12px;
  background: #eef1f5;
  border: 1px solid #d0d7de;
  color: #333;
}
.route-badge.route-fast {
  background: #fff4cc;
  border-color: #e6b800;
  color: #7a5c00;
  font-weight: 600;
}
