/* ========= 售后服务驾驶舱 — Refined cockpit styles ========= */

:root {
  --bg-0: #060a14;
  --bg-1: #0a1224;
  --bg-2: #0f1a33;
  --bg-3: #142547;
  --line-alpha: 0.18;
  --line: rgba(120, 160, 240, var(--line-alpha));
  --line-strong: rgba(140, 180, 250, calc(var(--line-alpha) + 0.14));
  --text-0: #eaf2ff;
  --text-1: #c5d2ec;
  --text-2: #8497bd;
  --text-3: #5a6a8e;
  --accent-rgb: 56, 217, 255;
  --accent: rgb(var(--accent-rgb));   /* primary cyan，可在「界面调节」中切换 */
  --accent-2: #6aa1ff;     /* secondary blue */
  --ok: #46d6a0;
  --warn: #ffc24d;
  --danger: #ff6a78;
  --violet: #b48aff;
  --grid-alpha: 0.06;
  --grid: rgba(120, 160, 240, var(--grid-alpha));

  /* ---- 「界面调节」可调项（由 TweakPanel 写入，见 l1/app.jsx）---- */
  --card-alpha: 0.72;              /* 卡片底色不透明度 */
  --card-blur: 0px;                /* 卡片毛玻璃 */
  --card-radius: 10px;             /* 卡片圆角 */
  --bg-blur: 0px;                  /* 背景图模糊 */
  --bg-brightness: 1;              /* 背景图明度 */
  --bg-veil: 0;                    /* 背景图遮罩浓度 */
  --grid-opacity: 1;               /* 科技网格强度 */
  --fx-opacity: 1;                 /* 扫描线 / 暗角光效强度 */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #000;
  color: var(--text-0);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-feature-settings: "tnum" 1, "cv02" 1;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* ---------- Stage scaler ---------- */
#stage-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background-color: #04070f;
  background:
    radial-gradient(1200px 700px at 20% 0%, rgba(36, 96, 200, 0.20), transparent 60%),
    radial-gradient(1200px 700px at 80% 100%, rgba(80, 40, 160, 0.18), transparent 60%),
    var(--bg-0);
}

#stage {
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
  position: relative;
  background:
    radial-gradient(1400px 800px at 50% 42%, rgba(24, 66, 140, 0.28), transparent 68%),
    radial-gradient(1000px 560px at 10% 2%, rgba(var(--accent-rgb), 0.16), transparent 60%),
    radial-gradient(1100px 660px at 94% 100%, rgba(126, 88, 255, 0.20), transparent 62%),
    linear-gradient(115deg, transparent 38%, rgba(120, 190, 255, 0.05) 46%, transparent 52%),
    linear-gradient(115deg, transparent 62%, rgba(150, 120, 255, 0.05) 68%, transparent 74%),
    linear-gradient(180deg, #07101f 0%, #050a18 100%);
  overflow: hidden;
}

/* 背景图层：挂在 #stage-wrap 上铺满整个视口（含舞台上下黑边），
   单独成层，模糊/明度只作用于背景图，不影响卡片内容 */
.stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--bg-blur)) brightness(var(--bg-brightness));
  transform: scale(1.06);            /* 模糊时避免边缘透出底色 */
  pointer-events: none;
}
.stage-veil {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(4, 9, 20, var(--bg-veil));
  pointer-events: none;
}
/* 选了背景图时舞台自身只保留氛围光，不再铺不透明底色 */
#stage.has-custom-bg {
  background:
    radial-gradient(1400px 800px at 50% 42%, rgba(24, 66, 140, 0.20), transparent 68%),
    radial-gradient(1000px 560px at 10% 2%, rgba(var(--accent-rgb), 0.12), transparent 60%),
    radial-gradient(1100px 660px at 94% 100%, rgba(126, 88, 255, 0.14), transparent 62%);
}

/* Tech grid: perspective floor grid + fine mesh, slow drift */
#stage::before {
  content: "";
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.055) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 240px 240px, 240px 240px, 40px 40px, 40px 40px;
  mask-image: radial-gradient(ellipse 78% 72% at 50% 46%, black 32%, transparent 92%);
  -webkit-mask-image: radial-gradient(ellipse 78% 72% at 50% 46%, black 32%, transparent 92%);
  animation: gridDrift 34s linear infinite;
  opacity: var(--grid-opacity, 1);
  pointer-events: none;
  z-index: 0;
}


/* Scan sweep + edge vignette + corner brackets */
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(180deg, transparent 0%, rgba(var(--accent-rgb), 0.035) 48%, rgba(var(--accent-rgb), 0.075) 50%, rgba(var(--accent-rgb), 0.035) 52%, transparent 100%),
    repeating-linear-gradient(180deg, rgba(120, 160, 240, 0.028) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse 96% 94% at 50% 50%, transparent 64%, rgba(2, 5, 12, 0.42) 100%);
  background-size: 100% 260%, 100% 100%, 100% 100%;
  background-repeat: no-repeat, repeat, no-repeat;
  animation: scanSweep 9s linear infinite;
  opacity: var(--fx-opacity, 1);
}

@keyframes gridDrift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-240px, -240px, 0); }
}
@keyframes scanSweep {
  0%   { background-position: 0 -160%, 0 0, 0 0; }
  100% { background-position: 0 160%, 0 0, 0 0; }
}

/* ---------- Live number ticker ---------- */
.num-live {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: color 0.35s ease, text-shadow 0.35s ease, transform 0.35s ease;
}
.num-live.num-up {
  color: var(--ok);
  text-shadow: 0 0 14px rgba(70, 214, 160, 0.55);
  animation: numPop 0.5s cubic-bezier(.2,.9,.2,1);
}
.num-live.num-down {
  color: var(--danger);
  text-shadow: 0 0 14px rgba(255, 106, 120, 0.5);
  animation: numPop 0.5s cubic-bezier(.2,.9,.2,1);
}
@keyframes numPop {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-3px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

/* ---------- Header ---------- */
.app-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 36, 76, 0.7), transparent);
  position: relative;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, #6aa1ff 100%);
  color: #07101f;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.4);
}
.header-center { display: flex; gap: 10px; align-items: center; }
.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.center-title-wrap { text-align: center; }
.center-title {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: 0.04em;
  line-height: 1;
}
.center-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.34em;
}
.global-filter {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(20, 37, 71, 0.6);
  border-radius: 6px;
  color: var(--text-1);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.global-filter:hover { background: rgba(40, 70, 130, 0.7); color: var(--text-0); }
.global-filter.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.2) inset; }
.global-filter .chev { color: var(--text-3); font-size: 10px; }

