/* 穹彻数采可视化平台 · 深色紫蓝光效主题（与 DR 平台共用视觉语言） */
:root {
  --bg: #08080f;
  --bg-2: #0c0d1a;
  --panel: rgba(18, 20, 40, 0.62);
  --panel-strong: rgba(22, 24, 48, 0.86);
  --line: rgba(140, 120, 255, 0.14);
  --line-strong: rgba(150, 130, 255, 0.32);
  --violet: #8b6cff;
  --violet-soft: #a58bff;
  --blue: #4d8bff;
  --cyan: #43d9ff;
  --text: #e9ecff;
  --text-dim: #9aa2c9;
  --text-faint: #6b7299;
  --good: #4be0b4;
  --warn: #ffc65c;
  --bad: #ff6b8a;
  --radius: 16px;
  --shadow-glow: 0 0 0 1px rgba(140,120,255,0.18), 0 14px 44px rgba(80, 60, 200, 0.22);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  letter-spacing: .2px;
}

#bg-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; opacity: .9; }
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 75% -10%, rgba(90, 60, 220, .16), transparent 60%),
    radial-gradient(1000px 640px at 8% 110%, rgba(40, 140, 255, .12), transparent 60%),
    radial-gradient(900px 600px at 50% 50%, transparent 40%, rgba(0,0,0,.42) 100%);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: 60px; display: flex; align-items: center; gap: 26px; padding: 0 24px;
  background: linear-gradient(180deg, rgba(10,10,22,.92), rgba(10,10,22,.55));
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan), 0 0 26px rgba(67,217,255,.6);
  animation: pulse 2.4s ease-in-out infinite;
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--text-faint); border-left: 1px solid var(--line-strong); padding-left: 10px; }
.company-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: .5px; color: var(--text-dim); white-space: nowrap;
  padding: 5px 12px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(140,120,255,.10), rgba(77,139,255,.05));
  border: 1px solid rgba(160,140,255,.22);
}
.cb-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--violet-soft); box-shadow: 0 0 8px var(--violet-soft); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  position: relative; padding: 9px 20px; border-radius: 10px;
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 600;
  transition: color .18s, background .18s, box-shadow .18s;
}
.tab:hover { color: var(--text); background: rgba(140,120,255,.08); }
.tab.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(140,120,255,.22), rgba(77,139,255,.12));
  box-shadow: inset 0 0 0 1px rgba(160,140,255,.35), 0 0 20px rgba(120,90,255,.25);
}
.meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.exit-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--text-dim); text-decoration: none;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  transition: all .15s; white-space: nowrap;
}
.exit-btn:hover { color: #fff; background: rgba(255,107,138,.16); border-color: var(--bad); }

/* 常驻浮动退出按钮 */
.exit-float {
  position: fixed; right: 22px; bottom: 22px; z-index: 1200;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 18px; border-radius: 999px;
  background: rgba(20,22,44,.92); border: 1px solid rgba(160,140,255,.45);
  color: #e9ecff; text-decoration: none; font-size: 13px; font-weight: 700;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 22px rgba(120,90,255,.3);
  transition: all .16s;
}
.exit-float:hover { background: rgba(255,107,138,.22); border-color: #ff6b8a; transform: translateY(-2px); }

/* 退出回门面：模糊淡出 */
body.leaving .app, body.leaving .topbar {
  filter: blur(14px); opacity: 0;
  transition: filter .36s ease, opacity .36s ease;
}
.meta-live { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }

/* ---------- 主区 ---------- */
.app {
  position: relative; z-index: 2; height: calc(100vh - 60px); margin-top: 60px;
  overflow-y: auto; scroll-behavior: smooth; padding: 22px 26px 60px;
  scrollbar-width: thin; scrollbar-color: rgba(140,120,255,.35) transparent;
}
.app::-webkit-scrollbar { width: 8px; }
.app::-webkit-scrollbar-thumb { background: rgba(140,120,255,.28); border-radius: 8px; }
.view { animation: fadein .4s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-glow);
}
.card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.card .sub { margin: 0 0 14px; font-size: 12px; color: var(--text-faint); }
.section-title { position: relative; padding-left: 14px; font-size: 20px; font-weight: 700; margin: 6px 0 2px; }
.section-title::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--violet), var(--blue)); box-shadow: 0 0 10px rgba(140,120,255,.6);
}
.section-desc { font-size: 13px; color: var(--text-dim); margin: 0 0 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-glow);
}
.stat .k { font-size: 12px; color: var(--text-dim); letter-spacing: .6px; }
.stat .k .stat-desc { font-weight: 400; font-size: 11px; color: var(--text-faint); letter-spacing: 0; }
.stat .v { font-size: 30px; font-weight: 800; margin-top: 6px; line-height: 1; }
.stat .v small { font-size: 15px; font-weight: 600; color: var(--text-dim); margin-left: 3px; }
.stat .tag { margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.stat .tag2 { margin-top: 4px; font-size: 12px; color: var(--text-faint); }
.stat::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(140,120,255,.25), transparent 65%);
  pointer-events: none;
}
.stat.violet .v { color: var(--violet-soft); text-shadow: 0 0 18px rgba(140,120,255,.5); }

