/* 2-6 调度中心 · 管理后台样式（纯手写，无构建依赖） */
:root {
  --bg: #0b0f14;
  --bg-soft: #0f151c;
  --card: #141b23;
  --card-2: #18212b;
  --line: #26313d;
  --line-soft: #1e2732;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3b82f6;
  --accent-2: #6366f1;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: #79c0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* 启动态 */
.boot { min-height: 100vh; display: grid; place-items: center; gap: 12px; color: var(--muted); }
.boot-logo {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-weight: 700;
  margin: 0 auto;
}
.boot-text { font-size: 13px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed); font-weight: 700; color: #fff; flex: 0 0 auto;
}
.login-head h1 { font-size: 18px; }
.login-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.login-foot { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 15, 20, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-weight: 700; font-size: 13px;
  flex: 0 0 auto;
}
.brand-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 8px;
  cursor: pointer; white-space: nowrap; font-size: 13px;
}
.nav button:hover { color: var(--text); background: var(--bg-soft); }
.nav button.active { color: #fff; background: #1d2937; }
.userbox { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: 0 0 auto; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #1f2b38; display: grid; place-items: center;
  font-size: 12px; color: #9fb2c6;
}
.userbox .uname { font-size: 12px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* 主体 */
.main { max-width: 1440px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }
.page-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* 卡片 & 统计 */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.split-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1024px) {
  .split, .split-2 { grid-template-columns: minmax(0, 1fr); }
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { border-color: #1d3a63; background: linear-gradient(180deg, #101d2c, var(--card)); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.card-head .muted { font-size: 12px; }

/* 表单 */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: #5b6a7a; }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline > label.field { margin-bottom: 0; flex: 1 1 160px; }
.inline > label.field.shrink { flex: 0 0 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #1e2936; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2f6fd8; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff9d97; border-color: #5a2a2c; background: #231416; }
.btn.danger:hover { background: #2d1719; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.queued { color: #79c0ff; background: #10243a; border-color: #1c3b57; }
.badge.claimed { color: #e3b341; background: #2a2210; border-color: #4a3a12; }
.badge.running { color: #d2a8ff; background: #241333; border-color: #3c2152; }
.badge.succeeded { color: #56d364; background: #0f2b18; border-color: #1f5530; }
.badge.failed { color: #ff7b72; background: #2d1214; border-color: #5a2225; }
.badge.timeout { color: #ffa657; background: #2b1a0d; border-color: #4f3011; }
.badge.cancelled { color: #9aa4af; background: #1c232b; border-color: #2a333d; }
.badge.online { color: #56d364; background: #0f2b18; border-color: #1f5530; }
.badge.offline { color: #9aa4af; background: #1c232b; border-color: #2a333d; }
.badge.disabled { color: #ff7b72; background: #2d1214; border-color: #5a2225; }
.badge.mock { color: #e3b341; background: #2a2210; border-color: #4a3a12; }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 13px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl th { background: #121922; color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; }
table.tbl tbody tr:hover { background: #131b24; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; font-size: 12px; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; color: var(--muted); padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* 详情抽屉 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(3, 6, 10, .6); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100%;
  background: #10161d; border-left: 1px solid var(--line); z-index: 41;
  transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1 1 auto; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 118px 1fr; gap: 8px 12px; font-size: 13px; margin-bottom: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.code {
  background: #0b1016; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; color: #b7c4d1;
}
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* 事件时间线 */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 16px; font-size: 12px; color: var(--muted); }
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: #3b4a5a;
}
.timeline li b { color: var(--text); font-weight: 600; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  background: #16202b; border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; transition: opacity .2s, transform .2s;
  max-width: min(520px, calc(100vw - 32px));
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: #5a2225; background: #231416; color: #ffb4b4; }
.toast.ok { border-color: #1f5530; background: #0f2216; color: #b7f0c4; }

/* 提示条 */
.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); font-size: 13px; margin-bottom: 14px;
}
.banner.warn { border-color: #4a3a12; background: #201a0c; color: #e3b341; }
.banner.err { border-color: #5a2225; background: #231416; color: #ffb4b4; }
.banner.ok { border-color: #1f5530; background: #0f2216; color: #b7f0c4; }

/* 登录错误 */
.form-err { color: #ff9d97; font-size: 12px; min-height: 18px; margin-top: 8px; }

/* 响应式 */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .topbar-inner { height: auto; padding: 10px 14px 0; flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; padding-bottom: 8px; flex-wrap: wrap; }
  .userbox { margin-left: auto; }
  .main { padding: 16px 14px 48px; }
  .drawer { width: 100%; border-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 21px; }
  .page-head h2 { font-size: 17px; }
  .card { padding: 14px; }
  body { font-size: 13px; }
}
@media (max-width: 390px) {
  .stats { grid-template-columns: 1fr; }
  .topbar-inner { padding: 10px 12px 0; }
  .userbox .uname { display: none; }
}
