/**
 * 汉仓茶业S2B平台 — 后台管理全局样式
 * 版本: 3.0.0
 * 更新: 2026-06-21
 *
 * 统一设计规范：
 * - 配色方案（主色、辅助色、中性色）
 * - 字体大小层级
 * - 布局结构（侧边栏 + 主内容区）
 * - 组件样式（卡片、表格、按钮、表单、弹窗、标签）
 * - 响应式断点
 * - 间距和圆角规范
 */

/* =========================================
   1. CSS 变量（配色方案、间距、圆角）
   ========================================= */

:root {
  /* --- 主色调 --- */
  --primary: #1a5632;
  --primary-light: #2d8a5e;
  --primary-dark: #0d3518;
  --primary-bg: #f0f7f2;

  /* --- 辅助色 --- */
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --warning: #e65100;
  --warning-light: #fff3e0;
  --danger: #c62828;
  --danger-light: #ffebee;
  --info: #1565c0;
  --info-light: #e3f2fd;

  /* --- 中性色 --- */
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  --white: #ffffff;

  /* --- 阴影 --- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.20);

  /* --- 圆角 --- */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* --- 间距 --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* --- 布局尺寸 --- */
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 64px;
  --header-h: 60px;
  --content-max-w: 1400px;

  /* --- 字体大小 --- */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;

  /* --- 字体粗细 --- */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* --- 行高 --- */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* --- 过渡 --- */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* --- Z-index 层级 --- */
  --z-dropdown: 100;
  --z-sidebar: 200;
  --z-modal-overlay: 1000;
  --z-modal: 1001;
  --z-toast: 2000;
}

/* =========================================
   2. 全局重置与基础样式
   ========================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: var(--leading-normal);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

/* =========================================
   3. 布局结构（左侧菜单 + 右侧内容）
   ========================================= */

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

/* --- 侧边栏 --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  color: var(--white);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
}

/* --- 侧边栏品牌区 --- */
.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 70px;
}

.sidebar-brand .logo {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: var(--font-bold);
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  font-size: 15px;
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar.collapsed .sidebar-brand .brand-text {
  display: none;
}

/* --- 侧边栏底部用户信息 --- */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-footer .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-footer .sidebar-user-info {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-footer .sidebar-user-info .role {
  font-size: 11px;
  opacity: 0.6;
}

.sidebar.collapsed .sidebar-footer .sidebar-user-info {
  display: none;
}

.sidebar.collapsed .sidebar-footer {
  justify-content: center;
}

/* 侧边栏底部退出按钮 */
.sidebar-footer .logout-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}
.sidebar-footer .logout-btn:hover {
  background: rgba(231,76,60,0.3);
  border-color: rgba(231,76,60,0.5);
  color: #e74c3c;
}
.sidebar.collapsed .sidebar-footer .logout-btn {
  margin-left: 0;
}

/* --- 侧边栏用户信息（auth-check.js动态创建） --- */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user .user-name {
  font-size: 13px;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 11px;
  opacity: 0.6;
  color: var(--white);
}
.sidebar.collapsed .sidebar-user .user-info { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; }

/* --- 退出按钮 --- */
.logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.sidebar.collapsed .logout-btn { display: none; }

/* 侧边栏底部退出登录按钮（全宽文字版，主框架 index.html 常驻侧边栏） */
.sidebar-logout-btn {
  margin: 8px 16px 14px;
  width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 9px 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-logout-btn:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.5);
  color: #e74c3c;
}
.sidebar.collapsed .sidebar-logout-btn { display: none; }

/* --- 侧边栏导航 --- */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

.nav-group {
  margin-bottom: 8px;
}

.nav-group-title {
  padding: 8px 20px 4px;
  font-size: 11px;
  opacity: 0.5;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-group-title {
  text-align: center;
  padding: 8px 4px 4px;
  font-size: 0;
}

.sidebar.collapsed .nav-group-title::after {
  content: "···";
  font-size: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  gap: 10px;
  font-size: var(--text-base);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.nav-item.active {
  background: var(--primary);
  font-weight: var(--font-medium);
  color: var(--white);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.sidebar.collapsed .nav-item {
  padding: 10px;
  justify-content: center;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

/* --- 主内容区 --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: var(--space-lg);
  transition: margin-left var(--transition-normal);
  max-width: 100%;
  min-height: 100vh;
  background: var(--gray-100);
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed-w);
}

/* --- 顶部导航栏（可选） --- */
.top-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* =========================================
   4. 卡片组件
   ========================================= */

.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--gray-200);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
}

.card-body {
  /* 默认无特殊样式 */
}

.card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* 指标卡片（数据看板用） */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.card-green::before { background: var(--primary); }
.stat-card.card-blue::before  { background: #3498db; }
.stat-card.card-orange::before { background: var(--warning); }
.stat-card.card-red::before   { background: var(--danger); }
.stat-card.card-purple::before { background: #9b59b6; }

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-label {
  font-size: var(--text-sm);
  color: var(--gray-600);
}

.stat-card .stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--gray-900);
  line-height: var(--leading-tight);
}

.stat-card .stat-value.green  { color: var(--primary); }
.stat-card .stat-value.blue   { color: #3498db; }
.stat-card .stat-value.orange { color: var(--warning); }
.stat-card .stat-value.red    { color: var(--danger); }
.stat-card .stat-value.purple { color: #9b59b6; }

.stat-card .stat-change {
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }

.stat-card .stat-aux {
  font-size: var(--text-sm);
  color: var(--gray-600);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--gray-200);
}

/* 响应式：指标卡片 */
@media (max-width: 1200px) {
  .stat-cards-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .stat-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stat-cards-row {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   5. 表格组件
   ========================================= */

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-lg);
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  min-width: 800px;
}

.table-container th,
.table-container td {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--text-base);
  border-bottom: 1px solid var(--gray-200);
  overflow-wrap: break-word;
  word-break: break-word;
}

.table-container th {
  white-space: nowrap;
}

.table-container th {
  background: var(--gray-50);
  font-weight: var(--font-semibold);
  color: var(--gray-700);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-container tbody tr:hover {
  background: var(--primary-bg);
}

.table-container tbody tr:last-child td {
  border-bottom: none;
}

/* 操作列固定到右侧（等价 el-table fixed="right"） */
.table-container th.col-actions,
.table-container td.actions,
.table-container td.col-actions,
.table-container td.sticky-col {
  position: sticky;
  right: 0;
  background: var(--white);
  z-index: 2;
  min-width: 260px;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.04);
}

.table-container th.col-actions {
  z-index: 3;
}

.table-container tbody tr:hover td.actions,
.table-container tbody tr:hover td.col-actions,
.table-container tbody tr:hover td.sticky-col {
  background: var(--primary-bg);
}

/* 表格列宽工具类 */
.table-col-50   { width: 50px; }
.table-col-80   { width: 80px; }
.table-col-100  { width: 100px; }
.table-col-120  { width: 120px; }
.table-col-150  { width: 150px; }
.table-col-200  { width: 200px; }
.table-col-300  { width: 300px; }
.table-col-auto  { width: auto; }

/* =========================================
   6. 按钮组件
   ========================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.5;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}

.btn-warning {
  background: var(--warning);
  color: var(--white);
  border-color: var(--warning);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

.btn-sm {
  padding: 4px 10px;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* =========================================
   7. 表单组件
   ========================================= */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--gray-700);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-base);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color var(--transition-fast);
  line-height: 1.5;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* 表单行（横向排列） */
