:root{
  --bg:#020b24;
  --panel:#061a45;
  --panel2:#08224f;
  --line:#1d5bb8;
  --line-soft:rgba(64,140,255,.35);
  --glow:rgba(40,130,255,.45);
  --text:#e9f2ff;
  --muted:#8fb0dc;
  --dim:#5f7fae;
  --cyan:#3fd6ff;
  --yellow:#ffd21f;
  --green:#19e3a1;
  --red:#ff4d4f;
  --num:"DIN Alternate","Bahnschrift","Roboto Condensed","Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{
  background:
    radial-gradient(1200px 600px at 50% -10%,rgba(30,110,255,.28),transparent 60%),
    radial-gradient(900px 500px at 100% 100%,rgba(0,120,255,.12),transparent 60%),
    linear-gradient(180deg,#03113a 0%,#020a22 100%);
  background-color:var(--bg);
  color:var(--text);
  font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif;
  -webkit-font-smoothing:antialiased;
  overflow:auto;
}
button{font:inherit;color:inherit}
.screen{
  display:grid;
  grid-template-columns:clamp(230px,15vw,280px) 48px minmax(620px,1fr) clamp(360px,24vw,460px);
  grid-template-rows:64px minmax(0,1fr);
  grid-template-areas:"top top top top" "dir bm center right";
  gap:10px;
  padding:8px 12px 12px;
  height:100vh;
  min-height:780px;
  min-width:1280px;
}

/* ---------- 面板通用 ---------- */
.panel{
  position:relative;
  background:linear-gradient(180deg,rgba(10,40,100,.72),rgba(5,22,62,.82));
  border:1px solid var(--line);
  border-radius:8px;
  box-shadow:inset 0 0 18px rgba(30,120,255,.18),0 0 10px rgba(0,80,200,.25);
  min-width:0;min-height:0;
}
.panel::before{ /* 顶部高光 */
  content:"";position:absolute;left:12px;right:12px;top:-1px;height:2px;
  background:linear-gradient(90deg,transparent,#4fb1ff,transparent);opacity:.75;border-radius:2px;
}
.panel-head{display:flex;align-items:center;gap:10px;padding:6px 12px 2px}
.panel-head h2{margin:0;font-size:17px;font-weight:700;letter-spacing:.5px;white-space:nowrap}
.sample-tag{font-size:11px;color:var(--dim);border:1px solid rgba(95,127,174,.5);border-radius:3px;padding:0 5px;line-height:16px}

/* ---------- 顶栏 ---------- */
.topbar{grid-area:top;display:grid;grid-template-columns:1fr auto 1fr;align-items:center}
.brand{display:flex;align-items:center;gap:10px}
.brand-logo{width:58px;height:40px}
.brand-name{font-size:19px;font-weight:700;letter-spacing:.3px;line-height:1.1}
.brand-sub{font-size:16px;font-weight:700;line-height:1.2}
.title{
  margin:0;position:relative;padding:8px 70px 10px;font-size:28px;font-weight:800;letter-spacing:2px;
  text-shadow:0 0 12px rgba(80,170,255,.6);
}
.title::before{
  content:"";position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(20,90,220,.35),rgba(10,40,120,.15));
  clip-path:polygon(0 0,100% 0,94% 100%,6% 100%);
  border-bottom:2px solid #3d9bff;z-index:-1;
}
.title::after{
  content:"";position:absolute;left:6%;right:6%;bottom:0;height:2px;
  background:linear-gradient(90deg,transparent,#56b6ff,transparent);
}
.topmeta{justify-self:end;text-align:right;line-height:1.35}
.clock{font-family:var(--num);font-size:18px;color:#cfe3ff}
.updated{font-size:12px;color:var(--muted)}

/* ---------- 左侧目录 ---------- */
.dir-panel{grid-area:dir;display:flex;flex-direction:column;padding:10px 6px 8px 10px}
.dir-title{font-size:19px;font-weight:700;text-align:center;padding:4px 0 8px;letter-spacing:1px}
.folder-list{list-style:none;margin:0;padding:0 4px 0 0;overflow:auto;flex:1;display:flex;flex-direction:column;justify-content:space-between}
.folder-list li{min-height:24px}
.folder-list a{
  display:flex;align-items:center;gap:7px;padding:3px 6px;border-radius:4px;
  color:var(--text);text-decoration:none;font-size:14px;line-height:20px;white-space:nowrap;
}
.folder-list a:hover{background:rgba(40,130,255,.22);box-shadow:inset 2px 0 0 #3fa2ff}
.folder-list a:focus-visible{outline:1px solid #6cbcff}
.folder-list .ficon{flex:none;width:20px;height:16px}
.folder-list .fname{overflow:hidden;text-overflow:ellipsis}
.folder-list li.missing a{color:var(--muted);cursor:not-allowed}
.folder-list .miss-badge{margin-left:auto;font-size:11px;color:#ffb020;border:1px solid #ffb020;border-radius:3px;padding:0 4px}
.folder-pending{font-size:12px;color:#ffb020;padding:6px 4px 0;border-top:1px dashed rgba(255,176,32,.4);margin-top:6px}

/* ---------- 书签 ---------- */
.bookmarks{grid-area:bm;display:flex;flex-direction:column;gap:10px;padding:0}
.bookmark{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:8px 0;cursor:pointer;
  background:linear-gradient(180deg,rgba(14,52,120,.9),rgba(6,26,70,.9));
  border:1px solid var(--line);border-radius:7px;box-shadow:0 0 8px rgba(0,90,220,.35);
  transition:border-color .15s,box-shadow .15s;
}
.bookmark:hover{border-color:#4fb1ff;box-shadow:0 0 12px rgba(60,160,255,.6)}
.bookmark svg{width:22px;height:22px;flex:none;fill:none;stroke:#cfe6ff;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.bm-code{font-family:var(--num);font-size:13px;font-weight:700;color:#d8e9ff;margin-top:1px}
.bm-text{writing-mode:vertical-rl;text-orientation:upright;font-size:16px;font-weight:600;letter-spacing:4px;line-height:1}

/* ---------- 中间 ---------- */
.center{grid-area:center;display:grid;grid-template-rows:minmax(0,1fr) minmax(0,1fr) clamp(170px,22vh,230px);gap:10px;min-width:0;min-height:0}
.prod-panel{display:flex;flex-direction:column;padding-bottom:4px}
.prod-meta{margin-left:auto;font-size:12px;color:var(--muted);display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.prod-meta .pill{border:1px solid var(--line-soft);border-radius:10px;padding:0 8px;line-height:18px}
.prod-meta .pill.warn{border-color:rgba(255,176,32,.6);color:#ffc04d}
.prod-meta .pill.ok{border-color:rgba(25,227,161,.5);color:#5df0bf}

.kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;padding:6px 12px 4px}
.kpi{
  position:relative;text-align:center;padding:6px 4px 5px;border-radius:6px;cursor:pointer;
  background:linear-gradient(180deg,rgba(25,80,170,.55),rgba(10,40,100,.55));
  border:1px solid rgba(70,150,255,.55);box-shadow:inset 0 0 10px rgba(40,130,255,.25);
  transition:box-shadow .15s,border-color .15s;
}
.kpi:hover{border-color:#6cbcff}
.kpi.on{box-shadow:inset 0 0 12px rgba(40,130,255,.35),0 -2px 0 var(--c) inset}
.kpi-name{font-size:15px;font-weight:600;color:#dbe9ff;white-space:nowrap}
.kpi-val{font-family:var(--num);font-size:24px;font-weight:700;line-height:1.15;white-space:nowrap;letter-spacing:.3px}
.kpi-val small{font-family:inherit;font-size:13px;font-weight:600;color:#cfe0ff;margin-left:3px}
.kpi-sub{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:15px}
.kpi-sub .up{color:#ff8a8a}.kpi-sub .down{color:#5df0bf}
.kpi.missing .kpi-val{color:var(--muted)}
.kpi .flag{position:absolute;top:3px;right:4px;font-size:10px;color:#ffb020}

.chart-wrap{position:relative;flex:1;min-height:110px;padding:0 6px}
.chart{position:absolute;inset:0 6px}
.chart svg{display:block;width:100%;height:100%}
.chart text{font-family:var(--num);fill:#b8cff0;font-size:12px}
.chart .unit-label{font-family:"PingFang SC","Microsoft YaHei",sans-serif;font-size:11px;fill:#8fb0dc}
.tooltip{
  position:absolute;pointer-events:none;z-index:5;min-width:190px;
  background:rgba(4,18,52,.96);border:1px solid #3d8eff;border-radius:6px;padding:8px 10px;
  font-size:12px;box-shadow:0 4px 18px rgba(0,0,0,.5);
}
.tooltip .tt-date{font-weight:700;font-size:13px;margin-bottom:4px}
.tooltip .tt-row{display:flex;align-items:center;gap:6px;line-height:20px;white-space:nowrap}
.tooltip .dot{width:8px;height:8px;border-radius:50%;flex:none}
.tooltip .tt-val{margin-left:auto;font-family:var(--num);font-size:13px;padding-left:10px}
.tooltip .kind{font-size:10px;border-radius:3px;padding:0 4px;line-height:15px}
.kind.actual{background:rgba(25,227,161,.18);color:#5df0bf}
.kind.reference{background:rgba(143,176,220,.18);color:#b8cff0}
.kind.missing{background:rgba(255,176,32,.18);color:#ffc04d}
.tooltip .tt-src{color:var(--dim);font-size:11px;margin-top:4px}

.legend{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 14px;padding:2px 10px 2px;font-size:13px}
.legend .chip{display:flex;align-items:center;gap:6px;cursor:pointer;opacity:.45;background:none;border:0;padding:1px 2px}
.legend .chip.on{opacity:1}
.legend .chip i{display:inline-block;width:18px;height:2px;position:relative}
.legend .chip i::after{content:"";position:absolute;left:5px;top:-3px;width:8px;height:8px;border-radius:50%;background:inherit}
.legend .key{color:var(--muted);font-size:12px;display:flex;align-items:center;gap:10px;margin-left:8px}
.legend .key b{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:4px;vertical-align:-1px}
.legend .key .k-act{background:#cfe0ff}
.legend .key .k-ref{border:1.5px solid #cfe0ff}

/* ---------- 底部 ---------- */
.bottom-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;min-height:0}
.spare-panel,.cons-panel{display:flex;flex-direction:column}
.spares{flex:1;display:flex;align-items:center;justify-content:center;gap:28px;padding:4px 16px 10px;min-height:0}
.spares svg{height:100%;max-height:150px;aspect-ratio:1}
.spares .donut-label{font-size:12px;fill:#e9f2ff}
.spares .donut-num{font-family:var(--num);font-size:22px;font-weight:700;fill:#fff}
.spare-legend{list-style:none;margin:0;padding:0;font-size:14px;display:grid;gap:10px;min-width:150px}
.spare-legend li{display:flex;align-items:center;gap:10px}
.spare-legend b{width:12px;height:12px;border-radius:2px}
.spare-legend span:last-child{margin-left:auto;font-family:var(--num);font-size:15px}
.consumables{flex:1;position:relative;min-height:0;padding:0 8px 4px}
.consumables svg{position:absolute;inset:0 8px 4px;width:calc(100% - 16px);height:calc(100% - 4px)}
.consumables text{font-family:var(--num);fill:#b8cff0;font-size:11px}
.consumables .cat{font-family:"PingFang SC","Microsoft YaHei",sans-serif;font-size:12px;fill:#dbe9ff}

/* ---------- 右侧 ---------- */
.right{grid-area:right;display:grid;grid-template-rows:repeat(4,minmax(0,1fr)) minmax(0,.86fr);gap:10px;min-height:0}
.list-panel{display:flex;flex-direction:column}
.rows{list-style:none;margin:0;padding:2px 12px 6px;flex:1;display:flex;flex-direction:column;justify-content:space-around}
.rows li{display:grid;grid-template-columns:24px 110px 1fr auto;align-items:center;gap:8px;font-size:13.5px;line-height:20px;white-space:nowrap}
.rows .no{display:inline-flex;align-items:center;justify-content:center;width:22px;height:17px;border-radius:3px;background:#1550b8;font-family:var(--num);font-size:12px}
.rows .code{font-family:var(--num);font-size:13.5px;color:#e4eeff;letter-spacing:.2px}
.rows .desc{overflow:hidden;text-overflow:ellipsis}
.rows .st{font-weight:700;font-size:13px}
.st.s-ing{color:var(--yellow)}.st.s-done{color:var(--green)}.st.s-wait{color:#fff}
.st.s-proc{color:#ffb020}.st.s-todo{color:var(--yellow)}.st.s-closed{color:var(--green)}
.rows .sev{width:13px;height:13px;border-radius:50%;justify-self:center;box-shadow:0 0 6px currentColor}
.sev.high{background:#ff4d3a;color:#ff4d3a}.sev.mid{background:#ffd21f;color:#ffd21f}.sev.low{background:#19e3a1;color:#19e3a1}
.lessons .rows li{grid-template-columns:24px 76px 1fr}

/* ---------- 提示 ---------- */
.toast{
  position:fixed;left:50%;bottom:36px;transform:translateX(-50%);z-index:20;
  background:rgba(6,26,70,.96);border:1px solid #3d8eff;border-radius:6px;padding:8px 16px;font-size:13px;
  box-shadow:0 4px 18px rgba(0,0,0,.5);
}

/* ---------- 窄屏：调整布局并允许滚动 ---------- */
@media (max-width:1366px){
  .kpi-val{font-size:20px}
  .kpi-name{font-size:13.5px}
  .rows li{font-size:12.5px;grid-template-columns:22px 100px 1fr auto;gap:6px}
}
@media (max-width:1279px){
  .screen{
    min-width:0;height:auto;min-height:0;
    grid-template-columns:230px 48px minmax(0,1fr);
    grid-template-rows:auto auto auto;
    grid-template-areas:"top top top" "dir bm center" "right right right";
  }
  .center{grid-template-rows:340px 340px 220px}
  .dir-panel{max-height:960px}
  .right{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:210px}
  .lessons{grid-column:1 / -1}
}
@media (max-width:900px){
  .screen{grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "bm" "dir" "center" "right"}
  .topbar{grid-template-columns:1fr;justify-items:center;gap:6px}
  .topmeta{justify-self:center;text-align:center}
  .title{font-size:22px;padding:6px 40px 8px}
  .bookmarks{flex-direction:row}
  .bookmark{flex:1;flex-direction:row;justify-content:center;padding:8px}
  .bm-text{writing-mode:horizontal-tb;letter-spacing:1px}
  .kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
  .center{grid-template-rows:auto auto auto}
  .prod-panel{height:420px}
  .bottom-row{grid-template-columns:1fr;grid-auto-rows:220px}
  .right{grid-template-columns:1fr}
  .lessons{grid-column:auto}
}
