/* ==========================================================================
   翼卡 · 后台管理样式
   ========================================================================== */

:root { --sidebar-w: 236px; }

body.admin { background: var(--ink-100); }

/* ------------------------------ 布局 ------------------------------ */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #131c3a, #1a2550 60%, #1e2f6e);
  color: #cbd5e1;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform .26s var(--ease-out);
  overflow-y: auto;
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand .logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(59,102,245,.45);
}
.sidebar-brand .txt { color: #fff; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.sidebar-brand .txt small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--brand-300);
  letter-spacing: .1em;
  margin-top: -2px;
}

.sidebar-nav { padding: 14px 12px; flex: 1; }
.nav-group-label {
  padding: 14px 12px 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(203, 213, 225, .48);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .16s var(--ease);
  position: relative;
}
.sidebar-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-item.active {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(59, 102, 245, .35);
}
.sidebar-item .ico { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-item .count {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.16);
  font-size: 11px;
  font-weight: 700;
}
.sidebar-item.active .count { background: rgba(255,255,255,.26); }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(203,213,225,.55);
  flex-shrink: 0;
}
.sidebar-foot a { color: rgba(203,213,225,.75); }
.sidebar-foot a:hover { color: #fff; }

/* 主区域 */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  height: 62px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar .page-title { font-size: 17px; font-weight: 700; color: var(--ink-900); }
.admin-topbar .spacer { flex: 1; }

.admin-content { padding: 24px; flex: 1; }
.admin-content-narrow { max-width: 980px; }

/* 移动端：抽屉 */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  transition: all .24s;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }

@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .admin-sidebar.open { transform: none; }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 16px; }
  .admin-topbar { padding: 0 16px; }
}

/* ------------------------------ 页面头 ------------------------------ */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; letter-spacing: -.02em; }
.page-head .sub { font-size: 13.5px; color: var(--ink-500); margin-top: 4px; }

/* ------------------------------ 统计卡 ------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all .22s var(--ease-out);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-200); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  opacity: 0;
  transition: opacity .22s;
}
.stat-card:hover::after { opacity: 1; }
.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-label { font-size: 13px; color: var(--ink-500); font-weight: 500; }
.stat-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--brand-50);
}
.stat-icon.green  { background: var(--success-50); }
.stat-icon.orange { background: var(--warn-50); }
.stat-icon.red    { background: var(--danger-50); }
.stat-icon.purple { background: #f5f3ff; }
.stat-icon.cyan   { background: #ecfeff; }
.stat-value {
  font-size: 27px;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-value .unit { font-size: .55em; font-weight: 600; color: var(--ink-500); margin-left: 3px; }
.stat-foot { font-size: 12.5px; color: var(--ink-500); margin-top: 6px; }

/* ------------------------------ 图表 ------------------------------ */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 190px;
  padding: 16px 4px 0;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%;
  max-width: 46px;
  min-height: 4px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  transition: all .3s var(--ease-out);
  position: relative;
  cursor: pointer;
}
.chart-bar:hover { filter: brightness(1.14); }
.chart-bar .tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--ink-900);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all .18s;
  z-index: 5;
}
.chart-bar:hover .tip { opacity: 1; transform: translateX(-50%); }
.chart-label { font-size: 11.5px; color: var(--ink-500); white-space: nowrap; }

/* ------------------------------ 后台表格增强 ------------------------------ */
.admin-card {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
}
.admin-card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #fff, var(--ink-50));
}
.admin-card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 9px; }
.admin-card-body { padding: 20px; }
.admin-card-body.flush { padding: 0; }

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 150px; padding: 8px 12px; font-size: 13.5px; }
.filter-bar .select { padding-right: 34px; }

.row-num { font-size: 12px; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; color: var(--ink-900); }
.cell-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ------------------------------ 权限勾选 ------------------------------ */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .16s;
  font-size: 13.5px;
  background: #fff;
}
.perm-item:hover { border-color: var(--brand-300); background: var(--brand-50); }
.perm-item.checked { border-color: var(--brand-500); background: var(--brand-50); }
.perm-item input { width: 16px; height: 16px; accent-color: var(--brand-500); margin: 0; flex-shrink: 0; }
.perm-item .perm-name { font-weight: 500; color: var(--ink-800); }
.perm-item .perm-key { font-size: 11px; color: var(--ink-400); font-family: ui-monospace, monospace; }

