/* 国药供应链操作引导 · 配置控制台
   纯静态、零外链。设计基准 13px，信息密度优先。 */

:root {
  --primary: #1668dc;
  --primary-hover: #2a7ae8;
  --primary-weak: #e8f1ff;
  --primary-dark: #0f52b3;
  --success: #18a058;
  --success-weak: #e9f7ef;
  --warning: #f0a020;
  --warning-weak: #fff7e8;
  --error: #d03050;
  --error-weak: #fdeef1;
  --bg: #f5f7fa;
  --card: #fff;
  --border: #e5e8ef;
  --border-strong: #d3d9e5;
  --text: #1f2329;
  --text2: #5b6473;
  --text3: #8b93a3;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(31, 35, 41, .05);
  --shadow-lg: 0 14px 40px rgba(31, 35, 41, .16);
  --top-h: 52px;
  --side-w: 288px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 13px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; margin: 0; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--text3); }
.text2 { color: var(--text2); }
.mono { font-family: var(--mono); font-size: 12px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.ic { display: inline-block; vertical-align: -2px; flex: none; }
.spacer { flex: 1; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(980px 460px at 50% -8%, #e3eeff 0%, rgba(245, 247, 250, 0) 62%),
    var(--bg);
}
.login-card {
  width: 384px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(22, 104, 220, .09);
  padding: 28px 28px 22px;
}
.brand-block { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, #2b7ff0, #1257bd);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 104, 220, .28);
}
.brand-mark.sm { width: 26px; height: 26px; border-radius: 7px; box-shadow: none; }
.brand-block h1 { font-size: 16px; font-weight: 600; letter-spacing: .2px; }
.brand-block p { font-size: 12px; color: var(--text3); margin-top: 2px; }
.login-foot { margin-top: 16px; font-size: 11.5px; color: var(--text3); text-align: center; line-height: 1.7; }
.login-card .banner { margin-bottom: 14px; }

/* ---------- 顶部栏 ---------- */
.topbar {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 40;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-title { font-size: 14px; font-weight: 600; white-space: nowrap; }
.topbar-sub { font-size: 12px; color: var(--text3); white-space: nowrap; }
.topbar .sep { width: 1px; height: 14px; background: var(--border-strong); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 16px; }
.avatar {
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  background: var(--primary-weak);
  color: var(--primary-dark);
  font-size: 12px; font-weight: 600;
  display: grid; place-items: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta b { font-size: 12.5px; font-weight: 600; }
.user-meta i { font-style: normal; font-size: 11px; color: var(--text3); }
.chip.version {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px;
  border-radius: 11px;
  background: var(--primary-weak);
  color: var(--primary-dark);
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}

/* ---------- 主体布局 ---------- */
.layout { display: flex; height: calc(100vh - var(--top-h)); overflow: hidden; }
.side {
  width: var(--side-w);
  flex: none;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side-hd {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.side-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.side-sub { font-size: 11px; color: var(--text3); }
.side-body { flex: 1; overflow: auto; padding: 6px 7px 28px; min-height: 0; }
.side-body::-webkit-scrollbar, .tabpane::-webkit-scrollbar, .drawer-bd::-webkit-scrollbar,
.fields-list::-webkit-scrollbar, .table-scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.side-body::-webkit-scrollbar-thumb, .tabpane::-webkit-scrollbar-thumb, .drawer-bd::-webkit-scrollbar-thumb,
.fields-list::-webkit-scrollbar-thumb, .table-scroll::-webkit-scrollbar-thumb {
  background: #cfd6e2; border-radius: 5px; border: 2px solid transparent; background-clip: content-box;
}
.side-mask { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.tabs {
  height: 42px;
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0 13px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary); font-weight: 600; }
.tab.on::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}
.tab .tab-count {
  font-size: 11px; font-weight: 500; color: var(--text3);
  background: #eef1f6; border-radius: 8px; padding: 0 6px; height: 16px; line-height: 16px;
}
.tab.on .tab-count { background: var(--primary-weak); color: var(--primary-dark); }

.tabpane { display: none; flex: 1; min-height: 0; overflow: auto; flex-direction: column; }
.tabpane.on { display: flex; }
.pad { padding: 16px 18px 40px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: #b9c3d5; background: #fafbfe; }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn.loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn.ghost:hover { background: #f2f5fa; color: var(--text); }
.btn.danger { color: var(--error); border-color: #efc2cd; background: #fff; }
.btn.danger:hover { background: var(--error-weak); border-color: #e5a5b5; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn.block { width: 100%; height: 36px; }
.btn.loading .spinner { margin-right: 2px; }

.spinner {
  width: 12px; height: 12px; flex: none;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
.btn.ghost .spinner, .btn:not(.primary) .spinner {
  border-color: rgba(22, 104, 220, .22);
  border-top-color: var(--primary);
}

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.lbl { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
.lbl .req { color: var(--error); margin-left: 2px; }
.lbl .opt { color: var(--text3); font-weight: 400; margin-left: 4px; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input { height: 30px; }
.textarea { min-height: 92px; resize: vertical; line-height: 1.65; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 104, 220, .12);
}
.input.invalid, .textarea.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(208, 48, 80, .1); }
.hint { font-size: 12px; color: var(--text3); margin-top: 5px; line-height: 1.6; }
.help-warn { color: #96590a; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.form-error { color: var(--error); font-size: 12px; margin-top: 6px; display: flex; gap: 5px; align-items: flex-start; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input {
  appearance: none;
  width: 34px; height: 20px; flex: none;
  border-radius: 10px;
  background: #d6dbe6;
  position: relative;
  cursor: pointer;
  transition: background .16s;
}
.switch input::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  transition: left .16s;
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { left: 16px; }
.switch input:focus-visible { outline: 2px solid rgba(22, 104, 220, .45); outline-offset: 2px; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.check-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  background: #fff;
}
.check-item:hover { background: #f8fafe; }
.check-item input { accent-color: var(--primary); margin: 0; }
.check-item.on { border-color: #b7d0f7; background: var(--primary-weak); color: var(--primary-dark); }

/* ---------- 搜索 / 分段 ---------- */
.search { position: relative; flex: 1 1 200px; min-width: 160px; max-width: 330px; }
.search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.search input { width: 100%; height: 30px; padding: 0 10px 0 29px; }
.search input::-webkit-search-cancel-button { display: none; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg button {
  height: 28px; padding: 0 10px;
  border: 0; background: transparent;
  font-size: 12px; color: var(--text2);
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary-weak); color: var(--primary-dark); font-weight: 600; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px;
  border-radius: 10px;
  font-size: 11px; font-weight: 500; line-height: 1;
  white-space: nowrap;
}
.badge.ok { background: var(--success-weak); color: #0c7a41; }
.badge.warn { background: var(--warning-weak); color: #93580a; }
.badge.err { background: var(--error-weak); color: #a11f3c; }
.badge.info { background: var(--primary-weak); color: var(--primary-dark); }
.badge.muted { background: #eef1f6; color: var(--text2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- 目录树 ---------- */
.tree { display: flex; flex-direction: column; gap: 1px; }
.tn {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  padding-left: calc(6px + var(--lv, 0) * 13px);
  min-height: 28px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  position: relative;
}
.tn:hover { background: #f2f5fa; }
.tn.active { background: var(--primary-weak); color: var(--primary-dark); }
.tn.active .tname { font-weight: 600; }
.tn .caret {
  width: 16px; height: 16px; flex: none;
  display: grid; place-items: center;
  border: 0; background: none; padding: 0;
  color: var(--text3); cursor: pointer;
  border-radius: 3px;
  transition: transform .14s;
}
.tn .caret:hover { background: rgba(31, 35, 41, .07); color: var(--text); }
.tn .caret.open { transform: rotate(90deg); }
.tn .caret.spacer { visibility: hidden; }
.tn .tico { color: var(--text3); flex: none; display: grid; place-items: center; width: 16px; }
.tn.menu > .tico { color: #6b7a92; }
.tn.page > .tico { color: #7f8ba0; }
.tn.region > .tico { color: #98a3b5; }
.tn.active > .tico { color: var(--primary); }
.tn .tname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.tn .tmeta { font-size: 11px; color: var(--text3); flex: none; font-variant-numeric: tabular-nums; }
.tn.active .tmeta { color: #3f7bd0; }
.tn .tflag { width: 5px; height: 5px; border-radius: 50%; background: var(--warning); flex: none; }
.tree-empty { padding: 28px 16px; }

/* ---------- 字段页 ---------- */
.fields-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.fields-hd {
  flex: none;
  padding: 13px 16px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.crumb { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text3); flex-wrap: wrap; }
.crumb b { color: var(--text); font-weight: 600; font-size: 13px; }
.crumb .csep { color: #c2c9d6; }
.hd-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hd-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hd-desc { font-size: 12px; color: var(--text3); margin-top: 3px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.stat {
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.stat .k { font-size: 11.5px; color: var(--text3); display: flex; align-items: center; gap: 4px; }
.stat .v { font-size: 18px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat.warn .v { color: #b9750a; }
.stat.err .v { color: var(--error); }
.stat.ok .v { color: var(--success); }

.fields-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.bar-count { font-size: 12px; color: var(--text3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fields-list { flex: 1; overflow: auto; padding: 12px 16px 40px; min-height: 0; }
.fields-list .banner { margin-bottom: 10px; }

.table-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.tbl th {
  position: sticky; top: 0; z-index: 2;
  background: #fafbfd;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text2);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f3f8;
  vertical-align: top;
  font-size: 12.5px;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.rowlink { cursor: pointer; }
.tbl tbody tr.rowlink:hover { background: #f8faff; }
.tbl tbody tr.rowlink:hover .flabel { color: var(--primary); }
.tbl tbody tr.conflict { box-shadow: inset 3px 0 0 var(--error); background: #fffafb; }
.tbl td.cell-time, .tbl th.cell-time { white-space: nowrap; color: var(--text3); font-variant-numeric: tabular-nums; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

.flabel { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 5px; }
.falias { font-size: 11px; color: var(--text3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdesc {
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.dash { color: #b8c0cf; }
.hl { background: #fff2c9; border-radius: 2px; padding: 0 1px; }

/* ---------- 知识库 ---------- */
.k-side-tools { padding: 8px 8px 6px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.k-side-tools .search { flex: none; max-width: none; }
.k-side-tools .chips {
  flex-wrap: wrap;
  max-height: 56px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.k-side-tools .chips::-webkit-scrollbar { width: 7px; }
.k-side-tools .chips::-webkit-scrollbar-thumb { background: #cfd6e2; border-radius: 4px; }
.k-list { display: flex; flex-direction: column; gap: 2px; padding: 6px 7px 24px; }
.k-item {
  padding: 8px 9px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.k-item:hover { background: #f4f7fc; }
.k-item.on { background: var(--primary-weak); border-color: #cfe0fb; }
.k-item.on .k-title { color: var(--primary-dark); }
.k-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-q { font-size: 11.5px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.k-meta { display: flex; gap: 5px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px;
  color: var(--primary-dark);
  background: #eef4ff;
  border-radius: 3px;
  padding: 1px 5px;
}
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 1px 9px;
  font-size: 11.5px;
  color: var(--text2);
  cursor: pointer;
  height: 22px;
  display: inline-flex;
  align-items: center;
}
.chip-btn:hover { border-color: #b7d0f7; color: var(--primary-dark); }
.chip-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.k-editor { max-width: 880px; }
.k-editor-hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.k-editor-hd h2 { font-size: 15px; font-weight: 600; }
.k-meta-line { font-size: 12px; color: var(--text3); display: flex; gap: 12px; flex-wrap: wrap; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fafbfd;
}
.step-idx {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary-weak); color: var(--primary-dark);
  font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
  margin-top: 3px;
}
.step-fields { display: grid; gap: 6px; }
.step-fields .input { height: 28px; font-size: 12.5px; }
.step-fields .textarea { min-height: 48px; font-size: 12.5px; }

/* ---------- 卡片 / 发布 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-hd { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-hd h3 { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.card-bd { padding: 14px; }
.card-bd.tight { padding: 10px 14px; }
.page-hd { margin-bottom: 12px; }
.page-hd h2 { font-size: 16px; font-weight: 600; }
.page-hd p { font-size: 12.5px; color: var(--text3); margin-top: 3px; line-height: 1.7; }

.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 7px 12px; font-size: 12.5px; }
.kv dt { color: var(--text3); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

.publish-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.publish-grid .card + .card { margin-top: 0; }
.rel-num { font-size: 26px; font-weight: 600; line-height: 1.2; color: var(--primary); font-variant-numeric: tabular-nums; }
.rel-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.counts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.count-item { font-size: 12px; color: var(--text2); }
.count-item b { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 横幅 / 空态 / 加载 ---------- */
.banner {
  display: flex; gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 12.5px;
  line-height: 1.65;
  margin-bottom: 12px;
  align-items: flex-start;
}
.banner .ic { margin-top: 2px; }
.banner > div { min-width: 0; }
.banner b { font-weight: 600; }
.banner.info { background: #eef5ff; border-color: #cfe0fb; color: #1b4a8c; }
.banner.ok { background: var(--success-weak); border-color: #bfe6d0; color: #0c7340; }
.banner.warn { background: var(--warning-weak); border-color: #f4d6a2; color: #8a5309; }
.banner.err { background: var(--error-weak); border-color: #f6c4cf; color: #9c2138; }
.banner .banner-act { margin-top: 6px; }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 54px 20px; text-align: center; color: var(--text3);
}
.empty .empty-ic {
  width: 42px; height: 42px; border-radius: 50%;
  background: #eef1f6; color: #a2abbc;
  display: grid; place-items: center; margin-bottom: 2px;
}
.empty h4 { font-size: 13px; font-weight: 600; color: var(--text2); }
.empty p { font-size: 12px; line-height: 1.75; max-width: 400px; }
.empty .btn { margin-top: 6px; }

.skel { padding: 6px 0; }
.skel-row { height: 30px; border-radius: 5px; background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; margin-bottom: 6px; }
.skel-row.w60 { width: 60%; }
.skel-row.w80 { width: 80%; }
.load-more { text-align: center; padding: 10px; color: var(--text3); font-size: 12px; }

/* ---------- 遮罩 / 抽屉 / 弹窗 ---------- */
.mask {
  position: fixed; inset: 0;
  background: rgba(31, 35, 41, .3);
  z-index: 60;
  animation: fade .15s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 540px; max-width: 94vw;
  background: #fff;
  z-index: 61;
  display: flex; flex-direction: column;
  box-shadow: -10px 0 36px rgba(31, 35, 41, .14);
  animation: slidein .18s cubic-bezier(.2, .8, .3, 1);
}
.drawer-hd {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 50px;
}
.drawer-hd h3 { font-size: 14px; font-weight: 600; }
.drawer-hd .sub { font-size: 12px; color: var(--text3); }
.drawer-bd { flex: 1; overflow: auto; padding: 16px 18px 28px; min-height: 0; }
.drawer-ft {
  flex: none;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: #fcfdff;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.form-meta {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 11.5px; color: var(--text3);
}
.form-meta b { font-weight: 500; color: var(--text2); }

.modal-mask { position: fixed; inset: 0; background: rgba(31, 35, 41, .34); z-index: 70; animation: fade .15s ease; }
.modal {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 620px; max-width: calc(100vw - 28px);
  max-height: 88vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 71;
  display: flex; flex-direction: column;
  animation: pop .16s cubic-bezier(.2, .8, .3, 1);
}
.modal.narrow { width: 440px; }
.modal.wide { width: 780px; }
.modal-hd { flex: none; display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px 10px; }
.modal-hd h3 { font-size: 14.5px; font-weight: 600; }
.modal-hd p { font-size: 12px; color: var(--text3); margin-top: 3px; line-height: 1.7; }
.modal-bd { flex: 1; overflow: auto; padding: 4px 18px 16px; min-height: 0; }
.modal-ft { flex: none; padding: 10px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; background: #fcfdff; border-radius: 0 0 10px 10px; }

.diff { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.diff th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--text3); padding: 6px 8px; border-bottom: 1px solid var(--border); background: #fafbfd; }
.diff td { padding: 7px 8px; border-bottom: 1px solid #f1f3f8; vertical-align: top; word-break: break-word; }
.diff tr:last-child td { border-bottom: 0; }
.diff .k { color: var(--text3); white-space: nowrap; width: 76px; }
.diff .cloud { color: var(--text2); background: #fafbfd; }
.diff .mine { color: var(--primary-dark); background: #f7fbff; }
.diff .emptyv { color: #b8c0cf; font-style: normal; }
.conflict-callout { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; background: var(--error-weak); border: 1px solid #f6c4cf; border-radius: 6px; color: #9c2138; font-size: 12.5px; line-height: 1.65; }

/* ---------- 提示条 ---------- */
.toast-host {
  position: fixed; top: calc(var(--top-h) + 10px); right: 16px;
  z-index: 95;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 200px; max-width: 380px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px 11px;
  font-size: 12.5px;
  display: flex; gap: 7px; align-items: flex-start;
  animation: toastin .18s ease;
}
.toast .ic { margin-top: 1px; color: var(--success); }
.toast.err { border-left-color: var(--error); }
.toast.err .ic { color: var(--error); }
.toast.info { border-left-color: var(--primary); }
.toast.info .ic { color: var(--primary); }
.toast.warn { border-left-color: var(--warning); }
.toast.warn .ic { color: #c9820a; }
.toast.out { opacity: 0; transform: translateX(8px); transition: opacity .2s, transform .2s; }

/* ---------- 响应式 ---------- */
@media (max-width: 1279px) {
  .side {
    position: fixed;
    top: var(--top-h); bottom: 0; left: 0;
    z-index: 46;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 10px 0 32px rgba(31, 35, 41, .14);
  }
  .side.open { transform: none; }
  .side.open + .side-mask {
    display: block;
    position: fixed;
    top: var(--top-h); left: 0; right: 0; bottom: 0;
    background: rgba(31, 35, 41, .22);
    z-index: 45;
  }
  .only-narrow:not(.hidden) { display: inline-flex !important; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publish-grid { grid-template-columns: minmax(0, 1fr); }
  .publish-grid .card + .card { margin-top: 12px; }
}
@media (min-width: 1280px) {
  .only-narrow { display: none !important; }
}
@media (max-width: 760px) {
  .topbar-sub, .topbar .sep, .chip.version { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .check-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; max-width: 100vw; }
  .form-meta { font-size: 11px; }
  .pad { padding: 12px 12px 32px; }
  .fields-hd, .fields-bar, .fields-list { padding-left: 12px; padding-right: 12px; }
}

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.985); opacity: .5; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes toastin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
