:root {
  --ink: #1c2b46;
  --ink-2: #2a3a5c;
  --gold: #b8893b;
  --gold-soft: #c9a45c;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e3e6ec;
  --text: #2a2f3a;
  --muted: #6b7280;
  --ok: #2f7d4f;
  --warn: #b8593b;
  --shadow: 0 1px 2px rgba(20,30,50,.04), 0 6px 20px rgba(20,30,50,.06);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 22px; height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; flex-shrink: 0; }
.brand .logo-mark { width: 38px; height: 38px; }
.brand .site-name {
  font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: .5px;
  white-space: nowrap;
}
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  padding: 8px 14px; border-radius: 8px; color: var(--ink-2); font-size: 15px; transition: background .15s;
}
.nav a:hover, .nav a.active { background: #f0f2f6; color: var(--ink); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); transition: all .15s;
  font-family: inherit;
}
.btn:hover { border-color: var(--gold-soft); color: var(--ink); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #15233b; color: #fff; }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-gold:hover { background: #a5782f; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.user-menu { position: relative; }
.user-menu .uname { padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.user-menu .uname:hover { background: #f0f2f6; }
.dropdown {
  position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); min-width: 160px; padding: 6px; display: none;
}
.dropdown.show { display: block; }
.dropdown a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--ink-2); }
.dropdown a:hover { background: #f0f2f6; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, #ffffff, #f3f5f8); border-bottom: 1px solid var(--line); }
.hero-inner { padding: 46px 0 40px; }
.hero h1 { font-size: 30px; color: var(--ink); margin: 0 0 12px; font-weight: 700; letter-spacing: .5px; }
.hero p { color: var(--muted); margin: 0 0 22px; max-width: 640px; }
.search-box {
  display: flex; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; max-width: 680px;
}
.search-box input { flex: 1; border: 0; padding: 15px 18px; font-size: 15px; outline: none; font-family: inherit; }
.search-box select { border: 0; border-left: 1px solid var(--line); padding: 0 14px; background: #fff; color: var(--ink-2); font-family: inherit; outline: none; }
.search-box button { border: 0; background: var(--ink); color: #fff; padding: 0 26px; font-size: 15px; cursor: pointer; font-family: inherit; }
.search-box button:hover { background: #15233b; }

/* ---------- Sections ---------- */
.section { padding: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.section-head h2 { font-size: 21px; color: var(--ink); margin: 0; font-weight: 700; }
.section-head .more { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.section-head .more:hover { color: var(--brand); }
.ico-arrow { width: 14px; height: 14px; flex: none; transition: transform .15s; }
.section-head .more:hover .ico-arrow { transform: translateX(2px); }
.ico-caret { width: 12px; height: 12px; flex: none; vertical-align: -1px; }

/* ---------- Category grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 12px; text-align: center; cursor: pointer; transition: all .15s;
}
.cat-card:hover { border-color: var(--gold-soft); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-card .ic { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--gold); }
.cat-card .nm { font-size: 15px; color: var(--ink); }

/* ---------- Cards grid ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all .15s; display: flex; flex-direction: column;
}
.card:hover { border-color: var(--gold-soft); box-shadow: var(--shadow); transform: translateY(-2px); }
.card .thumb { aspect-ratio: 4/3; background: #eceff3; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px 15px 16px; }
.card .cat-tag {
  display: inline-block; font-size: 12px; color: var(--gold); background: #fbf6ec;
  border: 1px solid #f0e4cc; padding: 1px 9px; border-radius: 20px; margin-bottom: 8px;
}
.card .title { font-size: 15px; color: var(--ink); font-weight: 600; margin: 0 0 8px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; }
.card .price { color: var(--warn); font-weight: 600; }

/* ---------- Detail ---------- */
.detail-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: start; }
.gallery .main-img { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #eceff3; aspect-ratio: 4/3; }
.gallery .main-img img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; }
.thumbs img { width: 78px; height: 62px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; opacity: .8; }
.thumbs img.active { border-color: var(--gold); opacity: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel h3 { margin: 0 0 14px; font-size: 17px; color: var(--ink); }
.info-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.info-row:last-child { border-bottom: 0; }
.info-row .k { color: var(--muted); }
.info-row .v { color: var(--ink); font-weight: 500; }
.detail-title { font-size: 24px; color: var(--ink); margin: 0 0 12px; font-weight: 700; }
.badge { display:inline-block; font-size:12px; padding:2px 10px; border-radius:20px; margin-left:8px; vertical-align:middle; }
.badge-pending { background:#fff4e6; color:#b8772a; border:1px solid #f3ddbb; }
.badge-rejected { background:#fdecea; color:#b8593b; border:1px solid #f3c9c0; }
.badge-approved { background:#e8f3ec; color:#2f7d4f; border:1px solid #c4e3d1; }
.desc-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 22px; }
.desc-box h3 { margin: 0 0 12px; color: var(--ink); }
.desc-box p { white-space: pre-wrap; color: #353b47; }

/* ---------- Forms ---------- */
.form-page { max-width: 460px; margin: 40px auto; }
.form-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.form-card h2 { margin: 0 0 6px; color: var(--ink); font-size: 22px; }
.form-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 7px; }
.field input[type=text], .field input[type=password], .field input[type=tel], .field input[type=email], .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  font-family: inherit; outline: none; transition: border .15s; background: #fff; color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold-soft); }
.field textarea { min-height: 120px; resize: vertical; }
.agree { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--muted); margin: 6px 0 18px; }
.agree input { margin-top: 4px; }
.agree a { color: var(--gold); }
.err { color: var(--warn); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---------- Publish form wide ---------- */
.publish-wrap { max-width: 820px; margin: 36px auto; }
.publish-wrap .form-card { max-width: none; }
.img-uploader { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-tile {
  width: 110px; height: 92px; border: 1px dashed var(--gold-soft); border-radius: 8px; display: flex;
  align-items: center; justify-content: center; color: var(--muted); cursor: pointer; font-size: 13px; text-align: center; background: #fcfaf6;
}
.upload-tile img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.upload-tile .x { position: absolute; }

/* ---------- Modal ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20,28,45,.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; max-width: 760px; width: 100%; max-height: 84vh; overflow: auto; padding: 30px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 16px; color: var(--ink); font-size: 20px; }
.modal .close { float: right; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
.legal { font-size: 14px; color: #353b47; line-height: 1.85; }
.legal h3 { font-size: 16px; color: var(--ink); margin: 20px 0 8px; }
.legal p { margin: 0 0 10px; }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 1100px; margin: 28px auto; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .n { font-size: 28px; color: var(--ink); font-weight: 700; }
.stat .l { color: var(--muted); font-size: 14px; margin-top: 4px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs .tab { padding: 10px 16px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs .tab.active { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }
table.data { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
table.data th { background: #f7f8fa; color: var(--ink-2); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
.mini-img { width: 64px; height: 48px; object-fit: cover; border-radius: 5px; }
.reject-box { margin-top: 8px; }
.reject-box textarea { width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-family: inherit; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #c9d2e0; margin-top: 50px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1fr; gap: 30px; padding: 42px 0 30px; }
.site-footer h4 { color: #fff; font-size: 15px; margin: 0 0 14px; font-weight: 600; }
.site-footer a { color: #c9d2e0; font-size: 14px; display: block; padding: 4px 0; }
.site-footer a:hover { color: #fff; }
.site-footer p { font-size: 13.5px; line-height: 1.9; margin: 4px 0; color: #aeb9cb; }
.footer-bottom { border-top: 1px solid #2c3a57; padding: 16px 0; font-size: 13px; color: #9aa6ba; text-align: center; }
.footer-bottom a { color: #c9d2e0; }

/* ---------- About / contact ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; align-items: start; }
.prose p { color: #353b47; margin: 0 0 14px; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: #353b47; }
.contact-list li .ic { width: 18px; height: 18px; color: var(--gold); flex-shrink: 0; margin-top: 3px; }

.empty { text-align: center; color: var(--muted); padding: 50px 0; }

@media (max-width: 980px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .detail-layout, .about-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
}
@media (max-width: 560px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .brand .site-name { font-size: 15px; }
}