.perm-group { margin-bottom: 22px; }
.perm-group-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-800);
  margin-bottom: 11px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ------------------------------ 详情列表 ------------------------------ */
.detail-list { display: grid; gap: 0; }
.detail-row {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-100);
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .k { width: 130px; flex-shrink: 0; color: var(--ink-500); }
.detail-row .v { flex: 1; color: var(--ink-900); font-weight: 500; word-break: break-all; }

/* ------------------------------ 登录页 ------------------------------ */
.admin-login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a, #1e2f6e 50%, #4c1d95);
  position: relative;
  overflow: hidden;
}
.admin-login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(59,102,245,.4), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(139,92,246,.38), transparent 42%);
}
.admin-login-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
}
.admin-login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 410px;
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-xl);
  padding: 42px 38px;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.5);
  animation: fadeUp .45s var(--ease-out) both;
}
.admin-login-logo {
  width: 62px; height: 62px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-600));
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 12px 32px rgba(59,102,245,.4);
}

/* 内联徽标 */
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.role-super    { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.role-operator { background: var(--brand-50); color: var(--brand-700); }
.role-finance  { background: var(--success-50); color: var(--success-700); }
.role-support  { background: #f5f3ff; color: #6d28d9; }
.role-default  { background: var(--ink-100); color: var(--ink-600); }

/* 库存条 */
.stock-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--ink-200);
  overflow: hidden;
  min-width: 70px;
}
.stock-bar .fill { height: 100%; border-radius: 3px; transition: width .3s var(--ease-out); }
.stock-bar .fill.ok { background: linear-gradient(90deg, var(--success-500), var(--success-600)); }
.stock-bar .fill.low { background: linear-gradient(90deg, var(--warn-500), var(--warn-600)); }
.stock-bar .fill.out { background: linear-gradient(90deg, var(--danger-500), var(--danger-600)); }

/* 模态框 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all .2s;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: scale(.96) translateY(10px);
  transition: transform .24s var(--ease-out);
}
.modal-backdrop.show .modal { transform: none; }
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.modal-head h3 { font-size: 17px; }
.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--ink-100);
  border-radius: 8px;
  cursor: pointer;
  font-size: 17px;
  color: var(--ink-600);
  display: grid;
  place-items: center;
  transition: all .16s;
}
.modal-close:hover { background: var(--danger-50); color: var(--danger-600); }
.modal-body { padding: 24px; }
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--ink-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--ink-50);
  position: sticky;
  bottom: 0;
}

/* Tab */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--ink-200);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .16s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--ink-900); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-500); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s; }

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 15px 16px; }
  .stat-value { font-size: 21px; }
  .stat-icon { width: 32px; height: 32px; font-size: 15px; }
  .detail-row { flex-direction: column; gap: 3px; }
  .detail-row .k { width: auto; }
  .page-head h1 { font-size: 19px; }
}

/* ==========================================================================
   浅色极简后台 · 统一层（v2）
   --------------------------------------------------------------------------
   解决的问题：
     1. 深色侧边栏与白内容区断层 → 侧边栏改浅色，与内容区同色系
     2. 全站无视觉层级（不知看哪、点哪）→ 建立字号/灰度/间距三级层次
     3. 表格拥挤、按钮泛滥 → 统一表格规范 + 主操作收敛
     4. 三套风格各行其是 → 全部引用同一组设计令牌
   本层为追加覆盖，不删除既有类，保证 42 个模板零破坏。
   ========================================================================== */

:root {
  /* ---- 后台专属令牌 ---- */
  --sidebar-w: 232px;
  --topbar-h: 56px;

  /* 中文界面用系统字体栈，字形更统一，避免衬线/无衬线混排 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans CJK SC", sans-serif;

  /* 字号阶：明确三级层次，禁止模板再手写字号 */
  --fs-xs: 12px;    /* 辅助信息、表格次要列 */
  --fs-sm: 13px;    /* 表格正文、表单说明 */
  --fs-base: 14px;  /* 正文、表单标签 */
  --fs-md: 15px;    /* 强调正文 */
  --fs-lg: 17px;    /* 区块标题 */
  --fs-xl: 20px;    /* 页面标题 */
  --fs-2xl: 26px;   /* 统计数字 */

  /* 行高：中文需要比英文更宽松 */
  --lh-tight: 1.3;
  --lh-base: 1.6;
  --lh-loose: 1.75;
}

