:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --text: #141821;
  --muted: #6d7484;
  --line: #e3e6ee;
  --blue: #4867f3;
  --blue-soft: #edf2ff;
  --blue-line: #c8d6ff;
  --orange: #e88338;
  --orange-soft: #fff6ef;
  --orange-line: #f5c7a6;
  --green: #14a46c;
  --red: #d94a4a;
  --shadow: 0 12px 28px rgba(22, 29, 43, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
}
button, input, textarea, select { font: inherit; }
a { color: var(--blue); text-decoration: none; }

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 62px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { color: var(--text); font-weight: 800; }
.nav-links { display: flex; gap: 8px; }
.nav-links a {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted);
}
.nav-links a.active, .nav-links a:hover { color: var(--blue); background: var(--blue-soft); }

.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 56px; }
.narrow { width: min(488px, calc(100% - 24px)); }
.form-page { width: min(448px, calc(100% - 24px)); }
.dashboard-page { width: min(1180px, calc(100% - 32px)); }

.hero { text-align: center; margin: 12px 0 18px; }
.hero h1, .dashboard-header h1 { margin: 0; font-size: 24px; line-height: 1.35; letter-spacing: 0; }
.hero p, .dashboard-header p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.compact-hero { padding-top: 2px; }
.review-hero { margin-top: 14px; }

.panel, .guide-panel, .note-panel {
  background: var(--panel);
  border: 1px solid rgba(227, 230, 238, 0.8);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.panel { padding: 20px; margin-top: 14px; }
.guide-panel {
  padding: 20px;
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, #6378e8 0%, #7451b7 100%);
}
.guide-panel h2 { margin: 0 0 10px; font-size: 17px; }
.guide-panel p, .guide-panel ol { margin: 0; font-size: 13px; line-height: 1.8; }
.guide-panel ol { padding-left: 18px; margin-top: 8px; }
.note-panel {
  margin-top: 14px;
  padding: 18px 20px;
  background: #fff9e8;
  border-color: #f6d269;
  color: #865a0c;
  box-shadow: none;
}
.note-panel ol { margin: 8px 0 0; padding-left: 18px; line-height: 1.75; font-size: 13px; }

.step-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 700; }
.step-title span {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
  font-size: 13px;
}
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-card {
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
}
.mode-card strong { font-size: 14px; }
.mode-card small { color: var(--muted); font-size: 12px; }
.mode-card.active { border: 2px solid var(--blue); background: var(--blue-soft); }