.header-right { display: flex; align-items: center; gap: 24px; }
.time-block { text-align: right; }
.time-now { font-size: 22px; font-weight: 600; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.time-date { font-size: 12px; color: var(--text-2); letter-spacing: 0.1em; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: pulse 2s ease-in-out infinite;
}
.status-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }

/* ---------- 界面调节触发按钮 + 背景缩略图选项 ---------- */
.bg-switch-trigger {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(120,160,240,.28);
  border-radius: 6px;
  background: rgba(12,24,48,.82);
  color: var(--text-1);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.bg-switch-trigger:hover,
.bg-switch-trigger.open { border-color: rgba(var(--accent-rgb), .62); background: rgba(23,47,88,.92); color: var(--accent); }
.bg-switch-trigger:focus-visible,
.bg-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bg-switch-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .8), rgba(106,161,255,.12));
  box-shadow: 0 0 9px rgba(var(--accent-rgb), .28);
}
.bg-option-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; }
.bg-option {
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(120,160,240,.18);
  border-radius: 6px;
  background: rgba(20,37,71,.48);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.bg-option:hover { border-color: rgba(var(--accent-rgb), .46); color:var(--text-0); }
.bg-option.selected { border-color: var(--accent); background: rgba(var(--accent-rgb), .13); color:var(--accent); box-shadow:0 0 0 1px rgba(var(--accent-rgb), .16); }
.bg-option-thumb {
  height: 46px;
  display:grid;
  place-items:center;
  overflow:hidden;
  border-radius:4px;
  background-size:cover;
  background-position:center;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}
.bg-option-thumb.is-default { background:radial-gradient(circle at 25% 20%, rgba(var(--accent-rgb), .32), transparent 45%), linear-gradient(145deg,#07101f,#101c38); }
.bg-option-thumb span { min-width:22px; height:22px; display:grid; place-items:center; border-radius:50%; background:rgba(4,9,20,.72); color:#dceaff; font:600 10px "JetBrains Mono",monospace; }
.bg-option.selected .bg-option-thumb span { background:var(--accent); color:#06101f; }
.bg-option-name { display:block; margin-top:5px; font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---------- 界面调节（Tweak UI）抽屉 ---------- */
.tweak-backdrop { position: absolute; inset: 0; z-index: 300; background: transparent; }
.tweak-panel {
  position: absolute;
  top: 0; right: 0;
  width: 336px;
  height: 100%;
  z-index: 301;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(var(--accent-rgb), .34);
  background: linear-gradient(180deg, rgba(9,19,39,.97), rgba(6,12,26,.97));
  box-shadow: -22px 0 60px rgba(0,0,0,.6), inset 1px 0 0 rgba(160,200,255,.08);
  backdrop-filter: blur(18px);
  animation: tweakIn .2s ease-out;
}
@keyframes tweakIn { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.tweak-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .14), transparent 70%);
}
.tweak-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .06em; color: var(--text-0); }
.tweak-head p { margin: 3px 0 0; font-size: 10px; letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; }
.tweak-close {
  margin-left: auto; width: 26px; height: 26px; flex: 0 0 auto;
  border: 1px solid rgba(120,160,240,.28); border-radius: 5px;
  background: transparent; color: var(--text-1); font-size: 15px; line-height: 1; cursor: pointer;
}
.tweak-close:hover { border-color: var(--accent); color: var(--accent); }
.tweak-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; }
.tweak-sec { padding: 13px 0; border-bottom: 1px dashed rgba(120,160,240,.14); }
.tweak-sec:last-child { border-bottom: 0; }
.tweak-sec-title {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .06em;
}
.tweak-sec-title::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--accent); }
.tweak-row { margin-bottom: 11px; }
.tweak-row:last-child { margin-bottom: 0; }
.tweak-row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 5px; font-size: 12px; color: var(--text-1); }
.tweak-row-head b { font: 500 11px "JetBrains Mono", monospace; color: var(--text-0); }
.tweak-range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: rgba(120,160,240,.22); outline: none; cursor: pointer; }
.tweak-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #06101f;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), .6); cursor: pointer;
}
.tweak-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #06101f; cursor: pointer; }
.tweak-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tweak-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tweak-swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(120,160,240,.28); cursor: pointer; padding: 0; position: relative; }
.tweak-swatch.selected { border-color: #eaf2ff; box-shadow: 0 0 0 2px rgba(255,255,255,.22), 0 0 12px currentColor; }
.tweak-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tweak-color-input { width: 26px; height: 26px; padding: 0; border: 1px solid rgba(120,160,240,.28); border-radius: 6px; background: transparent; cursor: pointer; }
.tweak-file { display: block; }
.tweak-file input[type="file"] { display: none; }
.tweak-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid rgba(var(--accent-rgb), .42); border-radius: 5px;
  background: rgba(var(--accent-rgb), .10); color: var(--accent);
  font: inherit; font-size: 12px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.tweak-btn:hover { background: rgba(var(--accent-rgb), .2); }
.tweak-btn.ghost { border-color: rgba(120,160,240,.28); background: transparent; color: var(--text-2); }
.tweak-btn.ghost:hover { border-color: var(--danger); color: var(--danger); background: rgba(255,106,120,.08); }
.tweak-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tweak-switch { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-1); cursor: pointer; }
.tweak-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tweak-switch-track { width: 34px; height: 18px; border-radius: 10px; background: rgba(120,160,240,.22); position: relative; transition: background .15s ease; flex: 0 0 auto; }
.tweak-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #c5d2ec; transition: transform .15s ease, background .15s ease; }
.tweak-switch input:checked + .tweak-switch-track { background: rgba(var(--accent-rgb), .5); }
.tweak-switch input:checked + .tweak-switch-track::after { transform: translateX(16px); background: var(--accent); }
.tweak-switch input:focus-visible + .tweak-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.tweak-hint { margin-top: 8px; font-size: 10px; line-height: 1.6; color: var(--text-3); }
.tweak-hint.warn { color: var(--warn); }
.tweak-foot { flex: 0 0 auto; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.tweak-foot .tweak-btn { flex: 1; }
.bg-option.is-upload .bg-option-thumb { background: repeating-linear-gradient(45deg, rgba(120,160,240,.10) 0 6px, transparent 6px 12px); }



/* ---------- Viz primitives ---------- */

/* Horizontal bar list (used by 待服务项目总览, 工单管理, 备件库, 巡矿回访) */
.hbar-list { display: flex; flex-direction: column; gap: 9px; }
.hbar-row {
  display: grid;
  grid-template-columns: 96px 1fr 56px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 5px;
  transition: background 0.15s ease;
}
.hbar-row:hover { background: rgba(var(--accent-rgb), 0.06); }
.hbar-row.active { background: rgba(var(--accent-rgb), 0.10); }
.hbar-row .hbar-label { font-size: 12px; color: var(--text-1); white-space: nowrap; }
.hbar-row .hbar-track {
  height: 8px; border-radius: 4px;
  background: rgba(120, 160, 240, 0.10);
  position: relative; overflow: hidden;
}
.hbar-row .hbar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  border-radius: 4px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4);
}
.hbar-row .hbar-fill.warn { background: linear-gradient(90deg, #d49a3a, var(--warn)); box-shadow: 0 0 8px rgba(255,194,77,0.4); }
.hbar-row .hbar-fill.danger { background: linear-gradient(90deg, #c14554, var(--danger)); box-shadow: 0 0 8px rgba(255,106,120,0.4); }
.hbar-row .hbar-fill.ok { background: linear-gradient(90deg, #2eb47e, var(--ok)); box-shadow: 0 0 8px rgba(70,214,160,0.4); }
.hbar-row .hbar-fill.violet { background: linear-gradient(90deg, #8c66e0, var(--violet)); }
.hbar-row .hbar-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 15px; font-weight: 600;
  color: var(--text-0);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hbar-row .hbar-value .unit { font-size: 11px; color: var(--text-2); font-weight: 400; margin-left: 2px; }

.pending-overview-grid {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.pending-overview-grid.is-eight { margin-top: 10px; }
.pending-overview-grid.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}
.pending-metric-card {
  background: rgba(18, 28, 48, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  min-height: 68px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
}
.pending-metric-card.active {
  border-color: rgba(var(--accent-rgb), .72);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .28), 0 8px 20px rgba(var(--accent-rgb), .10);
}
.pending-metric-card:nth-child(1) { border-top-color: var(--ok); }
.pending-metric-card:nth-child(2) { border-top-color: var(--danger); }
.pending-metric-card:nth-child(3) { border-top-color: var(--accent-2); }
.pending-metric-card:nth-child(4) { border-top-color: var(--warn); }
.pending-metric-card:nth-child(5) { border-top-color: var(--ok); }
.pending-metric-card:nth-child(6) { border-top-color: var(--accent-2); }
.pending-metric-card:nth-child(7) { border-top-color: var(--violet); }
.pending-metric-card:nth-child(8) { border-top-color: var(--accent); }

.pending-metric-card:nth-child(2) .pending-metric-value { color: var(--danger); }
.pending-metric-card:nth-child(4) .pending-metric-value { color: var(--warn); }

.pending-metric-label {
  font-size: 12px;
  color: #6b7b99;
  line-height: 1;
}
.pending-metric-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
  color: var(--text-0);
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pending-metric-value .unit {
  font-size: 11px;
  color: #6b7b99;
  font-weight: 400;
  margin-left: 0;
}

/* Stacked horizontal bar (used by 服务工单管理) */
.stacked-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.stacked-bar {
  height: 16px; border-radius: 8px;
  background: rgba(120, 160, 240, 0.10);
  display: flex; overflow: hidden;
}
.stacked-bar .seg {
  height: 100%;
  transition: flex-grow 0.3s ease;
  position: relative;
  cursor: pointer;
}
.stacked-bar .seg:hover { filter: brightness(1.2); }
.stacked-bar .seg.executing { background: linear-gradient(90deg, #3a7cd8, var(--accent-2)); }
.stacked-bar .seg.done { background: linear-gradient(90deg, #2eb47e, var(--ok)); }
.stacked-bar .seg.wait { background: linear-gradient(90deg, #d49a3a, var(--warn)); }
.stacked-bar .seg.overdue { background: linear-gradient(90deg, #c14554, var(--danger)); }

.stacked-legend {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
}
.stacked-legend .lg-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-1);
}
.stacked-legend .lg-dot {
  width: 8px; height: 8px; border-radius: 2px;
  flex-shrink: 0;
}
.stacked-legend .lg-dot.executing { background: var(--accent-2); }
.stacked-legend .lg-dot.done { background: var(--ok); }
.stacked-legend .lg-dot.wait { background: var(--warn); }
.stacked-legend .lg-dot.overdue { background: var(--danger); }
.stacked-legend .lg-label { flex: 1; }
.stacked-legend .lg-value { font-family: "JetBrains Mono", monospace; font-weight: 600; color: var(--text-0); }

/* Big number stat (inline use) */
.big-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.big-stat .bs-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 28px; font-weight: 600;
  color: var(--text-0);
  line-height: 1;
}
.big-stat .bs-value.ok { color: var(--ok); }
.big-stat .bs-value.warn { color: var(--warn); }
.big-stat .bs-value.danger { color: var(--danger); }
.big-stat .bs-value.accent { color: var(--accent); }
.big-stat .bs-value .unit { font-size: 14px; color: var(--text-2); font-weight: 400; margin-left: 3px; }
.big-stat .bs-label { font-size: 11px; color: var(--text-2); letter-spacing: 0.05em; }

/* Heatmap grid (项目未闭环问题) */
.heatmap {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}
.heatmap .hm-cell {
  border-radius: 6px;
  padding: 12px 10px;
  background: rgba(20, 37, 71, 0.4);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 70px;
  position: relative;
}
.heatmap .hm-cell:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.heatmap .hm-cell.header {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  min-height: 0;
  align-items: flex-start;
  justify-content: flex-end;
  cursor: default;
}
.heatmap .hm-cell.row-header {
  background: rgba(40, 70, 130, 0.3);
  align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-0);
}
.heatmap .hm-cell .hm-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 26px; font-weight: 600;
  color: var(--text-0);
  line-height: 1;
}
.heatmap .hm-cell .hm-meta {
  font-size: 11px;
  color: var(--text-2);
  display: flex; align-items: center; gap: 4px;
}
.heatmap .hm-cell.header .hm-col-label {
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.heatmap .hm-cell.sev-1 { background: rgba(var(--accent-rgb), 0.08); border-color: rgba(var(--accent-rgb), 0.25); }
.heatmap .hm-cell.sev-2 { background: rgba(255, 194, 77, 0.10); border-color: rgba(255, 194, 77, 0.35); }
.heatmap .hm-cell.sev-2 .hm-num { color: var(--warn); }
.heatmap .hm-cell.sev-3 { background: rgba(255, 106, 120, 0.10); border-color: rgba(255, 106, 120, 0.4); }
.heatmap .hm-cell.sev-3 .hm-num { color: var(--danger); }
.heatmap .hm-cell.sev-4 {
  background: rgba(255, 106, 120, 0.20);
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(255, 106, 120, 0.25);
}
.heatmap .hm-cell.sev-4 .hm-num { color: var(--danger); }
.heatmap .hm-cell.sev-0 { opacity: 0.45; }
.heatmap .hm-cell.sev-empty { opacity: 0.42; }
/* 整行可点：悬停时整行一起高亮，而不是只亮一个格子 */
.heatmap .hm-cell.row-hot {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.18);
  opacity: 1;
}
.heatmap .hm-cell.row-header.row-hot { color: var(--accent); }

.heatmap.compact-matrix {
  gap: 4px;
  margin-top: 0;
  flex: 1;
  grid-template-rows: auto repeat(11, 1fr);
}
.heatmap.compact-matrix .hm-cell {
  min-height: 0;
  padding: 4px 5px;
  border-radius: 5px;
  gap: 1px;
  justify-content: center;
}
.heatmap.compact-matrix .hm-cell:hover { transform: none; }
.heatmap.compact-matrix .hm-cell.header {
  padding: 2px 4px;
  justify-content: center;
}
.heatmap.compact-matrix .hm-cell.header .hm-col-label {
  font-size: 11px;
}
.heatmap.compact-matrix .hm-cell.row-header {
  font-size: 12px;
  font-weight: 600;
}
.heatmap.compact-matrix .hm-cell .hm-num {
  font-size: 15px;
}
.heatmap.compact-matrix .hm-cell .hm-meta {
  font-size: 9px;
  line-height: 1;
}

/* Compare row (备件库) */
.cmp-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.cmp-row .cmp-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
  display: flex; align-items: center; gap: 6px;
}
.cmp-row .cmp-name::before {
  content: ""; width: 3px; height: 14px;
  background: var(--accent); border-radius: 2px;
}
.cmp-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cmp-metric { display: flex; flex-direction: column; gap: 3px; }
.cmp-metric .cm-label { font-size: 11px; color: var(--text-2); }
.cmp-metric .cm-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px; font-weight: 600;
  color: var(--text-0);
}
.cmp-metric .cm-value.warn { color: var(--warn); }
.cmp-metric .cm-bar {
  height: 3px; border-radius: 2px;
  background: rgba(120, 160, 240, 0.10);
  position: relative; overflow: hidden;
  margin-top: 4px;
}
.cmp-metric .cm-bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent); border-radius: 2px;
}
.cmp-metric .cm-bar > i.warn { background: var(--warn); }
.cmp-metric .cm-bar > i.ok { background: var(--ok); }

/* Patrol stacked (巡矿回访) */
.patrol-row {
  display: grid;
  grid-template-columns: 70px 1fr 64px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.patrol-row:last-child { border-bottom: 0; }
.patrol-row .pr-label { font-size: 13px; color: var(--text-0); font-weight: 500; }
.patrol-row .pr-bar {
  height: 24px; border-radius: 5px;
  background: rgba(120, 160, 240, 0.10);
  position: relative; overflow: hidden;
  display: flex;
}
.patrol-row .pr-done {
  background: linear-gradient(90deg, #2eb47e, var(--ok));
  display: flex; align-items: center;
  padding-left: 8px;
  font-size: 11px; font-weight: 600; color: #07101f;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}
.patrol-row .pr-todo {
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px; color: var(--text-2);
  font-family: "JetBrains Mono", monospace;
  flex: 1;
}
.patrol-row .pr-stat {
  text-align: right;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px; font-weight: 600;
  color: var(--text-0);
}
.patrol-row .pr-stat .ps-label { display: block; font-size: 10px; color: var(--text-3); font-weight: 400; margin-bottom: 1px; font-family: inherit; letter-spacing: 0.04em; }
.patrol-row .pr-stat.empty .pr-stat-val { color: var(--text-3); }

/* Major case rings (重大客情) */
.case-rings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}
.case-card {
  background: rgba(20, 37, 71, 0.4);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.case-card:hover { border-color: var(--line-strong); }
.case-card .cc-title { font-size: 12px; color: var(--text-1); }
.case-card .cc-row { display: flex; gap: 12px; margin-top: 4px; }
.case-card .cc-stat { font-size: 11px; color: var(--text-2); }
.case-card .cc-stat .v {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px; font-weight: 600;
  color: var(--text-0);
  display: block; line-height: 1;
}
.case-card .cc-stat .v.warn { color: var(--warn); }

/* Funnel / stage flow (客诉处理阶段) */
.flow-stages {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 6px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 4px;
}
.flow-stage {
  flex: 1;
  min-width: 0;
  padding: 16px 8px 16px 16px;
  background: rgba(20, 37, 71, 0.4);
  border: 1px solid var(--line);
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.flow-stage:not(:first-child) {
  margin-left: -10px;
  padding-left: 22px;
  clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 50%, 100% 100%, 10px 100%, 0% 50%);
}
.flow-stage:first-child {
  clip-path: polygon(0% 0%, 100% 0%, calc(100% - 10px) 50%, 100% 100%, 0% 100%);
}
.flow-stage:last-child {
  clip-path: polygon(10px 0%, 100% 0%, 100% 100%, 10px 100%, 0% 50%);
  max-width: 100%;
}
.flow-stage .fs-step { font-size: 10px; color: var(--text-3); letter-spacing: 0.06em; }
.flow-stage .fs-label { font-size: 11px; color: var(--text-1); line-height: 1.2; }
.flow-stage .fs-val { font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; color: var(--text-0); line-height: 1; margin-top: 2px; }
.flow-stage.has-val { background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.4); }
.flow-stage.has-val .fs-val { color: var(--accent); }
.flow-stage.zero { opacity: 0.6; }
.flow-stage.zero .fs-val { color: var(--text-3); }
.cc-stat.metric-drill { cursor: pointer; border-radius: 4px; padding: 2px 6px; transition: background .15s ease; }
.cc-stat.metric-drill:hover { background: rgba(var(--accent-rgb), 0.12); }
/* 备件卡片上的单个指标可独立下钻，悬停时给出可点提示 */
.cmp-metric.metric-drill { cursor: pointer; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; transition: background .15s ease, box-shadow .15s ease; }
.cmp-metric.metric-drill:hover { background: rgba(var(--accent-rgb), 0.10); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.3); }
.cmp-metric.metric-drill:hover .cm-label { color: var(--accent); }

/* 悬停反馈与其它可下钻卡片保持一致。
   注意：箭头造型用了 clip-path，box-shadow 会被裁掉，所以外发光必须走 filter: drop-shadow —
   它跟随裁剪后的轮廓，效果才和 .case-card / .rs-cell-btn 的 glow 对得上。 */
.flow-stage:hover {
  background: rgba(var(--accent-rgb), 0.2);
  border-color: rgba(var(--accent-rgb), 0.6);
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.38));
  transform: translateY(-1px);
  opacity: 1;
}
.flow-stage:hover .fs-val,
.flow-stage:hover .fs-label { color: var(--accent); }
.flow-stage:hover:not(.zero) { background: rgba(var(--accent-rgb), 0.18); }

/* ---------- KPI strip ---------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.kpi-cell {
  background: rgba(10, 18, 36, 0.85);
  padding: 14px 16px 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}
.data-drill-cue {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .38);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(var(--accent-rgb), .10);
  font-size: 13px;
  line-height: 1;
}
.kpi-cell:hover { background: rgba(20, 37, 71, 0.9); }
.kpi-cell.is-primary { background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.10), rgba(var(--accent-rgb), 0.02)); }
.kpi-cell.active { background: rgba(var(--accent-rgb), 0.12); }
.kpi-cell.active::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 6px;
}
.kpi-value {
  font-family: "JetBrains Mono", "SF Mono", "Menlo", monospace;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 4px;
  display: flex; align-items: baseline; gap: 4px;
}
.kpi-unit { font-size: 13px; color: var(--text-2); font-weight: 400; margin-left: 2px; }
.kpi-cell.is-primary .kpi-value { color: var(--accent); }

/* ---------- Body grid ---------- */
.body-grid {
  display: grid;
  grid-template-columns: 500px 1fr 500px;
  gap: 14px;
  padding: 14px;
  height: calc(1080px - 72px);
}

.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }

/* ---------- Card ---------- */
.card {
  background: rgba(10, 18, 36, var(--card-alpha));
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 16px 18px;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), transparent 30%);
  pointer-events: none;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  position: relative;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-0);
  display: flex; align-items: center; gap: 10px;
}
.card-title .drill-cue {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid rgba(var(--accent-rgb), .32);
  border-radius: 10px;
  background: rgba(var(--accent-rgb), .09);
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-shadow: none;
}
.inline-drill {
  border-bottom: 1px dashed rgba(var(--accent-rgb), .42);
  transition: color .15s ease, background .15s ease;
}
.inline-drill:hover { color: var(--accent) !important; background: rgba(var(--accent-rgb), .07); }
.drill-surface { position: relative; }
.drill-surface::before {
  content: "›";
  position: absolute;
  top: 5px;
  right: 7px;
  z-index: 2;
  color: var(--accent);
  font-size: 9px;
  line-height: 1;
  opacity: .86;
}
.card-title::before {
  content: ""; display: inline-block;
  width: 3px; height: 14px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}
.card-meta { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.card-meta .big { color: var(--text-0); font-size: 14px; font-weight: 600; margin-right: 4px; }

/* ---------- Compact left column cards ---------- */
.compact-card { padding: 12px 14px; }
.compact-card .card-head { margin-bottom: 8px; }
.compact-card .card-title { font-size: 14px; letter-spacing: 0.06em; }
.compact-card .card-meta { font-size: 11px; }

/* ---------- Warranty filter (质保筛选按钮组) ---------- */
.warranty-filter {
  display: inline-flex;
  gap: 2px;
  background: rgba(20, 37, 71, 0.5);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px;
  margin-left: 8px;
}
.wf-btn {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-2);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.wf-btn:hover {
  color: var(--text-0);
  background: rgba(var(--accent-rgb), 0.08);
}
.wf-btn.active {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.15);
}

/* ---------- Mini-stat grid (待服务项目) ---------- */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.mini-stat {
  background: rgba(20, 37, 71, 0.4);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mini-stat:hover { background: rgba(40, 70, 130, 0.6); border-color: var(--line-strong); }
.mini-stat.active { background: rgba(var(--accent-rgb), 0.12); border-color: var(--accent); }
.mini-stat .ms-label { font-size: 12px; color: var(--text-1); }
.mini-stat .ms-value { font-family: "JetBrains Mono", monospace; font-size: 20px; font-weight: 600; color: var(--text-0); }
.mini-stat.warn .ms-value { color: var(--warn); }
.mini-stat.ok .ms-value { color: var(--ok); }

/* ---------- Filter row ---------- */
.filter-row {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.filter-item {
  display: flex; align-items: center;
  background: rgba(20, 37, 71, 0.4);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 8px;
}
.filter-item:hover { background: rgba(40, 70, 130, 0.6); }
.filter-item.has-value { border-color: var(--accent); color: var(--accent); }
.filter-item .fi-label { color: var(--text-2); white-space: nowrap; }
.filter-item .fi-val { color: var(--text-0); margin-left: auto; }
.filter-item.has-value .fi-val { color: var(--accent); }
.filter-item .chev { color: var(--text-3); font-size: 10px; }
/* 说明筛选条是「选中即下钻」，不是就地过滤指标 */
.filter-hint {
  display: flex; align-items: center; justify-content: flex-end;
  font-size: 10px; color: var(--text-3); letter-spacing: .02em; white-space: nowrap;
}

.compact-workorder .filter-row { gap: 6px; margin-bottom: 8px; }
.compact-workorder .filter-item { padding: 4px 7px; font-size: 11px; }
.compact-workorder .wo-status-merge {
  margin-top: 2px;
  padding-top: 4px;
}
.compact-workorder .wo-status-row {
  display: grid;
  grid-template-columns: 74px 126px 74px 1fr;
  gap: 8px;
  align-items: center;
}
.compact-workorder .wo-pie-metrics {
  display: grid;
  gap: 6px;
}
.compact-workorder .wo-pie-metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 37, 71, 0.26);
  padding: 5px 7px;
  display: grid;
  gap: 2px;
}
.compact-workorder .wo-pie-metric-label {
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.compact-workorder .wo-pie-metric-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  color: var(--text-0);
}
.compact-workorder .wo-pie-metric-value.ok {
  color: var(--ok);
}
.compact-workorder .wo-pie-metric-value small {
  font-size: 11px;
  color: var(--text-2);
  margin-left: 3px;
  font-weight: 400;
}
.compact-workorder .wo-status-pie-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.compact-workorder .wo-status-pie {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}
.compact-workorder .wo-status-pie-hole {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(6, 14, 30, 0.95);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  line-height: 1;
}
.compact-workorder .wo-status-pie-total {
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-0);
}
.compact-workorder .wo-status-pie-unit {
  margin-top: -2px;
  font-size: 10px;
  color: var(--text-2);
}
.compact-workorder .wo-status-list {
  display: grid;
  gap: 4px;
}
.compact-workorder .wo-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 37, 71, 0.26);
}
.compact-workorder .wo-status-item-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.compact-workorder .wo-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.compact-workorder .wo-status-label {
  font-size: 11px;
  color: var(--text-1);
}
.compact-workorder .wo-status-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-0);
}
.compact-workorder .wo-status-value span {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 400;
  margin-left: 2px;
}