select, input[type="text"], input[type="search"] {
  background: rgba(10,10,24,.7); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 8px 10px; font-size: 13px; outline: none; min-width: 120px;
}
select:focus, input:focus { border-color: var(--violet-soft); box-shadow: 0 0 0 2px rgba(140,120,255,.15); }
select option { background: #12132a; color: var(--text); }
.btn {
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text); background: rgba(140,120,255,.12); border: 1px solid var(--line-strong);
  transition: all .16s;
}
.btn:hover { background: rgba(140,120,255,.22); box-shadow: 0 0 14px rgba(140,120,255,.25); }
.btn.on {
  background: linear-gradient(180deg, rgba(140,120,255,.3), rgba(77,139,255,.18));
  border-color: var(--violet-soft); box-shadow: 0 0 14px rgba(140,120,255,.3);
}

.empty { padding: 60px 20px; text-align: center; color: var(--text-faint); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- 地图 ---------- */
.map-view { display: flex; gap: 16px; height: 100%; }
.map-stage {
  position: relative; flex: 1; min-width: 0; min-height: 72vh; border-radius: 18px;
  border: 1px solid var(--line-strong); overflow: hidden;
  background: radial-gradient(1000px 600px at 50% 30%, rgba(50,34,120,.30), rgba(8,8,16,.6));
  box-shadow: var(--shadow-glow);
}
.map-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(120% 120% at 50% 50%, transparent 52%, rgba(2,4,10,.72) 100%);
}
#map-canvas-wrap { position: absolute; inset: 0; }
#map-canvas-wrap canvas { position: absolute; inset: 0; display: block; transition: filter .65s ease, opacity .65s ease; }
#map-canvas-wrap.exiting canvas { filter: blur(16px) brightness(.6); opacity: 0; }
.map-canvas-bg { cursor: grab; }
.map-canvas-bg:active { cursor: grabbing; }
.map-canvas-fg { pointer-events: none; }
.map-zoom { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 7px; z-index: 5; }
.map-zoom button {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: rgba(14,15,32,.85); color: var(--text); border: 1px solid var(--line-strong);
  font-size: 17px; line-height: 1; transition: all .15s;
}
.map-zoom button:hover { background: rgba(140,120,255,.2); box-shadow: 0 0 14px rgba(140,120,255,.3); }
.map-hint {
  position: absolute; left: 14px; bottom: 12px; z-index: 5;
  padding: 7px 12px; border-radius: 20px; font-size: 12px; color: var(--text-dim);
  background: rgba(10,10,22,.7); border: 1px solid var(--line); pointer-events: none;
}
.map-title { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; z-index: 4; }
.mt-main { font-size: 18px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 0 20px rgba(140,120,255,.6), 0 2px 8px rgba(0,0,0,.6); }
.mt-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; letter-spacing: 2px; }

