:root {
  --bg: #0b0f17; --bg2: #111725; --card: #151c2c; --card2: #1b2437; --line: #26314a; --line2: #33405e;
  --text: #e6ebf5; --muted: #8a97b2; --dim: #5d6a86;
  --accent: #6d8bff; --accent2: #8f6dff; --accent-bg: rgba(109,139,255,.14);
  --ok: #2fca86; --ok-bg: rgba(47,202,134,.14); --warn: #f0b429; --warn-bg: rgba(240,180,41,.14);
  --bad: #ff5d6c; --bad-bg: rgba(255,93,108,.14); --info: #38bdf8;
  --radius: 14px; --shadow: 0 8px 30px rgba(0,0,0,.35);
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "DejaVu Sans Mono", "WenQuanYi Zen Hei Mono", monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5fa; --bg2: #e9edf5; --card: #ffffff; --card2: #f6f8fc; --line: #e1e6f0; --line2: #cfd7e6;
  --text: #172033; --muted: #5d6a86; --dim: #8a97b2; --accent-bg: rgba(109,139,255,.12);
  --shadow: 0 6px 24px rgba(23,32,51,.08); color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5fa; --bg2: #e9edf5; --card: #ffffff; --card2: #f6f8fc; --line: #e1e6f0; --line2: #cfd7e6;
    --text: #172033; --muted: #5d6a86; --dim: #8a97b2; --accent-bg: rgba(109,139,255,.12);
    --shadow: 0 6px 24px rgba(23,32,51,.08); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
  "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", Inter, "WenQuanYi Zen Hei", sans-serif; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ---------- 布局 ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0,1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 15px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: -.5px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted);
  font-weight: 500; margin-bottom: 2px; cursor: pointer;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { background: var(--accent-bg); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--dim); }