/* ---------- Data table ---------- */
.dt {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.dt thead th {
  background: rgba(40, 70, 130, 0.35);
  color: var(--text-1);
  font-weight: 500;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}
.dt thead th.num, .dt tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text-1);
}
.dt tbody tr { cursor: pointer; transition: background 0.12s ease; }
.dt tbody tr:hover { background: rgba(var(--accent-rgb), 0.06); }
.dt tbody tr.selected { background: rgba(var(--accent-rgb), 0.10); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt .pct-bar {
  display: inline-block;
  height: 4px;
  border-radius: 2px;
  background: rgba(120, 160, 240, 0.18);
  width: 60px;
  position: relative; vertical-align: middle;
  margin-right: 6px;
}
.dt .pct-bar > i {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}
.dt .pct-bar.ok > i { background: linear-gradient(90deg, var(--ok), #6affc8); }
.dt .pct-bar.warn > i { background: linear-gradient(90deg, var(--warn), #ffd97e); }
.dt .pct-bar.danger > i { background: linear-gradient(90deg, var(--danger), #ff9a9a); }
.dt .num-mono { font-family: "JetBrains Mono", monospace; }

/* ---------- Pill / tag ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.pill.ok { background: rgba(70, 214, 160, 0.15); color: var(--ok); }
.pill.warn { background: rgba(255, 194, 77, 0.15); color: var(--warn); }
.pill.danger { background: rgba(255, 106, 120, 0.15); color: var(--danger); }
.pill.cyan { background: rgba(var(--accent-rgb), 0.14); color: var(--accent); }
.pill.violet { background: rgba(180, 138, 255, 0.15); color: var(--violet); }

/* ---------- Map ---------- */
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(20, 50, 100, 0.4), rgba(8, 14, 30, 0.95));
}
.china-echart-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.map-svg { width: 100%; height: 100%; display: block; }
.province { fill: rgba(40, 80, 150, 0.35); stroke: rgba(120, 180, 255, 0.35); stroke-width: 0.15; transition: fill 0.15s ease; cursor: pointer; }
.province:hover { fill: rgba(80, 150, 230, 0.55); }
.province.has-office { fill: rgba(var(--accent-rgb), 0.18); stroke: rgba(var(--accent-rgb), 0.7); stroke-width: 0.2; }
.province.active { fill: rgba(var(--accent-rgb), 0.45); stroke: var(--accent); stroke-width: 0.35; filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), 0.6)); }

.map-marker {
  cursor: pointer;
}
.map-marker .ring { fill: none; stroke: var(--accent); stroke-width: 0.18; opacity: 0.6; animation: ring-pulse 2.4s ease-out infinite; transform-origin: center; transform-box: fill-box; }
.map-marker .ring.r2 { animation-delay: 0.8s; }
.map-marker .ring.r3 { animation-delay: 1.6s; }
@keyframes ring-pulse {
  0% { r: 0.8; opacity: 0.7; }
  100% { r: 4; opacity: 0; }
}
.map-marker .dot { fill: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }
.map-marker.major .dot { fill: var(--warn); }
.map-marker.major .ring { stroke: var(--warn); }
/* HTML overlay labels for map (avoid SVG font clamping) */
.map-html-label {
  position: absolute;
  transform: translate(8px, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  background: rgba(10, 18, 36, 0.92);
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-0);
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  line-height: 1;
}
.map-html-label:hover {
  background: rgba(15, 35, 70, 0.98);
  border-color: var(--accent);
  z-index: 10;
}
.map-html-label.active {
  background: rgba(20, 45, 90, 1);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2), 0 4px 12px rgba(0,0,0,0.5);
  z-index: 11;
}
.map-html-label.major {
  border-color: rgba(255, 194, 77, 0.6);
}
.map-html-label.major:hover,
.map-html-label.major.active {
  border-color: var(--warn);
}
.map-html-label .mhl-name {
  font-weight: 500;
  letter-spacing: 0.02em;
}
.map-html-label .mhl-num {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
  padding-left: 6px;
  border-left: 1px solid rgba(120, 160, 240, 0.25);
}
.map-html-label.major .mhl-num { color: var(--warn); }

.map-legend {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 14px;
  font-size: 11px;
  color: var(--text-2);
  background: rgba(8, 14, 30, 0.75);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  z-index: 8;
}
.map-legend .lg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 6px; }