body.admin {
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------ 侧边栏：改浅色 ------------------------------ */
.admin-sidebar {
  background: var(--surface);
  color: var(--ink-700);
  border-right: 1px solid var(--line);
  box-shadow: none;
}
.admin-sidebar::-webkit-scrollbar-thumb { background: var(--ink-300); }

.sidebar-brand {
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.sidebar-brand .logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  font-size: 15px;
  box-shadow: none;
}
.sidebar-brand .txt { color: var(--ink-900); font-size: 15.5px; font-weight: 700; }
.sidebar-brand .txt small {
  color: var(--ink-400);
  font-size: 10px;
  letter-spacing: .08em;
  font-weight: 500;
}

.sidebar-nav { padding: 10px 10px 14px; }
.nav-group-label {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: .06em;
}

/* 菜单项：hover 浅灰、选中品牌色浅底 + 左侧指示条 */
.sidebar-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  font-size: var(--fs-base);
  font-weight: 500;
  margin-bottom: 1px;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.sidebar-item:hover { background: var(--surface-hover); color: var(--ink-900); }
.sidebar-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-500);
}
.sidebar-item .ico { font-size: 15px; width: 18px; opacity: .85; }
.sidebar-item.active .ico { opacity: 1; }
.sidebar-item .count { background: var(--ink-100); color: var(--ink-600); }
.sidebar-item.active .count { background: var(--brand-100); color: var(--brand-700); }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-400);
}
.sidebar-foot a { color: var(--ink-500); }
.sidebar-foot a:hover { color: var(--brand-600); }

/* ------------------------------ 顶栏 ------------------------------ */
.admin-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar .page-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -.01em;
}

.admin-content { padding: 22px 24px 40px; }

/* ------------------------------ 页面层级规范 ------------------------------ */
/* 页面标题区：h1 + 说明 + 右侧操作，全站统一 */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink-900);
  line-height: var(--lh-tight);
  margin: 0;
}
.page-head .sub,
.page-head p {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  margin-top: 5px;
}
.page-head .actions,
.page-head .page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 工具栏：搜索/筛选统一外观 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.toolbar .field { display: flex; align-items: center; gap: 7px; }
.toolbar .field label {
  font-size: var(--fs-sm);
  color: var(--ink-500);
  white-space: nowrap;
}
.toolbar .spacer, .toolbar .grow { flex: 1; }

/* ------------------------------ 表格规范 ------------------------------ */
/* 目标：8-9 列不再拥挤 —— 收紧内边距、次要列弱化、数字右对齐 */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-wrap .table { margin: 0; }
.table-wrap .table:last-child { border-radius: 0; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table thead th {
  padding: 10px 14px;
  background: var(--surface-sunken);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-500);
  letter-spacing: .01em;
  text-transform: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-700);
  vertical-align: middle;
  line-height: var(--lh-base);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }

/* 次要列：字号更小、灰度更浅，主动弱化视觉权重 */
.table td.muted, .table th.muted { color: var(--ink-400); font-size: var(--fs-xs); }
/* 数字/金额/时间：等宽 + 右对齐，便于纵向比对 */
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.center, .table td.center { text-align: center; }
.table td.strong, .table th.strong { font-weight: 600; color: var(--ink-900); }
/* 主键/订单号列：等宽字体便于核对 */
.table td.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-xs); color: var(--ink-600); }
/* 操作列：不换行，右对齐贴边 */
.table th.col-actions, .table td.col-actions { text-align: right; white-space: nowrap; width: 1%; }

