:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1e2a38;
  --muted: #6b7c90;
  --line: #e4eaf1;
  --shadow: 0 1px 2px rgba(24, 42, 64, .05), 0 8px 24px rgba(24, 42, 64, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

button, input {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  outline: none;
}

button { cursor: pointer; transition: .15s; }
button.primary { background: #21615a; border-color: #21615a; color: #fff; }
button.primary:hover { background: #1a4f49; }
button.primary:disabled { opacity: .6; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
button.ghost:hover { color: var(--ink); border-color: var(--line); }
input:focus { border-color: #9db9d6; box-shadow: 0 0 0 3px rgba(45, 108, 173, .09); }

/* 密码门 */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 30px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gate-card h1 { margin: 0; font-size: 18px; font-weight: 600; }
.gate-sub { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.gate-card input { width: 100%; }
.gate-hint { margin: 4px 0 0; color: #93a2b4; font-size: 12px; }
.gate-error { margin: 0; color: #c0392b; font-size: 12.5px; }
.gate-error[hidden] { display: none; }

/* 看板 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.titles h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

main#app[hidden] { display: none; }
main#app { padding-bottom: 28px; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px 28px 0;
  max-width: 1400px;
  margin: 0 auto;
}
.foot {
  max-width: 1400px;
  margin: 14px auto 0;
  padding: 0 28px;
  color: #93a2b4;
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-head { display: flex; align-items: center; gap: 8px; }
.port { font-weight: 650; font-size: 15px; }
.kind { font-size: 11.5px; color: var(--muted); background: #f2f5f9; padding: 2px 7px; border-radius: 20px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #3aa675; }

.rings { display: flex; gap: 6px; justify-content: space-around; flex-wrap: wrap; }
.ring { position: relative; width: 152px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ring svg { width: 152px; height: 152px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: #eef2f6; stroke-width: 11; }
.ring .value { fill: none; stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-center {
  position: absolute; top: 0; height: 152px; width: 152px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-center b { font-size: 26px; font-weight: 660; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ring-center span { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.ring-center small { font-size: 10px; color: #93a2b4; margin-top: 3px; max-width: 94px; text-align: center; line-height: 1.25; }
.ring-label { font-size: 12px; color: var(--muted); }

.meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.meta b { display: block; color: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.parts { display: flex; gap: 6px; flex-wrap: wrap; }
.part { font-size: 11.5px; color: var(--muted); background: #f5f8fb; border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; }
.part b { color: var(--ink); font-weight: 600; }

.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 20px; background: #f3f6fa; color: #48596c; border: 1px solid var(--line); }
.pill b { font-variant-numeric: tabular-nums; }
.pill.run { background: #eaf6f1; border-color: #cfe9df; color: #1f6b52; }
.pill.queue { background: #eef3fb; border-color: #d6e2f4; color: #2c5b96; }
.pill.held { background: #fdf2e4; border-color: #f2ddc0; color: #8a5510; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; padding: 14px 16px 0; }
  .topbar { padding: 14px 16px; }
  .foot { padding: 0 16px; }
}

/* 用户查询 */
.panel {
  max-width: 1400px;
  margin: 18px auto 0;
  padding: 16px 18px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 640; }
.search { display: flex; gap: 8px; }
.search input { width: min(440px, 56vw); }
.user-result { margin-top: 12px; display: grid; gap: 14px; }
.user-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.user-card h3 { margin: 0 0 8px; font-size: 14px; font-weight: 650; }
.user-card h3 span { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 8px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eef2f6; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f9fbfd; }
.state { font-size: 11.5px; padding: 1px 7px; border-radius: 20px; background: #f2f5f9; }
.state.R, .state.RUNNING { background: #eaf6f1; color: #1f6b52; }
.state.Q, .state.PENDING { background: #eef3fb; color: #2c5b96; }
.state.H, .state.HELD { background: #fdf2e4; color: #8a5510; }
.hint { color: #93a2b4; font-size: 12px; margin: 8px 0 0; }

.card.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card.clickable:hover { border-color: #c3d4e4; box-shadow: 0 6px 22px rgba(24, 42, 64, .1); transform: translateY(-1px); }

/* 全部任务弹层 */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 32, 46, .38); }
.modal-body {
  position: relative; width: min(1100px, 96vw); max-height: 86vh;
  background: #fff; border-radius: 16px; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 60px rgba(15, 28, 44, .24);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.close { border: none; background: transparent; color: #8b9aab; font-size: 22px; line-height: 1; padding: 0 6px; }
.close:hover { color: var(--ink); }
.modal-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid #f0f4f8; }
.modal-tools input { width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: #4a5b6e; }
.chip.on { background: #21615a; border-color: #21615a; color: #fff; }
.chip.focus { background: #fdf2e4; border-color: #f2ddc0; color: #8a5510; cursor: default; }
.modal-list { padding: 4px 20px 18px; overflow: auto; }
.modal-list table { min-width: 760px; }
.modal-list thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-list tr.pinned td { background: #f5fbf9; }
.modal-list tr.pinned td:first-child { box-shadow: inset 3px 0 0 #2f8f83; font-weight: 600; }
body.modal-open { overflow: hidden; }

@media (max-width: 720px) {
  .modal { padding: 0; }
  .modal-body { width: 100vw; max-height: 100vh; border-radius: 0; }
  .search input { width: 100%; }
  .panel { margin: 14px 16px 0; }
}
