:root {
  --ink: #1a1814;
  --paper: #efe8dc;
  --card: #fffbf6;
  --line: #e5d9c8;
  --muted: #6f675c;
  --faint: #a3988a;
  --seal: #8e3b34;
  --seal-soft: #f4e4de;
  --tea: #3e5c4e;
  --sidebar: #1a1814;
  --sidebar-soft: #2a2622;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 460px);
}
.login-story {
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 20% 20%, rgba(142, 59, 52, 0.16), transparent 32%),
    #1a1814;
  color: #f4efe6;
}
.login-story img { width: 88px; height: 88px; object-fit: cover; border-radius: 22px; background: #f4efe6; }
.login-story h1 { font-family: "Palatino Linotype", "Songti SC", SimSun, serif; font-weight: 500; font-size: 56px; line-height: 1.05; margin: 24px 0 12px; }
.login-story p { max-width: 360px; color: #d9d0c3; font-size: 16px; }
.login-panel { display: flex; align-items: center; padding: 48px; }
.login-panel form { width: 100%; }
.login-panel h2 { font-family: "Palatino Linotype", "Songti SC", SimSun, serif; font-weight: 500; font-size: 32px; margin: 0 0 8px; }
.hint { color: var(--muted); margin-top: 0; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.side {
  background: var(--sidebar);
  color: #f4efe6;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; }
.brand img { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: #f4efe6; }
.brand strong { display: block; font-family: "Palatino Linotype", "Songti SC", SimSun, serif; font-size: 20px; font-weight: 500; }
.brand span { color: #b7ad9f; font-size: 12px; letter-spacing: 0.08em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  color: #e7dfd3;
}
.nav a.on, .nav a:hover { background: var(--sidebar-soft); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 8px 0; }
.side-foot button { background: transparent; color: #d9d0c3; border: 1px solid #3a342e; border-radius: 999px; padding: 8px 12px; text-align: left; }

.main { padding: 36px 40px 72px; max-width: 1180px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.top h1 { font-family: "Palatino Linotype", "Songti SC", SimSun, serif; font-weight: 500; font-size: 34px; margin: 0; }
.top p { margin: 6px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.stat { padding: 18px 18px 16px; }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 8px; font-family: "Palatino Linotype", "Songti SC", SimSun, serif; font-size: 32px; font-weight: 500; }
.stat em { font-style: normal; color: var(--seal); font-size: 12px; }

.card { padding: 18px 20px 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #f0e6d8; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.btn, .btn-line, .btn-seal, .btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 9px 16px;
  text-decoration: none;
  border: 1px solid transparent;
  background: var(--ink);
  color: #f6f1e8;
}
.btn-seal { background: var(--seal); }
.btn-line { background: transparent; color: var(--ink); border-color: #cfc3b2; }
.btn-quiet { background: var(--seal-soft); color: var(--seal); border-color: transparent; border-radius: 999px; padding: 6px 14px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

label.field { display: block; margin-bottom: 14px; }
label.field span, .check span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"], input[type="search"], textarea, select {
  width: 100%;
  background: #f7f1e7;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: #c9b59a; background: #fff; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 14px 22px; margin: 6px 0 16px; }
.check { display: flex; gap: 8px; align-items: center; }
.check span { margin: 0; color: var(--ink); font-size: 14px; }
.check input { accent-color: var(--seal); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0e6d8;
  color: #5c5348;
  font-size: 12px;
  margin-right: 6px;
}
.tag.seal { background: var(--seal-soft); color: var(--seal); }
.tag.tea { background: #e5efe8; color: var(--tea); }

.person { display: flex; gap: 12px; align-items: center; }
.avatar, .avatar-fallback {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: #eadfce; flex: none;
}
.avatar-fallback { display: grid; place-items: center; font-family: "Songti SC", SimSun, serif; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.empty { padding: 28px 8px; color: var(--muted); }

.bars { display: flex; align-items: flex-end; gap: 18px; height: 180px; padding-top: 12px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; }
.bar i { display: block; width: 100%; max-width: 42px; border-radius: 10px; background: #8e3b34; min-height: 4px; }
.bar b { font-weight: 500; font-size: 13px; }
.bar span { color: var(--muted); font-size: 12px; }

.hits { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.hit, .roster-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #f0e6d8;
}
.book-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.book-admin article {
  display: flex; gap: 14px; background: var(--card); border-radius: 22px; padding: 14px;
  box-shadow: 0 1px 0 rgba(26, 24, 20, 0.04);
}
.book-admin img { width: 78px; height: 108px; object-fit: cover; border-radius: 12px; background: #eadfce; flex: none; }
.book-admin h3 { margin: 0 0 6px; font-family: "Palatino Linotype", "Songti SC", SimSun, serif; font-weight: 500; font-size: 20px; }
.book-admin p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.book-admin .who { margin-top: 8px; color: var(--ink); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos figure { margin: 0; }
.photos img { width: 100%; height: 120px; object-fit: cover; border-radius: 16px; background: #eadfce; }
.photos figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }

.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; align-items: start; }
.profile-block + .profile-block { margin-top: 14px; }
.profile-block strong { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.qr { width: 160px; height: 160px; object-fit: contain; background: white; border-radius: 16px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #1a1814; color: #f6f1e8; padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: 0.2s ease; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-story { min-height: 280px; padding: 32px; }
  .login-story h1 { font-size: 40px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .stats, .split, .grid-2 { grid-template-columns: 1fr 1fr; }
  .main { padding: 24px 16px 48px; }
}
@media (max-width: 640px) {
  .stats, .split, .grid-2 { grid-template-columns: 1fr; }
}
