:root {
  --brown: #7a3b12;
  --brown-2: #97501f;
  --brown-dark: #552607;
  --green: #2f7d32;
  --green-2: #4c9a4f;
  --green-soft: #eaf4ea;
  --cream: #fbf6ec;
  --line: #ece6dd;
  --text: #2b2b2b;
  --muted: #8b8378;
  --bg: #f7f4ee;
  --shadow: 0 6px 24px rgba(90, 58, 26, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- header ---------- */
.topbar {
  background: linear-gradient(90deg, var(--brown-dark), var(--brown));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 26px;
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a {
  padding: 8px 13px;
  border-radius: 6px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .82);
  display: flex; align-items: center; gap: 6px;
  transition: .18s;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.nav a.quit { margin-left: 6px; color: #ffd9c0; }

/* ---------- page ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 24px 26px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: .5px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.breadcrumb { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.breadcrumb b { color: var(--brown); font-weight: 600; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #f3eee7;
}
.card-hd h3 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-hd h3::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--brown-2);
}
.card-bd { padding: 18px 20px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 6px;
  padding: 9px 18px; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  transition: .18s;
}
.btn-primary { background: var(--brown); color: #fff; }
.btn-primary:hover { background: var(--brown-2); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #276a29; }
.btn-ghost { background: #fff; border-color: #e2d8ca; color: #6b503a; }
.btn-ghost:hover { border-color: var(--brown-2); color: var(--brown); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

/* ---------- stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: radial-gradient(circle, rgba(122, 59, 18, .06), transparent 70%);
}
.stat-top { display: flex; align-items: center; gap: 10px; }
.stat-ico {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  background: var(--green-soft); color: var(--green); font-size: 17px;
}
.stat-ico.warm { background: #fbeee2; color: var(--brown-2); }
.stat h4 { margin: 0; font-size: 15px; font-weight: 700; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  background: #e6f4e6; color: #2e7d32; font-size: 12px; font-weight: 700;
}
.stat p { margin: 12px 0 8px; color: var(--muted); font-size: 12.8px; }
.stat .link { color: var(--brown-2); font-size: 12.5px; font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }
.one-col { display: grid; grid-template-columns: 1fr; gap: 18px; }

/* ---------- chart ---------- */
.chart-box { width: 100%; height: 300px; }
.chart-box svg { width: 100%; height: 100%; }
.legend { display: flex; gap: 16px; align-items: center; font-size: 12.5px; color: var(--muted); }
.legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.legend i.dash { height: 0; border-top: 2px dashed #9bc79e; }

/* ---------- todos ---------- */
.todo { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed #f0e9df; }
.todo:last-child { border-bottom: 0; }
.todo input { accent-color: var(--green); width: 15px; height: 15px; }
.todo span { font-size: 13.5px; }
.todo.done span { color: #b3aa9f; text-decoration: line-through; }
.todo time { margin-left: auto; color: #b3aa9f; font-size: 12px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid #f3eee7; }
.field { display: flex; align-items: center; gap: 8px; }
.field label { color: var(--muted); font-size: 13px; white-space: nowrap; }
select, input[type="text"], input[type="date"] {
  font-family: inherit; font-size: 13px; color: #4a3a2a;
  border: 1px solid #e4dacd; background: #fff; border-radius: 6px;
  padding: 8px 11px; min-width: 130px; outline: none;
}
select:focus, input:focus { border-color: var(--brown-2); box-shadow: 0 0 0 3px rgba(151, 80, 31, .1); }
.filters .spacer { margin-left: auto; }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12.5px; color: #8a7c6c; font-weight: 600;
  background: #faf7f1; padding: 12px 16px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 14px 16px; border-bottom: 1px solid #f4efe8; font-size: 13.2px; }
.tbl tr:hover td { background: #fdfbf7; }
.tbl .code { color: var(--brown-2); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4caf50; }
.tag.wait::before { background: #e6a23c; }
.tag.an::before { background: #3f8fd2; }
.ops { display: flex; gap: 10px; white-space: nowrap; }
.ops a { color: var(--brown-2); font-size: 12.5px; }
.ops a.del { color: #c0392b; }
.ops a:hover { text-decoration: underline; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--muted); font-size: 12.8px; }
.pager { display: flex; gap: 6px; }
.pager button {
  min-width: 30px; height: 30px; border-radius: 6px; border: 1px solid #e7ddcf;
  background: #fff; color: #6b5a48; font-size: 12.5px;
}
.pager button.active { background: var(--brown); color: #fff; border-color: var(--brown); }
.pager button:disabled { opacity: .45; cursor: default; }

/* ---------- analysis ---------- */
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.conclusion { padding: 4px 2px 0; }
.conclusion h4 { margin: 0 0 10px; font-size: 14px; color: var(--brown); }
.conclusion ul { margin: 0; padding-left: 20px; color: #5c5147; }
.conclusion li { margin-bottom: 7px; font-size: 13.4px; }
.conclusion .advice { margin-top: 14px; padding: 12px 14px; background: #fbf7ef; border-left: 3px solid #c9a06a; border-radius: 0 6px 6px 0; }

/* ---------- survey ---------- */
.survey-grid { display: grid; grid-template-columns: 240px 1fr; gap: 18px; }
.side-menu { padding: 10px 0; }
.side-menu .group { border-bottom: 1px solid #f3eee7; }
.side-menu .group > button {
  width: 100%; border: 0; background: transparent; padding: 11px 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px; color: #4b4036; font-weight: 600;
}
.side-menu .group > button:hover { color: var(--brown); background: #fcfaf6; }
.side-menu .sub { display: none; padding: 0 0 8px; }
.side-menu .group.open .sub { display: block; }
.side-menu .sub a {
  display: block; padding: 8px 18px 8px 32px; color: #7c7063; font-size: 13px;
  border-left: 2px solid transparent;
}
.side-menu .sub a:hover, .side-menu .sub a.active {
  color: var(--brown); background: #fdf8f0; border-left-color: var(--brown-2);
}
.survey-main { min-height: 620px; }
.survey-hero {
  padding: 16px 20px; border-bottom: 1px solid #f3eee7;
  background: linear-gradient(180deg, #fdfaf3, #fff);
}
.survey-hero h2 { margin: 0; font-size: 19px; color: var(--brown-dark); }
.survey-hero p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.record-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 26px; margin: 0; }
.record-list div { display: flex; justify-content: space-between; border-bottom: 1px dashed #f0e9df; padding: 9px 0; }
.record-list dt { color: var(--muted); font-size: 13px; }
.record-list dd { margin: 0; font-weight: 600; color: #4a3a2a; font-size: 13.2px; }
.photo-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.photo-row figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #faf7f1; }
.photo-row img { width: 100%; height: 150px; object-fit: cover; }
.photo-row figcaption { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.section-title { font-size: 14.5px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 15px; background: var(--green); border-radius: 2px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 230px 1fr; gap: 18px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.info-grid h4 { margin: 0 0 12px; font-size: 13.5px; color: var(--brown); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #f0e9df; font-size: 13.2px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; color: #403428; }
.status-ok { color: #2e7d32; font-weight: 700; }
.mini-tabs { display: flex; gap: 8px; }
.mini-tabs button {
  border: 1px solid #e6dccd; background: #fff; color: #7b6a58;
  border-radius: 6px; padding: 7px 14px; font-size: 12.8px;
}
.mini-tabs button.active { background: var(--brown); color: #fff; border-color: var(--brown); }

/* ---------- profile ---------- */
.profile-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; }
.profile-card { text-align: center; padding: 30px 20px; }
.avatar {
  width: 82px; height: 82px; border-radius: 50%; margin: 0 auto 12px;
  background: linear-gradient(135deg, #a4622f, #6d3210); color: #fff;
  display: grid; place-items: center; font-size: 30px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(109, 50, 16, .3);
}
.profile-card h3 { margin: 0; font-size: 18px; }
.profile-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.profile-stats { display: flex; justify-content: space-around; margin-top: 20px; padding-top: 18px; border-top: 1px solid #f2ece3; }
.profile-stats b { display: block; font-size: 20px; color: var(--brown); }
.profile-stats span { font-size: 12px; color: var(--muted); }
.log { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px dashed #f0e9df; font-size: 13.2px; }
.log time { color: #b3aa9f; font-size: 12.5px; white-space: nowrap; }
.log i { width: 8px; height: 8px; border-radius: 50%; background: #c9a06a; margin-top: 7px; flex: none; }

/* ---------- footer ---------- */
.foot {
  margin-top: 34px; background: linear-gradient(90deg, var(--brown-dark), #6b3310);
  color: rgba(255, 255, 255, .82);
}
.foot-inner {
  max-width: 1320px; margin: 0 auto; padding: 20px 26px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.foot-inner .brand-title { font-size: 14.5px; }
.foot-inner .slogan { color: rgba(255, 255, 255, .6); font-size: 12.5px; }
.foot-links { margin-left: auto; display: flex; gap: 22px; font-size: 12.5px; }
.copyright { text-align: center; padding: 10px; color: #b9a99c; font-size: 11.5px; background: #4b2208; }

/* ---------- modal / toast ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(40, 25, 12, .45);
  display: none; place-items: center; z-index: 50;
}
.modal-bg.show { display: grid; }
.modal { width: 460px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.modal h3 { margin: 0; padding: 18px 22px; font-size: 16px; border-bottom: 1px solid #f0e9df; }
.modal .body { padding: 20px 22px; }
.modal .body .field { margin-bottom: 14px; display: grid; grid-template-columns: 84px 1fr; }
.modal .body select, .modal .body input { width: 100%; }
.modal .foot-btns { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
.toast {
  position: fixed; left: 50%; top: 80px; transform: translate(-50%, -20px);
  background: #2f2a24; color: #fff; padding: 10px 20px; border-radius: 6px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .two-col, .analysis-grid, .settings-grid, .profile-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr 1fr; }
  .survey-grid { grid-template-columns: 200px 1fr; }
  .nav a span { display: none; }
}
