/* 集群面板（在 duix_prod 面板的基础上改）。颜色：页面沿用原来的灰白 / 深色两套；图表颜色按 dataviz 规范（完成 = 蓝，失败 = 红，两色在浅色、深色背景下都已校验） */
:root {
  --bg: #f6f7f9; --card: #fff; --text: #1f2328; --muted: #6a737d; --line: #e3e6ea; --accent: #2f6feb;
  --ok: #1a7f37; --bad: #cf222e; --warn: #9a6700; --run: #0969da;
  --s1: #2a78d6; --s-fail: #d03b3b; --grid: #eceef1; --axis: #c9ced4; --wash: rgba(47, 111, 235, .07);
  --thumb-bg: #e9ecef; --shadow: 0 6px 24px rgba(0, 0, 0, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #171b21; --text: #e6e8eb; --muted: #8b949e; --line: #2a3038; --accent: #4c8dff;
    --ok: #3fb950; --bad: #f85149; --warn: #d29922; --run: #58a6ff;
    --s1: #3987e5; --s-fail: #d03b3b; --grid: #232931; --axis: #3a414b; --wash: rgba(76, 141, 255, .10);
    --thumb-bg: #0b0e12; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 16px;
         background: var(--card); }
header h1 { font-size: 17px; margin: 0; }
.brand { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
main { max-width: 1320px; margin: 0 auto; padding: 4px 16px 40px; }
h3 { font-size: 15px; margin: 24px 0 10px; display: flex; gap: 12px; align-items: baseline; }
h4 { font-size: 14px; margin: 20px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; } .row.center { align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.err { color: var(--bad); white-space: pre-wrap; }
button, .btn { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px;
               cursor: pointer; font: inherit; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 顶部导航 */
.tabs { display: flex; gap: 2px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto;
        position: sticky; top: 0; z-index: 5; }
.tabs a { padding: 9px 14px; color: var(--text); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--accent); }
.tabs a.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 16px 0 12px; }
.chips { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--card); }
.chips button { border: none; border-radius: 0; padding: 5px 12px; }
.chips button + button { border-left: 1px solid var(--line); }
.chips button.on { background: var(--accent); color: #fff; }
.more { text-align: center; margin: 14px 0; }

/* 数字卡片 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 600; line-height: 1.3; }
.tile .value small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.tile .sub { font-size: 12px; color: var(--muted); }

/* 状态标签：文字 + 颜色点 */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 10px; font-size: 12px; border: 1px solid currentColor; white-space: nowrap; }
.s-succeeded { color: var(--ok); } .s-failed { color: var(--bad); } .s-running, .s-training, .s-checking { color: var(--run); }
.s-queued, .s-waiting_clone { color: var(--warn); }
.s-replaced, .s-deleted { color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 10px; font-size: 12px;
        background: rgba(0, 0, 0, .62); color: #fff; white-space: nowrap; }
.pill .dot.s-succeeded { background: #3fb950; } .pill .dot.s-failed { background: #ff6b6b; }
.pill .dot.s-running, .pill .dot.s-training, .pill .dot.s-checking { background: #58a6ff; }
.pill .dot.s-queued, .pill .dot.s-waiting_clone { background: #f2c94c; }
.pill .dot.s-replaced, .pill .dot.s-deleted { background: #9aa4ae; }
.running .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.bar { width: 90px; height: 6px; background: var(--line); border-radius: 3px; display: inline-block; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--run); border-radius: 3px; }

/* 视频卡片 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.gallery.mini { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.vcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; color: var(--text);
         transition: border-color .15s, transform .15s; }
.vcard:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.thumb { position: relative; aspect-ratio: 3 / 4; background: var(--thumb-bg); overflow: hidden; }
.thumb img { position: relative; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; }
.thumb .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.thumb .ov { position: absolute; }
.thumb .tl { top: 8px; left: 8px; } .thumb .br { bottom: 8px; right: 8px; } .thumb .bl { bottom: 8px; left: 8px; }
.thumb .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.vcard:hover .play { opacity: 1; }
.play i { width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, .55); position: relative; }
.play i::after { content: ""; position: absolute; left: 17px; top: 13px; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.thumb .pbar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .35); }
.thumb .pbar i { display: block; height: 100%; background: #58a6ff; }
.vbody { padding: 8px 10px 10px; }
.vtitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmeta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmeta.err { color: var(--bad); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 8px; }

/* 进行中列表 */
.active-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.arow { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--text); }
.arow:hover { text-decoration: none; border-color: var(--accent); }
.arow .athumb { width: 54px; height: 72px; border-radius: 6px; overflow: hidden; background: var(--thumb-bg); flex: none; }
.arow .athumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.arow .amain { flex: 1; min-width: 0; }
.arow .aline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.arow .wide-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.arow .wide-bar i { display: block; height: 100%; background: var(--run); }
.arow svg { flex: none; }

/* 图表 */
.charts2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.chart-card { padding: 10px 12px 6px; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-box { width: 100%; min-height: 60px; }
.chart-box .none { color: var(--muted); font-size: 12px; padding: 20px 0; text-align: center; }
svg.chart { display: block; overflow: visible; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis { stroke: var(--axis); stroke-width: 1; }
svg.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .lbl { fill: var(--text); font-size: 11px; }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .hit { fill: transparent; }
svg.chart .hit.on { fill: var(--wash); }
svg.chart .cross { stroke: var(--axis); stroke-width: 1; }
svg.chart .ring { stroke: var(--card); stroke-width: 2; }
.legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--card); color: var(--text); border: 1px solid var(--line);
       border-radius: 6px; box-shadow: var(--shadow); padding: 6px 9px; font-size: 12px; min-width: 120px; }
.tip-title { color: var(--muted); margin-bottom: 3px; }
.tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tip-row i { width: 10px; height: 2px; border-radius: 1px; flex: none; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--muted); }

/* 阶段用时条 */
.bars { display: grid; grid-template-columns: max-content minmax(80px, 1fr) max-content; gap: 6px 10px; align-items: center; max-width: 720px; font-size: 13px; }
.bars .track { height: 10px; }
.bars .track i { display: block; height: 100%; min-width: 2px; background: var(--s1); border-radius: 0 3px 3px 0; }
.bars .sub { color: var(--muted); padding-left: 14px; }
.bars .sub + .track i { background: color-mix(in srgb, var(--s1) 45%, transparent); }
.bars .v { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }

/* 表格 */
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; } tr.click:hover { background: var(--wash); }
td.num { font-variant-numeric: tabular-nums; }
td .tthumb { width: 30px; height: 40px; border-radius: 4px; object-fit: cover; object-position: center 25%; display: block; background: var(--thumb-bg); }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.good { color: var(--ok); } .worse { color: var(--bad); }
.cell-err { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; color: var(--bad); font-size: 12px; }
.small-tiles .tile .value { font-size: 20px; font-weight: 600; }

/* 详情弹窗 */
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); padding: 0;
         width: min(1200px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.dlg-head b { display: flex; gap: 8px; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { padding: 14px 16px 20px; overflow: auto; max-height: calc(100vh - 80px); }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.media video, .videos video { width: 100%; max-height: 62vh; background: #000; border-radius: 6px; display: block; }
.media .ph, .videos .ph { aspect-ratio: 3 / 4; max-height: 62vh; display: flex; align-items: center; justify-content: center; text-align: center;
                          padding: 20px; background: var(--thumb-bg); color: var(--muted); border-radius: 6px; }
.cap { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv a { word-break: break-all; }
.valimg { max-width: 560px; }
.valimg .heads { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.valimg img { width: 100%; display: block; border-radius: 6px; image-rendering: auto; }
.metrics td:not(:first-child) { font-variant-numeric: tabular-nums; }
.metrics { max-width: 720px; }
details.logs-box summary { cursor: pointer; color: var(--muted); margin-top: 18px; }
.logs { margin: 8px 0 0; padding: 0 0 0 14px; list-style: none; font-size: 13px; border-left: 2px solid var(--line); }
.logs li { padding: 3px 0 3px 10px; position: relative; white-space: normal; }
.logs li::before { content: ""; position: absolute; left: -19px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--axis); border: 2px solid var(--card); }
.logs li.bad::before { background: var(--bad); } .logs li.good::before { background: var(--ok); }
audio { width: 100%; max-width: 420px; height: 34px; }

form.grid { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; max-width: 820px; margin-top: 10px; }
form.grid input, form.grid select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }

button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
select, input[type=number] { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); font: inherit; }
.toolbar.actions { margin-top: -4px; padding: 8px 12px; background: var(--wash); border-radius: 8px; }
td.sel, th.sel { width: 28px; padding-right: 0; }
.node-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.role { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; background: var(--wash); color: var(--accent); }
.ops { display: flex; gap: 6px; flex-wrap: wrap; }
.ops button { padding: 2px 8px; font-size: 12px; }

@media (max-width: 900px) {
  .dgrid { grid-template-columns: 1fr; }
  .charts2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  form.grid { grid-template-columns: 1fr; }
  .ellipsis { max-width: 140px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .active-list { grid-template-columns: 1fr; }
}
