:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e5e9f0;
  --text: #1f2d3d;
  --muted: #8492a6;
  --primary: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --fail: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }

#topbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 52px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; }
#nav a.active { background: var(--primary); color: #fff; }

main { max-width: 1080px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 20px; margin-bottom: 16px; }
h2 { font-size: 16px; margin: 16px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.stat { font-size: 22px; font-weight: 700; margin-top: 4px; }
.muted { color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:hover td { background: #fafbfd; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; color: #fff; }
.badge.pass, .badge.success, .badge.approved, .badge.deployed { background: var(--ok); }
.badge.warn, .badge.running, .badge.pending, .badge.edited { background: var(--warn); }
.badge.fail, .badge.failed { background: var(--fail); }
.badge.ghost, .badge.rejected, .badge.rolled_back { background: var(--muted); }
.badge.info { background: var(--primary); }

.btn { display: inline-block; padding: 6px 14px; border: none; border-radius: 6px; background: var(--primary); color: #fff; cursor: pointer; font-size: 13px; text-decoration: none; }
.btn:hover { opacity: 0.9; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); }
.btn.fail { background: var(--fail); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.score { font-weight: 700; }
.score.pass { color: var(--ok); }
.score.warn { color: var(--warn); }
.score.fail { color: var(--fail); }

.diff-wrap { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.diff-head { background: #f0f3f8; padding: 6px 12px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.diff-cols { display: grid; grid-template-columns: 1fr 1fr; }
.diff-cols > div { padding: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; }
.diff-cols > div:first-child { border-right: 1px solid var(--line); background: #fff5f5; }
.diff-cols > div:last-child { background: #f5fff8; }
.diff-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }

textarea.edit { width: 100%; min-height: 200px; padding: 10px; font-family: ui-monospace, monospace; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.form-row input, .form-row textarea, .form-row select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }

.login-box { max-width: 360px; margin: 120px auto; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.bar-track { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2d3d; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px; z-index: 99; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
