/* ---------------------------------------------------------------- 设计变量 */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-soft: #fbfcfe;
  --line: #e6eaf2;
  --line-strong: #d6dce8;
  --text: #1b2431;
  --text-2: #4a5666;
  --muted: #7b8797;
  --accent: #2c6bed;
  --accent-dark: #1f55c4;
  --accent-soft: #edf3ff;
  --ok: #16a34a;
  --ok-soft: #eaf7ef;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --info: #0e8f9e;
  --info-soft: #e7f6f7;
  --shadow: 0 1px 2px rgba(20, 32, 54, .04), 0 8px 24px rgba(20, 32, 54, .05);
  --shadow-lg: 0 12px 40px rgba(20, 32, 54, .14);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input { font-family: inherit; font-size: inherit; color: inherit; }
.muted { color: var(--muted); font-size: 12.5px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* ---------------------------------------------------------------- 顶部栏 */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 66px;
  padding: 0 26px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, #3b7cf5, #1f55c4);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 4px 12px rgba(44, 107, 237, .28);
}

.brand-text h1 { font-size: 16px; }
.brand-text p { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.appbar-right { display: flex; align-items: center; gap: 14px; }

.conn {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: #14804a;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.conn .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .16);
}
.conn.pending { background: var(--warn-soft); color: #a45a05; }
.conn.pending .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 119, 6, .16); }
.conn.bad { background: var(--danger-soft); color: #b91c1c; }
.conn.bad .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }

/* 车队选择 */
.fleet { position: relative; }

