:root {
  --navy-0: #060d1a;
  --navy-1: #0a1628;
  --navy-2: #122544;
  --navy-3: #1a3560;
  --navy-line: rgba(120, 170, 230, 0.18);
  --orange: #ff8a2a;
  --orange-hot: #ffb347;
  --orange-soft: rgba(255, 138, 42, 0.15);
  --text-hi: #e8f0fb;
  --text-mid: #a8bcd6;
  --text-low: #6f88a8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--navy-0);
  color: var(--text-hi);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  user-select: none;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: grab;
}
#scene:active { cursor: grabbing; }
#scene.pointer { cursor: pointer; }

/* ---------- 悬浮面板 ---------- */
.panel {
  position: fixed;
  background: linear-gradient(160deg, rgba(18, 37, 68, 0.82) 0%, rgba(10, 22, 40, 0.78) 100%);
  border: 1px solid var(--navy-line);
  border-radius: 10px;
  padding: 14px 18px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  z-index: 10;
}

.panel::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--orange), transparent);
  border-radius: 2px;
  opacity: 0.8;
}

.panel-tl { top: 20px; left: 20px; display: flex; align-items: center; gap: 12px; padding: 12px 20px 12px 22px; }
.panel-tr { top: 20px; right: 20px; min-width: 220px; }
.panel-bl { bottom: 20px; left: 20px; min-width: 300px; max-width: 360px; }
.panel-br { bottom: 20px; right: 20px; min-width: 240px; }
.panel-bldg { top: 50%; right: 20px; transform: translateY(-50%); min-width: 230px; }
.panel-bldg[hidden] { display: none; }
.panel-bc { bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; padding: 10px 20px; }

.panel-title {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-mid);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.panel-title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* 品牌 */
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--orange) 0%, #ff5a1a 100%);
  position: relative;
  box-shadow: 0 4px 14px rgba(255, 138, 42, 0.35);
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 6px;
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 4px;
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-45deg);
}
.brand-text .title { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.brand-text .subtitle { font-size: 11px; color: var(--text-mid); letter-spacing: 2px; margin-top: 2px; }

/* 数据行 */
.stat-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text-mid);
}
.stat-row b {
  font-size: 16px; font-weight: 700; color: var(--text-hi);
  font-family: "Consolas", "SF Mono", monospace;
  letter-spacing: 1px;
}
.stat-row b.orange { color: var(--orange); text-shadow: 0 0 10px rgba(255,138,42,0.5); }
.stat-row.small { font-size: 11px; }
.stat-row.small b { font-size: 13px; color: var(--text-mid); }
.divider { height: 1px; background: var(--navy-line); margin: 8px 0 4px; }

/* 选中详情 */
.info-name {
  font-size: 20px; font-weight: 700;
  color: var(--orange-hot);
  margin: 4px 0 4px;
  letter-spacing: 1px;
}
.info-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid rgba(255, 138, 42, 0.35);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.info-tag:empty { display: none; }
.info-desc { font-size: 12px; color: var(--text-mid); line-height: 1.7; }
.info-metrics { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.info-metrics:empty { display: none; }
.info-metrics .m {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-low);
  padding: 3px 0; border-top: 1px dashed rgba(120,170,230,0.12);
}
.info-metrics .m span:last-child { color: var(--text-hi); font-family: Consolas, monospace; }

/* 提示 */
.hint { font-size: 12px; color: var(--text-mid); padding: 3px 0; }
kbd {
  display: inline-block;
  min-width: 62px;
  padding: 1px 6px;
  background: rgba(120, 170, 230, 0.12);
  border: 1px solid rgba(120, 170, 230, 0.25);
  border-radius: 3px;
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--text-hi);
  margin-right: 6px;
  text-align: center;
}