/* 三个资源指标居中悬浮在地图卡片上，指标每 6 秒自动轮换 */
.resource-strip {
  position: absolute;
  top: 56px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 10px;
  background: rgba(8, 14, 30, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  backdrop-filter: blur(8px);
  z-index: 8;
}
.rs-cell { display: flex; align-items: center; gap: 10px; }
.rs-cell-btn {
  position: relative;
  appearance: none;
  min-width: 168px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(20, 37, 71, 0.18);
  cursor: pointer;
  padding: 8px 28px 8px 10px;   /* 右侧给「›」留位 */
  overflow: hidden;
}
/* 轮换进度条：走完即切到下一个指标，让“自动轮换”可预期 */
.rs-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent));
  animation-name: rsProgress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes rsProgress { from { width: 0; } to { width: 100%; } }
.rs-cell-btn:hover { border-color: var(--line-strong); background: rgba(40, 70, 130, 0.28); }
/* 右上角「›」：只有点它才进二级页面，点卡片其它区域只切换地图指标 */
.rs-drill {
  position: absolute;
  top: 5px; right: 6px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.38);
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.rs-drill:hover { background: rgba(var(--accent-rgb), 0.26); border-color: rgba(var(--accent-rgb), 0.7); }
.rs-cell-btn.active {
  border-color: rgba(var(--accent-rgb), 0.62);
  background: rgba(var(--accent-rgb), 0.08);
}
.rs-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  display: grid; place-items: center;
  color: var(--accent);
}
.rs-label { font-size: 11px; color: var(--text-2); letter-spacing: 0.05em; }
.rs-value { font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; color: var(--text-0); line-height: 1; }
.rs-value small { font-size: 12px; color: var(--text-2); margin-left: 2px; }

