:root {
  --red: #c8102e;
  --red-d: #a50d26;
  --blue: #1a6fe0;
  --blue-l: #e8f1ff;
  --ink: #1a1a1a;
  --gray: #666;
  --line: #ececec;
  --bg: #f5f6f8;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
body { background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: inherit; text-decoration: none; }

/* 顶栏 */
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.topbar .logo { width: 30px; height: 30px; border-radius: 7px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; margin-right: 10px; }
.topbar .name { font-weight: 700; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .role { font-size: 13px; color: var(--gray); background: var(--bg); padding: 5px 12px; border-radius: 16px; margin-right: 10px; }
.topbar .logout { font-size: 13px; color: var(--red); cursor: pointer; }

/* 布局 */
.layout { display: flex; min-height: calc(100vh - 56px); }
.side { width: 200px; background: #fff; border-right: 1px solid var(--line); padding: 14px 0; }
.side .nav { display: block; padding: 12px 22px; color: var(--gray); cursor: pointer; font-size: 14px; border-left: 3px solid transparent; }
.side .nav:hover { background: var(--bg); }
.side .nav.active { color: var(--red); border-left-color: var(--red); background: #fff5f6; font-weight: 600; }
.side .nav.disabled { opacity: .35; cursor: not-allowed; }
.main { flex: 1; padding: 22px; overflow: auto; }

/* 卡片/统计 */
.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.stat { background: #fff; border-radius: 12px; padding: 18px 22px; min-width: 180px; border: 1px solid var(--line); }
.stat .k { font-size: 13px; color: var(--gray); }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat .v.red { color: var(--red); }
.stat .v.blue { color: var(--blue); }

/* 标题 */
.h2 { font-size: 18px; font-weight: 700; margin-bottom: 14px; }

/* 按钮 */
.btn { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--red-d); }
.btn.ghost { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn.blue { background: var(--blue); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: #fafafa; color: var(--gray); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag.stock { background: #e7f6ec; color: #1c9c4d; }
.tag.sold { background: #fde8ec; color: var(--red); }

/* 过滤条 */
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.filters .grow { flex: 1; min-width: 180px; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.dialog { background: #fff; border-radius: 14px; width: 440px; max-width: 92vw; max-height: 88vh; overflow: auto; padding: 22px; }
.dialog h3 { font-size: 17px; margin-bottom: 16px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; color: var(--gray); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.row2 { display: flex; gap: 12px; }
.row2 .field { flex: 1; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.muted { color: var(--gray); }

/* 登录 */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #e8f1ff, #f5f9ff); }
.login-card { background: #fff; border-radius: 16px; padding: 34px; width: 360px; max-width: 90vw; text-align: center; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.login-card .logo { width: 56px; height: 56px; border-radius: 12px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 26px; margin: 0 auto 14px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--gray); font-size: 13px; margin-bottom: 22px; }
.role-list { display: flex; flex-direction: column; gap: 10px; }
.role-btn { padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: left; background: #fff; }
.role-btn:hover { border-color: var(--red); background: #fff5f6; }
.role-btn .t { font-weight: 700; font-size: 15px; }
.role-btn .d { font-size: 12px; color: var(--gray); margin-top: 3px; }
.empty { text-align: center; color: var(--gray); padding: 40px; }
