:root {
  --bg: #070d18;
  --bg-soft: #0c1424;
  --panel: #101a2e;
  --panel-2: #14213a;
  --line: #1e2f4d;
  --line-soft: #182641;
  --text: #e8eefc;
  --muted: #8ea3c4;
  --faint: #5f7595;
  --cyan: #43d9d0;
  --cyan-dim: #1c8f8a;
  --violet: #8f8cff;
  --amber: #f3b75c;
  --red: #ff6b7a;
  --green: #54d68c;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(67, 217, 208, 0.09), transparent 60%),
    radial-gradient(900px 420px at -10% 100%, rgba(143, 140, 255, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.pad { padding: 16px 0; }
.right { text-align: right; }

/* login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-mark, .brand-mark {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  color: #051018;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border-radius: 10px;
}
.login-mark { width: 46px; height: 46px; font-size: 17px; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; letter-spacing: 0.2px; }
.login-sub { color: var(--muted); margin: 8px 0 24px; }
.login label {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.login input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  outline: none;
}
.login input:focus { border-color: var(--cyan-dim); box-shadow: 0 0 0 3px rgba(67, 217, 208, 0.12); }
.login button {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  color: #04121a;
  background: linear-gradient(135deg, var(--cyan), #7be9dc);
}
.login button:disabled { opacity: 0.55; cursor: wait; }
.login-error {
  margin-top: 14px;
  color: var(--red);
  background: rgba(255, 107, 122, 0.08);
  border: 1px solid rgba(255, 107, 122, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
}
.login-foot { margin-top: 24px; color: var(--faint); font-size: 12px; }

/* shell */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  border-right: 1px solid var(--line-soft);
  background: rgba(7, 13, 24, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 40px; height: 40px; font-size: 14px; }
.brand strong { display: block; font-size: 15px; letter-spacing: 0.4px; }
.brand small { color: var(--faint); font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; }
.nav { display: grid; gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(67, 217, 208, 0.12), transparent);
  border-color: rgba(67, 217, 208, 0.22);
}
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.nav-item.active .nav-dot { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.rail-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 12px;
  flex-wrap: wrap;
}
.version { margin-left: auto; font-family: var(--mono); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.conn-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(84, 214, 140, 0.7); }
.conn-dot.bad { background: var(--red); }

.main { padding: 34px 38px 64px; max-width: 1400px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 26px;
}
.topbar h1 { font-size: 27px; letter-spacing: 0.2px; }
.page-sub { color: var(--muted); margin-top: 6px; }
.topbar-actions { display: flex; gap: 8px; }

button.ghost {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 14px;
  color: var(--muted);
}
button.ghost:hover { color: var(--text); border-color: var(--cyan-dim); }
button.ghost.small { padding: 5px 10px; font-size: 12px; }
button.ghost.danger-text:hover { color: var(--red); border-color: rgba(255, 107, 122, 0.5); }

/* stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat span { color: var(--faint); font-size: 12px; letter-spacing: 0.6px; }
.stat strong { display: block; font-size: 26px; margin-top: 4px; font-family: var(--mono); }

/* panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { font-size: 15px; letter-spacing: 0.3px; }

/* table */
.table-wrap { overflow-x: auto; }
table.jobs { width: 100%; border-collapse: collapse; min-width: 860px; }
.jobs th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.6px;
  color: var(--faint);
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.jobs td { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.jobs tr:last-child td { border-bottom: 0; }
.jobs tbody tr { cursor: pointer; transition: background 0.15s; }
.jobs tbody tr:hover { background: rgba(67, 217, 208, 0.04); }
.job-name { font-weight: 600; display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-id { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.job-lang { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.job-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.mini {
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.mini:hover { color: var(--text); border-color: var(--cyan-dim); }
.mini.danger:hover { color: var(--red); border-color: rgba(255, 107, 122, 0.5); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.queued { color: var(--amber); border-color: rgba(243, 183, 92, 0.3); background: rgba(243, 183, 92, 0.07); }
.chip.running { color: var(--cyan); border-color: rgba(67, 217, 208, 0.32); background: rgba(67, 217, 208, 0.07); }
.chip.succeeded { color: var(--green); border-color: rgba(84, 214, 140, 0.3); background: rgba(84, 214, 140, 0.07); }
.chip.failed { color: var(--red); border-color: rgba(255, 107, 122, 0.35); background: rgba(255, 107, 122, 0.07); }
.chip.canceled { color: var(--faint); }
.chip.paused { color: var(--amber); border-color: rgba(243, 183, 92, 0.4); background: rgba(243, 183, 92, 0.1); }

.mini-bar { width: 110px; height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan-dim), var(--cyan)); }
.mini-percent { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 4px; }

.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty p { font-size: 15px; color: var(--text); margin-bottom: 6px; }

/* server info */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line-soft);
}
.info-cell { background: var(--panel); padding: 18px 20px; }
.info-cell span { display: block; color: var(--faint); font-size: 12px; letter-spacing: 0.4px; }
.info-cell strong { display: block; margin-top: 5px; font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.notes { margin: 0; padding: 18px 22px 18px 40px; color: var(--muted); }
.notes li { margin: 6px 0; }

/* detail */
.detail { animation: rise 0.22s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}
.detail-head h2 { font-size: 22px; margin-top: 10px; overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.progress-panel { padding: 20px; }
.progress-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-top strong { font-family: var(--mono); font-size: 24px; }
.bar { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan), var(--violet));
  transition: width 0.35s ease;
}
.stage-line { color: var(--muted); margin: 12px 0 14px; font-size: 13px; }
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.stage-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--faint);
  font-size: 13px;
}
.stage-list li.active { color: var(--text); background: rgba(67, 217, 208, 0.06); border-color: rgba(67, 217, 208, 0.2); }
.stage-list li.done { color: var(--muted); }
.stage-index { font-family: var(--mono); font-size: 11px; width: 18px; color: var(--faint); }
.stage-state { margin-left: auto; font-size: 11px; letter-spacing: 0.5px; }
.facts { margin: 0; padding: 16px 20px; display: grid; gap: 12px; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.facts dt { color: var(--faint); font-size: 12px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts code { font-family: var(--mono); font-size: 12px; }

.files { display: grid; gap: 10px; padding: 16px 20px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-soft);
}
.file-kind {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(67, 217, 208, 0.1);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
}
.file-kind.dual { color: var(--violet); background: rgba(143, 140, 255, 0.1); }
.file-kind.glossary { color: var(--amber); background: rgba(243, 183, 92, 0.1); }
.file-main { min-width: 0; flex: 1; }
.file-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main span { color: var(--faint); font-size: 12px; }
.file-dl {
  border: 1px solid rgba(67, 217, 208, 0.35);
  background: rgba(67, 217, 208, 0.08);
  color: var(--cyan);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
}
.file-dl:hover { background: rgba(67, 217, 208, 0.16); }

.error-panel { border-color: rgba(255, 107, 122, 0.28); }
.error-text {
  margin: 0;
  padding: 16px 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #ffc1c7;
  background: rgba(255, 107, 122, 0.04);
}
.error-panel.pause-panel { border-color: rgba(243, 183, 92, 0.35); }
.pause-panel .panel-head h2 { color: var(--amber); }
.pause-panel .error-text {
  color: #ffe0b0;
  background: rgba(243, 183, 92, 0.05);
}
.log {
  margin: 0;
  padding: 16px 20px;
  max-height: 380px;
  overflow: auto;
  background: #060b14;
  font-family: var(--mono);
  font-size: 12px;
  color: #a8c0dd;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    gap: 15px;
  }
  .brand small, .version, .rail-foot { display: none; }
  .nav { grid-auto-flow: column; }
  .nav-item { padding: 8px 12px; }
  .main { padding: 22px 18px 48px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .detail-head { flex-direction: column; }
}