/* ---------- Donut ---------- */
.donut-wrap { display: flex; align-items: center; gap: 12px; }
.donut { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); }
.donut .ring-bg { fill: none; stroke: rgba(120, 160, 240, 0.12); stroke-width: 8; }
.donut .ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.donut .ring-fg.ok { stroke: var(--ok); }
.donut .ring-fg.warn { stroke: var(--warn); }
.donut .ring-fg.danger { stroke: var(--danger); }
.donut .donut-label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 19px; font-weight: 600;
}

.summary-band {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 4px 14px;
  border-bottom: 1px solid var(--line);
}
.summary-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.summary-kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 124px;
}
.summary-kpi {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 37, 71, 0.34);
}
.summary-kpi .sk-label {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.summary-kpi .sk-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-0);
  line-height: 1;
}
.summary-kpi .sk-value span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  margin-left: 3px;
}
.summary-kpi .sk-value.warn { color: var(--warn); }
.summary-kpi .sk-value.danger { color: var(--danger); }
.patrol-band {
  margin-bottom: 12px;
}

/* ---------- Drawer ---------- */
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 640px;
  background: linear-gradient(180deg, #0a1730, #07101f);
  border-left: 1px solid var(--line-strong);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 51;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between;
}
.drawer-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.06em; }
.drawer-head .sub { color: var(--text-2); font-size: 12px; margin-top: 4px; letter-spacing: 0.08em; }
.drawer-body { padding: 22px 28px; overflow-y: auto; flex: 1; }
.drawer-close {
  background: rgba(40, 70, 130, 0.4);
  border: 1px solid var(--line);
  color: var(--text-1);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer; font-size: 16px;
  transition: all 0.15s ease;
}
.drawer-close:hover { background: rgba(255, 106, 120, 0.2); border-color: var(--danger); color: var(--danger); }

