:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #15803d;
  --ok-bg: #e8f6ee;
  --warn: #a16207;
  --warn-bg: #fdf4d7;
  --danger: #b91c1c;
  --danger-bg: #fdeaea;
  --info: #1d4ed8;
  --info-bg: #e8f0fe;
  --neutral: #475569;
  --neutral-bg: #eef2f7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  min-height: 58px;
  flex-wrap: wrap;
}

.brand a {
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.brand a:hover { text-decoration: none; }
.brand span { color: #94a3b8; font-weight: 500; margin-left: 6px; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-link {
  color: #cbd5e1;
  padding: 7px 10px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 13px;
}
.nav-link:hover { background: #1e293b; color: #ffffff; text-decoration: none; }
.nav-link.active { background: #1d4ed8; color: #ffffff; }

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 12px;
  color: #cbd5e1;
}
.account-name { color: #ffffff; font-weight: 600; }
.account-org { padding: 2px 8px; background: #1e293b; border-radius: 99px; }
.inline-form { display: inline; margin: 0; }

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 22px 56px;
}

footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px 28px;
  color: var(--muted);
  font-size: 12px;
}

h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 12px 18px; }
.panel + .panel { margin-top: 18px; }

.grid { display: grid; gap: 16px; }
.section-title { margin: 22px 0 12px; font-size: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-workflow { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 700; line-height: 1.25; margin-top: 2px; }
.stat .hint { color: var(--muted); font-size: 12px; }

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.workflow-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 16px;
}
.workflow-card:hover { border-color: #bfdbfe; box-shadow: var(--shadow); }
.workflow-card a { color: inherit; }
.workflow-card .desc { color: var(--muted); font-size: 13px; min-height: 40px; }
.workflow-meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.workflow-meta strong { color: var(--ink); font-size: 15px; margin-right: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  background: var(--brand);
  color: #ffffff;
  text-decoration: none;
  line-height: 1.2;
  font-family: inherit;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #eef2f7; color: #1e293b; border-color: var(--line); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-ghost { background: transparent; color: #e2e8f0; border-color: #334155; }
.btn-ghost:hover { background: #1e293b; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-outline { background: #fff; color: var(--brand); border-color: #bfdbfe; }
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-danger { background: var(--danger-bg); color: var(--danger); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-neutral { background: var(--neutral-bg); color: var(--neutral); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  background: #f8fafc;
}

.callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px 14px;
  color: #334155;
  font-size: 13px;
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); color: #713f12; }
.callout.danger { border-left-color: var(--danger); background: var(--danger-bg); color: #7f1d1d; }
.callout.ok { border-left-color: var(--ok); background: var(--ok-bg); color: #14532d; }
.callout strong { font-weight: 650; }

.flash {
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  border: 1px solid #bbf7d0;
  background: var(--ok-bg);
  color: #14532d;
}
.flash.error { border-color: #fecaca; background: var(--danger-bg); color: #7f1d1d; }
.flash.warn { border-color: #fed7aa; background: var(--warn-bg); color: #7c2d12; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 550; font-size: 12px; background: #f8fafc; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td .small, .small { font-size: 12px; color: var(--muted); }

.empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafbfc;
}
.empty strong { display: block; color: #334155; margin-bottom: 4px; font-size: 14px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); font-weight: 550; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #ffffff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #bfdbfe;
  outline-offset: 1px;
  border-color: var(--brand);
}
textarea { resize: vertical; min-height: 76px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.help { color: var(--muted); font-size: 12px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input[type="text"] { width: 150px; padding: 5px 8px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
}
.tab:hover { text-decoration: none; border-color: #bfdbfe; color: var(--brand); }
.tab.active { background: #1e293b; border-color: #1e293b; color: #ffffff; }

.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 12px; padding: 9px 0; position: relative; }
.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  z-index: 1;
}
.step:not(:last-child) .step-dot::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 30px;
  bottom: -4px;
  width: 2px;
  background: #e2e8f0;
}
.step.ok .step-dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.step.running .step-dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.step.failed .step-dot { border-color: var(--danger); background: var(--danger); color: #fff; }
.step-body { padding-top: 1px; }
.step-title { font-weight: 550; font-size: 13px; }
.step-note { color: var(--muted); font-size: 12px; }

.step-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.step-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--line);
}
.step-chip.ok { background: var(--ok-bg); color: var(--ok); border-color: #bbf7d0; }
.step-chip.running { background: var(--info-bg); color: var(--info); border-color: #bfdbfe; }
.step-chip.failed { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.step-chip.skipped { opacity: 0.6; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.action-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfcfe;
  margin: 0;
}
.action-box strong { font-size: 13px; }
.action-box.danger-zone { border-color: #fecaca; background: #fffafa; }

.node-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #ffffff;
}
.node-card + .node-card { margin-top: 10px; }
.node-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.node-title strong { font-size: 14px; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbfcfe; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #334155;
  max-height: 320px;
  overflow: auto;
}

.token-box {
  border: 1px dashed #93c5fd;
  background: #eff6ff;
  border-radius: 10px;
  padding: 16px;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #1e3a8a;
  user-select: all;
}

.error-shell { max-width: 560px; margin: 8vh auto 0; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.login-shell { max-width: 420px; margin: 9vh auto 0; }
.login-card { padding: 28px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .btn { width: 100%; padding: 10px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }

.progress { width: 100%; height: 8px; accent-color: var(--brand); }
.severity { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-weight: 550; font-size: 13px; }
.list-item .meta { color: var(--muted); font-size: 12px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4, .grid-workflow { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .container { padding: 18px 14px 40px; }
  .account { width: 100%; justify-content: flex-end; }
}
