/* admin.css —— Wendy之家 管理后台设计系统
 * 2026-10-21 按 VI v2：主色绿 #79B41C、正文 #2C3327、大标题宋体；无构建步骤，纯 CSS。
 * （旧版主色 #D4B467 金褐已按 VI v2 换掉；间距/结构不动，只换 token 与标题字体。）
 * 布局：左侧固定侧栏 + 右侧内容区；<900px 折叠为顶部抽屉，适配移动端。
 */
:root {
  /* VI v2（brand/vi/v2）：主色绿 + 墨绿正文；金褐只保留为少量点缀 */
  --vi-green: #79b41c;
  --vi-green-dark: #5e8e12;
  --vi-green-deep: #4c7410;
  --vi-green-tint: #f2f8e6;
  --vi-green-tint-2: #e4f2cc;
  --vi-green-line: #cbe3a3;
  --vi-text: #2c3327;
  --vi-serif: "Songti SC", "STSong", "SimSun", serif;

  --brand: var(--vi-green);
  --brand-dark: var(--vi-green-dark);
  --brand-deep: var(--vi-green-deep);
  --brand-tint: var(--vi-green-tint);
  --brand-tint-2: var(--vi-green-tint-2);
  --brand-line: var(--vi-green-line);

  --text-1: var(--vi-text);
  --text-2: #4d5461;
  --text-3: #8a9099;
  --text-4: #a3a9b3;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #eceef2;

  --danger: #fa5151;
  --warning: #ff9f0a;
  --success: #4caf7d;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sp-1: 6px;
  --sp-2: 12px;
  --sp-3: 18px;
  --sp-4: 26px;

  --sidebar: 232px;
  --shadow: 0 2px 10px rgba(31,35,41,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text-1);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--brand-deep); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
/* VI v2：大标题用宋体，正文保持系统无衬线（字号层级不改结构） */
.topbar-title, .card-title, .modal-head, .empty-title, .page-title { font-family: var(--vi-serif); letter-spacing: .02em; }
/* B5：演示模式必须显式标注（file:// 演示时会出现在顶栏） */
.demo-badge {
  background: #fff7e6; color: #b06a00; border: 1px solid #ffe0a3;
  border-radius: 999px; padding: 2px 10px; font-size: 12px; white-space: nowrap;
}

/* ------------------------------- 布局 ------------------------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 20px 18px 14px; border-bottom: 1px solid var(--line); }
.sidebar-brand img { width: 148px; height: auto; display: block; }
.sidebar-brand .slogan { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1 1 auto; }
.nav-group { font-size: 12px; color: var(--text-4); padding: 12px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md); color: var(--text-2); font-size: 14px;
}
.nav a:hover { background: #f7f8fa; color: var(--text-1); }
.nav a.active { background: var(--brand-tint); color: var(--brand-deep); font-weight: 600; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-2); }
.content { padding: 22px; }

/* ------------------------------- 卡片 ------------------------------- */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.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)); }
.stat { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-label { font-size: 13px; color: var(--text-3); }
.stat-num { font-size: 30px; font-weight: 600; color: var(--brand-deep); line-height: 1.3; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-4); }

/* ------------------------------- 表格 ------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--text-3); font-weight: 500; background: #fafbfc; }
tbody tr:hover { background: #fcfcfd; }
td.wrap, th.wrap { white-space: normal; }
.table-empty { padding: 44px 0; text-align: center; color: var(--text-3); }

/* ------------------------------- 表单 / 按钮 ------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: var(--r-md);
  font: inherit; color: var(--text-1); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(212,180,103,.18); }
input[disabled], select[disabled] { background: #f6f7f9; color: var(--text-4); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  font: inherit; cursor: pointer; background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--brand-deep); border-color: var(--brand-line); }
.btn-ghost:hover { background: var(--brand-tint); }
.btn-plain { background: var(--brand-tint); color: var(--brand-deep); }
.btn-danger { background: #fff; color: var(--danger); border-color: #ffd9d9; }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn[disabled] { background: #eceef2; color: var(--text-4); cursor: not-allowed; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; }

/* ------------------------------- 徽标 / 提示 ------------------------------- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge-gold { background: var(--brand-tint-2); color: var(--brand-deep); }
.badge-gray { background: #f0f1f4; color: var(--text-2); }
.badge-warn { background: #fff7e6; color: #b06f00; }
.badge-danger { background: #fff0f0; color: var(--danger); }
.badge-success { background: #eef8f2; color: var(--success); }
.notice { padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 16px; }
.notice-gold { background: var(--brand-tint); border: 1px solid var(--brand-line); color: var(--brand-deep); }
.notice-warn { background: #fff7e6; border: 1px solid #ffe0b2; color: #8a5a00; }
.notice-danger { background: #fff0f0; border: 1px solid #ffd9d9; color: #b3261e; }
.muted { color: var(--text-3); font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* ------------------------------- 登录页 ------------------------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #dcc07a 0%, var(--brand) 55%, #c9a75f 100%); padding: 24px;
}
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 30px 28px; box-shadow: 0 18px 50px rgba(31,35,41,.18); }
.login-card img { width: 176px; height: auto; display: block; margin: 0 auto 6px; }
.login-quote { text-align: center; font-size: 13px; color: var(--text-3); margin-bottom: 22px; }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--text-4); text-align: center; }

/* ------------------------------- 弹层 / 抽屉 ------------------------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(31,35,41,.42);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal { background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(31,35,41,.9); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 80;
}
.toast.show { opacity: 1; }

/* ------------------------------- 移动端 ------------------------------- */
.menu-btn { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-block; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
}