.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.detail-kpi { background: rgba(20, 37, 71, 0.4); border: 1px solid var(--line); padding: 12px; border-radius: 8px; }
.detail-kpi .lab { font-size: 11px; color: var(--text-2); letter-spacing: 0.05em; }
.detail-kpi .val { font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; margin-top: 4px; }

.detail-list { margin-top: 8px; }
.detail-row {
  display: grid;
  grid-template-columns: 1fr 100px 100px 80px;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.detail-row .name { font-size: 13px; }
.detail-row .sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.detail-row .num-mono { font-family: "JetBrains Mono", monospace; font-size: 14px; }

/* ---------- Misc ---------- */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin: 16px 0 10px;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}

/* Stages bar */
.stage-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.stage-cell {
  padding: 10px 12px;
  background: rgba(20, 37, 71, 0.4);
  border: 1px solid var(--line);
  border-radius: 7px;
  position: relative;
}
.stage-cell .sc-step { font-size: 11px; color: var(--text-3); margin-bottom: 4px; letter-spacing: 0.05em; }
.stage-cell .sc-label { font-size: 12px; color: var(--text-1); margin-bottom: 6px; }
.stage-cell .sc-val { font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; color: var(--text-0); }
.stage-cell.has-val { border-color: rgba(var(--accent-rgb), 0.3); }
.stage-cell.has-val .sc-val { color: var(--accent); }
.stage-cell.zero .sc-val { color: var(--text-3); }
.stage-cell .arrow {
  position: absolute; top: 50%; right: -10px;
  width: 12px; height: 12px;
  transform: translateY(-50%);
  color: var(--text-3);
  z-index: 1;
}
.stage-cell:last-child .arrow { display: none; }