/* ---------- 磨砂管理弹窗 ---------- */
.qc-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,4,14,.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: qcFade .25s ease both;
}
.qc-modal {
  position: relative; width: min(940px, 94vw); height: min(660px, 88vh);
  display: flex; flex-direction: column;
  background: rgba(20,22,48,.52);
  backdrop-filter: blur(28px) saturate(155%); -webkit-backdrop-filter: blur(28px) saturate(155%);
  border: 1px solid rgba(170,150,255,.28); border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6), 0 0 50px rgba(110,80,230,.22);
  overflow: hidden;
  animation: qcModalIn .32s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes qcFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes qcModalIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }

.qc-modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 22px 24px 16px; border-bottom: 1px solid var(--line);
}
.qc-modal-title { font-size: 22px; font-weight: 800; }
.qc-modal-sub { display: block; font-size: 13px; font-weight: 400; color: var(--text-dim); margin-top: 5px; letter-spacing: .5px; }
.qc-modal-close {
  margin-left: auto; width: 34px; height: 34px; flex: 0 0 34px;
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  background: rgba(255,255,255,.04); color: var(--text-dim); font-size: 20px; line-height: 1;
  transition: all .15s;
}
.qc-modal-close:hover { color: #fff; background: rgba(255,107,138,.2); border-color: var(--bad); }

.qc-modal-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.qc-toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
}
.qc-seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px;
  background: rgba(10,10,24,.6); border: 1px solid var(--line-strong);
}
.qc-seg-btn {
  padding: 7px 15px; border: 0; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  background: transparent; transition: all .16s; letter-spacing: .3px;
}
.qc-seg-btn:hover { color: var(--text); }
.qc-seg-btn.on {
  color: #fff; background: linear-gradient(180deg, rgba(140,120,255,.32), rgba(77,139,255,.2));
  box-shadow: 0 0 12px rgba(140,120,255,.3), inset 0 0 0 1px rgba(160,140,255,.4);
}
.qc-tools { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.qc-tool-label { font-size: 12px; color: var(--text-faint); }
.qc-day-btn { min-width: 30px; padding: 7px 9px; line-height: 1; }
.qc-day-btn[disabled] { opacity: .35; pointer-events: none; }
#qc-person-search { min-width: 140px; max-width: 180px; }

.qc-chart-scroll {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 6px 24px 24px;
  scrollbar-width: thin; scrollbar-color: rgba(140,120,255,.35) transparent;
}
.qc-chart-scroll::-webkit-scrollbar { width: 8px; }
.qc-chart-scroll::-webkit-scrollbar-thumb { background: rgba(140,120,255,.28); border-radius: 8px; }
.qc-chart { display: flex; flex-direction: column; }
.qc-empty { padding: 60px 0; text-align: center; color: var(--text-faint); }

/* ---------- 横向条形图 ---------- */
.hb-row { display: flex; align-items: center; gap: 14px; padding: 12px 0 22px; transition: opacity .2s; }
.hb-row.dim { opacity: 0.7; }
.hb-head { width: 176px; flex: 0 0 176px; display: flex; flex-direction: column; min-width: 0; }
.hb-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-sub { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track {
  position: relative; flex: 1; height: 24px;
  background: rgba(255,255,255,.04); border-radius: 6px;
}
.hb-total {
  position: absolute; left: 0; top: 0; height: 24px; border-radius: 6px;
  background: linear-gradient(90deg, #3d74e0, #5d9bff);
  box-shadow: 0 0 12px rgba(77,139,255,.35);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.hb-total-lbl {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  color: #fff; font-weight: 600; font-size: 12px; white-space: nowrap;
}
.hb-eff {
  position: absolute; left: 0; top: 0; height: 24px; border-radius: 6px;
  background: linear-gradient(90deg, #2ab89f, #3fd6bc);
  box-shadow: 0 0 12px rgba(55,214,192,.3);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.hb-eff-lbl {
  position: absolute; top: -19px; right: 0;
  color: #4fe3c6; font-size: 11px; white-space: nowrap;
}
.hb-rate { width: 64px; flex: 0 0 64px; text-align: right; font-weight: 700; font-size: 13px; color: #7ee6ff; }

/* ---------- 优秀标杆 ---------- */
.bm-row { display: grid; grid-template-columns: repeat(2, minmax(200px, 280px)); gap: 22px; }
.bm-card {
  aspect-ratio: 3 / 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 18px; text-align: center;
  background: linear-gradient(165deg, rgba(139,108,255,.16), rgba(77,139,255,.08));
  border: 1px solid rgba(160,140,255,.32); border-radius: 20px; box-shadow: var(--shadow-glow);
}
.bm-card.empty { background: rgba(140,120,255,.05); border-color: var(--line); }
.bm-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 800; color: #fff;
  background: linear-gradient(160deg, #6a5bff, #37a6ff);
  box-shadow: 0 0 30px rgba(110,90,255,.5);
  margin-bottom: 18px;
}
.bm-name { font-size: 18px; font-weight: 800; }
.bm-metric { font-size: 30px; font-weight: 800; color: var(--violet-soft); text-shadow: 0 0 18px rgba(140,120,255,.5); margin: 10px 0 4px; }
.bm-tag {
  display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, rgba(140,120,255,.3), rgba(77,139,255,.18));
  border: 1px solid rgba(160,140,255,.4);
}
.bm-sub-line { margin-top: 12px; font-size: 12px; color: var(--text-dim); }

.bench-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.bench-head h3 { margin: 0; }
.bench-hint { font-size: 12px; color: var(--text-faint); }

.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 14px; }
.task-card {
  overflow: hidden; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  animation: cardIn .4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.task-card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 14px 34px rgba(60,40,160,.35); }
.task-cover { width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: rgba(140,120,255,.08); }
.task-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-cover-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: #fff;
  background: linear-gradient(150deg, rgba(139,108,255,.3), rgba(77,139,255,.16));
}
.task-body { padding: 13px 15px 14px; }
.task-name { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.task-desc { font-size: 12px; color: var(--text-dim); line-height: 1.55; min-height: 36px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(140,120,255,.08); font-size: 11px; color: var(--text-faint); flex-wrap: wrap; }
.task-meta span + span::before { content: "·"; margin-right: 12px; color: var(--line-strong); }

/* ---------- 产能汇总 ---------- */
.cp-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.cp-row { display: flex; align-items: center; gap: 14px; padding: 7px 0; }
.cp-name { width: 150px; flex: 0 0 150px; font-size: 13px; font-weight: 600; }
.cp-bar { position: relative; flex: 1; height: 16px; background: rgba(255,255,255,.04); border-radius: 5px; }
.cp-total { position: absolute; left: 0; top: 0; height: 16px; border-radius: 5px; background: linear-gradient(90deg, #3d74e0, #5d9bff); }
.cp-eff { position: absolute; left: 0; top: 0; height: 16px; border-radius: 5px; background: linear-gradient(90deg, #2ab89f, #3fd6bc); }
.cp-num { width: 80px; flex: 0 0 80px; text-align: right; font-size: 12px; color: var(--text-dim); }
.cp-num.eff { color: #4fe3c6; }
.cp-rate { width: 56px; flex: 0 0 56px; text-align: right; font-size: 13px; font-weight: 700; color: #7ee6ff; }

/* 产能汇总「本月」卡的月份切换箭头 */
.cap-month-nav { position: absolute; right: 12px; top: 12px; display: inline-flex; gap: 4px; }
.cap-nav-btn {
  width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,.06); color: var(--text-dim);
  border: 1px solid var(--line); font-size: 14px; line-height: 1;
  transition: all .15s;
}
.cap-nav-btn:hover { color: #fff; background: rgba(140,120,255,.22); }
.cap-nav-btn[disabled] { opacity: .3; pointer-events: none; }

/* ---------- 通用 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  z-index: 80; padding: 10px 18px; border-radius: 10px; font-size: 13px;
  background: rgba(20,22,44,.95); border: 1px solid var(--line-strong);
  color: var(--text); opacity: 0; pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr; }
  .bm-row { grid-template-columns: 1fr; }
  .hb-head { width: 110px; flex-basis: 110px; }
}