.form-grid.two { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field { display: block; }
.field span { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 650; }
.field span em {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-style: normal;
  font-size: 12px;
}
.field span em.orange { color: var(--orange); background: var(--orange-soft); }
.field span b { color: var(--red); }
.field input, .field textarea, .filter-bar input, .filter-bar select, .copy-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d9dde6;
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .filter-bar input:focus, .filter-bar select:focus, .copy-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(72, 103, 243, 0.12);
}
.spaced { margin-top: 14px; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.is-hidden { display: none !important; }

.target-preview {
  min-height: 72px;
  border: 1px solid var(--blue-line);
  background: var(--blue-soft);
  border-radius: 10px;
  padding: 14px;
  color: #53627f;
  line-height: 1.8;
}
.target-preview .target-line { color: var(--text); font-weight: 700; }

.primary, .secondary {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 750;
}
.primary { background: var(--blue); color: #fff; box-shadow: 0 10px 22px rgba(72, 103, 243, 0.22); }
.primary:hover { background: #3d5be2; }
.secondary { background: #eef1f7; color: #293142; }
.secondary:hover { background: #e3e8f3; }
button:disabled { cursor: not-allowed; opacity: 0.56; box-shadow: none; }
.wide { width: 100%; }
.copy-box { display: grid; grid-template-columns: 1fr 116px; gap: 10px; margin-top: 14px; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head span { color: var(--muted); font-size: 13px; }
.recent-list { display: grid; gap: 10px; }
.recent-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcff; }
.recent-item strong { display: block; margin-bottom: 4px; }
.recent-item small { color: var(--muted); }
.empty { color: var(--muted); }

.switch-row { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 10px; }
.switch-row input { display: none; }
.switch-row i { width: 44px; height: 24px; border-radius: 999px; background: #d9dbe2; position: relative; transition: 0.2s; }
.switch-row i:before { content: ""; position: absolute; width: 20px; height: 20px; top: 2px; left: 2px; border-radius: 50%; background: #fff; transition: 0.2s; }
.switch-row input:checked + i { background: var(--blue); }
.switch-row input:checked + i:before { left: 22px; }

.review-section {
  border-radius: 14px;
  padding: 18px;
  margin-top: 14px;
  border: 1px solid var(--blue-line);
  background: var(--blue-soft);
}
.review-section.consultant { border-color: var(--orange-line); background: var(--orange-soft); }
.review-section h2 { margin: 0; font-size: 16px; }
.review-section .sub { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.person-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  margin-bottom: 14px;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
}
.consultant .avatar { background: var(--orange); }
.stars { display: flex; align-items: center; gap: 7px; min-height: 36px; }
.star {
  border: 0;
  background: transparent;
  color: #cfd3dc;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.star.active { color: #ffc247; }
.score-label { color: var(--muted); margin-left: 10px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.tag {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: #5b6270;
  cursor: pointer;
}
.tag.active { border-color: var(--blue); color: var(--blue); background: #f8faff; }
.consultant .tag.active { border-color: var(--orange); color: var(--orange); background: #fffaf5; }
.submit-btn { width: 100%; margin-top: 20px; min-height: 52px; font-size: 17px; }
.loading, .success-panel { text-align: center; color: var(--muted); }
.success-panel h2 { color: var(--green); margin: 0 0 8px; }
.success-panel p { margin: 0; line-height: 1.7; }
.success-close { min-width: 168px; margin-top: 18px; }
.review-submitted .form-page {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.review-submitted .success-panel { width: 100%; margin-top: 0; }

.dashboard-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 12px 0 18px; }
.filter-bar {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.filter-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.filter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr)) minmax(150px, 1fr) minmax(170px, 1fr) 96px;
  gap: 12px;
  align-items: end;
}
.quick-range { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-range button {
  min-height: 38px;
  min-width: 64px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  color: #596174;
}
.quick-range button.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 750; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.kpi-card {
  padding: 18px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.kpi-card span { color: var(--muted); font-size: 13px; }
.kpi-card strong { display: block; margin-top: 8px; font-size: 30px; letter-spacing: 0; }
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.role-card { padding: 18px; border-radius: 14px; border: 1px solid var(--blue-line); background: var(--blue-soft); }
.role-card.consultant { border-color: var(--orange-line); background: var(--orange-soft); }
.role-card h3 { margin: 0 0 12px; font-size: 17px; }
.role-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.role-metrics div { background: rgba(255,255,255,0.72); border-radius: 10px; padding: 12px; }
.role-metrics span { display: block; color: var(--muted); font-size: 12px; }
.role-metrics strong { display: block; margin-top: 5px; font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips span { padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,0.82); color: #566073; font-size: 12px; }
.table-panel { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { color: var(--muted); font-size: 12px; font-weight: 750; background: #fafbfe; }
.score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; height: 30px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.review-list { display: grid; gap: 10px; }
.review-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; }
.review-card .meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.review-card p { margin: 8px 0 0; line-height: 1.7; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1f2633;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
  z-index: 50;
}

@media (max-width: 920px) {
  .filter-fields { grid-template-columns: 1fr 1fr; }
  .filter-fields #applyFilter { min-height: 44px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .top-nav { padding: 0 12px; height: auto; min-height: 58px; align-items: flex-start; flex-direction: column; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .nav-links { width: 100%; overflow-x: auto; }
  .mode-grid, .role-grid, .kpi-grid, .filter-fields { grid-template-columns: 1fr; }
  .copy-box { grid-template-columns: 1fr; }
  .dashboard-header { align-items: flex-start; flex-direction: column; }
  .role-metrics { grid-template-columns: 1fr; }
  .page { width: min(100% - 20px, 1120px); padding-bottom: 40px; }
}