/* 截断长文本，避免撑破表格 */
.table td .ellipsis, .table td.truncate {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* 空状态：统一观感 */
.table .empty-row td {
  padding: 44px 16px;
  text-align: center;
  color: var(--ink-400);
  font-size: var(--fs-sm);
}
.table .empty-row .em-ico { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }

/* ------------------------------ 统计卡细化 ------------------------------ */
.stat-grid { gap: 14px; }
.stat-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.stat-card::after { display: none; }   /* 去掉装饰性光晕，保持极简 */
.stat-card:hover { transform: none; border-color: var(--line-strong); box-shadow: var(--shadow); }
.stat-label, .stat-card .label {
  font-size: var(--fs-xs);
  color: var(--ink-500);
  font-weight: 500;
}
.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

/* ------------------------------ 卡片与表单 ------------------------------ */
.card { border-color: var(--line); box-shadow: var(--shadow-sm); }
.card-header { background: var(--surface-sunken); border-bottom-color: var(--line); padding: 12px 18px; }
.card-header h3, .card-header .card-title { font-size: var(--fs-md); font-weight: 600; }
.card-body { padding: 18px; }

.form-label, label.label {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.form-hint, .hint {
  font-size: var(--fs-xs);
  color: var(--ink-400);
  margin-top: 5px;
  line-height: var(--lh-base);
}

/* ------------------------------ 详情页键值对 ------------------------------ */
.detail-row {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-sm);
}
.detail-row:last-child { border-bottom: 0; }
.detail-row .k {
  width: 132px;
  flex-shrink: 0;
  color: var(--ink-500);
}
.detail-row .v { color: var(--ink-900); font-weight: 500; word-break: break-all; }

/* ------------------------------ 表格行内操作收敛 ------------------------------ */
/* 目标：解决「不知道该点哪」—— 主操作显性，次要操作收进「⋯」菜单 */
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}
.row-more { position: relative; display: inline-flex; }
.row-more > button {
  font-size: 15px;
  line-height: 1;
  padding: 4px 7px;
  color: var(--ink-500);
}
.row-more > button:hover { color: var(--ink-900); }
/* 行内下拉：右对齐，避免超出表格边界 */
.dropdown-right {
  right: 0;
  left: auto;
  min-width: 150px;
}
.dropdown-right .dropdown-item {
  font-size: var(--fs-sm);
  padding: 8px 12px;
}

/* ------------------------------ 卡密导入 ------------------------------ */
/* 规则条：把「一行=一条卡密」的规则直接写在输入框上方，避免误用分隔符 */
.import-rules {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 11px 14px;
  margin-bottom: 18px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius);
  font-size: var(--fs-xs);
  color: var(--ink-600);
  line-height: 1.6;
}
.import-rules-title {
  font-weight: 700;
  color: var(--brand-700);
  letter-spacing: .04em;
}
.import-rule { display: inline-flex; align-items: center; gap: 5px; }
.import-rule + .import-rule::before {
  content: '·';
  color: var(--brand-300);
  margin-right: 4px;
}
.import-rule code {
  background: var(--surface);
  border: 1px solid var(--brand-200);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  color: var(--brand-700);
}

/* TXT 拖拽区 */
.file-drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.file-drop:hover,
.file-drop.is-over {
  border-color: var(--brand-500);
  background: var(--brand-50);
}
.file-drop.is-over { border-style: solid; }
.file-drop.is-loaded { border-color: var(--success-500); background: var(--success-50); }
.file-drop-inner {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
}
.file-drop-ico { font-size: 22px; line-height: 1; }
.file-drop-txt {
  font-size: var(--fs-sm);
  color: var(--ink-600);
  line-height: 1.6;
}
.file-drop-txt b { color: var(--brand-600); }
.file-drop-sub {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-400);
  margin-top: 2px;
}

/* 行数统计 */
.label-count {
  float: right;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--brand-600);
  background: var(--brand-50);
  border-radius: 20px;
  padding: 1px 9px;
}

