/* ============================================================
   新南丰便利店官网 - 管理后台样式
   ============================================================ */
:root {
  --brand: #0b7a3f;
  --brand-dark: #075e30;
  --brand-deep: #064a27;
  --brand-soft: #e7f5ec;
  --accent: #f59e0b;
  --ink: #1d2b23;
  --muted: #5f6f64;
  --bg: #f4f6f4;
  --line: #e3eae4;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(7, 94, 48, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.65; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

/* ---------- 登录页 ---------- */
.admin-login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
}
.login-box { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 40px 36px; box-shadow: 0 30px 70px rgba(0,0,0,.28); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand img { width: 46px; height: 46px; margin: 0 auto 12px; object-fit: cover; border-radius: 10px; background: #fff; }
.login-brand h1 { font-size: 20px; }
.login-brand p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.login-back { text-align: center; margin-top: 18px; font-size: 13.5px; }
.login-back a { color: var(--muted); }
.login-back a:hover { color: var(--brand); }
.btn-block { width: 100%; }

/* ---------- 布局 ---------- */
.admin-body { display: flex; min-height: 100vh; }
.admin-side {
  width: 220px; background: #052616; color: rgba(255,255,255,.9); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
.admin-brand { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; font-weight: 700; font-size: 15px; line-height: 1; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand img { width: 28px; height: 28px; max-width: 28px; max-height: 28px; flex: 0 0 28px; background: #fff; border-radius: 8px; object-fit: cover; }
.admin-nav { flex: 1; padding: 10px 10px 12px; overflow: auto; }
.admin-nav a, .nav-parent { display: flex; align-items: center; gap: 10px; height: 40px; margin: 2px 0; padding: 0 12px; border-radius: 8px; color: rgba(255,255,255,.78); font-size: 14px; line-height: 1; transition: background .18s, color .18s; }
.admin-nav a:hover, .nav-parent:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav > a.active, .nav-parent.active { background: #128a4e; color: #fff; font-weight: 600; }
.nav-ico, .nav-caret { width: 16px; height: 16px; min-width: 16px; max-width: 16px; max-height: 16px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; }
.admin-side svg { width: 16px !important; height: 16px !important; max-width: 16px !important; max-height: 16px !important; display: block; }
.nav-caret { margin-left: auto; opacity: .75; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub { margin: 0 0 6px; padding-left: 18px; }
.nav-sub a { height: 36px; padding: 0 12px; font-size: 13px; color: rgba(255,255,255,.62); }
.nav-sub a.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav-sub a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.admin-side-foot { padding: 10px 14px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px; margin-bottom: 2px; }
.side-avatar { width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.14); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 26px; }
.side-user > span:last-child { min-width: 0; }
.side-user strong { display: block; color: #fff; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user em { display: block; font-style: normal; font-size: 12px; line-height: 1.2; color: rgba(255,255,255,.45); }
.side-actions { display: flex; gap: 4px; }
.side-actions a { flex: 1; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; border-radius: 6px; color: rgba(255,255,255,.88); }
.side-actions a:hover { background: rgba(255,255,255,.08); color: #fff; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fff;
  height: 56px; padding: 0 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(7, 28, 18, .02);
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-topbar h1 { font-size: 16px; line-height: 1.3; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle {
  display: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 0; flex-shrink: 0;
}
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; }
.nav-mask { display: none; }
.admin-user { color: var(--muted); font-size: 13.5px; }
.admin-content { padding: 22px 28px 60px; }
.page-lead { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; font-size: 14px; font-weight: 600; border: 1.5px solid transparent; transition: all .18s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fdecec; color: #9b1c1c; border-color: transparent; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
a.btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost),
button.btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost) { background: #fff; border-color: var(--line); color: var(--ink); }

/* ---------- 提示 ---------- */
.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; transition: opacity .8s; }
.alert p { margin: 2px 0; }
.alert.fade { opacity: 0; }
.alert-ok { background: var(--brand-soft); border: 1px solid #a7d8bd; color: var(--brand-dark); }
.alert-err { background: #fdecec; border: 1px solid #f5b5b5; color: #9b1c1c; }

/* ---------- 统计卡片 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; color: inherit; }
a.stat-card { transition: transform .18s, box-shadow .18s; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(7, 94, 48, .12); }
.stat-card-num { font-size: 30px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.stat-card-num small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-card > span:nth-child(2) { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.stat-card-go { margin-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--brand); }

/* ---------- 面板 ---------- */
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; }
.panel-head a { font-size: 13.5px; color: var(--brand); font-weight: 600; }
.admin-panel .table { box-shadow: none; }
.feed-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: none; padding-top: 2px; }
.feed-item strong { display: block; font-size: 14.5px; }
.feed-item p { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th {
  text-align: left; background: #f6faf7; color: #3d5246; font-size: 12.5px;
  padding: 11px 14px; white-space: nowrap; font-weight: 600;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table tbody tr:hover { background: #fafcfb; }
.table tbody tr:last-child td { border-bottom: none; }
.table a { color: var(--brand); }
.table a:hover { text-decoration: underline; }
.cell-ellipsis { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-clip { display: block; max-width: 320px; max-height: 2.9em; overflow: hidden; white-space: normal; line-height: 1.45; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.col-actions { min-width: 188px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status-form { display: inline-flex; gap: 6px; align-items: center; }
.row-unread { background: #fffdf5; }
.row-unread:hover { background: #fffaf0 !important; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.badge-0 { background: #fff7e6; color: #b45309; }
.badge-1 { background: #e0f2fe; color: #0369a1; }
.badge-2 { background: var(--brand-soft); color: var(--brand-dark); }
.badge-done { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar-meta { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.toolbar-form { display: flex; gap: 8px; }
.toolbar-form input {
  font-family: inherit; font-size: 14px; padding: 9px 14px; border: 1.5px solid var(--line);
  border-radius: 9px; outline: none; min-width: 240px;
}
.toolbar-form input:focus { border-color: var(--brand); }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-tabs a { padding: 7px 18px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.filter-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 内联表单 ---------- */
.inline-form { display: inline-flex; gap: 6px; vertical-align: middle; align-items: center; }
.select-sm {
  font-family: inherit; font-size: 13px; padding: 5px 8px; border: 1.5px solid var(--line);
  border-radius: 7px; outline: none; background: #fff;
}

/* ---------- 列表卡片 ---------- */
.list-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-card .toolbar { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-card .table { box-shadow: none; border-radius: 0; min-width: 760px; }
.list-card .pagination { justify-content: flex-end; margin: 0; padding: 12px 16px 14px; }
.table-wrap { overflow-x: auto; }

/* ---------- 后台表单（不依赖前台 style.css） ---------- */
.admin-content .form { background: #fff; border-radius: 16px; padding: 8px 32px 24px; box-shadow: var(--shadow); max-width: 980px; }
.login-box .form { background: transparent; box-shadow: none; padding: 0; max-width: none; }
.form--compact { max-width: 760px; }
.form-section { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: none; }
.form-section-head h2 { font-size: 16px; line-height: 1.4; margin-bottom: 6px; }
.form-section-head p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-item { display: flex; flex-direction: column; margin-bottom: 16px; }
.form-grid .form-item { margin-bottom: 0; }
.form-item--full { grid-column: 1 / -1; }
.form-item label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.form-item label i { color: #dc2626; font-style: normal; }
.form-item input, .form-item select, .form-item textarea {
  font-family: inherit; font-size: 15px; padding: 11px 14px; border: 1.5px solid var(--line);
  border-radius: 10px; outline: none; background: #fff; color: var(--ink); width: 100%;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,122,63,.12);
}
.form-item textarea { resize: vertical; min-height: 90px; }
.media-grid { display: flex; flex-direction: column; gap: 8px; }
.media-card, .media-card--logo { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; }
.media-thumb { width: 56px; height: 56px; min-width: 56px; max-width: 56px; max-height: 56px; flex: 0 0 56px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #f4f6f4 center/cover no-repeat; cursor: zoom-in; display: block; overflow: hidden; }
.media-card--logo .media-thumb { background-size: contain; background-color: #fff; }
.media-body { min-width: 0; }
.media-card strong { display: block; font-size: 14px; line-height: 1.3; }
.media-card .form-hint { margin: 2px 0 8px; }
.media-card input[type="file"] { width: 100%; padding: 6px 8px; font-size: 12px; }
.media-card .check-line { margin-top: 6px; font-size: 13px; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.form-actions { margin: 0 -32px -24px; padding: 14px 32px; background: #fbfcfb; border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-actions-btns { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.admin-form--narrow .form-item:last-of-type { margin-bottom: 0; }
.thumb-preview { width: 72px; height: 48px; min-width: 72px; max-width: 72px; max-height: 48px; margin-top: 10px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f4f6f4 center/cover no-repeat; cursor: zoom-in; display: block; }
.admin-content > img, .admin-content .form img { max-width: 72px; max-height: 48px; }
.lightbox { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: rgba(6, 18, 12, .72); }
.lightbox[hidden] { display: none; }
.lightbox img { width: auto; height: auto; max-width: min(960px, 92vw); max-height: 84vh; object-fit: contain; border-radius: 10px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 999px; background: rgba(255,255,255,.92); color: var(--ink); font-size: 22px; line-height: 1; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-line input { width: auto; }

/* ---------- 空态 ---------- */
.empty-tip { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination .current {
  min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; color: var(--ink);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .admin-cols { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .admin-side { position: fixed; top: 0; left: 0; z-index: 40; transform: translateX(-105%); transition: transform .2s ease; }
  .admin-body.nav-open .admin-side { transform: none; }
  .admin-body.nav-open .nav-mask { display: block; position: fixed; inset: 0; background: rgba(6, 30, 18, .45); z-index: 35; }
  .admin-topbar, .admin-content { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 720px) {
  .stat-cards { grid-template-columns: 1fr; }
  .form-grid, .form-section, .media-grid { grid-template-columns: 1fr; }
  .form-section { gap: 14px; }
  .admin-content .form { padding: 8px 18px 18px; }
  .form-actions { margin-left: -18px; margin-right: -18px; margin-bottom: -18px; padding-left: 18px; padding-right: 18px; }
  .form-actions-btns { margin-left: 0; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-meta { margin-left: 0; }
  .toolbar-form { width: 100%; }
  .toolbar-form input { min-width: 0; flex: 1; width: 100%; }
  .feed-item { grid-template-columns: minmax(0, 1fr) auto; }
  .feed-item time { display: none; }
}
