/* ============ 用友红 · 设计体系 ============ */
:root {
  --red: #e60012;
  --red-deep: #c7000b;
  --red-dark: #9e0009;
  --red-soft: #ff5a45;
  --red-bg: #fff1f0;
  --red-border: #ffd9d5;
  --red-tint: #fff8f7;
  --ink: #1f2329;
  --ink-2: #51565d;
  --ink-3: #8a9099;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e8eaed;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(31, 35, 41, 0.06), 0 8px 24px rgba(31, 35, 41, 0.07);
  --font: "PingFang SC", "Microsoft YaHei", "微软雅黑", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.7;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--ink); }

/* ============ 通用组件 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 10px 22px;
  font-size: 15px; transition: all .18s ease;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); }
.btn-ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--red); border-color: var(--red-border); background: var(--red-tint); }
.btn-danger-ghost { background: #fff; color: #d4380d; border: 1px solid #ffd6c2; }
.btn-danger-ghost:hover { background: #fff4ef; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.field-label .req { color: var(--red); margin-left: 2px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; outline: none; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.08);
}
.input.err, .textarea.err { border-color: var(--red); background: var(--red-tint); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.field { margin-bottom: 18px; }
.field-tip { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

/* toast */
#toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: rgba(31,35,41,.92); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 999;
  max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: rgba(199, 0, 11, .95); }

/* ============ 调研页 ============ */
.hero {
  background: linear-gradient(118deg, var(--red-dark) 0%, var(--red-deep) 34%, var(--red) 68%, var(--red-soft) 100%);
  color: #fff; padding: 54px 20px 88px; position: relative; overflow: hidden;
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}
.hero::before { width: 460px; height: 460px; right: -120px; top: -180px; }
.hero::after { width: 300px; height: 300px; right: 160px; bottom: -200px; background: rgba(255,255,255,.05); }
.hero-inner { max-width: 860px; margin: 0 auto; position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 1px; opacity: .95; margin-bottom: 26px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--red);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
}
.hero h1 { font-size: 34px; line-height: 1.35; letter-spacing: 1px; font-weight: 700; }
.hero-sub { margin-top: 14px; font-size: 15px; opacity: .92; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-tags span {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  padding: 4px 14px; border-radius: 999px; font-size: 13px;
}
.hero-tags span i { font-style: normal; font-weight: 700; margin-right: 4px; }

.survey-main { max-width: 860px; margin: -52px auto 0; padding: 0 16px 90px; position: relative; z-index: 2; }
.intro-card { border-top: 4px solid var(--red); margin-bottom: 22px; }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.sec-num {
  flex: none; width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--red), var(--red-soft)); color: #fff;
  font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sec-head h2 { font-size: 19px; }
.sec-head .sec-sub { font-size: 13px; color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.section { margin-bottom: 22px; }
.intro-card p { color: var(--ink-2); margin-top: 10px; text-align: justify; }
.intro-card p:first-of-type { margin-top: 16px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* 角色选择 */
.role-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.role-opt {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  display: flex; align-items: center; gap: 9px; background: #fff; transition: all .15s;
  font-size: 14px; user-select: none;
}
.role-opt:hover { border-color: var(--red-border); background: var(--red-tint); }
.role-opt .dot {
  flex: none; width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid #c9cdd4; position: relative; transition: all .15s;
}
.role-opt.sel { border-color: var(--red); background: var(--red-bg); font-weight: 600; }
.role-opt.sel .dot { border-color: var(--red); }
.role-opt.sel .dot::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--red);
}

/* 模块矩阵 */
.cat-block { margin-top: 22px; }
.cat-block:first-of-type { margin-top: 14px; }
.cat-title {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.cat-name { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.cat-name::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, var(--red), var(--red-soft));
}
.cat-quick { display: flex; gap: 8px; }
.cat-quick button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-3);
  font-size: 12px; padding: 3px 10px; border-radius: 999px; transition: all .15s;
}
.cat-quick button:hover { color: var(--red); border-color: var(--red-border); background: var(--red-tint); }
.mod {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.mod.need-yes { border-color: var(--red-border); background: var(--red-tint); }
.mod-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mod-name { font-weight: 600; font-size: 14.5px; }
.mod-desc { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.mod-choose { display: flex; gap: 8px; }
.opt {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); font-size: 13.5px; cursor: pointer; background: #fff;
  transition: all .15s; user-select: none;
}
.opt:hover { border-color: var(--red-border); }
.opt input { display: none; }
.opt.sel-need { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.opt.sel-no { background: #f2f3f5; border-color: #c9cdd4; color: var(--ink-2); font-weight: 600; }
.mod-note { margin-top: 10px; width: 100%; min-height: 60px; }
.mod-note:placeholder-shown { min-height: 44px; }

.submit-bar { margin-top: 26px; text-align: center; z-index: 5; }
@media (max-width: 900px) { .submit-bar { position: sticky; bottom: 14px; } }
.submit-inner {
  display: inline-flex; align-items: center; gap: 16px; background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px); border-radius: 14px; padding: 12px 18px; box-shadow: var(--shadow);
}
.submit-hint { font-size: 13px; color: var(--ink-3); }
#btnSubmit { padding: 12px 46px; font-size: 16px; border-radius: 10px; box-shadow: 0 6px 16px rgba(230,0,18,.28); }

.err-msg {
  background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red-deep);
  border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; display: none;
}
.err-msg.show { display: block; }

/* 提交成功 */
.success-view { text-align: center; padding: 60px 20px; }
.success-icon {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--red-soft));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 38px;
}
.success-view h2 { font-size: 22px; margin-bottom: 10px; }
.success-view p { color: var(--ink-2); }
.survey-code {
  display: inline-block; margin: 18px 0; background: var(--red-bg); border: 1px dashed var(--red-border);
  color: var(--red-deep); font-weight: 700; letter-spacing: 1px; padding: 8px 22px; border-radius: 8px;
}

