/* ============ 管理后台样式 ============ */
:root {
  --green-950: #142e18;
  --green-800: #1f4d26;
  --green-700: #286033;
  --green-600: #2e6b35;
  --green-500: #3f8a49;
  --green-100: #e4efe1;
  --amber: #e9a13b;
  --amber-dark: #c9851e;
  --paper: #fffdf8;
  --ink: #22281f;
  --muted: #6b7568;
  --line: #e3dccb;
  --red: #b03a2c;
  --radius: 16px;
  --shadow-md: 0 12px 30px rgba(31, 55, 26, .12);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: #f3eee3; line-height: 1.6; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; transition: all .2s ease; white-space: nowrap;
}
.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-800); }
.btn-ghost { background: #fff; color: var(--green-800); border-color: #cdc4ae; }
.btn-ghost:hover { background: var(--green-100); }
.btn-danger { background: #fff; color: var(--red); border-color: #e5c3bd; }
.btn-danger:hover { background: #fbeae6; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #3c4638; margin-bottom: 6px; }
.field label em { color: var(--red); font-style: normal; }
.field input, .field textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid #d8d0bc; border-radius: 10px;
  background: #fff; font-size: 14px; color: var(--ink); outline: none; resize: vertical;
  transition: border .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(63,138,73,.14); }
.field input[disabled] { background: #f0ece0; color: #888; }
.form-error {
  background: #fbeae6; border: 1px solid #eec4ba; color: var(--red);
  border-radius: 10px; padding: 9px 14px; font-size: 13px; margin: 0 0 12px;
}
.hint { font-size: 12px; color: #98a091; margin: 8px 0 0; }
.narrow-form { max-width: 460px; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(800px 400px at 15% 0%, #eaf2dd 0%, transparent 60%), linear-gradient(160deg, #f8f2e4, #e9dfc9);
}
.login-card {
  width: min(400px, 100%); background: #fff; border-radius: 22px;
  padding: 40px 36px 30px; box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand img { margin: 0 auto 14px; border-radius: 50%; box-shadow: 0 4px 14px rgba(31,55,26,.15); }
.login-brand h1 { font-size: 22px; color: var(--green-950); margin: 0 0 6px; letter-spacing: 1px; }
.login-brand p { margin: 0; font-size: 13px; color: var(--muted); }
.back-home {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 18px; font-size: 13px; color: var(--muted);
}
.back-home:hover { color: var(--green-700); }
.back-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 后台布局 ---------- */
.app-view { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #1b3a22, #142e18);
  color: #cfe0c9; display: flex; flex-direction: column; padding: 18px 14px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-brand img { border-radius: 50%; }
.side-brand strong { display: block; color: #fff; font-size: 17px; letter-spacing: 1px; }
.side-brand small { font-size: 11px; color: #9dc39b; }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 12px; border: 0; border-radius: 10px; background: transparent;
  color: #bfd6ba; font-size: 14px; font-weight: 600; text-align: left;
  transition: background .2s, color .2s;
}
.side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-link.active { background: rgba(233,161,59,.16); color: var(--amber); }
.side-link.plain { color: #a9c3a4; font-size: 13px; }
.side-link.plain:hover { color: #fff; }
.side-ico { display: grid; place-items: center; width: 20px; height: 20px; flex: none; }
.side-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-link.plain .side-ico svg { stroke-width: 2; }
.side-link .badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px;
  padding: 1px 8px; border-radius: 999px;
}
.side-foot { display: grid; gap: 4px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; }

.main { padding: 26px 30px 60px; min-width: 0; }
.main-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.main-top h2 { margin: 0; color: var(--green-950); font-size: 24px; }
.main-top p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel[hidden] { display: none; }

.seg { display: inline-flex; background: #efe9da; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.seg-btn { border: 0; background: transparent; padding: 7px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #5d6659; }
.seg-btn.active { background: #fff; color: var(--green-800); box-shadow: 0 2px 6px rgba(31,55,26,.1); }

/* ---------- 产品列表 ---------- */
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 0 10px; }
.product-admin-list { display: grid; gap: 10px; }
.prow {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px;
  background: #fffdf8; transition: box-shadow .2s;
}
.prow:hover { box-shadow: 0 4px 12px rgba(31,55,26,.08); }
.prow-thumb {
  width: 66px; height: 66px; flex: none; border-radius: 12px; overflow: hidden;
  background: #f1ead9; display: grid; place-items: center;
}
.prow-thumb img { width: 100%; height: 100%; object-fit: contain; }
.prow-main { flex: 1; min-width: 0; }
.prow-main h4 { margin: 0 0 3px; font-size: 15px; color: var(--green-950); }
.prow-main .prow-meta { font-size: 12px; color: var(--muted); }
.prow-main .prow-sub { font-size: 12px; color: #8a9386; }
.prow-price { font-weight: 800; color: var(--red); font-size: 14px; white-space: nowrap; }
.prow-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; color: #5d6659; transition: all .2s;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--green-700); border-color: var(--green-500); background: var(--green-100); }
.icon-btn.danger:hover { color: var(--red); border-color: #e5a99f; background: #fbeae6; }

/* ---------- 留言列表 ---------- */
.msg-list { display: grid; gap: 12px; }
.msg-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fffdf8; }
.msg-item.unread { border-left: 4px solid var(--amber); background: #fffaf0; }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-head strong { font-size: 15px; color: var(--green-950); }
.pill { font-size: 11px; padding: 2px 10px; border-radius: 999px; font-weight: 700; }
.pill.unread { background: #fbe8d0; color: var(--amber-dark); }
.pill.read { background: #e8efe3; color: var(--green-700); }
.msg-time { margin-left: auto; font-size: 12px; color: #9aa293; }
.msg-contact { font-size: 12.5px; color: var(--muted); margin: 4px 0 6px; }
.msg-content { font-size: 14px; color: #39423a; white-space: pre-line; background: #f7f3e8; border-radius: 10px; padding: 10px 12px; }
.msg-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- 弹窗（产品编辑） ---------- */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,30,14,.58); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative; width: min(780px, 100%); max-height: 92vh; overflow: auto;
  background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(15,30,14,.3);
  animation: pop .24s ease;
}
@keyframes pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 2; border-radius: 20px 20px 0 0;
}
.modal-head h3 { margin: 0; color: var(--green-950); font-size: 19px; }
.modal-x {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; color: #5d6659;
}
.modal-x:hover { color: var(--red); border-color: #e5a99f; }
.modal-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.modal-body-form { padding: 20px 24px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; justify-content: flex-end; }

.img-block { border: 1px dashed #cfc6b0; border-radius: 14px; padding: 14px; margin-bottom: 16px; background: #fcfaf3; }
.img-block-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.img-label { font-weight: 700; font-size: 14px; color: #3c4638; }
.radio { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #4c5749; cursor: pointer; }
.img-row { display: flex; gap: 16px; align-items: flex-start; }
.preview-wrap {
  width: 150px; height: 150px; flex: none; border-radius: 12px; overflow: hidden;
  background: #efe7d3; display: grid; place-items: center; position: relative;
}
.preview-wrap img { width: 100%; height: 100%; object-fit: contain; }
.preview-empty { font-size: 12px; color: #a49c87; }
.img-controls { flex: 1; min-width: 0; }
.img-controls input[type="file"] { display: block; margin-bottom: 10px; font-size: 13px; }
.img-controls input[type="url"] { width: 100%; padding: 9px 12px; border: 1.5px solid #d8d0bc; border-radius: 9px; font-size: 13px; }

/* ---------- 企业信息 ---------- */
.settings-form .field input, .settings-form .field textarea { max-width: 720px; }
.settings-form .btn { margin-top: 4px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: 10px; width: min(92vw, 440px); }
.toast {
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; color: #fff;
  box-shadow: 0 10px 24px rgba(15,30,14,.25); animation: tin .25s ease;
}
.toast.ok { background: var(--green-600); }
.toast.err { background: var(--red); }
@keyframes tin { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .app-view { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .side-brand { border: 0; padding: 0 8px 0 0; }
  .side-brand img { display: none; }
  .side-nav { flex-direction: row; margin: 0; flex: 1; }
  .side-link { width: auto; padding: 8px 10px; font-size: 13px; }
  .side-foot { border: 0; padding: 0; display: flex; }
  .main { padding: 18px 14px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .prow { flex-wrap: wrap; }
  .prow-price { margin-left: auto; }
}
@media (max-width: 560px) {
  .side-brand { display: none; }
  .side-link span.side-ico { display: none; }
  .img-row { flex-direction: column; }
}
