:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e4e6eb;
  --text: #1f2329;
  --muted: #8f959e;
  --brand: #3370ff;
  --brand-soft: #eaf0ff;
  --ok: #2ea44f;
  --warn: #d97706;
  --err: #d93026;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

/* 被第三方站点以 iframe 嵌入时（标记由各模板 <head> 里的小脚本打上），
   页面底色改为半透明，让宿主页的底色透出来；不支持 color-mix 的浏览器退化为全透明。
   想要更透就把 45% 调小，想保留更多自己的灰底就调大。 */
html.in-iframe body {
  background: transparent;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .logo { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .stats { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1280px; margin: 24px auto 64px; padding: 0 24px; }
.wrap.wide { max-width: 1500px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1; min-width: 320px; }
.field label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="password"] {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--text);
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

button {
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
button:hover { border-color: #c9ced6; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: #2860e0; }
button.primary:disabled { opacity: .6; cursor: not-allowed; }
button.mini { height: 28px; padding: 0 10px; font-size: 12px; }
button.danger { color: var(--err); }

table { width: 100%; border-collapse: collapse; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 900px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: #fafbfc; }
tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

td.actions-cell { white-space: nowrap; }
.actions-group { display: inline-flex; align-items: center; gap: 6px; }
.actions-group button { height: 30px; }

.search-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-row input { width: 260px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; line-height: 18px; }
.badge.pending  { background: #f0f1f3; color: var(--muted); }
.badge.running  { background: var(--brand-soft); color: var(--brand); }
.badge.done     { background: #e8f6ec; color: var(--ok); }
.badge.failed   { background: #fdecea; color: var(--err); }
.badge.skipped  { background: #fff5e5; color: var(--warn); }

.progress { height: 8px; background: #eef0f3; border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .3s; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.err-text { color: var(--err); font-size: 12px; }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }

.tree { font-size: 13px; max-height: 68vh; overflow: auto; }
.tree .dir { font-weight: 600; margin: 10px 0 4px; color: #4e5969; }
.tree .file { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text); cursor: pointer; }
.tree .file:hover { background: var(--brand-soft); }
.tree .file.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tree .indent { padding-left: 14px; }

.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.preview-head h2 { margin: 0; flex: 1; }
.preview {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-height: 72vh;
  overflow: auto;
}

.markdown-body { font-size: 14px; line-height: 1.75; word-wrap: break-word; }
.markdown-body h1 { font-size: 24px; margin: 8px 0 16px; }
.markdown-body h2 { font-size: 20px; margin: 24px 0 12px; }
.markdown-body h3 { font-size: 17px; margin: 20px 0 10px; }
.markdown-body h4 { font-size: 15px; margin: 16px 0 8px; }
.markdown-body img { max-width: 100%; border-radius: 6px; }
.markdown-body table { border: 1px solid var(--border); margin: 12px 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 10px; }
.markdown-body th { background: #fafbfc; }
.markdown-body code { background: #f2f3f5; padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.markdown-body pre { background: #f7f8fa; padding: 14px; border-radius: 8px; overflow: auto; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--border); color: #4e5969; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.show { opacity: .95; }
.toast.error { background: var(--err); }
