* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: #303133; background: #f0f2f5; }

/* ===== 登录页 ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}
.login-bg::before, .login-bg::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.login-bg::before { width: 400px; height: 400px; top: -100px; left: -100px; }
.login-bg::after { width: 300px; height: 300px; bottom: -80px; right: -80px; }
.login-card {
  position: relative; z-index: 1; background: #fff; padding: 40px;
  border-radius: 16px; width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { font-size: 28px; font-weight: 700; color: #303133; text-align: center; margin-bottom: 8px; }
.login-logo span { background: linear-gradient(135deg, #667eea, #f093fb); -webkit-background-clip: text; color: transparent; }
.login-card h2 { text-align: center; font-size: 20px; color: #606266; margin-bottom: 8px; font-weight: 500; }
.login-tip { text-align: center; color: #909399; font-size: 12px; margin-bottom: 20px; }
.login-tip b { color: #f56c6c; }
.login-card .form-row { margin-bottom: 16px; }
.login-card .form-row label { display: block; font-size: 12px; color: #909399; margin-bottom: 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: #667eea; }
.login-btn { width: 100%; padding: 12px; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.login-btn:hover { opacity: .9; }
.login-foot { text-align: center; color: #c0c4cc; font-size: 12px; margin-top: 20px; }

/* ===== 主后台布局 ===== */
.admin-app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #304156; color: #bfcbd9; display: flex; flex-direction: column; }
.brand { padding: 18px 20px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #3a5169; }
.brand span { background: linear-gradient(135deg, #409EFF, #67C23A); -webkit-background-clip: text; color: transparent; margin-left: 4px; }
.brand-sub { padding: 8px 20px 16px; font-size: 11px; color: #8a9aae; border-bottom: 1px solid #3a5169; }
.nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: block; padding: 12px 20px; color: #bfcbd9; font-size: 14px;
  cursor: pointer; border-left: 3px solid transparent; transition: all .2s;
}
.nav-item:hover { background: #263445; color: #f4f4f5; }
.nav-item.active { background: #263445; color: #f4f4f5; border-left-color: #409EFF; }
.sidebar-foot { padding: 12px 0; border-top: 1px solid #3a5169; }
.sidebar-foot a { display: block; padding: 8px 20px; color: #8a9aae; font-size: 12px; }
.sidebar-foot a:hover { color: #fff; }

.main { flex: 1; overflow: auto; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: #fff; border-bottom: 1px solid #ebeef5;
  position: sticky; top: 0; z-index: 10;
}
.crumbs { font-size: 16px; color: #303133; font-weight: 500; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px;
  background: #f5f7fa; border-radius: 16px; font-size: 13px;
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.page { display: none; padding: 20px 24px; }
.page.active { display: block; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 20px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; right: -20px; top: -20px;
  width: 100px; height: 100px; border-radius: 50%; opacity: .08;
}
.stat-card.c1::before { background: #409EFF; }
.stat-card.c2::before { background: #67C23A; }
.stat-card.c3::before { background: #E6A23C; }
.stat-card.c4::before { background: #F56C6C; }
.stat-label { color: #909399; font-size: 13px; }
.stat-value { color: #303133; font-size: 30px; font-weight: 700; margin: 8px 0 4px; }
.stat-extra { color: #67C23A; font-size: 12px; }

/* 通用面板 */
.panel { background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.panel-head { font-size: 15px; font-weight: 600; color: #303133; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #ebeef5; }
.muted { color: #909399; font-size: 12px; font-weight: 400; margin-left: 4px; }

/* 折线柱状图 */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 0 8px; }
.chart .bar {
  flex: 1; background: linear-gradient(180deg, #409EFF, #79bbff); border-radius: 6px 6px 0 0;
  position: relative; min-height: 4px; transition: opacity .2s;
}
.chart .bar:hover { opacity: .8; }
.chart .bar::after {
  content: attr(data-val); position: absolute; top: -22px; left: 50%;
  transform: translateX(-50%); font-size: 11px; color: #606266;
}
.chart .bar .label {
  position: absolute; bottom: -22px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: #909399;
}

/* 饼图（用 CSS conic 模拟） */
.pie-row { display: flex; gap: 24px; align-items: center; }
.pie {
  width: 180px; height: 180px; border-radius: 50%;
  background: conic-gradient(#409EFF 0 32%, #67C23A 32% 56%, #E6A23C 56% 72%, #F56C6C 72% 88%, #909399 88% 100%);
}
.pie-legend { display: flex; flex-direction: column; gap: 8px; }
.pie-legend .li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pie-legend .dot { width: 12px; height: 12px; border-radius: 3px; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 13px;
  background: #fff;
}
.toolbar input { min-width: 220px; }

/* 表格 */
.table-wrap { background: #fff; border-radius: 10px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 12px 16px; text-align: left; font-size: 13px;
  border-bottom: 1px solid #ebeef5;
}
.data-table th { background: #fafafa; color: #909399; font-weight: 500; }
.data-table tbody tr:hover { background: #f5f7fa; }
.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-cell .ico {
  width: 36px; height: 36px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.prod-cell .nm { color: #303133; line-height: 1.4; }
.prod-cell .id { color: #909399; font-size: 11px; }

.status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.status.s-pending { background: #fdf6ec; color: #E6A23C; }
.status.s-paid { background: #ecf5ff; color: #409EFF; }
.status.s-shipped { background: #f0f9eb; color: #67C23A; }
.status.s-done { background: #f0f9eb; color: #67C23A; }
.status.s-cancel { background: #fef0f0; color: #F56C6C; }
.status.s-active { background: #f0f9eb; color: #67C23A; }
.status.s-banned { background: #fef0f0; color: #F56C6C; }

.row-actions { display: flex; gap: 8px; }
.row-actions a { color: #409EFF; font-size: 12px; cursor: pointer; }
.row-actions a:hover { text-decoration: underline; }
.row-actions a.danger { color: #F56C6C; }

/* 进度条 */
.bar-mini { width: 100px; height: 6px; background: #ebeef5; border-radius: 3px; overflow: hidden; }
.bar-mini .fi { height: 100%; background: linear-gradient(90deg, #ff5e3a, #ff2a68); border-radius: 3px; }

/* 按钮 */
.btn { padding: 8px 16px; border: 1px solid #dcdfe6; background: #fff; color: #606266; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn:hover { color: #409EFF; border-color: #b3d8ff; }
.btn.primary { background: #409EFF; border-color: #409EFF; color: #fff; }
.btn.primary:hover { background: #66b1ff; color: #fff; }
.btn.danger { background: #F56C6C; border-color: #F56C6C; color: #fff; }
.btn.danger:hover { background: #f78989; color: #fff; }

.pager { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.pager a, .pager span {
  padding: 6px 12px; border: 1px solid #dcdfe6; border-radius: 4px;
  color: #606266; font-size: 12px; cursor: pointer; background: #fff;
}
.pager a.active { background: #409EFF; color: #fff; border-color: #409EFF; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 12px; color: #606266; }
.form-row input, .form-row select, .form-row textarea {
  padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 13px;
  font-family: inherit; resize: vertical;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: #409EFF; }
.form-actions { margin-top: 16px; text-align: right; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: #fff; border-radius: 10px; width: 640px; max-width: 95vw;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid #ebeef5; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.modal-head a { cursor: pointer; color: #909399; font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-foot { padding: 16px 20px; border-top: 1px solid #ebeef5; display: flex; justify-content: flex-end; gap: 10px; }

/* 响应式 */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .pie-row { flex-direction: column; }
}
@media (max-width: 720px) {
  .sidebar { width: 64px; }
  .brand span, .brand-sub, .nav-item span, .sidebar-foot a { display: none; }
  .nav-item { padding: 14px 0; text-align: center; }
  .stat-grid { grid-template-columns: 1fr; }
}