.form-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* 表单标签固定宽度（横向表单用） */
.form-label-fixed {
  width: 100px;
  flex-shrink: 0;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-bar .form-group {
  margin-bottom: 0;
  min-width: 160px;
}

.filter-bar .btn {
  height: 38px;
}

/* =========================================
   8. 弹窗组件
   ========================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active,
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal,
.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 18px;
  color: var(--gray-600);
}

.modal-close:hover {
  background: var(--gray-100);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid var(--gray-200);
}

/* 全屏弹窗：用 .modal.modal-fullscreen（双类）提高特异性，
   正确覆盖 admin-global.css 中 .modal{max-width:600px}，
   否则 products 等编辑弹窗会被压到 600px 宽、批次码 8 列表格溢出右侧 */
.modal.modal-fullscreen {
  width: 95%;
  max-width: 1200px;
  max-height: 92vh;
}

/* =========================================
   9. 标签 / 状态徽章
   ========================================= */

.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  font-weight: var(--font-medium);
}

.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-danger  { background: var(--danger-light);  color: var(--danger);  }
.tag-info    { background: var(--info-light);    color: var(--info);    }
.tag-default { background: var(--gray-100);    color: var(--gray-600); }

/* =========================================
   10. 工具类
   ========================================= */

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--gray-500); }
.text-primary  { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }

.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }

.flex        { display: flex; }
.flex-wrap   { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm      { gap: var(--space-sm); }
.gap-md      { gap: var(--space-md); }

/* 加载状态 */
.loading-mask {
  position: relative;
  min-height: 100px;
}

.loading-mask::after {
  content: "加载中...";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--gray-600);
  z-index: 10;
  border-radius: var(--radius-md);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state .empty-text {
  font-size: 14px;
}

/* Toast 提示 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  transform: translateX(100%);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: var(--z-toast);
  box-shadow: var(--shadow-md);
  transition: transform .3s;
}

.toast.show {
  transform: translateX(0);
}

.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-warning  { background: var(--warning); color: #fff; }
.toast-info     { background: var(--info);    color: #fff; }

/* =========================================
   11. 响应式断点
   ========================================= */

/* 平板横屏及以下（1024px）*/
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed-w);
  }
  .sidebar .sidebar-brand .brand-text,
  .sidebar .nav-item span,
  .sidebar .nav-group-title {
    display: none;
  }
  .main-content {
    margin-left: var(--sidebar-collapsed-w);
  }
}

/* 平板竖屏及以下（768px）*/
@media (max-width: 768px) {
  .main-content {
    padding: var(--space-md);
  }
  .stat-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-bar {
    flex-direction: column;
  }
  .filter-bar .form-group {
    min-width: 100%;
  }
}

/* 手机（480px）*/
@media (max-width: 480px) {
  .stat-cards-row {
    grid-template-columns: 1fr;
  }
  .card {
    padding: var(--space-md);
  }
}

/* =========================================
   12. 左侧菜单折叠（JS 依赖）
   ========================================= */

/* 默认：所有菜单项可见（.nav-item 基础 display:flex 已在前面定义）
 * JS 权限过滤、用户点击折叠时动态添加 .collapsed 类隐藏
 */
.nav-group.collapsed .nav-item {
  display: none;
}

/* 分组标题可点击提示 */
.nav-group-title {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
  transition: color var(--transition-fast);
}

.nav-group-title:hover {
  opacity: 0.85;
}

/* 展开/折叠指示器（纯 CSS 箭头） */
.nav-group-title::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.45);
  transition: transform var(--transition-fast);
}

.nav-group.expanded .nav-group-title::after {
  transform: translateY(-50%) rotate(180deg);
}

.nav-group.collapsed .nav-group-title::after {
  transform: translateY(-50%) rotate(0deg);
}

/* 侧边栏整体折叠时，隐藏指示器 */
.sidebar.collapsed .nav-group-title::after {
  display: none;
}