.survey-footer { text-align: center; color: var(--ink-3); font-size: 13px; padding: 0 16px 40px; margin-top: -60px; }

/* ============ 后台 ============ */
.topbar {
  background: linear-gradient(90deg, var(--red-dark), var(--red) 60%, var(--red-soft));
  color: #fff; padding: 0 22px; height: 58px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(158,0,9,.25);
}
.topbar .tb-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.topbar .tb-brand small { font-weight: 400; opacity: .85; font-size: 12.5px; display: block; line-height: 1.2; }
.top-actions { display: flex; gap: 10px; }
.top-actions .btn { padding: 7px 14px; font-size: 13px; }
.btn-white { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn-white:hover { background: rgba(255,255,255,.28); }

.admin-main { max-width: 1180px; margin: 0 auto; padding: 20px 18px 60px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: none; background: none; font-size: 15px; padding: 10px 18px; color: var(--ink-3);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; font-weight: 600;
}
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--red), var(--red-soft)); }
.stat .s-label { font-size: 13px; color: var(--ink-3); }
.stat .s-value { font-size: 28px; font-weight: 800; color: var(--ink); margin-top: 4px; line-height: 1.2; }
.stat .s-value small { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.stat .s-foot { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.grid-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 960px) { .grid-charts { grid-template-columns: 1fr; } }
.chart-card h3 { font-size: 15px; margin-bottom: 4px; }
.chart-card .c-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.chart { width: 100%; height: 300px; }
.chart.tall { height: 560px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 170px; }

.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 780px; }
.tbl th {
  text-align: left; padding: 12px 14px; background: #faf7f7; color: var(--ink-2);
  font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #f2f3f5; vertical-align: middle; }
.tbl tr:hover td { background: var(--red-tint); }
.tbl .tag {
  display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.tag-red { background: var(--red-bg); color: var(--red-deep); border: 1px solid var(--red-border); }
.tag-gray { background: #f2f3f5; color: var(--ink-2); border: 1px solid var(--line); }
.tag-amber { background: #fff7e8; color: #d46b08; border: 1px solid #ffe3ad; }
.link-btn { color: var(--red); background: none; border: none; font-size: 13.5px; padding: 4px 8px; }
.link-btn.gray { color: var(--ink-3); }
.link-btn:hover { text-decoration: underline; }
.empty-tip { text-align: center; color: var(--ink-3); padding: 40px 0; }

/* 登录 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f8f4f4 0%, var(--bg) 40%), var(--bg); padding: 20px;
}
.login-card {
  width: 380px; max-width: 94vw; background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  padding: 40px 34px; border-top: 5px solid var(--red); text-align: center;
}
.login-card .lock {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--red-bg); color: var(--red); font-size: 28px;
  display: flex; align-items: center; justify-content: center;
}
.login-card h2 { font-size: 19px; margin-bottom: 4px; }
.login-card .lg-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.login-card .input { text-align: left; margin-bottom: 14px; }
.login-card .btn { width: 100%; padding: 11px; }
.login-err { color: var(--red); font-size: 13px; margin-bottom: 10px; display: none; }
.login-err.show { display: block; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 18, 22, 0.55); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 720px; max-width: 96vw; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 22px; color: var(--ink-3); line-height: 1; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-body h4 {
  font-size: 14px; color: var(--red-deep); margin: 16px 0 8px; padding-left: 9px;
  border-left: 3px solid var(--red);
}
.modal-body h4:first-child { margin-top: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 13.5px; }
.detail-grid .dg-item b { color: var(--ink-3); font-weight: 400; margin-right: 6px; }
.dl-block {
  background: #fafafa; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
  font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start;
}
.dl-block .dl-name { flex: none; font-weight: 600; }
.dl-block .dl-note { color: var(--ink-2); word-break: break-all; }
.dl-block.no { opacity: .62; }
.text-answer { white-space: pre-wrap; font-size: 13.5px; color: var(--ink-2); background: #fafafa; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
