:root {
  --green: #00C375;
  --green-dark: #00A862;
  --green-soft: #E6F8F0;
  --bg: #F0F8F3;
  --card: #FFFFFF;
  --ink: #16241D;
  --ink-2: #3E5147;
  --muted: #66756D;
  --line: #E3EEE7;
  --danger: #E5484D;
  --danger-soft: #FDECEC;
  --gold: #B7791F;
  --gold-soft: #FDF6E7;
  --blue: #2563EB;
  --shadow: 0 8px 24px rgba(22, 36, 29, 0.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; }
a { color: var(--green-dark); }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: radial-gradient(1200px 600px at 20% -10%, #D8F7E9 0%, transparent 60%), var(--bg);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  width: 56px; height: 56px; margin: 0 auto 10px;
  border-radius: 16px; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(0, 195, 117, 0.28);
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 19px; box-shadow: none; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; letter-spacing: 1px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 24px 20px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-tip { color: var(--muted); font-size: 12px; margin: 0 0 18px; }
.login-foot { color: #9AA9A1; font-size: 11px; margin: 16px 0 0; text-align: center; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #FBFDFC; color: var(--ink); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 195, 117, .12); background: #fff; }
textarea { resize: vertical; min-height: 72px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 4px 0 16px; }
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--green); }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin: 10px 0 0; }
.form-row { display: flex; gap: 12px; }
.form-row > .field { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; color: var(--ink);
  transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--green); color: var(--green-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--green-soft); color: var(--green-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn-small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px 16px; font-size: 14px; }

/* ---------- 框架 ---------- */
.app { min-height: 100vh; display: flex; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.sidebar-name { font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.sidebar-sub { font-size: 11px; color: var(--muted); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 500;
}
.nav-item:hover { background: var(--green-soft); color: var(--green-dark); }
.nav-item.active { background: var(--green); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(0,195,117,.22); }
.nav-ico { width: 18px; text-align: center; font-size: 14px; opacity: .9; }
.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.env-tag { font-size: 11px; color: #9AA9A1; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; padding: 0 24px; background: rgba(255,255,255,.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar h2 { font-size: 17px; margin: 0; }
.page-sub { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.admin-badge { background: var(--green-soft); color: var(--green-dark); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; }
.content { padding: 22px 24px 40px; max-width: 1240px; width: 100%; margin: 0 auto; }
.only-mobile { display: none; }

/* ---------- 卡片/网格 ---------- */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.stat-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: .5px; line-height: 1.1; }
.stat-sub { font-size: 11px; color: #9AA9A1; }
.stat-value.green { color: var(--green-dark); }
.stat-value.gold { color: var(--gold); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 15px; font-weight: 700; margin: 0; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-body { padding: 16px 18px; }
.card-body.no-pad { padding: 0; }
.section { margin-bottom: 18px; }
.mt-16 { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.right { text-align: right; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1; }
.toolbar input[type="text"] { max-width: 260px; }
.toolbar select { max-width: 150px; }
.search-box { position: relative; }
.search-box input { padding-left: 30px; }
.search-box::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9AA9A1; font-size: 15px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 14px; background: #F7FBF8; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #EEF5F0; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FAFDFB; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 42px 16px; text-align: center; color: #9AA9A1; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---------- 徽标 ---------- */
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green-dark); }
.badge-gray { background: #EFF3F1; color: #66756D; }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-blue { background: #EAF1FE; color: var(--blue); }
.code-pill { font-family: ui-monospace, Menlo, Consolas, monospace; background: #F4F9F6; border: 1px dashed #CFE3D7; border-radius: 8px; padding: 2px 8px; font-size: 12px; letter-spacing: .5px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(16, 30, 23, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; z-index: 100; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--card); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.18); overflow: hidden; animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #FBFDFC; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- 提示 ---------- */
.toast-wrap { position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: 360px; }
.toast { background: #16241D; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 10px 26px rgba(0,0,0,.2); animation: slide .2s ease; }
.toast.success { background: var(--green-dark); }
.toast.error { background: var(--danger); }
.toast.info { background: #33463C; }
@keyframes slide { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 加载 ---------- */
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--muted); gap: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #F0F6F2 25%, #F8FCF9 37%, #F0F6F2 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 12px 16px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0 10px 10px; gap: 6px; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .sidebar-foot { display: none; }
  .only-mobile { display: inline-flex; }
  .content { padding: 14px 14px 32px; }
  .topbar { padding: 0 14px; height: 56px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
  .toolbar { padding: 12px 14px; }
  .toolbar input[type="text"] { max-width: none; flex: 1; }
  .login-card { padding: 22px 18px 16px; }
}
