/* ============ 后台管理样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f4f1; color: #1f2d27; font-size: 14.5px;
}
a { text-decoration: none; color: inherit; }

.layout { display: flex; min-height: 100vh; }

/* 侧栏 */
.sidebar {
  width: 220px; background: linear-gradient(180deg, #122615, #1b4222);
  color: #cfe0d2; flex-shrink: 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand img { width: 38px; height: 38px; background: #fff; border-radius: 9px; padding: 4px; object-fit: contain; }
.side-brand b { font-size: 15px; color: #fff; display: block; }
.side-brand span { font-size: 11px; opacity: .6; }
.side-nav { padding: 14px 10px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 3px;
  border-radius: 10px; font-size: 14.5px; opacity: .85; transition: all .2s;
}
.side-nav a:hover { background: rgba(255,255,255,.08); opacity: 1; }
.side-nav a.active { background: linear-gradient(135deg, #66bb6a, #2e7d32); color: #fff; opacity: 1; }
.side-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; opacity: .55; }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid #e2ece4; padding: 0 26px;
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; color: #1b5e20; font-weight: 700; }
.topbar-right { display: flex; gap: 12px; align-items: center; }
.topbar-right a, .topbar-right button {
  font-size: 13.5px; color: #5a6b62; background: none; border: 1px solid #e2ece4;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.topbar-right a:hover, .topbar-right button:hover { border-color: #66bb6a; color: #2e7d32; }
.content { padding: 26px; }

/* 卡片 & 表格 */
.card {
  background: #fff; border-radius: 14px; border: 1px solid #e2ece4;
  padding: 22px 24px; margin-bottom: 22px; box-shadow: 0 6px 18px rgba(27,94,32,.04);
}
.card h2 { font-size: 16px; color: #1b5e20; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 13px; color: #5a6b62; background: #f1f8f2;
  padding: 10px 12px; border-bottom: 1px solid #e2ece4; white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid #eef4f0; vertical-align: middle; font-size: 14px; }
tr:hover td { background: #f8fbf9; }
.thumb { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; background: #f0f4f1; }
.thumb-lg { width: 170px; height: 96px; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.badge.on { background: #e3f5e6; color: #2e7d32; }
.badge.off { background: #fbe9e7; color: #d84315; }
.badge.gray { background: #eceff1; color: #607d8b; }

/* 按钮 */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 9px; border: none; cursor: pointer;
  font-size: 13.5px; font-family: inherit; background: linear-gradient(135deg, #66bb6a, #2e7d32);
  color: #fff; transition: opacity .2s;
}
.btn:hover { opacity: .9; }
.btn.ghost { background: #fff; color: #2e7d32; border: 1px solid #66bb6a; }
.btn.danger { background: #fff; color: #d84315; border: 1px solid #f0b4ae; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 26px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: #5a6b62; margin-bottom: 6px; }
.field label i { color: #d84315; font-style: normal; }
.field input[type=text], .field input[type=password], .field input[type=number], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid #dfe8e1; border-radius: 9px;
  font-size: 14px; font-family: inherit; outline: none; transition: border .2s; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: #66bb6a; }
.field textarea { resize: vertical; min-height: 110px; }
.field .hint { font-size: 12px; color: #93a69b; margin-top: 4px; }

/* 图片选择器 */
.img-picker { display: flex; gap: 14px; align-items: center; }
.img-preview {
  width: 150px; height: 100px; border-radius: 10px; object-fit: contain;
  border: 1px dashed #c4d6c8; background: #f6faf7; padding: 6px;
}
.img-ops { display: flex; flex-direction: column; gap: 8px; }

/* 新闻编辑器 */
.editor-area {
  border: 1px solid #dfe8e1; border-radius: 9px; overflow: hidden; background: #fff;
}
.editor-toolbar { padding: 8px; border-bottom: 1px solid #e8f0ea; display: flex; gap: 6px; flex-wrap: wrap; background: #f8fbf9; }
.editor-toolbar button {
  border: 1px solid #d7e5da; background: #fff; border-radius: 7px; padding: 5px 12px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.editor-toolbar button:hover { background: #eef6f0; }
.editor-area textarea {
  display: block; width: 100%; min-height: 380px; border: none; outline: none;
  padding: 16px; font-size: 15px; line-height: 1.9; font-family: inherit; resize: vertical;
}

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 32, 24, .45); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 28px 30px; width: 640px; max-width: 96vw;
  max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.modal h3 { color: #1b5e20; margin-bottom: 18px; font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* toast */
#toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: #1b5e20; color: #fff; padding: 10px 26px; border-radius: 999px;
  font-size: 14px; z-index: 200; opacity: 0; transition: opacity .3s; pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.err { background: #d84315; }

/* dashboard */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border-radius: 14px; border: 1px solid #e2ece4; padding: 20px 22px;
  box-shadow: 0 6px 18px rgba(27,94,32,.04);
}
.stat-card b { font-size: 34px; color: #1b5e20; display: block; }
.stat-card span { font-size: 13px; color: #5a6b62; }
.stat-card .ico { float: right; font-size: 26px; opacity: .5; }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .side-brand b, .side-brand span, .side-nav a span, .side-foot { display: none; }
  .side-nav a { justify-content: center; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
