/* admin.css —— 后台管理端样式（无依赖，Element 风格配色） */

/* ---- 数据看板（第 29 节）：趋势用内联 SVG，不引图表库 ---- */
.bi-line { width: 100%; height: 130px; margin: 6px 0; background: #fbfcfd; border-radius: 6px; }
.bi-line polyline { fill: none; stroke: var(--primary); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.bi-bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.bi-bar-name { width: 150px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-bar-track { flex: 1; height: 14px; background: #f2f3f5; border-radius: 7px; overflow: hidden; }
.bi-bar-track i { display: block; height: 100%; background: var(--primary); }
.bi-bar-value { width: 110px; text-align: right; flex: none; }
.bi-caveats { margin: 8px 0 0; padding-left: 20px; }
.bi-caveats li { color: var(--muted); font-size: 12px; }
:root {
  --primary: #07c160;
  --primary-dark: #069b4d;
  --danger: #f5222d;
  --warn: #fa8c16;
  --text: #1f2329;
  --muted: #8a8f99;
  --line: #e8eaed;
  --bg: #f5f6f8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); min-height: 20px; margin: 8px 0 0; }

/* ---- 登录 ---- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.gate-box {
  width: 360px; background: #fff; padding: 32px; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
}
.gate-logo {
  width: 56px; height: 56px; line-height: 56px; text-align: center; border-radius: 14px;
  background: var(--primary); color: #fff; font-size: 28px; font-weight: 700; margin-bottom: 12px;
}
.gate-box h1 { font-size: 20px; margin: 0 0 4px; }
.gate-box label { display: block; margin: 16px 0 6px; font-size: 13px; color: #4a5058; }
.gate-box input, input, select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 6px; font-size: 14px; color: var(--text); background: #fff; outline: none;
}
textarea { height: auto; padding: 8px 10px; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input[type="checkbox"] { width: auto; height: auto; }

/* ---- 布局 ---- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 200px; background: #fff; border-right: 1px solid var(--line); flex-shrink: 0;
}
.brand { padding: 20px 16px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--line); }
.brand-logo {
  display: inline-block; width: 26px; height: 26px; line-height: 26px; text-align: center;
  border-radius: 8px; background: var(--primary); color: #fff; margin-right: 8px; font-size: 14px;
}
#nav { padding: 8px 0; }
#nav a {
  display: block; padding: 10px 18px; color: #4a5058; cursor: pointer; font-size: 13px;
  border-left: 3px solid transparent;
}
#nav a:hover { background: #f7f8fa; }
#nav a.active { color: var(--primary); background: #f0fbf5; border-left-color: var(--primary); font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.crumb { font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; }
.view { padding: 20px; }

/* ---- 通用件 ---- */
.card { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.cards { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.metric { flex: 1 1 200px; background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.metric .label { color: var(--muted); font-size: 13px; }
.metric .value { font-size: 26px; font-weight: 700; margin-top: 6px; word-break: break-all; }
.metric .value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .f { display: flex; flex-direction: column; gap: 4px; }
.toolbar .f label { font-size: 12px; color: var(--muted); }
.toolbar .f input, .toolbar .f select { width: 160px; }

.btn {
  height: 34px; padding: 0 14px; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { background: #fff; border-color: #ffccc7; color: var(--danger); }
.btn.warn { background: #fff; border-color: #ffe0b2; color: var(--warn); }
.btn.ghost { background: transparent; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.block { width: 100%; height: 40px; margin-top: 20px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: top; }
th { background: #fafbfc; color: #4a5058; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 0; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef1f5; color: #4a5058; }
.tag.pending { background: #fff7e6; color: #d46b08; }
.tag.approved { background: #e8f8ef; color: #0f9d58; }
.tag.rejected, .tag.void { background: #fff1f0; color: #cf1322; }
.tag.draft { background: #eef1f5; color: #4a5058; }
.tag.ok { background: #e8f8ef; color: #0f9d58; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; }
.form-grid .f { display: flex; flex-direction: column; gap: 4px; }
.form-grid .f label { font-size: 12px; color: var(--muted); }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.hint.ok { color: #0f9d58; }
.hint.bad { color: var(--danger); }

/* ---- 弹层 ---- */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 20px; width: 720px; max-width: 94vw;
  max-height: 88vh; overflow: auto;
}
.modal-box h3 { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%); z-index: 99;
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}

/* ---- 明细行 ---- */
.lines { width: 100%; }
.lines td { padding: 6px 4px; border-bottom: 1px dashed var(--line); }
.badge { display: inline-block; padding: 0 6px; border-radius: 4px; background: #fff7e6; color: #d46b08; font-size: 12px; }
.notice { white-space: pre-wrap; background: #f7f8fa; border-radius: 8px; padding: 12px; font-size: 13px; }
.kv { display: flex; gap: 8px; padding: 4px 0; }
.kv .k { color: var(--muted); min-width: 92px; }
.kv .v { flex: 1; }

/* ---- 汇报模板设计器 / 汇报记录（第 49.10 / 49.11 节） ---- */
#modal-box { overflow-x: auto; }
#modal-box:has(#rpt-fields) { width: 1120px; }
#rpt-fields { width: 100%; }
#rpt-fields td { padding: 4px; vertical-align: middle; }
#rpt-fields input[type="text"], #rpt-fields input:not([type]), #rpt-fields .rf-opts, #rpt-fields .rf-cond {
  width: 100%; min-width: 120px; box-sizing: border-box;
}
#rpt-fields .rf.off { opacity: .45; }
#rpt-fields .rf.off .rf-label { text-decoration: line-through; }
#rpt-report .card { margin-top: 12px; }
.nowrap { white-space: nowrap; }
tr.unread td { background: #fffbe6; }
.cmt { border-left: 2px solid var(--line); padding: 4px 0 4px 8px; margin: 4px 0; font-size: 13px; }
