/* ============================================================
 *  考评小程序 · 通用样式（浅色企业风）
 * ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f5f7fa;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- 布局 ---------- */
.app-header {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #0ea5e9 100%);
  color: #fff;
  padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(37, 99, 235, .18);
}
.app-header .h-title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.app-header .h-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.app-header .h-right { float: right; font-size: 12px; opacity: .9; }

.container { max-width: 720px; margin: 0 auto; padding: 16px; }
.container.wide { max-width: 1180px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card .card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card .card-title .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: all .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { display: flex; width: 100%; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.input, .select, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
textarea.input { resize: vertical; min-height: 62px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td {
  padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
}
table.tb th { background: #f8fafc; color: var(--text-2); font-weight: 600; font-size: 12px; }
table.tb tbody tr:hover { background: #f8fafc; }
table.tb td.num, table.tb th.num { text-align: right; }
table.tb .empty { text-align: center; color: var(--text-3); padding: 26px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px;
  background: #f1f5f9; color: var(--text-2); border: 1px solid var(--line);
}
.tag.blue { background: var(--primary-soft); color: var(--primary); border-color: #bfdbfe; }
.tag.green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag.amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.tag.red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ---------- 前台：身份选择 ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.person-chip {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center;
  cursor: pointer; transition: all .15s; background: #fff;
}
.person-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.person-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.person-chip .pc-name { font-weight: 600; font-size: 14px; }
.person-chip .pc-dept { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.person-chip.active .pc-dept { color: rgba(255, 255, 255, .85); }

/* ---------- 前台：区域选择（全厂共用一套程序） ---------- */
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.region-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 12px; text-align: center;
  cursor: pointer; background: #fff; transition: all .15s;
}
.region-card:hover {
  border-color: var(--primary); background: var(--primary-soft);
  transform: translateY(-2px); box-shadow: 0 4px 14px rgba(37, 99, 235, .12);
}
.region-card .rg-icon { font-size: 26px; line-height: 1; }
.region-card .rg-name { font-weight: 700; font-size: 15px; margin-top: 6px; }
.region-card .rg-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.region-card .rg-go { font-size: 11px; color: var(--primary); margin-top: 8px; font-weight: 600; }
.region-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #f8fafc; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}

/* ---------- 前台：评分卡 ---------- */
.rate-sub {
  display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2);
  background: #f8fafc; border-radius: 8px; padding: 8px 12px; margin: 6px 0 12px;
  align-items: center;
}
.rate-sub .rate-total { margin-left: auto; color: var(--text); }
.rate-sub .rate-total b { color: var(--primary); font-size: 16px; }

.eval-type {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; transition: all .15s; background: #fff;
}
.eval-type:hover { border-color: var(--primary); background: var(--primary-soft); }
.eval-type .et-label { font-weight: 600; font-size: 14px; }
.eval-type .et-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.eval-type.disabled { opacity: .55; cursor: not-allowed; }
.eval-type.disabled:hover { border-color: var(--line); background: #fff; }
.eval-type .et-count {
  float: right; font-size: 11px; font-weight: 500; color: var(--primary);
  background: var(--primary-soft); border-radius: 20px; padding: 2px 8px;
}
.eval-type .et-count.none { color: var(--text-3); background: #f1f5f9; }
.progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress { flex: 1; height: 8px; background: #e8edf3; border-radius: 20px; overflow: hidden; }
.progress .bar { height: 100%; background: linear-gradient(90deg, #2563eb, #0ea5e9); border-radius: 20px; transition: width .3s; }
.progress-txt { font-size: 12px; color: var(--text-2); white-space: nowrap; }

.rate-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; }
.rate-card.done { border-color: #a7f3d0; background: #f0fdf9; }
.rate-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.rate-head .rh-name { font-size: 16px; font-weight: 700; }
.rate-head .rh-meta { font-size: 12px; color: var(--text-3); }

.dim-row { margin-bottom: 12px; }
.dim-row .dim-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.dim-row .dim-desc { font-size: 11px; color: var(--text-3); margin-bottom: 6px; line-height: 1.45; }
.grade-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.grade-opt {
  flex: 1; min-width: 62px; text-align: center; padding: 8px 4px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; font-size: 12px; background: #fff; transition: all .15s;
  user-select: none;
}
.grade-opt .go-label { font-weight: 600; display: block; }
.grade-opt .go-score { font-size: 10px; color: var(--text-3); }
.grade-opt:hover { border-color: var(--primary); }
.grade-opt.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.grade-opt.active .go-score { color: rgba(255, 255, 255, .85); }

/* ---------- 后台：Tab ---------- */
.tabs { display: flex; gap: 4px; background: #fff; padding: 6px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-2);
  white-space: nowrap; transition: all .15s;
}
.tab:hover { background: #f1f5f9; }
.tab.active { background: var(--primary); color: #fff; font-weight: 500; }

/* ---------- 后台：KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 12px; color: var(--text-3); }
.kpi .k-value { font-size: 24px; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.kpi .k-foot { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.kpi.accent .k-value { color: var(--primary); }
.kpi.green .k-value { color: #047857; }
.kpi.amber .k-value { color: #b45309; }

/* ---------- 图表 ---------- */
.chart-box { min-height: 60px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.legend { flex: 1; min-width: 130px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-bottom: 6px; }
.legend-item .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item .lg-name { flex: 1; color: var(--text-2); }
.legend-item .lg-val { color: var(--text-3); font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 模态框 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 460px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal .m-head { padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.modal .m-body { padding: 18px; }
.modal .m-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal .m-close { cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: rgba(15, 23, 42, .92); color: #fff; padding: 9px 16px; border-radius: 20px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(15, 23, 42, .25); animation: tin .22s ease;
}
.toast.ok { background: #047857; }
.toast.err { background: #b91c1c; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 其他 ---------- */
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.center { text-align: center; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-3); }
.empty-state .es-icon { font-size: 40px; margin-bottom: 8px; }

.login-box { max-width: 360px; margin: 60px auto; }

/* 分数着色 */
.score-good { color: #047857; font-weight: 600; }
.score-mid { color: #b45309; font-weight: 600; }
.score-bad { color: #b91c1c; font-weight: 600; }

/* 评价类型汇总 */
.et-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 6px; background: #f8fafc; font-size: 13px;
}
.et-summary b { font-size: 14px; }

/* 维度分档单元格 */
.grade-cells { display: flex; gap: 4px; flex-wrap: wrap; }
.grade-cell { display: inline-flex; align-items: center; gap: 2px; }
.grade-cell .input { padding: 4px 6px; font-size: 12px; height: 28px; }

/* 打印 */
@media print {
  .app-header, .tabs, .btn, .no-print { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- 新建表单：类型卡片选择层（各家同款） ---------- */
.create-modal { max-width: 720px; }
.create-modal .m-body { padding: 20px 22px 24px; }
.crate-sec { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 4px 0 12px; }
.crate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.crate-card {
  position: relative; cursor: pointer; text-align: center; padding: 20px 12px 16px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.crate-card:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(37, 99, 235, .12); transform: translateY(-2px); }
.crate-card .cc-ic { font-size: 30px; line-height: 1; margin-bottom: 10px; }
.crate-card .cc-n { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.crate-card .cc-d { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.crate-card .cc-tag {
  position: absolute; top: -9px; right: 10px; background: var(--primary); color: #fff;
  font-size: 11px; border-radius: 9px; padding: 1px 8px;
}
.crate-tpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.crate-tpl-item {
  cursor: pointer; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.crate-tpl-item:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37, 99, 235, .10); }
.crate-tpl-item .ct-n { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.crate-tpl-item .ct-d { font-size: 12px; color: var(--text-3); }
.crate-empty { font-size: 12px; color: var(--text-3); padding: 10px 0 2px; }

/* ---------- 工作台·我的表单卡片（WPS 表单同款） ---------- */
.fbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 2px 0 14px; }
.chip-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.fchip {
  cursor: pointer; padding: 4px 12px; border-radius: 14px; font-size: 12px;
  border: 1px solid var(--line); color: var(--text-2); background: #fff; user-select: none;
}
.fchip.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.fcard {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 16px 16px 12px;
  background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.fcard:hover { border-color: var(--primary); box-shadow: 0 8px 22px rgba(37, 99, 235, .12); transform: translateY(-2px); }
.fcard .fc-t { font-size: 15px; font-weight: 700; line-height: 1.4; word-break: break-all; }
.fcard .fc-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.fcard .fc-num { font-size: 12px; color: var(--text-2); }
.fcard .fc-time { font-size: 11px; color: var(--text-3); }
.fcard .fc-ops { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }
.fcards-empty { padding: 30px 10px; text-align: center; color: var(--text-3); font-size: 13px; grid-column: 1 / -1; }
.badge.survey { background: #eef2ff; color: #4f46e5; }
.badge.vote { background: #fdf2f8; color: #db2777; }
.badge.exam { background: #fffbeb; color: #b45309; }
.badge.kaoping { background: #ecfdf5; color: #047857; }