/* 解析预览 */
.import-preview {
  margin: 16px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.import-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.import-preview .table th { background: var(--surface); }
.import-preview .table td { font-size: var(--fs-xs); }

/* ------------------------------ 系统设置页 ------------------------------ */
.settings-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.settings-nav-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: .06em;
  padding: 8px 10px 6px;
}
.settings-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  transition: background .14s var(--ease);
}
.settings-nav-item:hover { background: var(--surface-hover); }
.settings-nav-item.is-saved { background: var(--brand-50); }
.settings-nav-ico { font-size: 15px; line-height: 1.35; flex-shrink: 0; }
.settings-nav-txt { min-width: 0; }
.settings-nav-name {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-800);
  line-height: 1.4;
}
.settings-nav-desc {
  display: block;
  font-size: 11px;
  color: var(--ink-400);
  line-height: 1.45;
  margin-top: 1px;
}
.settings-nav-foot {
  border-top: 1px solid var(--line-soft);
  margin-top: 6px;
  padding-top: 6px;
}
.settings-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
/* 分区卡片底部操作条：与内容区用分隔线隔开，明确「这个按钮只管这块」 */
.card-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-sunken);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.textarea-lg { min-height: 220px; line-height: 1.75; }

@media (max-width: 1000px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .settings-nav-title { width: 100%; }
  .settings-nav-desc { display: none; }
  .settings-nav-foot { border-top: 0; margin-top: 0; padding-top: 0; width: 100%; }
  .form-grid-3 { grid-template-columns: 1fr; }
}

/* ------------------------------ 仪表盘营收概览 ------------------------------ */
.rev-band {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.rev-main {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 45%, #6366f1 100%);
  color: #fff;
  overflow: hidden;
}
.rev-main::after {
  content: '';
  position: absolute;
  right: -50px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  pointer-events: none;
}
.rev-main-label {
  font-size: 12.5px;
  opacity: .82;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.rev-main-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.rev-cur { font-size: 21px; font-weight: 600; opacity: .9; }
.rev-main-meta {
  margin-top: 12px;
  font-size: 13px;
  opacity: .88;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.rev-dot { opacity: .5; }
.rev-main-cmp {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}
.rev-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.rev-delta.up   { background: rgba(255, 255, 255, .2); color: #d1fae5; }
.rev-delta.down { background: rgba(255, 255, 255, .2); color: #fee2e2; }
.rev-cmp-txt { opacity: .82; }

.rev-side {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
}
.rev-mini {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.rev-mini-label { font-size: 12.5px; color: var(--ink-500); margin-bottom: 5px; }
.rev-mini-value {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-900);
}
.rev-mini-foot { font-size: 12px; color: var(--ink-400); margin-top: 3px; }

.rev-trend-card { margin-bottom: 20px; }
.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 130px;
  padding: 8px 4px 0;
}
.month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 6px;
  min-width: 0;
}
.month-col-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.month-col-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  transition: opacity .15s var(--ease);
}
.month-col:hover .month-col-bar { opacity: .72; }
.month-col-label {
  font-size: 11px;
  color: var(--ink-400);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .rev-band { grid-template-columns: 1fr; }
  .rev-side { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); }
  .rev-main-value { font-size: 30px; }
}
@media (max-width: 620px) {
  .rev-side { grid-template-columns: 1fr; }
  .month-chart { height: 110px; }
  .month-col-label { font-size: 10px; }
}

/* ------------------------------ 验证码 ------------------------------ */
/* 与 .dropdown 同样的问题：这些类原本只定义在 shop.css，
   而后台只加载 app.css + admin.css，导致后台登录页验证码错位。 */
.captcha-row { display: flex; gap: 12px; align-items: stretch; }
.captcha-row .input { flex: 1; min-width: 0; }
.captcha-img {
  height: 46px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ink-100);
  transition: border-color .16s var(--ease);
}
.captcha-img:hover { border-color: var(--brand-400); }

/* ------------------------------ 顶栏用户菜单 ------------------------------ */
/* 后台只加载 app.css + admin.css，而 .dropdown 原本只定义在 shop.css 里，
   导致后台下拉菜单完全没有定位/圆角/阴影（渲染成普通 div，把顶栏撑变形）。
   这里在后台补齐完整定义。 */
.user-menu { position: relative; }

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-700);
  font-family: inherit;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.user-trigger:hover { border-color: var(--brand-300); background: var(--brand-50); }
.user-trigger .avatar {
  width: 28px; height: 28px;
  font-size: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, .16), 0 2px 8px -2px rgba(15, 23, 42, .08);
  padding: 7px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
  z-index: 200;
}
.user-menu.open .dropdown,
.dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 8px;
}