/* 图例 */
.legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-mid); letter-spacing: 1px; }
.sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; box-shadow: 0 0 6px rgba(0,0,0,0.4); }
.sw-a { background: #4a7ab5; }
.sw-b { background: #e8e8ec; }
.sw-c { background: #ff8a2a; }
.sw-d { background: #2a3548; border: 1px solid #d8d8d8; }
.sw-e { background: linear-gradient(90deg, #1e4a7a 40%, #f0f0f5 40%); }

/* 下钻面包屑 */
.crumb {
  position: fixed;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(160deg, rgba(18, 37, 68, 0.85), rgba(10, 22, 40, 0.8));
  border: 1px solid var(--navy-line);
  border-radius: 8px;
  padding: 8px 14px;
  backdrop-filter: blur(12px);
  z-index: 12;
}
.crumb[hidden] { display: none; }
.crumb-item {
  background: none; border: none; cursor: pointer;
  color: var(--text-mid); font-size: 12px; letter-spacing: 1px;
  padding: 2px 6px; border-radius: 4px;
  font-family: inherit;
}
.crumb-item:hover { color: var(--text-hi); background: rgba(120,170,230,0.12); }
.crumb-item.active { color: var(--orange); font-weight: 700; }
.crumb-sep { color: var(--text-low); font-size: 12px; }

/* 加载层 */
.loader {
  position: fixed; inset: 0;
  background: radial-gradient(circle at center, #eaf3fb 0%, #bcd6ee 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  z-index: 100;
  transition: opacity 0.6s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 48px; height: 48px;
  border: 2px solid rgba(255, 138, 42, 0.25);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loader-text { font-size: 12px; color: #35608f; letter-spacing: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .panel-bc, .panel-br { display: none; }
  .panel-bl { max-width: 260px; }
}

/* ---------- 管理平台侧边栏 ---------- */
.pf-toggle {
  position: fixed; top: 86px; left: 20px; z-index: 20;
  background: linear-gradient(135deg, var(--orange), #ff5a1a);
  color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; letter-spacing: 2px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(255,138,42,0.35); font-family: inherit;
}
.pf-root {
  position: fixed; top: 0; left: 0; bottom: 0; width: 400px; z-index: 30;
  background: linear-gradient(160deg, rgba(14,29,52,0.97), rgba(8,18,34,0.97));
  border-right: 1px solid var(--navy-line);
  transform: translateX(-102%); transition: transform .35s ease;
  display: flex; flex-direction: column;
  box-shadow: 8px 0 32px rgba(0,0,0,0.4);
}
.pf-root.open { transform: translateX(0); }
.pf-head {
  padding: 14px 16px; font-size: 15px; font-weight: 700; letter-spacing: 2px;
  color: var(--orange-hot); border-bottom: 1px solid var(--navy-line);
  display: flex; justify-content: space-between; align-items: center;
}
.pf-head button { background: none; border: none; color: var(--text-mid); font-size: 18px; cursor: pointer; }
.pf-warn { padding: 8px 16px; font-size: 12px; color: var(--text-mid); background: rgba(255,138,42,0.08); border-bottom: 1px solid var(--navy-line); }
.pf-warn b { color: var(--orange); }
.pf-menu { padding: 8px 10px; overflow-y: auto; max-height: 42%; border-bottom: 1px solid var(--navy-line); }
.pf-group { font-size: 11px; color: var(--text-low); letter-spacing: 2px; margin: 8px 6px 4px; }
.pf-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text-mid); font-size: 13px; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: inherit;
}
.pf-item:hover { background: rgba(120,170,230,0.12); color: var(--text-hi); }
.pf-body { flex: 1; overflow: auto; padding: 12px 14px; }
.pf-title { font-size: 13px; color: var(--orange-hot); margin-bottom: 8px; letter-spacing: 1px; }
.pf-hint { font-size: 12px; color: var(--text-mid); line-height: 1.8; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.pf-table th { color: var(--text-low); font-weight: 600; text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--navy-line); white-space: nowrap; }
.pf-table td { color: var(--text-mid); padding: 4px 6px; border-bottom: 1px dashed rgba(120,170,230,0.1); white-space: nowrap; }
.pf-table .lk { color: var(--orange); cursor: pointer; text-decoration: underline dotted; }
.bad { color: #ff6b6b; } .warn { color: var(--orange); } .good { color: #7dd87d; }
/* 弹窗 */
.pf-modal { position: fixed; inset: 0; z-index: 40; background: rgba(4,10,20,0.55); display: flex; align-items: center; justify-content: center; }
.pf-modal[hidden] { display: none; }
.pf-modal-card {
  width: min(720px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  background: linear-gradient(160deg, #122544, #0a1628); border: 1px solid var(--navy-line);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.pf-modal-head { padding: 12px 16px; font-size: 14px; font-weight: 700; color: var(--orange-hot); display: flex; justify-content: space-between; border-bottom: 1px solid var(--navy-line); }
.pf-modal-head button { background: none; border: none; color: var(--text-mid); font-size: 18px; cursor: pointer; }
.pf-modal-body { padding: 14px 18px; overflow: auto; }
.pf-modal-foot { padding: 10px 16px; border-top: 1px solid var(--navy-line); display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--text-mid); }
.pf-course { margin-bottom: 12px; }
.pf-course-t { font-size: 13px; color: var(--text-hi); margin-bottom: 4px; }
.pf-course-b { font-size: 12px; color: var(--text-mid); line-height: 1.7; }
.pf-q { margin-bottom: 12px; }
.pf-q-t { font-size: 13px; color: var(--text-hi); margin-bottom: 4px; }
.pf-o { display: block; font-size: 12px; color: var(--text-mid); padding: 2px 0; cursor: pointer; }
.pf-btn { background: var(--orange); color: #fff; border: none; border-radius: 6px; padding: 6px 14px; font-size: 12px; cursor: pointer; font-family: inherit; }

/* 录入表单 */
.pf-form { display: flex; flex-direction: column; gap: 8px; }
.pf-form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--text-mid); }
.pf-form input, .pf-form select {
  flex: 1; max-width: 200px;
  background: rgba(120,170,230,0.1); border: 1px solid var(--navy-line);
  border-radius: 5px; color: var(--text-hi); padding: 5px 8px; font-size: 12px; font-family: inherit;
}
.pf-form input:focus, .pf-form select:focus { outline: 1px solid var(--orange); }
.pf-form-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }

/* 车辆信息卡 */
.vc-badge { display:inline-block; color:#fff; font-size:12px; border-radius:10px; padding:2px 12px; margin-left:10px; letter-spacing:1px; }
.pf-vcard .pf-table td:first-child { color: var(--text-low); width: 110px; }
.pf-vcard .pf-table td { font-size: 13px; padding: 6px 8px; }

/* 加油充电费用进度条 */
.fb-bar { display:inline-block; width:70px; height:8px; border-radius:4px; background:rgba(120,170,230,0.15); margin-right:6px; vertical-align:middle; overflow:hidden; }
.fb-bar i { display:block; height:100%; background:linear-gradient(90deg,#ff8a2a,#ffb347); }

/* ===== 后台管理入口（原运行概览位置）：品牌质感入口卡 ===== */
.admin-link {
  text-decoration: none;
  cursor: pointer;
  min-width: 232px;
  padding: 14px 16px 12px;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(22, 42, 78, 0.88) 0%, rgba(12, 26, 50, 0.88) 58%, rgba(30, 30, 60, 0.88) 100%);
  border: 1px solid rgba(255, 138, 42, 0.28);
  transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.25s, border-color 0.25s;
}
.admin-link::after {
  content: "";
  position: absolute;
  right: -34px; top: -34px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 42, 0.22) 0%, rgba(255, 138, 42, 0) 70%);
  pointer-events: none;
}
.admin-link:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 138, 42, 0.65);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 138, 42, 0.18), 0 6px 26px rgba(255, 138, 42, 0.16);
}
.admin-link-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-link-icon {
  width: 44px; height: 44px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(255, 138, 42, 0.95) 0%, rgba(230, 100, 25, 0.95) 100%);
  box-shadow: 0 4px 14px rgba(255, 120, 40, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.admin-link-titles { flex: 1; min-width: 0; }
.admin-link-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}
.admin-link-sub {
  font-size: 11px;
  color: rgba(200, 216, 235, 0.75);
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.admin-link-arrow {
  font-size: 26px;
  line-height: 1;
  color: var(--orange);
  opacity: 0.55;
  transition: transform 0.25s, opacity 0.25s;
  flex: none;
}
.admin-link:hover .admin-link-arrow {
  transform: translateX(5px);
  opacity: 1;
}
.admin-link-enter {
  margin-top: 11px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 6px;
  text-indent: 6px;
  color: #ffd9b0;
  padding: 7px 0 6px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(255, 138, 42, 0.14) 0%, rgba(255, 138, 42, 0.30) 50%, rgba(255, 138, 42, 0.14) 100%);
  border: 1px solid rgba(255, 138, 42, 0.35);
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.admin-link:hover .admin-link-enter {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 120, 40, 0.42) 0%, rgba(255, 138, 42, 0.55) 50%, rgba(255, 120, 40, 0.42) 100%);
  box-shadow: 0 2px 12px rgba(255, 120, 40, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ===== 左侧车牌名册抽屉（隐藏式，hover 滑出） ===== */
.plate-drawer {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translate(-100%, -50%);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 60;   /* 高于档案弹窗(.pf-modal z:40)：弹窗打开时左缘拉手仍可悬停唤出名册 */
}
.plate-drawer:hover { transform: translate(0, -50%); }
.pd-handle {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 8px;
  background: linear-gradient(160deg, rgba(18, 37, 68, 0.92), rgba(10, 22, 40, 0.92));
  border: 1px solid var(--navy-line);
  border-left: none;
  border-radius: 0 10px 10px 0;
  color: #ffd9b0;
  font-size: 12px;
  letter-spacing: 2px;
  writing-mode: vertical-lr;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.pd-handle .pd-arrow { writing-mode: horizontal-tb; font-size: 14px; color: var(--orange); transition: transform 0.3s; }
.plate-drawer:hover .pd-handle .pd-arrow { transform: translateX(3px); }
.pd-panel {
  width: 244px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(18, 37, 68, 0.94), rgba(10, 22, 40, 0.94));
  border: 1px solid var(--navy-line);
  border-left: none;
  border-radius: 0 12px 12px 0;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  padding: 12px 12px 10px;
}
.pd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pd-title { font-size: 13px; font-weight: 700; color: #e8f0fa; letter-spacing: 1px; display: flex; align-items: center; gap: 7px; }
.pd-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.pd-count { font-size: 11px; color: #8aa0b8; }
.pd-search {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #e8f0fa;
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
  margin-bottom: 8px;
}
.pd-search:focus { border-color: rgba(255, 138, 42, 0.6); }
/* 名册只允许纵向滚动：横向滚动条一旦因 hover 位移出现，会挤掉行高造成"车牌一直闪" */
.pd-list { overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 60px; scrollbar-width: thin; overscroll-behavior: contain; }
/* 名册滚到尽头后不再把滚轮"传递"给 3D 画布（否则相机会被缩放，路面接缝处就会闪） */
.plate-drawer { overscroll-behavior: contain; }
.plate-drawer * { overscroll-behavior: contain; }
.pd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
/* hover 高亮改用内阴影，不再平移行（平移会撑出横向滚动条 → 闪烁） */
.pd-row:hover { background: rgba(255, 138, 42, 0.14); box-shadow: inset 2px 0 0 var(--orange); }
.pd-row.active { background: rgba(255, 138, 42, 0.22); box-shadow: inset 2px 0 0 var(--orange); }
.pd-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pd-plate { font-size: 12.5px; color: #f2f6fb; font-weight: 600; flex: 1; letter-spacing: 0.4px; }
.pd-meta { font-size: 10.5px; color: #8aa0b8; }
.pd-ev { font-size: 9px; color: #7dd8a8; border: 1px solid rgba(125, 216, 168, 0.5); border-radius: 4px; padding: 0 3px; }
.pd-tip { font-size: 10.5px; color: #7288a3; margin-top: 8px; line-height: 1.5; }

/* 任一弹窗（车辆档案卡/学习/考试/费用明细）打开期间，隐藏左下「选中对象」面板：
   车辆数据统一在弹窗里看，不重复展示；弹窗关闭（含 ×、Esc）自动恢复 */
body:has(#pf-modal:not([hidden])) #info-panel { display: none; }

/* 选中面板内的动作按钮（如加油充电站「查看每台车明细」） */
.m-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #ffd9b0;
  background: linear-gradient(90deg, rgba(255, 138, 42, 0.16), rgba(255, 138, 42, 0.30), rgba(255, 138, 42, 0.16));
  border: 1px solid rgba(255, 138, 42, 0.45);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.m-btn:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 120, 40, 0.4), rgba(255, 138, 42, 0.55), rgba(255, 120, 40, 0.4));
  box-shadow: 0 2px 12px rgba(255, 120, 40, 0.3);
}
