:root {
  --bg: #F4F1EB;
  --surface: #FFFFFF;
  --ink: #17181A;
  --muted: #7C766D;
  --faint: #A9A29A;
  --line: #E7E2D8;
  --brand: #2E5E4E;
  --brand-soft: #E8F0EC;
  --warn: #B4553A;
  --warn-soft: #FBEDE8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 24, 26, .04), 0 8px 24px rgba(23, 24, 26, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

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

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand); }

.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px;
  flex: 0 0 216px;
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side .logo {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 0 10px 18px;
}
.side .logo small { display: block; font-family: inherit; font-size: 11px; font-weight: 400; color: var(--faint); letter-spacing: 1.5px; margin-top: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14.5px;
  text-align: left;
  width: 100%;
  transition: background .16s, color .16s;
}
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; }
.nav-item:hover { background: rgba(46,94,78,.06); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active .dot { opacity: 1; }
.side .spacer { flex: 1; }
.role-switch {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  text-align: center;
  background: var(--surface);
}
.role-switch:hover { border-color: var(--brand); color: var(--brand); }

.main { flex: 1; min-width: 0; padding: 32px 40px 80px; }
.wrap { max-width: 880px; margin: 0 auto; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { font-size: 12.5px; color: var(--faint); letter-spacing: 1px; margin-bottom: 6px; }
.daytitle {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1.25;
}
.subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; }

.bottomnav { display: none; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 15.5px; font-weight: 650; letter-spacing: .2px; }
.card-hint { font-size: 12.5px; color: var(--faint); }

.iconbtn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 17px;
}
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 11px; font-size: 14.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .12s, box-shadow .16s, background .16s;
}
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(46,94,78,.22); }
.btn.primary:hover { background: #26503f; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); border-color: #EBD5CD; background: var(--warn-soft); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- chips / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--brand)); }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 11.5px;
  background: #F2EFE9; color: var(--muted); margin-right: 6px;
}
.tag.warn { background: var(--warn-soft); color: var(--warn); }

.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); background: var(--surface);
}
.filter.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- focus card ---------- */
.focus-card {
  background: linear-gradient(135deg, #2E5E4E 0%, #23483c 100%);
  color: #fff;
  border-radius: 20px;
  padding: 26px 26px 24px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(46,94,78,.25);
}
.focus-card::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255,255,255,.07);
}
.focus-card .fc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.focus-card .chip { background: rgba(255,255,255,.16); color: #fff; }
.focus-card h2 { font-size: 23px; font-weight: 700; letter-spacing: .3px; margin-bottom: 6px; }
.focus-card p { font-size: 13.5px; color: rgba(255,255,255,.72); }
.focus-card .rest { background: rgba(255,255,255,.1); }

/* ---------- steps ---------- */
.step {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.step:last-child { border-bottom: none; }
.check {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 8px;
  border: 1.6px solid #CFC8BC; display: grid; place-items: center;
  transition: background .16s, border-color .16s;
}
.check svg { width: 13px; height: 13px; opacity: 0; transition: opacity .16s; }
.step.done .check { background: var(--brand); border-color: var(--brand); }
.step.done .check svg { opacity: 1; }
.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: 14.5px; font-weight: 600; }
.step.done .step-body h3 { color: var(--faint); text-decoration: line-through; }
.step-body p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.step-min { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- stats ---------- */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; text-align: left;
}
.stat .num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent .num { color: var(--brand); }

/* ---------- lists ---------- */
.mkcard {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px;
  background: var(--surface);
}
.mkcard .mk-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.mkcard .mk-q { font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.mkcard img { max-width: 100%; border-radius: 10px; margin-top: 10px; border: 1px solid var(--line); }
.mkcard .mk-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mkcard .mk-foot .spacer { flex: 1; }
.leveldots { display: inline-flex; gap: 3px; }
.leveldots i { width: 6px; height: 6px; border-radius: 2px; background: #DED8CD; display: block; }
.leveldots i.on { background: var(--brand); }

.empty { text-align: center; color: var(--faint); font-size: 13.5px; padding: 40px 20px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; letter-spacing: .3px; }
.input, .textarea, .select {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line);
  background: #FCFBF8; outline: none; transition: border-color .16s, background .16s;
  -webkit-appearance: none; appearance: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); background: #fff; }
.textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%237C766D' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.hintline { font-size: 12px; color: var(--faint); margin-top: 6px; line-height: 1.5; }

/* ---------- review ---------- */
.review-card { min-height: 300px; display: flex; flex-direction: column; }
.review-q { font-size: 18px; line-height: 1.75; white-space: pre-wrap; flex: 1; }
.review-q img { max-width: 100%; border-radius: 12px; margin-top: 14px; border: 1px solid var(--line); }
.review-answer { border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 16px; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.review-actions { display: flex; gap: 10px; margin-top: 20px; }
.review-actions .btn { flex: 1; }

/* ---------- report ---------- */
.report {
  white-space: pre-wrap; font-size: 14px; line-height: 1.9;
  background: #FCFBF8; border: 1px solid var(--line); border-radius: 12px; padding: 18px;
}

/* ---------- timer ---------- */
.timerbar {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 9px 10px 9px 20px;
  display: flex; align-items: center; gap: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  z-index: 60; font-variant-numeric: tabular-nums;
}
.timerbar .t { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.timerbar button { color: #fff; font-size: 13px; opacity: .8; padding: 5px 10px; border-radius: 999px; }
.timerbar button:hover { background: rgba(255,255,255,.14); opacity: 1; }

/* ---------- toast / modal ---------- */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -16px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(23,24,26,.42); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 150;
}
.modal-box {
  background: var(--surface); border-radius: 20px; padding: 26px; width: 100%; max-width: 460px;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.28);
  animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal-foot { display: flex; gap: 10px; margin-top: 22px; }
.modal-foot .btn { flex: 1; }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mb0 { margin-bottom: 0; }
.msg {
  background: var(--brand-soft); border-radius: 12px; padding: 14px 16px; font-size: 14px;
  color: #1f463a; margin-bottom: 10px;
}
.msg .who { font-size: 11.5px; color: #4f7a6c; margin-bottom: 4px; letter-spacing: .5px; }

@media (max-width: 760px) {
  .side { display: none; }
  .main { padding: 20px 16px 120px; }
  .daytitle { font-size: 25px; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 18px; border-radius: 15px; }
  .focus-card { padding: 22px; }
  .focus-card h2 { font-size: 20px; }
  .row { flex-direction: column; gap: 0; }

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b));
    z-index: 100;
  }
  .bottomnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; font-size: 11px; color: var(--faint); border-radius: 10px;
  }
  .bottomnav button .bdot { width: 20px; height: 3px; border-radius: 2px; background: transparent; margin-bottom: 3px; }
  .bottomnav button.active { color: var(--brand); font-weight: 600; }
  .bottomnav button.active .bdot { background: var(--brand); }
  .timerbar { bottom: calc(74px + var(--safe-b)); }
}
