/* ============================================================
   代理返佣管理系统 · 管理后台 布局样式（美化版）
   ============================================================ */

:root {
  --brand: #5b5cf0;
  --brand-dark: #34309f;
  --ink: #17203b;
  --muted: #73809a;
  --line: #e8ebf5;
  --surface: #ffffff;
  --canvas: #f4f5fb;
  --violet-soft: #f0efff;
  --shadow: 0 18px 45px rgba(36, 43, 88, .08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  font-family: "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 12px;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 82% 14%, rgba(99, 143, 255, 0.48), transparent 28%), linear-gradient(135deg, #101a37 0%, #1f3d94 58%, #315efb 100%);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  top: -160px; right: -120px;
}
.login-wrap::after {
  content: '';
  position: absolute;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  bottom: -120px; left: -100px;
}
.login-card {
  position: relative;
  z-index: 2;
  width: 400px;
  background: #fff;
  border-radius: 24px;
  padding: 48px 44px 36px;
  box-shadow: 0 26px 70px rgba(7, 18, 56, 0.32);
}
.login-logo {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  width: 72px; height: 72px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #315efb, #7392ff);
  color: #fff;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(49, 94, 251, 0.34);
}
.login-card h2 { text-align: center; font-size: 23px; letter-spacing: .4px; color: var(--ink); margin: 20px 0 6px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.login-tip { text-align: center; color: #aab3c3; font-size: 12px; margin-top: 20px; }

/* ---------- 主布局 ---------- */
.layout { display: flex; height: 100vh; background: radial-gradient(circle at 78% -10%, #e4e5ff 0, rgba(228,229,255,0) 32%), var(--canvas); }
.sidebar {
  width: 210px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #131a35 0%, #18264a 53%, #232060 100%);
  display: flex;
  flex-direction: column;
}
.sidebar::before { content: ''; position: absolute; width: 220px; height: 220px; top: -105px; right: -100px; border-radius: 50%; background: rgba(140, 131, 255, .25); filter: blur(2px); pointer-events: none; }
.sidebar::after { content: ''; position: absolute; width: 150px; height: 150px; bottom: 5%; left: -95px; border-radius: 50%; background: rgba(78, 180, 255, .12); pointer-events: none; }
.logo {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  color: #fff;
  font-size: 14px;
  letter-spacing: .3px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  position: relative;
  z-index: 1;
  white-space: nowrap;
}
.logo-icon {
  font-size: 22px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #8077ff, #52b7ff);
  border-radius: 9px;
  font-size: 15px;
  font-weight: 800;
}
.menu { border-right: none; flex: 1; overflow-y: auto; padding: 14px 10px; position: relative; z-index: 1; }
.menu .el-menu-item {
  height: 38px;
  border-radius: 10px;
  margin: 3px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.menu .el-menu-item .el-icon { font-size: 16px; }
.menu .el-menu-item.is-active {
  background: linear-gradient(100deg, #665df2, #548ff5) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(69, 89, 234, 0.3);
}
.menu .el-menu-item:hover { background: rgba(255, 255, 255, 0.08) !important; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(22, 30, 64, .035);
  z-index: 5;
}
.page-title { font-size: 16px; font-weight: 750; letter-spacing: .15px; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.username { color: #4c5870; font-weight: 600; background: #f3f4fb; padding: 6px 10px; border-radius: 8px; }

.content { flex: 1; overflow: auto; padding: 14px 18px 22px; }

/* ---------- 卡片与统计 ---------- */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card-header {
  font-size: 14px;
  font-weight: 750;
  color: var(--ink);
  margin-bottom: 11px;
  padding-left: 0;
  border-left: none;
}
.user-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.user-card-header p { margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 400; }
.users-card .toolbar { margin-top: 18px; }
.card.narrow { max-width: 680px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}
.stat-card {
  background: linear-gradient(140deg, #fff 0%, #f9f9ff 100%);
  border-radius: 12px;
  padding: 13px;
  box-shadow: 0 12px 28px rgba(35, 41, 88, 0.06);
  border: 1px solid #e9e9fb;
  border-top: 3px solid var(--brand);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 21, 41, 0.1); }
.stat-card:nth-child(2) { border-top-color: #14b8a6; }
.stat-card:nth-child(3) { border-top-color: #f59e0b; }
.stat-card:nth-child(4) { border-top-color: #22c55e; }
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 21px; font-weight: 750; color: var(--ink); line-height: 1.2; letter-spacing: -.4px; }
.stat-value.warn { color: #e6a23c; }
.stat-value.ok { color: #67c23a; }

/* ---------- 工具条 / 分页 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 9px;
  padding: 6px;
  border-radius: 8px;
  background: #fafbff;
  border: 1px solid #f0f1f8;
}
.toolbar .spacer { flex: 1; }
.toolbar .el-upload { display: inline-flex; align-items: center; margin: 0; line-height: 1; }
.toolbar .el-upload .el-button { margin: 0; }
.toolbar > a { display: inline-flex; align-items: center; height: 32px; line-height: 32px; white-space: nowrap; }
.pager { margin-top: 12px; display: flex; justify-content: flex-end; }

.form-tip { color: #8b95aa; font-size: 12px; line-height: 1.65; margin-top: 5px; }

/* ---------- 表格美化 ---------- */
.el-table { border-radius: 9px; overflow: hidden; border: 1px solid var(--line); --el-table-row-hover-bg-color: #f7f7ff; font-size: 11.5px; }
.el-table th.el-table__cell {
  background: #f5f5fe !important;
  color: #55617a;
  font-weight: 700;
  height: 34px;
}
.el-table .el-table__cell { padding: 6px 0; }
.el-button { gap: 4px; font-weight: 500; min-height: 26px; padding: 5px 8px; font-size: 12px; border-radius: 6px; }
.el-button--small { min-height: 22px; padding: 3px 6px; font-size: 11px; }
.el-button.is-link { min-height: auto; padding: 2px 4px; }
.el-button--primary { --el-button-bg-color: var(--brand); --el-button-border-color: var(--brand); --el-button-hover-bg-color: #7471f8; --el-button-hover-border-color: #7471f8; --el-button-active-bg-color: #4844d5; }
.el-button--success { --el-button-bg-color: #21aa85; --el-button-border-color: #21aa85; --el-button-hover-bg-color: #36bd99; --el-button-hover-border-color: #36bd99; }
.el-input__wrapper, .el-textarea__inner, .el-select__wrapper { min-height: 28px; border-radius: 7px; box-shadow: 0 0 0 1px #e5e8f1 inset !important; font-size: 12px; }
.el-input__wrapper.is-focus, .el-select__wrapper.is-focused { box-shadow: 0 0 0 1px var(--brand) inset !important; }
.el-overlay-dialog { display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.el-dialog { margin: 0 !important; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 72px rgba(25, 28, 67, .2); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.el-dialog__header { margin: 0; padding: 12px 16px 10px; border-bottom: 1px solid #eef0f7; background: linear-gradient(90deg, #fcfcff, #f4f3ff); flex: 0 0 auto; }
.el-dialog__title { color: var(--ink); font-weight: 750; }
.el-dialog__body { padding: 11px 16px; overflow: auto; min-height: 0; flex: 1 1 auto; }
.el-dialog__footer { padding: 9px 16px 11px; border-top: 1px solid #f0f1f6; flex: 0 0 auto; }
.el-dialog .el-form-item { margin-bottom: 10px; }
.el-dialog .el-form-item__label { font-size: 12px; }
.el-radio-button__inner { padding: 7px 11px; font-size: 12px; }

/* ---------- 团购池选择与快捷创建 ---------- */
.pool-binding { display: grid; gap: 10px; }
.pool-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pool-mode { height: 34px; border: 1px solid #e1e4f1; background: #fafbff; color: #69748a; border-radius: 8px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: .18s ease; }
.pool-mode:hover:not(:disabled) { border-color: #a8a5ff; color: var(--brand); background: #f4f3ff; }
.pool-mode.active { background: var(--violet-soft); color: #4e48d6; border-color: #9894ff; box-shadow: 0 4px 12px rgba(91, 92, 240, .11); }
.pool-mode:disabled { opacity: .48; cursor: not-allowed; }
.pool-create-panel { display: grid; gap: 9px; padding: 11px; border: 1px solid #dfddff; border-radius: 10px; background: linear-gradient(135deg, #faf9ff, #f4f8ff); }
.pool-create-title { font-weight: 700; color: #403ab3; font-size: 13px; }
.pool-rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pool-rule-grid label { display: block; margin: 0 0 6px 2px; font-size: 12px; color: #747f96; }
.table-muted { color: #a3acbd; }
.customer-action-cell { display: grid; gap: 5px; padding-right: 4px; }
.customer-action-name { color: #273451; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-action-buttons { display: flex; gap: 4px; flex-wrap: wrap; }
.table-action { appearance: none; border: 1px solid #dce1ed; background: #fff; color: #56637a; padding: 2px 5px; border-radius: 4px; line-height: 16px; font: inherit; font-size: 11px; cursor: pointer; }
.table-action.primary { color: #4e48d6; border-color: #c9c6ff; background: #f5f4ff; }
.table-action.warning { color: #b87916; border-color: #f2d59e; background: #fffbf2; }
.table-action.danger { color: #cf4e59; border-color: #f3c9ce; background: #fff7f7; }
.table-action:hover { filter: brightness(.97); }
.order-table .el-table__fixed { box-shadow: 8px 0 12px rgba(35, 44, 82, .05); }

@media (max-width: 900px) {
  .sidebar { width: 72px; }
  .logo { padding: 0; justify-content: center; }
  .logo > span:last-child, .menu .el-menu-item span { display: none; }
  .menu { padding: 18px 10px; }
  .menu .el-menu-item { justify-content: center; }
  .content { padding: 20px; }
}

@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 0 18px; }
  .username { display: none; }
  .card { padding: 18px; border-radius: 16px; }
  .toolbar { padding: 10px; }
  .pool-rule-grid { grid-template-columns: 1fr; }
}

/* ---------- 导入结果 ---------- */
.import-result {
  background: #f5f7fa;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 4px;
  font-size: 13px;
  color: #303133;
}
.import-result ul { margin: 8px 0 0 18px; color: #f56c6c; }
