:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e3e6ea;
  --text: #1f2329;
  --muted: #8a9099;
  --brand: #07c160;
  --brand-dark: #059b4d;
  --danger: #e64340;
}

/* 原 App 自带字体（与包内 assets/fonts 完全一致；PingFang 为唯一含中文的字体） */
@font-face {
  font-family: "AppPingFang";
  src: url("/assets/fonts/PingFang.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: "SansStdRegular";
  src: url("/assets/fonts/SansStdRegular.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: "SansStdMedium";
  src: url("/assets/fonts/SansStdMedium.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: "SansStdBold";
  src: url("/assets/fonts/SansStdBold.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: "WeChatNum";
  src: url("/assets/fonts/WeChatNum.ttf") format("truetype");
  font-display: block;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg); display: flex; flex-direction: column; height: 100vh;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-size: 16px; font-weight: 600; }
.tag { font-size: 11px; font-weight: 400; color: #fff; background: var(--brand); border-radius: 10px; padding: 1px 8px; margin-left: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions label { color: var(--muted); display: flex; align-items: center; gap: 4px; }
button {
  font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer;
}
button:hover { border-color: #c9ced6; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.link { border: none; background: none; color: #576b95; padding: 2px 4px; }
select, input, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text);
  width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
.muted { color: var(--muted); font-size: 12px; }

.layout { flex: 1; display: grid; grid-template-columns: 400px 1fr; gap: 12px; padding: 12px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; min-height: 0; }
.panel.form h2 { font-size: 14px; margin: 0 0 10px; }
.preview { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; }
.stage { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; background:
  linear-gradient(45deg, #eef0f3 25%, transparent 25%, transparent 75%, #eef0f3 75%) 0 0/16px 16px,
  linear-gradient(45deg, #eef0f3 25%, transparent 25%, transparent 75%, #eef0f3 75%) 8px 8px/16px 16px, #f8f9fb;
  border-radius: 8px; padding: 12px;
}
#c { box-shadow: 0 4px 18px rgba(0,0,0,.16); border-radius: 4px; background: #fff; max-width: 100%; }

/* nav */
.nav-group { margin-bottom: 12px; }
.nav-group > .t { font-size: 12px; color: var(--muted); margin: 6px 0; letter-spacing: .5px; }
.nav-item {
  display: block; width: 100%; text-align: left; border: none; background: none; padding: 7px 8px;
  border-radius: 6px; cursor: pointer; color: var(--text);
}
.nav-item:hover { background: #f2f4f7; }
.nav-item.active { background: #e8f8ef; color: var(--brand-dark); font-weight: 600; }
.nav-item .soon { font-size: 11px; color: #b9bfc7; margin-left: 4px; }

/* form */
.field { margin-bottom: 10px; }
.field > label { display: block; color: #5b6270; margin-bottom: 4px; font-size: 12px; }
.field .row { display: flex; gap: 6px; align-items: center; }
.field.inline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field.inline > label { margin: 0; }
.field input[type=checkbox] { width: auto; }
.hint-inline { color: #b9bfc7; font-size: 11px; }
.avatar-btn { width: 44px; height: 44px; border-radius: 6px; border: 1px solid var(--line); background: #fff; padding: 0; overflow: hidden; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; cursor: pointer; background: #fff; }
.chip.active { background: #e8f8ef; border-color: var(--brand); color: var(--brand-dark); }
.list-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.list-row input { flex: 1; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 10px; width: min(880px, 92vw); max-height: 88vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-head button { border: none; background: none; font-size: 20px; line-height: 1; }
.modal-body { padding: 14px; overflow: auto; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.avatar-grid button { padding: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1/1; }
.avatar-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.role-card { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.role-card img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.role-card .meta { flex: 1; min-width: 0; }
.role-card .meta b { display: block; }
.role-card .meta span { color: var(--muted); font-size: 12px; }
.notice { background: #fff8e6; border: 1px solid #ffe1a8; color: #8a6100; padding: 8px 10px; border-radius: 8px; font-size: 12px; margin-bottom: 10px; }
