/* ============================================================
 * base.css · 设计变量与通用组件
 * ============================================================ */
:root {
  --ink: #2d4a3e;
  --ink-2: #3c6b58;
  --seal: #b85450;
  --blue: #2f5d8c;
  --gold: #8a6d3b;
  --plum: #5b4a8c;
  --paper: #f7f4ec;
  --bg: #f2efe6;
  --card: #ffffff;
  --line: #e8e2d4;
  --text: #2c2c2c;
  --muted: #8a8578;
  --red: #b85450;
  --green: #2d7a4f;
  --serif: "Songti SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(60, 50, 30, .07);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--blue); }

.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.red { color: var(--red) !important; }
.ok-c { color: var(--green); }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.seal { background: var(--seal); border-color: var(--seal); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.wide { width: 100%; }
.link {
  background: none; border: none; color: var(--blue);
  font-size: 12.5px; padding: 0 6px 0 0; text-decoration: none;
}
.link:hover { text-decoration: underline; }
.link.red { color: var(--seal); }
.icon-btn { background: none; border: none; font-size: 20px; color: var(--muted); line-height: 1; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block; font-size: 11.5px; padding: 2px 8px;
  border-radius: 999px; background: #eee9dc; color: var(--muted);
  border: 1px solid transparent; line-height: 1.6;
}
.tag.ok { background: #e9f4ec; color: var(--green); }
.tag.warn { background: #fbf1e2; color: var(--gold); }
.tag.bad { background: #fbeceb; color: var(--seal); }
.pill {
  display: inline-block; font-size: 12.5px; padding: 5px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
}
.pill.ok { background: #e9f4ec; border-color: #cfe6d6; color: var(--green); }

/* ---------------- 面板 / 卡片 ---------------- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.panel-head h3 { font-size: 15px; color: var(--ink); font-weight: 700; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------------- 表格 ---------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f2eee4; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #fbf9f4; }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; }

/* ---------------- 表单 ---------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form.inline { flex-direction: row; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.form input, .form select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: #fefdfa; color: var(--text); outline: none;
}
.form input:focus, .form select:focus { border-color: var(--ink); background: #fff; }
.switch-row { flex-direction: row !important; align-items: center; justify-content: space-between; color: var(--text) !important; font-size: 13.5px !important; }
.switch-row input { width: auto; }
.mini-select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; }
.search { display: flex; gap: 8px; }
.search input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  min-width: 200px; background: #fff; outline: none;
}
.hint-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: #f7f4ea; border-left: 3px solid var(--gold);
  font-size: 12.5px; color: #6b6355; line-height: 1.7;
}
.notice {
  background: #fdf6e8; border: 1px solid #f0e2c4; border-left: 3px solid var(--gold);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; color: #6b5a34;
}
.notice b { color: var(--gold); margin-right: 8px; }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(35, 30, 20, .45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: rgba(45, 74, 62, .94); color: #fff; padding: 10px 20px;
  border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: .22s; z-index: 300; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: rgba(184, 84, 80, .95); }

.empty {
  padding: 34px 16px; text-align: center; color: var(--muted);
  font-size: 13px; background: #fbf9f4; border-radius: 10px;
}
.empty.big { padding: 70px 16px; font-size: 15px; }

/* ---------------- 图表 ---------------- */
.chart { width: 100%; height: auto; display: block; }
.barh { display: flex; flex-direction: column; gap: 9px; }
.barh-row { display: grid; grid-template-columns: 96px 1fr 56px; align-items: center; gap: 10px; font-size: 12.5px; }
.barh-label { color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); }
.barh-track { background: #f0ece1; border-radius: 999px; height: 10px; overflow: hidden; }
.barh-track i { display: block; height: 100%; border-radius: 999px; }
.barh-val { text-align: right; color: var(--ink); font-weight: 600; }

/* ---------------- 步骤点 / 进度条 ---------------- */
.steps-mini { display: flex; gap: 4px; }
.steps-mini i { width: 16px; height: 8px; border-radius: 3px; background: #ebe6d9; display: block; }
.steps-mini i.on { background: var(--ink); }
.mini-prog { display: flex; align-items: center; gap: 8px; }
.mini-prog i { display: block; height: 7px; border-radius: 999px; background: var(--ink); max-width: 96px; min-width: 4px; }
.mini-prog span { font-size: 12px; color: var(--muted); }
.mini-prog.wide i { max-width: none; }
.essay-prog { height: 6px; background: #f0ece1; border-radius: 999px; margin: 10px 0; overflow: hidden; }
.essay-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--ink-2), var(--ink)); border-radius: 999px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); display: inline-block; }
.dot.red { background: var(--seal); }
