/* 麦肯内容管理 · 样式 */
:root {
  --green: #3f6b45;
  --green-dark: #2f4732;
  --green-soft: #eef3ee;
  --line: #e3e7e3;
  --ink: #1f2a22;
  --ink-2: #55635a;
  --ink-3: #8b978f;
  --bg: #f6f8f6;
  --white: #fff;
  --warn: #b4541f;
  --danger: #c0392b;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(24, 48, 30, .06), 0 8px 24px rgba(24, 48, 30, .06);
}

* { box-sizing: border-box; }

/* 关键：类选择器里的 display 会盖掉浏览器的 [hidden] 默认样式，必须显式兜住 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- 启动态 ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot-inner { text-align: center; color: var(--ink-2); }
.boot-logo { font: 700 26px/1 Georgia, serif; letter-spacing: .22em; color: var(--green-dark); margin-bottom: 14px; }

/* ---------- 布局 ---------- */
#app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.side {
  background: var(--green-dark);
  color: #e8efe9;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 6px; background: #e9f0e9; color: var(--green-dark);
  display: grid; place-items: center; font: 700 17px/1 Georgia, serif;
}
.brand strong { display: block; font-size: 14px; letter-spacing: .04em; }
.brand small { color: #9fb2a3; font-size: 12px; }

.nav { flex: 1; overflow: auto; padding: 6px 10px 20px; }
.nav-group { margin-top: 14px; }
.nav-group > span {
  display: block; padding: 6px 10px; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: #8ba48f;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 9px 12px; margin: 2px 0; border: 0; border-radius: 6px;
  background: transparent; color: #d8e4da; text-align: left; cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); }
.nav-item.on { background: #eef3ee; color: var(--green-dark); font-weight: 600; }
.nav-item .count { font-size: 12px; opacity: .65; }

.side-foot { padding: 14px 20px 20px; border-top: 1px solid rgba(255, 255, 255, .09); }
.ghost-link { color: #b9cbbd; font-size: 13px; text-decoration: none; }
.ghost-link:hover { color: #fff; }
.who { margin-top: 10px; font-size: 12px; color: #8ba48f; word-break: break-all; }

.main { padding: 26px 30px 80px; max-width: 1120px; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.topbar h1 { margin: 0 0 4px; font-size: 21px; font-weight: 650; letter-spacing: .01em; }
.hint { margin: 0; color: var(--ink-3); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- 语言切换 ---------- */
.lang-switch { display: flex; background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.lang-switch button {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 4px; cursor: pointer;
  font-size: 12px; color: var(--ink-2); letter-spacing: .02em;
}
.lang-switch button.on { background: var(--green); color: #fff; }
.lang-switch button .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #c9d3ca; margin-left: 5px; vertical-align: 1px; }
.lang-switch button .dot.filled { background: #7fb37f; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: 8px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #cbd6cc; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #eef1ee; }
.btn.danger { color: var(--danger); border-color: #f0d3ce; }
.btn.danger:hover { background: #fdf1ef; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

/* ---------- 列表 ---------- */
.list { display: grid; gap: 10px; }

.card {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.card:hover { border-color: #cfdad0; }
/* 组织架构的层级：左侧竖线 + 缩进，让人一眼看出上下级 */
.card.nested { border-left: 3px solid #cfe0d2; background: #fdfefd; }
.card.nested .title { font-weight: 550; }
.card .thumb {
  width: 84px; height: 56px; border-radius: 5px; object-fit: cover; background: #eef1ee;
  display: grid; place-items: center; color: var(--ink-3); font-size: 11px; border: 1px solid var(--line);
}
.card .title { font-weight: 600; margin-bottom: 2px; }
.card .sub { color: var(--ink-3); font-size: 12.5px; }
.card .badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px;
  background: var(--green-soft); color: var(--green); margin-left: 8px; vertical-align: 1px;
}
.card .badge.draft { background: #fdf3e6; color: var(--warn); }
.card .ops { display: flex; gap: 6px; align-items: center; }

.rowgroup { margin: 22px 0 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- 编辑器 ---------- */
.editor { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.editor-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.editor-head .name { font-weight: 600; }
.editor-body { padding: 18px; display: grid; gap: 18px; }
.editor-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px; border-top: 1px solid var(--line); background: #fbfcfb; border-radius: 0 0 var(--radius) var(--radius);
}

.field { display: grid; gap: 6px; }
.field > label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.field .req { color: var(--danger); }
.field .help { color: var(--ink-3); font-size: 12px; }
.field input[type=text], .field input[type=date], .field textarea, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: #9dbba2; box-shadow: 0 0 0 3px rgba(63, 107, 69, .12);
}
.field textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.field .filled { font-size: 11px; color: var(--ink-3); font-weight: 400; }

.imgfield { display: grid; grid-template-columns: 132px 1fr; gap: 12px; align-items: start; }
.imgfield .preview {
  width: 132px; height: 88px; border: 1px dashed #cdd8ce; border-radius: 6px; background: #f7f9f7;
  display: grid; place-items: center; overflow: hidden; color: var(--ink-3); font-size: 11px; text-align: center;
}
.imgfield .preview img { width: 100%; height: 100%; object-fit: cover; }
.imgfield .tools { display: grid; gap: 8px; }

.toggle { display: flex; align-items: center; gap: 9px; }
.toggle input { width: 16px; height: 16px; accent-color: var(--green); }

.empty { color: var(--ink-3); padding: 40px 0; text-align: center; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--green-dark); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); z-index: 50;
}
.toast.err { background: #8f2f22; }

.denied { max-width: 520px; margin: 12vh auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 30px; box-shadow: var(--shadow); text-align: center; }
.denied h2 { margin: 0 0 10px; font-size: 18px; }
.denied p { color: var(--ink-2); margin: 6px 0; }
.denied code { background: #f3f5f3; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; overflow-x: auto; gap: 6px; }
  .nav-group > span { display: none; }
  .nav-group { display: flex; gap: 6px; margin: 0; }
  .main { padding: 18px 16px 60px; }
  .card { grid-template-columns: 64px 1fr; }
  .card .thumb { width: 64px; height: 44px; }
  .card .ops { grid-column: 1 / -1; justify-content: flex-end; }
  .imgfield { grid-template-columns: 1fr; }
}