.empty-hint { color: var(--text-3); font-size: 12px; text-align: center; padding: 30px 0; }

/* Scroll */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 160, 240, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 160, 240, 0.4); }

/* Dropdown */
.dd-pop {
  position: absolute;
  background: rgba(15, 26, 51, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
}
.dd-item {
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.dd-item:hover { background: rgba(var(--accent-rgb), 0.1); color: var(--text-0); }
.dd-item.checked { color: var(--accent); }
.dd-item .check { color: var(--accent); }

/* Tooltip on map */
.map-tip {
  position: absolute;
  background: rgba(15, 26, 51, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  pointer-events: none;
  font-size: 12px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 20;
}
.map-tip .tt-title { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.map-tip .tt-row { display: flex; justify-content: space-between; color: var(--text-1); margin-top: 3px; }
.map-tip .tt-row .v { font-family: "JetBrains Mono", monospace; color: var(--text-0); }


/* ================= v3 科技感增强 ================= */

#stage > * { position: relative; z-index: 1; }
#stage > .tweak-backdrop { position: absolute; z-index: 300; }
#stage > .tweak-panel { position: absolute; z-index: 301; }
#stage > .app-header { z-index: 200; overflow: visible; }

@keyframes dashRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dashPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.app-header { position: relative; }
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .55), rgba(126,88,255,.4), transparent);
}
.center-title { text-shadow: 0 0 26px rgba(var(--accent-rgb), .35); }
.status-dot { animation: dashPulse 2.4s ease-in-out infinite; }

.card {
  /* 三段渐变的不透明度整体跟随 --card-alpha（基准 .72 ⇒ .78/.82/.86） */
  background:
    linear-gradient(180deg,
      rgba(22,38,74, calc(var(--card-alpha) * 1.083)) 0%,
      rgba(10,18,36, calc(var(--card-alpha) * 1.139)) 46%,
      rgba(8,14,30,  calc(var(--card-alpha) * 1.194)) 100%);
  border-color: rgba(120,160,240, calc(var(--line-alpha) + 0.02));
  box-shadow: inset 0 1px 0 rgba(150,190,255,.10), 0 10px 30px rgba(2,6,16,.45);
  overflow: hidden;
  animation: dashRise .5s cubic-bezier(.22,.7,.3,1) both;
}
.col > .card:nth-child(1) { animation-delay: .04s; }
.col > .card:nth-child(2) { animation-delay: .12s; }
.col > .card:nth-child(3) { animation-delay: .2s; }

.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), .55) 0 1px, transparent 1px) top left / 16px 16px no-repeat,
    linear-gradient(-45deg, rgba(var(--accent-rgb), .4) 0 1px, transparent 1px) bottom right / 16px 16px no-repeat;
  opacity: .0;
}
.card-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .45), rgba(120,160,240,.10) 60%, transparent);
}
.card-title { text-shadow: 0 0 18px rgba(var(--accent-rgb), .25); }
.card-title::before { box-shadow: 0 0 10px rgba(var(--accent-rgb), .8); }