.fleet-btn {
  display: flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text-2);
  transition: border-color .15s, background .15s;
}
.fleet-btn:hover { border-color: #b9c4d6; background: var(--panel-soft); }
.fleet-label { font-size: 12px; color: var(--muted); }
.fleet-value { font-size: 13px; font-weight: 600; color: var(--text); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { font-size: 10px; color: var(--muted); }

.fleet-pop {
  position: absolute; right: 0; top: 44px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 50;
}
.fleet-pop-head { padding: 10px 14px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.fleet-list { max-height: 280px; overflow-y: auto; padding: 6px; }
.fleet-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.fleet-item:hover { background: var(--panel-soft); }
.fleet-item input { accent-color: var(--accent); width: 15px; height: 15px; }
.fleet-item .code { margin-left: auto; font-size: 11px; color: var(--muted); }
.fleet-pop-foot { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel-soft); }

.user { display: flex; align-items: center; gap: 9px; padding-left: 14px; border-left: 1px solid var(--line); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 650;
  font-size: 13px;
}
.umeta { display: flex; flex-direction: column; line-height: 1.25; }
.umeta span { font-size: 13px; font-weight: 600; }
.umeta small { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- 主容器 */
.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 26px 60px; }

/* 搜索卡 */
.search-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 14px;
}

.search-main { display: flex; align-items: flex-end; gap: 12px; }

.search-field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.search-field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.search-field input {
  height: 46px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .04em;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-field input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44, 107, 237, .13);
}
.search-field input::placeholder { font-weight: 400; letter-spacing: 0; color: #a7b1c0; font-size: 14px; }

button.primary {
  height: 46px;
  min-width: 108px;
  padding: 0 22px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  box-shadow: 0 4px 12px rgba(44, 107, 237, .24);
  transition: background .15s, transform .06s, box-shadow .15s;
}
button.primary:hover { background: var(--accent-dark); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { background: #a9bde6; box-shadow: none; cursor: not-allowed; }

button.primary.sm { height: 34px; min-width: 76px; padding: 0 15px; font-size: 13px; border-radius: 8px; box-shadow: 0 2px 8px rgba(44, 107, 237, .2); }

button.ghost {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
  transition: background .15s, border-color .15s, color .15s;
}
button.ghost:hover { background: var(--panel-soft); border-color: #b9c4d6; color: var(--text); }
button.ghost.sm { height: 28px; padding: 0 10px; font-size: 12px; }

.search-hint { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.hint-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips.center { justify-content: center; }

.chip {
  height: 27px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 16px;
  padding: 4px;
  background: #eaeef5;
  border-radius: 11px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .6); }
.tab.active { background: #fff; color: var(--accent-dark); font-weight: 650; box-shadow: 0 1px 3px rgba(20, 32, 54, .1); }

.panel { display: none; }
.panel.active { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 14px;
}
.panel-head h3 { font-size: 15px; }
.panel-head p { margin-top: 3px; }
.panel-actions { display: flex; gap: 8px; flex-shrink: 0; }

.filter-row {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}
.filter-row label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.filter-row input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  outline: none;
  font-size: 13px;
  color: var(--text);
}
.filter-row input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(44, 107, 237, .1); }
.quick { display: flex; gap: 6px; margin-left: auto; }
.filter-row .check { flex-direction: row; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); height: 34px; font-weight: 500; }
.filter-row .check input { height: 15px; width: 15px; accent-color: var(--accent); }

/* 单程时效表 */
.trip-cell-main { font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }.trip-cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.trip-route { display: flex; flex-direction: column; gap: 2px; }
.trip-route .path { font-size: 13px; font-weight: 500; }
.trip-route .sites { font-size: 11.5px; color: var(--muted); }
.trip-charge-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 650; color: var(--warn); font-variant-numeric: tabular-nums; }
.trip-note { font-size: 11.5px; color: var(--danger); margin-top: 2px; }
.trip-reason { font-size: 12px; color: var(--muted); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable i { font-style: normal; opacity: .45; margin-left: 3px; }
th.sortable.on i { opacity: 1; color: var(--accent); }

/* 空状态 */
.empty {
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
}
.empty-icon { font-size: 30px; margin-bottom: 10px; opacity: .8; }
.empty h2 { font-size: 17px; margin-bottom: 7px; }
.empty p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card + .card { margin-top: 14px; }
.card h3 { font-size: 14px; margin-bottom: 4px; }

/* 在途 ETA 卡片 */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin-bottom: 0; }

.dest-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.dest-line .site {
  font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 7px;
  background: var(--panel-soft); border: 1px solid var(--line);
}
.dest-line .site.to { background: #eef6ff; border-color: #cfe3fb; color: #1b5aa8; }
.dest-line .go { color: var(--muted); font-size: 13px; }

.eta-strip {
  margin-top: 12px; padding: 10px 12px; border-radius: 9px; font-size: 12.5px;
  line-height: 1.55; border: 1px solid var(--line); background: var(--panel-soft); color: var(--text);
}
.eta-strip.ok { background: #f1faf3; border-color: #ccead5; color: #1a6b34; }
.eta-strip.warn { background: #fff8ec; border-color: #f5e2bd; color: #8a5a12; }
.eta-strip strong { font-weight: 650; }
.eta-strip code {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11.5px; padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, .045);
}

.result-area { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; align-items: start; }

/* 车辆头卡 */
.hero {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  background: linear-gradient(120deg, #ffffff 0%, #f7faff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.hero-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.plate-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plate {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: .07em;
  color: #10203a;
}
.hero-sub { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2); }
.hero-sub b { font-weight: 600; color: var(--text); }
.hero-right { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.hero-right .big { font-size: 20px; font-weight: 700; }
.hero-right .lbl { font-size: 11.5px; color: var(--muted); }

/* 状态徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: #14804a; }
.badge.moving { background: var(--accent-soft); color: var(--accent-dark); }
.badge.off { background: #eef1f6; color: #5c6878; }
.badge.idle { background: var(--warn-soft); color: #a45a05; }
.badge.charge { background: var(--info-soft); color: #0b7481; }
.badge.danger { background: var(--danger-soft); color: #b91c1c; }
.badge.plain { background: var(--panel-soft); color: var(--text-2); border: 1px solid var(--line); }

/* 指标网格 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.metric { background: var(--panel); padding: 13px 15px; }
.metric .k { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; display: flex; align-items: center; gap: 4px; }
.metric .v { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.metric .v small { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.metric .v.dim { color: var(--muted); font-size: 14px; font-weight: 500; }

/* 电量条 */
.bar { height: 6px; border-radius: 99px; background: #edf0f6; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .3s; }
.bar > i.warn { background: var(--warn); }
.bar > i.danger { background: var(--danger); }

/* 详情列表 */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 22px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--muted); flex-shrink: 0; }
.kv-row .v { text-align: right; word-break: break-all; }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 任务分组 */
.task-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.task-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.task-group-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid var(--line); background: var(--panel-soft); }
.task-group-head .name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.task-group-head .count { font-size: 12.5px; font-weight: 700; color: var(--text-2); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.task-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.task-item { padding: 9px 10px; border-radius: 9px; border: 1px solid transparent; transition: background .15s; }
.task-item:hover { background: var(--panel-soft); border-color: var(--line); }
.task-item .no { font-size: 12.5px; font-weight: 600; letter-spacing: .01em; }
.task-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-empty { padding: 22px 10px; text-align: center; color: #a7b1c0; font-size: 12.5px; }

.dot-state { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-state.s2 { background: var(--warn); }
.dot-state.s4 { background: var(--accent); }
.dot-state.s6 { background: var(--ok); }
.dot-state.s5 { background: #98a2b3; }

/* 轨迹 */
.track-stats { display: flex; flex-wrap: wrap; gap: 26px; padding: 4px 2px 14px; }
.track-stats .item .k { font-size: 11.5px; color: var(--muted); }
.track-stats .item .v { font-size: 19px; font-weight: 700; }
.track-map { background: linear-gradient(160deg, #f8fbff, #eef4fd); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.track-map svg { display: block; width: 100%; height: 340px; }

/* 进度 */
.progress { display: flex; align-items: center; gap: 9px; }
.progress .track { flex: 1; height: 6px; border-radius: 99px; background: #edf0f6; overflow: hidden; min-width: 60px; }
.progress .track > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress span { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

/* 路线卡 */
.route-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; background: var(--panel-soft); border-bottom: 1px solid var(--line); }
.route-head .name { font-weight: 650; font-size: 13.5px; }
.route-body { padding: 12px 16px 14px; display: grid; gap: 12px; }
.goods-line { display: flex; align-items: center; gap: 12px; font-size: 12.5px; flex-wrap: wrap; }
.goods-line .gname { min-width: 140px; font-weight: 500; }
.goods-line .gmeta { color: var(--muted); font-size: 12px; }

.stack { display: flex; flex-direction: column; gap: 11px; margin: 12px 0; }
.stack label, .row2 label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.stack input, .row2 input {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel-soft); font-size: 13px; outline: none; color: var(--text);
}
.stack input:focus, .row2 input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(44, 107, 237, .1); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 提示 / 骨架 */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 13px;
  background: var(--warn-soft);
  color: #8a4d04;
  border: 1px solid #f3dfbe;
}
.notice.error { background: var(--danger-soft); color: #a71d1d; border-color: #f5c9c9; }
.notice.info { background: var(--accent-soft); color: #1f4fb8; border-color: #d5e2fb; }
.notice strong { font-weight: 650; }

.skeleton { padding: 18px; }
.sk-line { height: 13px; border-radius: 6px; background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 50%, #eef1f6 75%); background-size: 300% 100%; animation: shimmer 1.2s infinite; margin-bottom: 10px; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -100% 0; } }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(16, 26, 42, .42); display: grid; place-items: center; z-index: 90; padding: 24px; }
.modal[hidden] { display: none; }
.fleet-pop[hidden], .toast[hidden] { display: none; }
details summary::-webkit-details-marker { display: none; }
details summary::marker { content: ""; }
.modal-box { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(880px, 100%); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.modal-head > div { display: flex; gap: 8px; }
.modal pre { margin: 0; padding: 16px; overflow: auto; font-size: 12.2px; line-height: 1.6; background: #fbfcfe; font-family: "SFMono-Regular", Consolas, Menlo, monospace; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #1b2431; color: #fff;
  padding: 11px 20px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg);
  z-index: 100; max-width: 80vw;
}
.toast.bad { background: #b91c1c; }

/* ------------------------------------------------------ 批量在途 */
.batch-input { display: flex; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.batch-input textarea {
  flex: 1; min-height: 118px; resize: vertical; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px; line-height: 1.75; color: var(--text); letter-spacing: .02em;
}
.batch-input textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.batch-side { display: flex; flex-direction: column; gap: 8px; justify-content: flex-start; width: 190px; flex-shrink: 0; }
.batch-side .muted { font-size: 11.5px; line-height: 1.55; margin: 0; }

.badge.plain-state { background: var(--panel-soft); color: var(--text-2); border: 1px solid var(--line); }
.badge.loading { background: var(--warn-soft); color: #a45a05; }

.remain-time { font-size: 15px; font-weight: 700; color: var(--ok); font-variant-numeric: tabular-nums; white-space: nowrap; }
.remain-time.zero { color: var(--muted); }
.remain-time.fallback { color: var(--warn); }

.method-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 5px;
  background: var(--panel-soft); border: 1px solid var(--line); color: var(--muted);
}
.method-tag.table { background: #eef6ff; border-color: #cfe3fb; color: #1b5aa8; }
.method-tag.fallback { background: var(--warn-soft); border-color: #f5e2bd; color: #8a5a12; }
.method-tag.eta { background: var(--ok-soft); border-color: #ccead5; color: #14804a; }

.batch-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; margin-top: 3px; max-width: 380px; }

/* 判定依据标签：围栏 / 轨迹 */
.judge-tag {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  font-size: 10.5px; line-height: 16px; border-radius: 4px; vertical-align: middle;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel-soft);
}
.judge-tag.fence { color: #14804a; border-color: #ccead5; background: var(--ok-soft); }
.judge-tag.track { color: #8a5a12; border-color: #f5e2bd; background: var(--warn-soft); }

/* 待执行线路：跟在数量下方，限制宽度以免撑宽表格 */
.pending-routes { max-width: 190px; white-space: normal; line-height: 1.45; }

.forecast-summary { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; padding: 14px 16px; background: var(--accent-soft); border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.forecast-table-wrap { margin-top: 16px; max-height: 72vh; overflow: auto; }
.forecast-table { font-size: 12px; min-width: 1760px; }
.forecast-table th { position: sticky; top: 0; z-index: 2; background: #f2f5fb; white-space: nowrap; }
.forecast-table td { vertical-align: top; min-width: 95px; max-width: 280px; white-space: normal; padding: 12px 10px; }
.forecast-table small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.forecast-table th:first-child, .forecast-table td:first-child { position: sticky; left: 0; background: white; z-index: 1; min-width: 105px; border-right: 1px solid var(--line); }
.forecast-table th:first-child { z-index: 3; background: #f2f5fb; }
.vehicle-link { background: transparent; border: 0; padding: 2px; text-align: left; font-size: 12px; color: var(--accent-dark); }
.vehicle-link:hover b { text-decoration: underline; }
.vehicle-link small { max-width: 120px; }
.forecast-route { min-width: 140px; max-width: 190px; line-height: 1.5; margin: 8px 0; }
.forecast-leg { margin: 6px 0 12px; min-width: 100px; }
.forecast-service { display: block; margin-bottom: 12px; white-space: nowrap; }
.forecast-service input { width: 66px; min-width: 0; padding: 5px; margin-top: 5px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; }
.forecast-service span { font-size: 10px; color: var(--muted); margin-left: 3px; }
.forecast-service input:invalid { border-color: var(--danger); }
.arrival-cell { min-width: 210px !important; }
.arrival-cell input[type=datetime-local] { width: 205px; padding: 6px; font-size: 12px; border: 1px solid var(--line-strong); border-radius: 6px; margin: 5px 0; }
.arrival-task { padding: 5px 0; font-size: 11px; color: var(--text-2); border-bottom: 1px dashed var(--line); }
.arrival-confirm { display: flex; gap: 6px; align-items: center; margin-top: 12px; white-space: nowrap; cursor: pointer; }
.arrival-confirm input { width: 15px; height: 15px; }
.arrival-validation { color: var(--muted); font-size: 11px; margin-top: 5px; }
.arrival-missing { color: var(--warn); font-weight: 600; margin: 6px 0; }
.forecast-confirmed { background: #f3faf6; }
.forecast-confirmed .arrival-validation { color: var(--ok); }
.forecast-warning { color: #a34d0a; font-size: 11px; line-height: 1.65; min-width: 170px; }
.forecast-warning div { margin-bottom: 8px; }
.forecast-table .batch-note { min-width: 220px; max-width: 280px; }
.forecast-table textarea { width: 100%; min-width: 200px; margin-top: 10px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px; font-family: inherit; font-size: 12px; }
.arrival-export { position: fixed; right: 18px; bottom: 18px; z-index: 30; font-size: 12px; padding: 9px 12px; border-radius: 8px; box-shadow: var(--shadow-lg); }
.arrival-export[hidden] { display: none; }
.forecast-overview-task { padding: 12px 0; border-bottom: 1px solid var(--line); }
[data-panel=batch] { padding-bottom: 64px; }


@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .fleet-value { max-width: 110px; }
  .brand-text p { display: none; }
}
@media (max-width: 760px) {
  .wrap { padding: 16px 14px 50px; }
  .appbar { padding: 0 14px; }
  .conn { display: none; }
  .hero { flex-direction: column; }
  .hero-right { align-items: flex-start; text-align: left; }
  .quick { margin-left: 0; }
}
/* Batch trip filtering and CSV column selection. */
#tripFilter { min-width: 310px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line, #d8dfe7); border-radius: 8px; font: inherit; resize: vertical; }
.csv-dialog { width: min(660px, 90vw); max-height: 85vh; overflow: auto; padding: 24px; border: 1px solid #d8dfe7; border-radius: 14px; color: #203047; background: #fff; }
.csv-dialog::backdrop { background: rgba(15, 28, 47, .4); }
.csv-dialog h3 { margin: 0 0 10px; }
.csv-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 20px 0; }
.csv-columns label { display: flex; align-items: center; gap: 8px; }
.csv-columns input { width: auto; }
.csv-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.csv-error { color: #b42318; min-height: 1.5em; }
.batch-controls { margin: 16px 0; }
.batch-controls > label { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.batch-controls p { margin: 8px 0; }
.batch-bulk-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 18px; }
.batch-bulk-row label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.batch-bulk-row input { width: 120px; }
.batch-controls select, .batch-controls input { padding: 8px; border: 1px solid #d8dfe7; border-radius: 8px; background: white; }
.bulk-check { width: 18px; height: 18px; }
