/* PageShot 2.0 · 单页界面样式（无第三方依赖） */
:root {
  --bg: #0b1220;
  --bg-soft: #111a2c;
  --card: #131d31;
  --card-2: #16223a;
  --line: #22304c;
  --line-soft: #1b2740;
  --text: #e6edf7;
  --text-dim: #9aabc4;
  --text-faint: #6f819e;
  --accent: #4f8cff;
  --accent-2: #22d3a6;
  --warn: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(79, 140, 255, 0.16), transparent 60%),
    radial-gradient(800px 400px at 0% 0%, rgba(34, 211, 166, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: #0d1524; padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 650; }
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px;
  background: linear-gradient(180deg, rgba(16, 24, 40, 0.78), rgba(11, 18, 32, 0.62));
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 30px -24px rgba(0, 0, 0, 0.9);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #4f8cff, #22d3a6);
  box-shadow: 0 6px 16px rgba(79, 140, 255, 0.35);
}
.logo.big { width: 54px; height: 54px; font-size: 20px; margin: 0 auto 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text h1 { font-size: 17px; letter-spacing: 0.2px; }
.brand-text .muted { font-size: 11.5px; }

.tabs {
  position: relative; display: flex; gap: 2px; flex: 1;
  padding: 4px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.tab-pill {
  position: absolute; top: 4px; left: 0; height: calc(100% - 8px);
  width: var(--pill-w, 0px); transform: translateX(var(--pill-x, 0px));
  border-radius: 9px; pointer-events: none; opacity: 0;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.92), rgba(34, 211, 166, 0.72));
  box-shadow: 0 6px 18px -6px rgba(79, 140, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.42s cubic-bezier(0.34, 1.42, 0.5, 1), width 0.42s cubic-bezier(0.34, 1.42, 0.5, 1), opacity 0.2s;
}
.tabs.has-pill .tab-pill { opacity: 1; }
.tab {
  position: relative; z-index: 1;
  border: 0; background: transparent; color: var(--text-dim);
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: color 0.18s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: #fff; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 9px; background: rgba(255, 255, 255, 0.22);
  font-size: 11px; line-height: 18px; text-align: center;
}

.statusline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 3px rgba(255,255,255,0.05); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18); }
.dot.warn { background: var(--warn); }

.icon-btn {
  border: 1px solid var(--line); background: var(--card);
  color: var(--text-dim); width: 32px; height: 32px; border-radius: 9px;
  cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------------- 布局 ---------------- */
main { max-width: 1180px; margin: 0 auto; padding: 22px 22px 70px; }
.panel { display: none; animation: fade 0.18s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  position: relative;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(79, 140, 255, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(24, 35, 56, 0.92), rgba(15, 23, 39, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 22px 50px -30px rgba(0, 0, 0, 0.95);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.06), transparent 32%);
  opacity: 0.7;
}
.card:hover { border-color: rgba(255, 255, 255, 0.12); }
/* 浮入：滚动到可视区才出现，卡片多时不会一起抖 */
.card.reveal, .run-card.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.22, 0.68, 0.28, 1), transform 0.5s cubic-bezier(0.22, 0.68, 0.28, 1);
}
.card.reveal.in, .run-card.reveal.in { opacity: 1; transform: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15.5px; }

/* ---------------- 统计卡 ---------------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.stat-label { font-size: 11.5px; color: var(--text-faint); }
.stat strong { font-size: 17px; font-weight: 650; letter-spacing: 0.3px; }

/* ---------------- 表单 ---------------- */
label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 10px 0 5px; }
label.spaced { margin-top: 16px; }
input[type=text], input[type=url], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #0c1424; color: var(--text); font-size: 13.5px;
  font-family: inherit; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.16); }
textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px; }
select.compact { width: auto; padding: 7px 9px; font-size: 12.5px; }

.input-row { display: flex; gap: 10px; align-items: center; }
.input-row input { flex: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }

.checks { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--text); font-size: 13.5px; cursor: pointer; }
.check.inline { margin: 0; white-space: nowrap; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

.advanced { margin-top: 14px; border: 1px dashed var(--line); border-radius: 10px; padding: 0 14px 8px; }
.advanced summary { cursor: pointer; padding: 10px 0; color: var(--text-dim); font-size: 13px; user-select: none; }
.advanced[open] summary { color: var(--text); }

.hint { margin-top: 14px; font-size: 12px; color: var(--text-faint); line-height: 1.9; }
.hint.warn { color: var(--warn); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: 0.15s;
}
.btn:hover { border-color: var(--accent); color: #fff; text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, #3b82f6, #2b6fe0); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.14); border-color: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.full { width: 100%; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sticky-actions { position: sticky; bottom: 12px; background: rgba(11, 18, 32, 0.9); padding: 10px; border: 1px solid var(--line-soft); border-radius: 12px; backdrop-filter: blur(8px); }

/* ---------------- 结果 ---------------- */
.result-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 18px; align-items: start; }
.preview-wrap { background: #0a101c; border: 1px solid var(--line); border-radius: 10px; padding: 8px; max-height: 620px; overflow: auto; }
.preview-wrap img { width: 100%; display: block; border-radius: 6px; background: #fff; }
.result-meta dl { margin: 0; display: grid; grid-template-columns: 84px 1fr; gap: 6px 10px; font-size: 12.5px; }
.result-meta dt { color: var(--text-faint); }
.result-meta dd { margin: 0; word-break: break-all; }
.result-meta .btn-row { margin-top: 16px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table th { background: #0e1729; color: var(--text-dim); font-weight: 600; font-size: 12px; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(79, 140, 255, 0.05); }
.table .empty { text-align: center; color: var(--text-faint); padding: 26px; }
.table .job-name { font-weight: 650; }
.table .job-url { color: var(--text-faint); font-size: 11.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge-status { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-status.ok { color: #6ee7b7; background: rgba(52, 211, 153, 0.14); }
.badge-status.error { color: #fca5a5; background: rgba(248, 113, 113, 0.14); }
.badge-status.skipped { color: #cbd5e1; background: rgba(148, 163, 184, 0.16); }
.badge-status.disabled { color: var(--text-faint); background: rgba(148, 163, 184, 0.1); }

/* ---------------- 历史 ---------------- */
.runs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.run-card {
  border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden;
  background: var(--card-2); cursor: pointer; transition: 0.15s; display: flex; flex-direction: column;
}
.run-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.run-thumb { height: 130px; background: #0a101c; display: grid; place-items: center; overflow: hidden; }
.run-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.run-thumb .none { color: var(--text-faint); font-size: 12px; }
.run-body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 4px; }
.run-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.run-title .run-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.run-state {
  flex: none; max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; font-weight: 500; line-height: 16px; padding: 0 5px; border-radius: 4px;
  background: rgba(56, 189, 248, 0.14); color: #7dd3fc;
}
.run-sub { font-size: 11.5px; color: var(--text-faint); display: flex; justify-content: space-between; gap: 6px; }
.run-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.run-actions .btn { padding: 4px 8px; font-size: 11.5px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ---------------- 提示 / 弹窗 ---------------- */
.warn-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.warn-list .item {
  font-size: 12px; padding: 7px 10px; border-radius: 8px;
  background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.28); color: #fde68a;
}
.warn-list .item.error { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: #fca5a5; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 220px; max-width: 380px; padding: 10px 14px; border-radius: 10px;
  background: #16223a; border: 1px solid var(--line); color: var(--text);
  font-size: 13px; box-shadow: var(--shadow); animation: slide 0.2s ease;
}
.toast.ok { border-color: rgba(52, 211, 153, 0.5); }
.toast.error { border-color: rgba(248, 113, 113, 0.55); }
.toast.info { border-color: rgba(79, 140, 255, 0.5); }
.toast.warn { border-color: rgba(251, 191, 36, 0.6); }

.userbox { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; padding-left: 10px; border-left: 1px solid var(--line-soft); }
.user-chip { font-size: 12px; color: var(--text-dim); padding: 3px 8px; border-radius: 999px; background: #101a2e; border: 1px solid var(--line-soft); }
.user-chip.admin { color: #bfe0ff; border-color: rgba(79, 140, 255, 0.5); }
.role-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-soft); color: var(--text-dim); }
.role-tag.admin { color: #bfe0ff; border-color: rgba(79, 140, 255, 0.55); }
.state-off { color: var(--warn); font-size: 12px; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 7, 15, 0.72); backdrop-filter: blur(3px); }
.modal-box {
  position: relative; width: min(920px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; }
.modal-body pre { font-family: var(--mono); font-size: 12px; background: #0a101c; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 60vh; color: #c7d2e4; }
.modal-body .viewer { text-align: center; }
.modal-body .viewer img { max-width: 100%; border-radius: 8px; background: #fff; }
.modal-body .viewer .meta { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }

/* ---------------- webhook 行 ---------------- */
.webhook-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.webhook-row { display: grid; grid-template-columns: 180px 1fr 40px; gap: 8px; align-items: center; }
.webhook-row .btn { padding: 8px 0; }

/* ---------------- 登录页 ---------------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: min(380px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px 26px 22px; box-shadow: var(--shadow); text-align: center;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card label { text-align: left; }
.login-card .error { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: 6px 0 2px; }
.login-card .btn { margin-top: 4px; }


/* ---------------- 看板状态（BI） ---------------- */
.bi-summary {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--text-dim); line-height: 2;
}
.bi-summary strong { color: var(--text); }
.bi-summary .tag {
  display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 20px;
  background: rgba(79, 140, 255, 0.14); color: #a9c6ff; font-size: 11.5px;
}
.bi-summary .tag.warn { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.bi-summary .tag.ok { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.state-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.state-card {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--card-2);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.state-card:hover { border-color: var(--accent); }
.state-card.on { border-color: var(--accent); background: rgba(79, 140, 255, 0.08); }
.state-card.editing { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.state-card input[type=checkbox] { margin-top: 3px; }
.state-main { flex: 1; min-width: 0; }
.state-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.state-desc { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; word-break: break-all; }
.state-src { font-size: 10.5px; padding: 1px 6px; border-radius: 20px; background: rgba(148, 163, 184, 0.16); color: var(--text-dim); font-weight: 500; }
.steps-wrap { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--card-2); }
.steps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.step-list { display: flex; flex-direction: column; gap: 8px; }
.step-row { display: grid; grid-template-columns: 122px minmax(130px, 1.5fr) minmax(110px, 1fr) 30px 30px 30px; gap: 8px; align-items: center; }
.step-row input, .step-row select { padding: 7px 9px; font-size: 12.5px; }
.step-row .icon-btn { width: 28px; height: 28px; padding: 0; font-size: 13px; }
.step-empty { color: var(--text-faint); font-size: 12.5px; padding: 8px 0; }
.bi-results { margin-top: 16px; }

/* 逐状态截图：进度条 + 结果卡片状态 */
/* ---------- 视觉选区（在整页预览图上点选 / 拖框） ---------- */
.vp-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.vp-zoom {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-info {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line, #2a3342);
  border-radius: 10px;
  background: rgba(120, 170, 255, 0.04);
}

.preset-info-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.preset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.preset-table th,
.preset-table td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.12);
  vertical-align: top;
}

.preset-table th {
  color: var(--muted, #93a1b5);
  font-weight: 500;
  white-space: nowrap;
}

.preset-table tr:last-child td {
  border-bottom: 0;
}

.preset-table td:first-child {
  white-space: nowrap;
}

.dirty-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #f5a623;
  border: 1px solid rgba(245, 166, 35, 0.45);
  background: rgba(245, 166, 35, 0.12);
}

.state-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid var(--line, #2a3342);
  border-radius: 8px;
  background: rgba(120, 170, 255, 0.03);
}

.state-pick .check {
  margin: 0;
  white-space: nowrap;
}

.vp-width {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted, #93a1b5);
}

.vp-width input {
  width: 78px;
  padding: 3px 6px;
  font-size: 12px;
}

.vp-pct {
  min-width: 40px;
  text-align: right;
  font-size: 12px;
  color: var(--muted, #93a1b5);
}

.vp-tip {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted, #93a1b5);
}

.vp-scroll {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--line, #2a3342);
  border-radius: 8px;
  background: #0b1220;
}

.vp-stage {
  position: relative;
  margin: 0 auto;
  line-height: 0;
  cursor: crosshair;
  touch-action: none;
}

.vp-img {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.vp-boxes {
  position: absolute;
  inset: 0;
}

.vp-box {
  position: absolute;
  border: 1px solid rgba(79, 140, 255, 0.55);
  background: rgba(79, 140, 255, 0.07);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.vp-box:hover {
  background: rgba(79, 140, 255, 0.22);
  border-color: #4f8cff;
}

.vp-box.on {
  background: rgba(79, 140, 255, 0.3);
  border: 2px solid #4f8cff;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.25);
}

.vp-drag {
  position: absolute;
  border: 2px dashed #f5a623;
  background: rgba(245, 166, 35, 0.16);
  pointer-events: none;
}

.vp-sel {
  position: absolute;
  border: 2px solid #4f8cff;
  background: rgba(79, 140, 255, 0.16);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.2);
}

.vp-meta {
  margin-top: 4px;
}
.range-editor {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line, #2a3342);
  border-radius: 10px;
  background: rgba(120, 170, 255, 0.03);
}

.range-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.range-modes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.range-modes .btn.on {
  border-color: var(--accent, #4f8cff);
  color: var(--accent, #4f8cff);
  background: rgba(79, 140, 255, 0.12);
}

.range-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.range-row input[type="number"] {
  width: 84px;
}

.range-row label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted, #93a1b5);
}

.range-row select {
  min-width: 220px;
  max-width: 100%;
}

.state-range {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(79, 140, 255, 0.16);
  color: #7fb0ff;
  white-space: nowrap;
}

.bi-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.bi-progress-track {
  flex: 1; height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
}
.bi-progress-track span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #22d3ee);
  transition: width 0.25s ease;
}
.bi-progress #biProgressText { white-space: nowrap; }
.warn-tag {
  flex: none; font-size: 10.5px; font-weight: 500; line-height: 16px; padding: 0 5px;
  border-radius: 4px; background: rgba(251, 191, 36, 0.16); color: #fbbf24;
}
.run-card.is-failed { border-color: rgba(248, 113, 113, 0.45); }
.run-card.is-failed .err-text { color: #fda4af; }
/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .result-layout { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
}
@media (max-width: 640px) {
  main { padding: 14px 12px 60px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .webhook-row { grid-template-columns: 1fr 40px; }
  .webhook-row input:first-child { grid-column: 1 / -1; }
  .brand { min-width: 0; }
  .statusline #healthText { display: none; }
}

/* ============================================================
   动效层（3.4）：参考 MotionSites 的「卡片依次浮入 / 页签切换」做法，
   用原生 View Transitions + CSS 动画实现，零依赖、零构建。
   所有动画都在 prefers-reduced-motion 下自动关闭。
   ============================================================ */
:root {
  --ease-out-soft: cubic-bezier(0.22, 0.68, 0.28, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes shimmer {
  from { background-position: -220px 0; }
  to { background-position: 220px 0; }
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(79, 140, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 140, 255, 0); }
}
@keyframes bar-sweep {
  0% { transform: translateX(-100%); }
  60% { transform: translateX(120%); }
  100% { transform: translateX(220%); }
}

/* 页签切换：旧内容淡出、新内容上浮 */
.panel { view-transition-name: none; }
.panel.active { view-transition-name: tabpanel; }
::view-transition-old(tabpanel) { animation: fade-out 0.16s ease both; }
::view-transition-new(tabpanel) { animation: rise-in 0.30s var(--ease-out-soft) both; }

/* 卡片 / 表格行依次浮入 */
.stagger-item {
  animation: rise-in 0.42s var(--ease-out-soft) both;
  animation-delay: calc(var(--i, 0) * 26ms);
}
.run-card .run-thumb img { transition: transform 0.45s var(--ease-out-soft); }
.run-card:hover .run-thumb img { transform: scale(1.035); }
.stat-value.bump { animation: rise-in 0.35s var(--ease-spring) both; }

/* 顶部细进度条：有请求在飞时出现 */
.busy-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 95;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
body.is-busy .busy-bar { opacity: 1; }
body.is-busy .busy-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: bar-sweep 1.1s linear infinite;
}

/* 实时同步到新数据时，标题旁的小圆点闪一下 */
.sync-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-left: 6px; opacity: 0; vertical-align: middle;
}
.sync-dot.ping { animation: pulse-ring 0.9s ease-out 2; opacity: 1; }

/* 权限矩阵里的小标签 */
.perm-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px;
  background: rgba(79, 140, 255, 0.16); color: #a9c4ff; border: 1px solid rgba(79, 140, 255, 0.3);
}
.perm-yes { color: #34d399; font-weight: 600; }
.perm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.perm-list .check { display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.perm-list .check.on { border-color: rgba(79, 140, 255, 0.35); }
.perm-list .perm-note { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* 加载骨架（历史列表首屏） */
@keyframes sk-shimmer { from { background-position: -220px 0; } to { background-position: 320px 0; } }
.sk-card {
  border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 10px;
  background: rgba(255, 255, 255, 0.02); overflow: hidden;
}
.sk-thumb, .sk-line {
  background: linear-gradient(90deg, rgba(255,255,255,0.045) 25%, rgba(255,255,255,0.11) 37%, rgba(255,255,255,0.045) 63%);
  background-size: 420px 100%;
  animation: sk-shimmer 1.25s linear infinite;
  border-radius: 7px;
}
.sk-thumb { height: 108px; margin-bottom: 10px; }
.sk-line { height: 9px; margin: 7px 0; }
.sk-line.w60 { width: 60%; } .sk-line.w40 { width: 40%; } .sk-line.w80 { width: 80%; }

/* 主按钮：hover 时一层光扫过 */
.btn.primary { position: relative; overflow: hidden; }
.btn.primary::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg); opacity: 0;
}
.btn.primary:hover::after { animation: sheen 0.7s ease; }
@keyframes sheen {
  0% { left: -60%; opacity: 0.9; }
  100% { left: 120%; opacity: 0; }
}
.btn:active { transform: translateY(1px); }

/* 共享元素：缩略图 → 大图 的形变 */
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 0.38s;
  animation-timing-function: cubic-bezier(0.22, 0.68, 0.28, 1);
}

/* ---------------- 3.6 视觉层：极光背景 / 聚光卡片 / 滚动进度 ---------------- */
body { position: relative; }
body::before {
  content: ""; position: fixed; inset: -20% -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(620px 420px at 18% 8%, rgba(79, 140, 255, 0.22), transparent 62%),
    radial-gradient(720px 520px at 86% 18%, rgba(34, 211, 166, 0.15), transparent 62%),
    radial-gradient(520px 420px at 62% 92%, rgba(168, 85, 247, 0.13), transparent 62%);
  filter: blur(46px) saturate(120%);
  animation: aurora 26s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); opacity: 0.85; }
  50% { opacity: 1; }
  100% { transform: translate3d(3%, 2.5%, 0) scale(1.08); opacity: 0.9; }
}

/* 鼠标跟随的聚光效果（Framer Spotlight Bento 的思路） */
.card, .stat, .run-card { position: relative; }
.card::before, .stat::before, .run-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(124, 176, 255, 0.16), transparent 62%);
  opacity: 0; transition: opacity 0.28s ease;
}
.card:hover::before, .stat:hover::before, .run-card:hover::before { opacity: 1; }

/* 卡片浮起（配合聚光，鼠标离开回落） */
.card:hover { transform: translateY(-2px); }
.run-card:hover { transform: translateY(-3px); box-shadow: 0 26px 50px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(124, 176, 255, 0.16); }

/* 统计卡：第一张放大，数字用渐变 */
.stats { grid-template-columns: 1.5fr repeat(5, 1fr); }
.stat:first-child strong { font-size: 26px !important; background: linear-gradient(120deg, #8fb6ff, #34d399);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat:hover { transform: translateY(-2px); border-color: rgba(124, 176, 255, 0.28); }

/* 任务表行：hover 左侧亮条 */
#jobsTable tbody tr { position: relative; transition: background 0.2s ease; }
#jobsTable tbody tr:hover { background: rgba(124, 176, 255, 0.055); }
#jobsTable tbody tr td:first-child { box-shadow: inset 2px 0 0 transparent; transition: box-shadow 0.2s ease; }
#jobsTable tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 rgba(124, 176, 255, 0.7); }
.readonly-row { opacity: 0.82; }

/* 负责人小标签 */
.owner-chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  background: rgba(148, 163, 184, 0.14); border: 1px solid rgba(148, 163, 184, 0.25); color: #cbd5e1;
}
.owner-chip.mine { background: rgba(79, 140, 255, 0.16); border-color: rgba(79, 140, 255, 0.42); color: #b9d0ff; }

/* 顶部滚动进度 */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 96;
  background: linear-gradient(90deg, #4f8cff, #22d3a6);
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.8);
  transition: width 0.8s cubic-bezier(0.22, 0.68, 0.28, 1);
  pointer-events: none;
}

/* 实时同步圆点常亮（收到新数据时再闪一下） */
.sync-dot { opacity: 0.75; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.45); } 50% { box-shadow: 0 0 0 4px rgba(79, 140, 255, 0); } }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat:first-child { grid-column: span 3; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .card:hover, .run-card:hover, .stat:hover { transform: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .panel.active { view-transition-name: none; }
}