.pending-metric-card, .case-card, .kpi-cell, .rs-cell {
  background: linear-gradient(180deg,
      rgba(26,44,82, var(--card-alpha)),
      rgba(12,21,42, calc(var(--card-alpha) * 1.083))) !important;
  position: relative;
  overflow: hidden;
}
.pending-metric-card::after, .case-card::after {
  content: ""; position: absolute; top: 0; left: 0; width: 28%; height: 1px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .9), transparent);
}
.pending-metric-card:hover, .case-card:hover, .rs-cell-btn:hover {
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .34), 0 8px 24px rgba(var(--accent-rgb), .10);
}
.pending-metric-value, .kpi-value, .cm-value, .donut-label, .cc-stat .v, .fs-val, .wo-status-pie-total {
  text-shadow: 0 0 16px rgba(var(--accent-rgb), .28);
}
.map-wrap { position: relative; }
.map-wrap::before {
  content: ""; position: absolute; inset: 12% 8%; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), .10), transparent 72%);
}
.heatmap .hm-cell.header { background: linear-gradient(180deg, rgba(30,52,96,.9), rgba(18,32,62,.9)); }
.pr-done { box-shadow: inset 0 0 12px rgba(70,214,160,.35); }
.flow-stage { position: relative; overflow: hidden; }

.body-grid { position: relative; z-index: 1; }

/* ---- 渲染兜底提示（ErrorBoundary） ---- */
.dash-crash {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: var(--bg-0, #060a14); color: var(--text-0, #eaf2ff); text-align: center; padding: 40px;
}
.dash-crash-title { font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.dash-crash-msg {
  max-width: 640px; font-size: 13px; line-height: 1.7; color: var(--text-2, #8fa3c8);
  font-family: 'JetBrains Mono', monospace; word-break: break-all;
}
.dash-crash-btn {
  padding: 8px 18px; border: 1px solid var(--accent, #38d9ff); border-radius: 4px;
  background: transparent; color: var(--accent, #38d9ff); font-size: 13px; cursor: pointer;
}
.dash-crash-btn:hover { background: rgba(56, 217, 255, .12); }
