:root {
  --bg: #fafaf7;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #888;
  --border: #e6e1d6;
  --accent: #8b5a2b;
  --accent-light: #f0e3d0;
  --sold: #9e9e9e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text);
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  font-size: 14px;
  line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 顶栏 ============ */
.header { background: var(--accent); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.header .brand { font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.header .brand small { font-size: 11px; opacity: 0.85; font-weight: 400;
  letter-spacing: 1px; margin-left: 8px; }
.header .nav a { color: #fff; margin-left: 18px; opacity: 0.9; }
.header .nav a:hover { opacity: 1; }

/* ============ 主区 ============ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }
.row { display: flex; gap: 24px; }
.aside { width: 200px; flex: 0 0 200px; }
.main { flex: 1 1 auto; min-width: 0; }

/* ============ 搜索条 ============ */
.search-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.search-bar input[type=text] { flex: 1; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 14px; background: #fff; }
.search-bar button { padding: 8px 18px; background: var(--accent); color: #fff;
  border: 0; border-radius: 4px; cursor: pointer; font-size: 14px; }
.search-bar button:hover { background: #6e4521; }
.search-bar .back { background: #999; }

/* ============ 分类 ============ */
.cat-list { list-style: none; background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 0; }
.cat-list li a { display: flex; justify-content: space-between; padding: 8px 14px;
  color: var(--text); }
.cat-list li a:hover { background: var(--accent-light); text-decoration: none; }
.cat-list li.active a { background: var(--accent-light); color: var(--accent);
  font-weight: 600; }
.cat-count { color: var(--muted); font-size: 12px; }

/* ============ 书卡 ============ */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px; }
.book-card { background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s; }
.book-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
.book-card .cover { width: 100%; aspect-ratio: 2/3; background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 48px; overflow: hidden; }
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card .info { padding: 10px 12px; }
.book-card .info .title { font-size: 14px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; height: 38px; }
.book-card .info .author { font-size: 12px; color: var(--muted); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card .info .meta { display: flex; justify-content: space-between;
  align-items: baseline; margin-top: 8px; }
.book-card .info .price { color: #c0392b; font-weight: 700; font-size: 16px; }
.book-card .info .cond { font-size: 11px; color: var(--muted);
  background: var(--bg); padding: 1px 6px; border-radius: 3px; }
.book-card.sold { opacity: 0.55; }
.book-card.sold .info .price { color: var(--sold); text-decoration: line-through; }
.book-card.sold::after { content: '已售'; position: absolute; top: 8px; right: 8px;
  background: #c0392b; color: #fff; padding: 2px 8px; border-radius: 3px;
  font-size: 11px; }
.book-card { position: relative; }

/* ============ 详情 ============ */
.detail { background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 24px; display: flex; gap: 28px; }
.detail .cover { width: 220px; flex: 0 0 220px; }
.detail .cover img, .detail .cover .placeholder { width: 100%; aspect-ratio: 2/3;
  background: var(--accent-light); border-radius: 4px; display: flex;
  align-items: center; justify-content: center; color: var(--accent);
  font-size: 64px; overflow: hidden; }
.detail .cover img { object-fit: cover; }
.detail h1 { font-size: 22px; margin-bottom: 8px; }
.detail .author { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.detail .price-row { font-size: 28px; color: #c0392b; font-weight: 700;
  margin: 12px 0; }
.detail .attrs { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.detail .attrs .attr { background: var(--bg); padding: 4px 10px;
  border-radius: 3px; font-size: 12px; color: var(--muted); }
.detail .attrs .attr b { color: var(--text); }
.detail .desc { background: var(--bg); padding: 12px; border-radius: 4px;
  white-space: pre-wrap; margin-top: 14px; font-size: 13px; }
.detail .contact { margin-top: 18px; padding: 14px; background: var(--accent-light);
  border-radius: 4px; }
.detail .contact .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.detail .contact .value { font-size: 16px; font-weight: 600; }
.detail .actions { margin-top: 18px; display: flex; gap: 8px; }
.detail .actions form { display: inline; }
.detail .actions button { padding: 8px 18px; border: 0; border-radius: 4px;
  cursor: pointer; font-size: 13px; }
.detail .actions .sold-btn { background: #c0392b; color: #fff; }
.detail .actions .sold-btn:hover { background: #a93226; }
.detail .actions .remove-btn { background: #888; color: #fff; }

/* ============ 表单 ============ */
.form-wrap { background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 28px; max-width: 720px; margin: 0 auto; }
.form-wrap h1 { font-size: 20px; margin-bottom: 18px; }
.form-row { display: flex; gap: 14px; margin-bottom: 14px; }
.form-row > * { flex: 1; }
label { display: block; font-size: 13px; color: #444; margin-bottom: 4px; }
input[type=text], input[type=number], textarea, select { width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 3px; font-size: 14px;
  font-family: inherit; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
input[type=file] { font-size: 13px; }
.submit-row { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; }
.submit-row button { padding: 10px 32px; background: var(--accent); color: #fff;
  border: 0; border-radius: 4px; font-size: 15px; font-weight: 600;
  cursor: pointer; }
.submit-row button:hover { background: #6e4521; }
.submit-row .hint { color: var(--muted); font-size: 12px; }

/* ============ 分页 ============ */
.pager { text-align: center; margin-top: 24px; }
.pager a, .pager span { display: inline-block; padding: 4px 10px;
  margin: 0 2px; border: 1px solid var(--border); border-radius: 3px;
  background: #fff; color: var(--text); }
.pager .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============ footer ============ */
.footer { text-align: center; color: var(--muted); padding: 32px 0;
  font-size: 12px; border-top: 1px solid var(--border); margin-top: 36px; }
.footer a { color: var(--muted); }
