:root {
  --paper: #f4efe6;
  --paper-2: #fffdf8;
  --ink: #241c16;
  --muted: #6d6258;
  --line: #e4d8c8;
  --cinnabar: #9c341f;
  --cinnabar-dark: #7a2616;
  --pine: #1f6b4a;
  --pine-soft: #e7f3ec;
  --gold: #8d6a2f;
  --danger: #9c2f2f;
  --shadow: 0 12px 32px rgba(70, 42, 18, 0.08);
  --radius: 18px;
  --nav-h: 68px;
  --sidebar: 228px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(156, 52, 31, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cinnabar-dark); }

.shell { min-height: 100vh; }
.sidebar {
  display: none;
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #2a211b;
  color: #f6efe4;
  padding: 22px 16px;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.seal {
  width: 46px; height: 46px;
  border: 2px solid #e7b2a4;
  color: #f3c7bc;
  display: grid; place-items: center;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 26px;
}
.brand h1 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 22px;
  font-weight: 600;
}
.brand-title {
  display: inline-grid;
  justify-items: end;
  width: max-content;
  max-width: 100%;
}
.brand-title h1,
.brand-title h2 { justify-self: start; margin: 0; }
.brand-title .ver {
  margin-top: 1px;
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--muted);
}
.sidebar .brand-title .ver { color: #cbbbaa; font-size: 10px; }
.brand p { margin: 2px 0 0; color: #cbbbaa; font-size: 12px; }
.brand.light .seal { border-color: var(--cinnabar); color: var(--cinnabar); }
.brand.light p { color: var(--muted); }
.home-mark .brand { margin-bottom: 8px; }
.home-mark .brand-title h1 {
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 28px;
  font-weight: 600;
}
.nav-btn, .side-link {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #f6efe4;
  border: 0;
  border-radius: 12px;
  padding: 12px 12px;
  margin-bottom: 4px;
}
.side-link.active, .nav-btn.active { background: rgba(255, 255, 255, 0.1); }
.main { padding: 16px 16px calc(var(--nav-h) + 20px); max-width: 1100px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.topbar h2 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 28px;
  font-weight: 600;
}
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.grid { display: grid; gap: 10px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid #ddcfc0;
  background: #fff;
  border-radius: 12px;
  padding: 12px 12px;
  min-height: 48px;
}
textarea { min-height: 72px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 16px;
  background: #efe6da;
}
.btn.primary { background: var(--cinnabar); color: white; font-size: 18px; font-weight: 650; }
.btn.primary:hover { background: var(--cinnabar-dark); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: #f8e8e6; color: var(--danger); }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.check input { width: auto; min-height: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.error {
  background: #fdeceb;
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.ok {
  background: var(--pine-soft);
  color: var(--pine);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.record, .person, .quote, .book-card, .money, .meet {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.record:first-child, .person:first-child { border-top: 0; }
.record h3, .person h3, .book-card h3, .quote h3 { margin: 0 0 4px; font-size: 17px; }
.meta { color: var(--muted); font-size: 13px; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #f3e7d8;
}
.badge.ok { background: var(--pine-soft); color: var(--pine); }
.badge.bad { background: #fdeceb; color: var(--danger); }
.progress {
  height: 10px;
  background: #efe6da;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.progress > span { display: block; height: 100%; background: var(--cinnabar); }
.progress.met > span { background: var(--pine); }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.bar-track { height: 14px; background: #efe6da; border-radius: 999px; overflow: hidden; }
.bar-track > span { display: block; height: 100%; background: var(--gold); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.desktop-only { display: none; }
.mobile-only { display: block; }
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  background: #fffdf8;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 5;
}
.bottom-nav button {
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
}
.bottom-nav button.active { color: var(--cinnabar); font-weight: 700; }
.login-wrap { max-width: 420px; margin: 8vh auto; padding: 16px; }
.login-wrap h2 { font-family: "Songti SC", "Noto Serif SC", serif; font-size: 34px; margin: 0; }
.login-wrap .brand { margin-bottom: 12px; }
.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  background: #f7f1e8;
  border-radius: 12px;
  padding: 10px;
}
pre.doc {
  white-space: pre-wrap;
  background: #241c16;
  color: #f6efe4;
  border-radius: 16px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.45;
  overflow: auto;
}
.total { font-family: "Songti SC", "Noto Serif SC", serif; font-size: 40px; margin: 0; }
.filters { display: grid; gap: 10px; margin-bottom: 10px; }
.pager { display: flex; gap: 8px; align-items: center; }

@media (max-width: 899px) {
  .checkin-form textarea { height: 48px; min-height: 48px; }
  .checkin-form .btn.primary { width: 100%; }
}

@media (min-width: 900px) {
  .sidebar { display: flex; flex-direction: column; }
  .main { margin-left: var(--sidebar); padding: 28px 32px 48px; max-width: none; }
  .bottom-nav { display: none; }
  .desktop-only { display: block; }
  .mobile-only { display: none; }
  .wide-table { overflow: auto; }
  .layout-2 { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
  .checkin-form textarea { min-height: 96px; }
  .filters { grid-template-columns: 180px 1fr auto; align-items: end; }
}