/* 头像 + 昵称 + 用户名 + 角色，分层展示，避免挤成一行 */
.dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
}
.dropdown-head .avatar {
  width: 34px; height: 34px;
  font-size: 14px;
  border-radius: 10px;
  flex-shrink: 0;
}
.dropdown-head-txt { min-width: 0; }
.dropdown-head-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.35;
}
.dropdown-head-user {
  font-size: var(--fs-xs);
  color: var(--ink-400);
  line-height: 1.4;
}
.dropdown-head-role {
  padding: 0 12px 10px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--ink-700);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.dropdown-item:hover { background: var(--surface-hover); color: var(--ink-900); }
.dropdown-item.danger { color: var(--danger-600); }
.dropdown-item.danger:hover { background: var(--danger-50); }

/* ------------------------------ 我的资料页 ------------------------------ */
/* 顶部概览条：一眼确认「我是谁 / 什么角色 / 何时登录」 */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 52px; height: 52px;
  font-size: 21px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b, #dc2626);
  flex-shrink: 0;
}
.profile-hero-main { flex: 1; min-width: 0; }
.profile-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.profile-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--ink-500);
}
.profile-meta-item { color: var(--ink-500); }
.profile-hero-side {
  text-align: right;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  flex-shrink: 0;
}
.profile-hero-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-400);
  margin-bottom: 3px;
}
.profile-hero-value {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-800);
  font-variant-numeric: tabular-nums;
}

/* 两列布局：左（可编辑）右（只读信息），移动端自动堆叠 */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}
.profile-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* 卡片头部右侧的说明文字 */
.card-header-hint {
  font-size: var(--fs-xs);
  color: var(--ink-400);
  font-weight: 400;
}
.card-header-link {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-600);
}
.card-header-link:hover { color: var(--brand-500); }
.card-header:has(.card-header-hint),
.card-header:has(.card-header-link) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* 表单两列并排 */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

/* 密码区折叠：默认收起，避免与基本资料混在一起造成拥挤 */
.pw-toggle > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink-700);
  list-style: none;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.pw-toggle > summary::-webkit-details-marker { display: none; }
.pw-toggle > summary::before {
  content: '🔒';
  margin-right: 8px;
}
.pw-toggle > summary:hover { background: var(--surface-hover); border-color: var(--brand-300); }
.pw-toggle[open] > summary {
  border-style: solid;
  border-color: var(--brand-200);
  background: var(--brand-50);
  color: var(--brand-700);
}
.pw-toggle-hint {
  font-size: var(--fs-xs);
  color: var(--ink-400);
  font-weight: 400;
}
.pw-form { padding-top: 16px; }

/* 最近操作时间线 */
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-item {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.activity-item:last-child { border-bottom: 0; }
.activity-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-400);
  margin-top: 7px;
  flex-shrink: 0;
}
.activity-body { min-width: 0; flex: 1; }
.activity-action {
  font-size: var(--fs-xs);
  color: var(--ink-700);
  font-weight: 500;
  word-break: break-all;
}
.activity-detail {
  font-size: var(--fs-xs);
  color: var(--ink-500);
  margin-top: 2px;
  line-height: var(--lh-base);
}
.activity-time {
  font-size: 11px;
  color: var(--ink-400);
  margin-top: 3px;
}
.empty-empty {
  padding: 24px 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-400);
}

@media (max-width: 1000px) {
  .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .profile-hero-side {
    text-align: left;
    padding-left: 0;
    padding-top: 12px;
    border-left: 0;
    border-top: 1px solid var(--line);
    width: 100%;
  }
}

/* ------------------------------ 移动端 ------------------------------ */
@media (max-width: 1024px) {
  .admin-content { padding: 16px 14px 32px; }
  .admin-sidebar {
    box-shadow: 0 0 0 1px var(--line), var(--shadow-lg);
  }
}
@media (max-width: 640px) {
  .page-head h1 { font-size: var(--fs-lg); }
  .table thead th, .table tbody td { padding: 9px 10px; }
  .toolbar { padding: 10px 12px; }
}

