:root {
  --brand: #165dff;
  --brand-900: #0e42d2;
  --brand-50: #e8f0ff;
  --brand-100: #d3e2ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --line: #e6e9f0;
  --line-2: #f0f2f7;
  --ok: #00b42a;
  --ok-bg: #e8ffea;
  --warn: #ff7d00;
  --warn-bg: #fff7e8;
  --danger: #f53f3f;
  --danger-bg: #ffece8;
  --gray-bg: #f2f3f5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(20, 40, 90, 0.06), 0 6px 20px rgba(20, 40, 90, 0.05);
  --shadow-sm: 0 1px 2px rgba(20, 40, 90, 0.06);
}

* { box-sizing: border-box; }

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

a { color: var(--brand); text-decoration: none; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 10% -10%, #e6efff 0%, rgba(230, 239, 255, 0) 60%),
    radial-gradient(900px 480px at 100% 0%, #eaf1ff 0%, rgba(234, 241, 255, 0) 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--line);
}
.login-brand {
  padding: 46px 42px;
  background: linear-gradient(160deg, #165dff 0%, #0e42d2 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-brand h1 { font-size: 24px; margin: 0 0 14px; letter-spacing: 0.5px; }
.login-brand p { margin: 0 0 22px; color: rgba(255, 255, 255, 0.85); font-size: 13.5px; line-height: 1.9; }
.login-brand ul { margin: 0; padding: 0; list-style: none; }
.login-brand li {
  font-size: 13px; color: rgba(255,255,255,.92); padding: 5px 0 5px 20px; position: relative;
}
.login-brand li::before {
  content: ""; position: absolute; left: 2px; top: 13px;
  width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.75);
}
.login-form { padding: 46px 42px; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { margin: 0 0 6px; font-size: 19px; }
.login-form .sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }

/* ---------------- 表单控件 ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field .req { color: var(--danger); margin-left: 3px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.7; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all .16s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; font-weight: 500; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--brand-50); color: var(--brand); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- 布局 ---------------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15.5px; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(150deg, #165dff, #0e42d2);
  color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-50); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600;
}
.role-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 20px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid #ffe0b8;
}

.container { max-width: 1240px; margin: 0 auto; padding: 22px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 20px; font-size: 13.5px; cursor: pointer;
  color: var(--text-2); border: 1px solid transparent; background: transparent; font-family: inherit;
}
.tab:hover { color: var(--brand); }
.tab.active { background: #fff; color: var(--brand); border-color: var(--brand-100); box-shadow: var(--shadow-sm); font-weight: 500; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15.5px; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); }
.card-head .spacer { flex: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---------------- 指标卡 ---------------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.kpi .label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -0.5px; line-height: 1.1; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi.accent { background: linear-gradient(150deg, #165dff, #0e42d2); border-color: transparent; }
.kpi.accent .label { color: rgba(255,255,255,.8); }
.kpi.accent .value { color: #fff; }
.kpi .kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.kpi.accent .kpi-sub { color: rgba(255,255,255,.78); }
.kpis-8 { grid-template-columns: repeat(4, 1fr); }

/* 可点击下钻的指标卡 */
.kpi-link { cursor: pointer; position: relative; transition: border-color .15s, box-shadow .15s, transform .15s; }
.kpi-link:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(22, 93, 255, .14); transform: translateY(-2px); }
.kpi-link:active { transform: translateY(0); }
.kpi-link::after {
  content: "查看明细 ›";
  position: absolute; right: 14px; top: 13px;
  font-size: 11px; color: var(--brand); opacity: 0; transition: opacity .15s;
}
.kpi-link:hover::after { opacity: 1; }
.kpi.accent.kpi-link::after { color: rgba(255, 255, 255, .9); }
.kpi-link .label { padding-right: 62px; }

/* 下钻明细表高亮列 */
td.cell-strong { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---------------- 问卷编辑器 ---------------- */
.ed-sec { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: #fbfcfe; }
.ed-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ed-sec-head .ed-sec-title { flex: 1; min-width: 200px; font-weight: 600; }
.ed-q { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.ed-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ed-q-head .spacer { flex: 1; }
.ed-q-head select { width: auto; min-width: 128px; padding: 6px 10px; font-size: 13px; }
.ed-idx { font-size: 12px; color: var(--text-3); background: var(--gray-bg); border-radius: 6px; padding: 2px 9px; white-space: nowrap; }
.ed-req { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.ed-req input { accent-color: var(--brand); }
.ed-items { display: flex; flex-direction: column; gap: 8px; }
.ed-item { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.ed-q .field { margin-bottom: 10px; }
.ed-q .field:last-child { margin-bottom: 0; }
#pane-editor input[type="text"], #pane-editor textarea { font-size: 13.5px; }

/* ---------------- 状态标签 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 2px 9px; border-radius: 20px; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.submitted { background: var(--ok-bg); color: var(--ok); }
.badge.submitted .dot { background: var(--ok); }
.badge.viewed { background: var(--warn-bg); color: var(--warn); }
.badge.viewed .dot { background: var(--warn); }
.badge.untouched { background: var(--gray-bg); color: var(--text-3); }
.badge.untouched .dot { background: var(--text-3); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
th {
  text-align: left; padding: 11px 12px; background: #fafbfe; color: var(--text-2);
  font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12.5px; }
.link-url { color: var(--text-3); cursor: pointer; }
.link-url:hover { color: var(--brand); }
.cell-note { color: var(--text-3); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 13.5px; }

/* ---------------- 统计条形 ---------------- */
.bar-row { display: grid; grid-template-columns: 150px 1fr 62px; align-items: center; gap: 12px; padding: 6px 0; }
.bar-row .name { font-size: 13px; color: var(--text-2); text-align: right; }
.bar-track { background: var(--line-2); border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #4f8bff, #165dff); transition: width .5s; }
.bar-row .val { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-row.rank1 .bar-fill { background: linear-gradient(90deg, #ff9a3d, #ff7d00); }

.score-pill {
  display: inline-block; min-width: 40px; text-align: center; padding: 1px 8px;
  border-radius: 6px; font-size: 12.5px; font-weight: 600;
  background: var(--brand-50); color: var(--brand);
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px;
  max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.icon-close { cursor: pointer; color: var(--text-3); background: none; border: none; font-size: 20px; line-height: 1; padding: 0 4px; }
.icon-close:hover { color: var(--text); }

/* ---------------- 提示 ---------------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1d2129; color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: toastIn .22s ease;
}
.toast.ok { background: #00b42a; }
.toast.err { background: #f53f3f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------- 问卷填写页 ---------------- */
.survey-page { max-width: 760px; margin: 0 auto; padding: 0 16px 80px; }
.survey-hero {
  background: linear-gradient(150deg, #165dff, #0e42d2);
  color: #fff; border-radius: 0 0 20px 20px; padding: 34px 26px 30px;
  margin: 0 -16px 20px;
}
.survey-hero h1 { margin: 0 0 10px; font-size: 22px; }
.survey-hero p { margin: 0; font-size: 13.5px; color: rgba(255,255,255,.88); line-height: 1.9; }
.survey-hero .who { display: inline-block; margin-top: 14px; background: rgba(255,255,255,.16); padding: 4px 12px; border-radius: 20px; font-size: 12.5px; }
.sec { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.sec-title { font-size: 15.5px; font-weight: 600; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.sec-title::before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: var(--brand); }
.sec-desc { font-size: 12.5px; color: var(--text-3); margin: 0 0 18px; }
.q { padding: 14px 0; border-top: 1px dashed var(--line-2); }
.q:first-of-type { border-top: none; padding-top: 4px; }
.q-title { font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.q-title .req { color: var(--danger); margin-left: 3px; }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: flex-start; gap: 9px; padding: 10px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
  transition: all .14s; font-size: 13.5px; background: #fff;
}
.opt:hover { border-color: var(--brand-100); background: #fafbff; }
.opt input { margin: 3px 0 0; accent-color: var(--brand); flex: none; }
.opt.checked { border-color: var(--brand); background: var(--brand-50); }
.other-box { margin: 9px 0 2px; }
.other-box input {
  border: 1px dashed var(--brand-100);
  background: #fafbff;
  padding-left: 34px;
  background-image: linear-gradient(transparent, transparent);
}
.other-box input:focus { border-style: solid; background: #fff; }
.other-box::after {
  content: "选中「其他」项需补充说明";
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 5px;
}
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rate-matrix { display: flex; flex-direction: column; gap: 10px; }
.rate-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rate-item .lab { font-size: 13.5px; }
.rate-item .lab small { display: block; color: var(--text-3); font-size: 11.5px; }
.stars { display: flex; gap: 5px; }
.star {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff;
  color: var(--text-3); font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: all .12s;
}
.star:hover { border-color: var(--brand); color: var(--brand); }
.star.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.submit-bar { position: sticky; bottom: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 14px 0; margin-top: 18px; display: flex; align-items: center; gap: 14px; }
.submit-bar .tip { font-size: 12.5px; color: var(--text-3); flex: 1; }
.done-card { text-align: center; padding: 60px 24px; }
.done-ico { width: 62px; height: 62px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto 18px; }
.done-card h2 { margin: 0 0 10px; font-size: 20px; }
.done-card p { color: var(--text-3); margin: 0; font-size: 13.5px; }
.warn-box { background: var(--warn-bg); border: 1px solid #ffe0b8; color: #b25c00; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; margin-bottom: 16px; }
.stepper { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-bottom: 16px; }
.stepper .chip { padding: 3px 11px; border-radius: 20px; background: #fff; border: 1px solid var(--line); }
.stepper .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.stepper .chip.done { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .kpis, .kpis-8 { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .opt-grid { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 14px; }
  .container { padding: 14px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 96px 1fr 54px; }
  .rate-item { grid-template-columns: 1fr; }
  .survey-hero { border-radius: 0 0 16px 16px; padding: 26px 18px 22px; }
}
