:root {
  --paper: #efe9dc;
  --card: #fbf8f1;
  --wash: #f5efe4;
  --ink: #211e18;
  --muted: #716657;
  --faint: #9d9383;
  --jade: #2f6656;
  --jade-2: #477f70;
  --seal: #b43a2e;
  --gold: #a7792d;
  --line: rgba(33, 30, 24, .13);
  --shadow: 0 10px 30px rgba(33, 30, 24, .09);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100dvh; padding: env(safe-area-inset-top) 0 84px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  background: rgba(239, 233, 220, .94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(33, 30, 24, .08);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.seal {
  width: 42px; height: 42px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; background: var(--seal);
  font: 900 24px ui-serif, "Songti SC", serif; transform: rotate(-4deg);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.22);
}
.brand b { display: block; font: 800 18px ui-serif, "Songti SC", serif; }
.brand span, .userline { display: block; color: var(--muted); font-size: 12px; }
.content { padding: 18px 16px 26px; max-width: 860px; margin: 0 auto; }
.hero { margin: 4px 0 18px; }
.eyebrow { color: var(--seal); font-size: 12px; font-weight: 800; letter-spacing: .22em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font: 900 30px/1.15 ui-serif, "Songti SC", serif; letter-spacing: 0; }
h2 { margin-bottom: 14px; font: 800 20px/1.25 ui-serif, "Songti SC", serif; }
h3 { margin-bottom: 10px; font-size: 16px; }
p { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.soft { background: var(--wash); box-shadow: none; }
.grid { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.stack { display: grid; gap: 10px; }
.empty { color: var(--faint); text-align: center; padding: 32px 14px; }
.muted { color: var(--muted); font-size: 13px; }
.tiny { color: var(--faint); font-size: 12px; }

label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf8;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(47,102,86,.14); }

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 800;
  color: var(--ink);
  background: var(--wash);
}
.btn.primary { color: #fff; background: var(--jade); }
.btn.seal-btn { color: #fff; background: var(--seal); font-family: ui-serif, "Songti SC", serif; letter-spacing: .08em; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.danger { color: var(--seal); }
.btn:disabled { opacity: .55; }
.icon-btn { flex: 0 0 auto; width: 38px; padding: 0; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(33, 30, 24, .96);
  border-top: 1px solid rgba(255,255,255,.08);
}
.tab {
  min-width: 0;
  border: 0;
  background: transparent;
  color: #bdb4a3;
  border-radius: 8px;
  padding: 7px 2px;
  font-size: 11px;
}
.tab b { display: block; font-size: 17px; line-height: 1; margin-bottom: 2px; }
.tab.on { color: #fff; background: var(--seal); }

.item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
}
.avatar {
  width: 40px; height: 40px; border-radius: 8px;
  flex: 0 0 auto; display: grid; place-items: center;
  color: #fff; background: var(--jade);
  font: 800 18px ui-serif, "Songti SC", serif;
}
.item-main { flex: 1; min-width: 0; }
.item-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 850; }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; background: rgba(47,102,86,.12); color: var(--jade); }
.pill.gold { background: rgba(167,121,45,.14); color: var(--gold); }
.pill.seal { background: rgba(180,58,46,.12); color: var(--seal); }
.actions { display: flex; gap: 6px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--wash); color: var(--muted); padding: 8px 12px; font-size: 13px; }
.result-block { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fffdf8; margin-bottom: 12px; }
.message { white-space: pre-wrap; background: var(--wash); border-radius: 8px; padding: 12px; }
.history-time { color: var(--faint); font-size: 12px; }
.notice { border: 1px solid rgba(167,121,45,.28); background: rgba(167,121,45,.1); color: #77551d; border-radius: 8px; padding: 12px; font-size: 13px; }
.error { border: 1px solid rgba(180,58,46,.35); background: rgba(180,58,46,.08); color: #842a21; border-radius: 8px; padding: 12px; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 30;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: #fff; border-radius: 8px;
  padding: 10px 16px; opacity: 0; pointer-events: none; transition: .2s;
  max-width: calc(100vw - 32px); text-align: center; font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.auth { min-height: 100dvh; display: grid; align-items: center; padding: 28px 16px; }
.auth .card { width: min(440px, 100%); margin: 0 auto; }

@media (min-width: 760px) {
  .shell { padding-bottom: 20px; }
  .tabbar { left: 50%; right: auto; bottom: 18px; transform: translateX(-50%); width: min(720px, calc(100% - 36px)); border-radius: 14px; padding: 8px; }
  .content { padding-bottom: 100px; }
  .grid.two { grid-template-columns: 360px 1fr; align-items: start; }
}