.main { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.page-title .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.mobile-bar { display: none; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.card + .card { margin-top: 16px; }
.grid > .card, .hero > .card, .metrics > .card, .g2 > .card, .g3 > .card { margin-top: 0; }
.jump svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.svc svg, .row > a > svg { width: 16px; height: 16px; }
.section-gap { margin-top: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--card2); color: var(--text); cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.btn.ok { background: var(--ok); border-color: transparent; color: #04140c; }
.btn.danger { color: var(--bad); border-color: rgba(255,93,108,.4); background: var(--bad-bg); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--card2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.icon-btn { width: 30px; padding: 0; }

/* ---------- 表单 ---------- */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
label.f .hint { font-weight: 400; color: var(--dim); font-size: 11.5px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text);
  outline: none; width: 100%; min-width: 0;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check .hint { display: block; color: var(--dim); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }

/* ---------- 状态 ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--card2); color: var(--muted); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.info { background: var(--accent-bg); color: var(--accent); }
.pill.pulse .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--card2); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

/* ---------- 概览 ---------- */
.hero { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 16px; }
.hero-main { position: relative; overflow: hidden; }
.hero-main::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-bg), transparent 70%); pointer-events: none; }
.hero-name { font-size: 24px; font-weight: 750; letter-spacing: -.4px; }
.hero-gpu { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.power { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.jump { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jump a { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card2); color: var(--text); transition: border-color .15s, transform .1s; }
.jump a:hover { border-color: var(--accent); transform: translateY(-1px); }
.jump .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; font-size: 13px; }
.jump b { display: block; font-size: 14px; } .jump span { font-size: 12px; color: var(--muted); }
.jump .disabled { opacity: .45; pointer-events: none; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-top: 16px; }
.metric .label { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; }
.metric .val { font-size: 26px; font-weight: 750; letter-spacing: -.6px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.metric .val small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.bar { height: 7px; background: var(--card2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .5s; }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.spark { width: 100%; height: 34px; display: block; margin-top: 8px; }
.svc { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; gap: 8px; }
.svc:last-child { border-bottom: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--card2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--card2); }
td.name { white-space: normal; word-break: break-all; min-width: 160px; }
td.actions { text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; font-weight: 600;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- 文件 ---------- */
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.crumbs a { padding: 3px 6px; border-radius: 6px; color: var(--text); cursor: pointer; }
.crumbs a:hover { background: var(--card2); }
.crumbs span { color: var(--dim); }
.fname { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.fname svg { width: 17px; height: 17px; flex: none; }
.fname.dir svg { color: var(--warn); } .fname.file svg { color: var(--muted); }
.drop { border: 2px dashed var(--accent); background: var(--accent-bg); }
.quick a { cursor: pointer; }

/* ---------- 终端 ---------- */
.term-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.term-tab { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 13px; }
.term-tab.active { border-color: var(--accent); background: var(--accent-bg); }
.term-tab .x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 15px; }
.term-box { background: #0a0d14; border-radius: 12px; border: 1px solid var(--line); padding: 8px; height: calc(100vh - 230px); min-height: 360px; }
.term-box > div { height: 100%; }
.term-keys { display: none; gap: 6px; margin-top: 8px; overflow-x: auto; }
.term-keys button { flex: none; }

/* ---------- 任务进度 ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 8px 0; align-items: flex-start; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--line2); color: var(--dim); margin-top: 1px; }
.steps .done .st { background: var(--ok); border-color: var(--ok); color: #04140c; }
.steps .running .st { border-color: var(--accent); color: var(--accent); }
.steps .running .st::after { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps .failed .st { background: var(--bad); border-color: var(--bad); color: #fff; }
.steps .skipped .st { color: var(--dim); border-style: dashed; }
.steps .skipped .nm { color: var(--dim); text-decoration: line-through; }
.steps .nm { font-weight: 550; } .steps .det { font-size: 12px; color: var(--muted); word-break: break-all; }
@keyframes spin { to { transform: rotate(360deg); } }
.logbox { background: #0a0d14; color: #c9d4ea; border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--line); }
.progress-big { height: 10px; }
.jobmini { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.jobmini:last-child { border-bottom: 0; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5,8,14,.6); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--line2); border-radius: 16px; width: min(560px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow); padding: 22px; }
.modal.wide { width: min(980px, 100%); }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--card); border: 1px solid var(--line2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 11px 14px;
  box-shadow: var(--shadow); font-size: 13.5px; animation: slide .2s ease-out; }
.toast.bad { border-left-color: var(--bad); } .toast.ok { border-left-color: var(--ok); }
@keyframes slide { from { transform: translateY(10px); opacity: 0 } }
.banner { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); border: 1px solid rgba(240,180,41,.35); margin-bottom: 16px; font-size: 13.5px; }
.banner.info { background: var(--accent-bg); border-color: rgba(109,139,255,.35); }
.banner.bad { background: var(--bad-bg); border-color: rgba(255,93,108,.35); }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 500px at 70% -10%, var(--accent-bg), transparent), var(--bg); }
.login .box { width: min(400px, 100%); }
.login .brand { justify-content: center; padding-bottom: 22px; font-size: 18px; }

/* ---------- 部署 ---------- */
.dep-sec { margin-bottom: 16px; }
.dep-sec > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.dep-sec > summary::-webkit-details-marker { display: none; }
.dep-sec > summary .num { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; font-size: 12.5px; }
.dep-sec > summary .chev { margin-left: auto; color: var(--dim); transition: transform .2s; }
.dep-sec[open] > summary .chev { transform: rotate(90deg); }
.dep-sec .body { margin-top: 16px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.preset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card2); }
.preset:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }

/* ---------- 移动端 ---------- */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 16px 92px; }
  .mobile-bar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--bg2); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobile-bar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); padding: 4px 6px; border-radius: 8px; cursor: pointer; min-width: 52px; }
  .mobile-bar a svg { width: 21px; height: 21px; }
  .mobile-bar a.active { color: var(--accent); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .metrics { gap: 10px; }
  .metric .val { font-size: 22px; }
  .card { padding: 14px; }
  .page-title h1 { font-size: 19px; }
  .hide-m { display: none !important; }
  .term-box { height: calc(100vh - 290px); }
  .term-keys { display: flex; }
  .jump { grid-template-columns: 1fr; }
  .power .btn { flex: 1; }
}
@media (min-width: 761px) { .show-m { display: none !important; } }
.spin-sm { width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; display: inline-block; animation: spin .8s linear infinite; }
.metric .label span:first-child { white-space: nowrap; }
.metric .label span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 8px; min-width: 0; }
.preview-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 10px; }
