:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: rgba(59, 130, 246, 0.12);
  --sidebar-active-border: #3b82f6;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-main: #f1f5f9;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --success: #059669;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 4px 16px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 10px 24px -4px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg-main); color: var(--text-main); font-size: 16px; -webkit-font-smoothing: antialiased; }

.layout { display: flex; min-height: 100vh; }

/* ========== 侧边栏 ========== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .3s ease;
}
.sidebar.collapsed {
  width: 72px;
}
.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: padding .3s ease;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-brand {
  padding: 0 16px;
  justify-content: center;
}
.sidebar-brand .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
  flex-shrink: 0;
}
.sidebar-brand span {
  font-size: 17px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 1px;
  transition: opacity .3s ease;
  opacity: 1;
}
.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  margin-left: auto;
  margin-right: -8px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-close svg {
  width: 22px;
  height: 22px;
}
.sidebar-close:hover, .sidebar-close:active {
  color: #f1f5f9;
}
.sidebar.collapsed .sidebar-close {
  display: none !important;
}
.sidebar.collapsed .sidebar-brand span {
  opacity: 0;
  width: 0;
  display: none;
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sidebar.collapsed .sidebar-nav {
  padding: 16px 10px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 15px;
  transition: all .2s;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  min-height: 44px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-nav a {
  padding: 11px 0;
  justify-content: center;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #60a5fa;
  font-weight: 500;
}
.sidebar-nav a span {
  transition: opacity .2s ease;
  opacity: 1;
}
.sidebar.collapsed .sidebar-nav a span {
  opacity: 0;
  width: 0;
  display: none;
}

/* ========== 菜单树（根目录 + 子菜单） ========== */
.menu-group { margin-bottom: 2px; }
.menu-root {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  color: #94a3b8;
  font-size: 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  min-height: 44px;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  position: relative;
}
.menu-root:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.menu-root svg { flex-shrink: 0; }
.menu-root .menu-arrow {
  margin-left: auto;
  transition: transform .2s ease;
  opacity: 0.5;
}
.menu-group.open .menu-root { color: #60a5fa; font-weight: 500; }
.menu-group.open .menu-root .menu-arrow { transform: rotate(90deg); }
.menu-children {
  padding-left: 16px;
  display: none;
}
.menu-children a {
  padding: 8px 12px 8px 16px;
  font-size: 15px;
  min-height: 36px;
  gap: 8px;
}
.menu-children a::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #475569;
  flex-shrink: 0;
}
.menu-children a:hover::before { background: #60a5fa; }
.menu-children a.active::before { background: #60a5fa; }
.sidebar.collapsed .menu-group .menu-children { display: none !important; }
.sidebar.collapsed .menu-root .menu-arrow { display: none; }
.sidebar.collapsed .menu-root { justify-content: center; padding: 11px 0; }
.sidebar.collapsed .menu-root span { display: none; }

.sidebar-footer {
  padding: 12px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 15px;
  color: #475569;
  transition: opacity .3s ease;
}
.sidebar.collapsed .sidebar-footer {
  opacity: 0;
  pointer-events: none;
}

/* 侧边栏折叠按钮 */
.sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 80px;
  width: 24px;
  height: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  box-shadow: var(--shadow-sm);
  transition: all .2s;
  color: var(--text-muted);
}
.sidebar-toggle:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-light);
}
.sidebar.collapsed .sidebar-toggle {
  right: -12px;
}
.sidebar-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform .3s ease;
}
.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .sidebar { width: 280px; transform: translateX(-100%); transition: transform .3s ease; box-shadow: 4px 0 24px rgba(0,0,0,.15); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 280px; }
  .sidebar-toggle { display: none; }
  .sidebar-close { display: flex; }
  .sidebar-brand { padding-right: 12px; }
  .sidebar.collapsed .sidebar-brand { padding: 0 24px; justify-content: flex-start; }
  .sidebar.collapsed .sidebar-brand span { opacity: 1; width: auto; display: inline; }
  .sidebar.collapsed .sidebar-nav { padding: 16px 12px; }
  .sidebar.collapsed .sidebar-nav a { padding: 11px 16px; justify-content: flex-start; }
  .sidebar.collapsed .sidebar-nav a span { opacity: 1; width: auto; display: inline; }
  .sidebar.collapsed .sidebar-footer { opacity: 1; pointer-events: auto; }
}

/* ========== 主内容区 ========== */
.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .3s ease; }
.sidebar.collapsed ~ .overlay ~ .main,
.sidebar.collapsed ~ .main {
  margin-left: 72px;
}
.topbar {
  height: 64px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text-main); letter-spacing: 0.3px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-dropdown { position: relative; }
.user-dropdown-toggle { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: background .2s; user-select: none; }
.user-dropdown-toggle:hover { background: var(--border-light); }
.user-dropdown-arrow { transition: transform .2s ease; color: var(--text-light); }
.user-dropdown.open .user-dropdown-arrow { transform: rotate(180deg); }
.user-dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 140px; display: none; z-index: 100; overflow: hidden; }
.user-dropdown.open .user-dropdown-menu { display: block; }
.user-dropdown-menu a { display: block; padding: 10px 16px; font-size: 15px; color: var(--text-main); text-decoration: none; transition: background .15s; }
.user-dropdown-menu a:hover { background: #f8fafc; }
.user-dropdown-menu a + a { border-top: 1px solid var(--border-light); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: #fff;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(59,130,246,0.25);
}

.content { flex: 1; padding: 24px 28px; overflow-x: hidden; }

/* ========== 移动端基础 ========== */
.menu-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 8px;
  min-width: 44px; min-height: 44px;
  align-items: center; justify-content: center;
}
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.4); z-index: 99;
  backdrop-filter: blur(4px);
}
.overlay.show { display: block; }

@media (max-width: 768px) {
  .sidebar { width: 280px; transform: translateX(-100%); transition: transform .3s ease; box-shadow: 4px 0 24px rgba(0,0,0,.15); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 16px; height: 56px; }
  .topbar-title { font-size: 15px; }
  .content { padding: 16px; }
  .user-dropdown-toggle { display: flex; }
}

@media (max-width: 480px) {
  .sidebar { width: 100%; }
  .topbar-right .btn-secondary { padding: 8px 12px; font-size: 15px; }
}

/* ========== 卡片 ========== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--text-main); }
.card-body { padding: 24px; }

@media (max-width: 768px) {
  .card-header { padding: 14px 18px; }
  .card-body { padding: 18px; }
  .card:hover { box-shadow: var(--shadow); transform: none; }
}

/* ========== 统计卡片 ========== */
.stat-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px;
}
.stat-card .left { flex: 1; min-width: 0; overflow: hidden; }
.stat-label { font-size: 15px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-main); margin-top: 6px; letter-spacing: -0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #2563eb; }
.stat-icon.teal { background: linear-gradient(135deg, #ccfbf1, #99f6e4); color: #0d9488; }
.stat-icon.green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #059669; }
.stat-icon.amber { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.stat-icon.rose { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #e11d48; }

@media (max-width: 768px) {
  .stat-card { padding: 18px; }
  .stat-value { font-size: 24px; }
  .stat-icon { width: 44px; height: 44px; }
  .stat-icon svg { width: 20px; height: 20px; }
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all .2s; text-decoration: none;
  line-height: 1; white-space: nowrap;
  min-height: 38px; touch-action: manipulation;
}
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}
.btn-primary:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: #fff; color: var(--text-main); border-color: var(--border-color); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-secondary:active { transform: translateY(1px); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-danger:active { transform: translateY(1px); }
.btn-sm { padding: 7px 12px; font-size: 15px; min-height: 32px; }
.btn-xs { padding: 5px 10px; font-size: 15px; min-height: 28px; }

@media (max-width: 768px) {
  .btn { padding: 10px 14px; min-height: 40px; font-size: 15px; }
  .btn-sm { padding: 8px 12px; min-height: 36px; }
  .btn-xs { padding: 6px 10px; min-height: 32px; }
}

/* ========== 表单 ========== */
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  font-size: 15px; outline: none; transition: all .2s;
  background: #fff; color: var(--text-main);
  -webkit-appearance: none;
}
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-label { display: block; font-size: 15px; font-weight: 500; margin-bottom: 6px; color: var(--text-main); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-control { padding: 11px 12px; font-size: 16px; }
  .form-label { font-size: 15px; margin-bottom: 8px; }
  .form-group { margin-bottom: 18px; }
}

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.table thead th {
  background: #f8fafc; padding: 12px 16px; text-align: left;
  font-weight: 500; font-size: 15px; color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main); vertical-align: middle;
}
.table tbody tr:hover td { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

@media (max-width: 768px) {
  .table { font-size: 15px; }
  .table thead th { padding: 12px 14px; font-size: 15px; }
  .table tbody td { padding: 12px 14px; }
  .table-wrap { margin: 0 -16px; width: calc(100% + 32px); padding: 0 16px; }
}

/* ========== 标签 ========== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 15px; font-weight: 500;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-default { background: #f1f5f9; color: var(--text-muted); }

@media (max-width: 768px) {
  .badge { padding: 4px 10px; font-size: 15px; }
}

/* ========== 搜索栏/工具栏 ========== */
.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; width: 280px; }
.search-box input { padding-left: 36px; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-light); pointer-events: none; }

@media (max-width: 768px) {
  .toolbar { gap: 8px; margin-bottom: 16px; }
  .search-box { width: 100%; flex: 1; min-width: 0; }
  .toolbar .btn-primary { margin-left: 0; width: auto; }
}

/* ========== 分页 ========== */
.pagination, #pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 0 4px; }
.pagination-info { font-size: 15px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 768px) {
  .pagination, #pagination { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  padding: 16px;
}
.login-box { width: 100%; max-width: 400px; }
.login-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3);
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 32px; color: #f8fafc; font-size: 20px; font-weight: 600; letter-spacing: 1px; }
.login-brand .logo-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  display: grid; place-items: center;
  color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}
.login-hint { text-align: center; font-size: 15px; color: #64748b; margin-top: 20px; }
.login-error {
  background: rgba(220,38,38,0.12); border: 1px solid rgba(220,38,38,0.3);
  color: #fca5a5; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 15px; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }

@media (max-width: 480px) {
  .login-page { padding: 12px; align-items: flex-start; padding-top: 60px; }
  .login-card { padding: 28px 20px; border-radius: var(--radius); }
  .login-brand { font-size: 18px; margin-bottom: 24px; }
  .login-brand .logo-icon { width: 36px; height: 36px; }
}

/* ========== 面板 ========== */
.panel { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow); }
.panel-header { padding: 14px 20px; border-bottom: 1px solid var(--border-light); font-size: 15px; font-weight: 600; color: var(--text-main); background: linear-gradient(to right, #f8fafc, #fff); border-radius: var(--radius) var(--radius) 0 0; }
.panel-body { padding: 20px; }

@media (max-width: 768px) {
  .panel-header { padding: 12px 16px; }
  .panel-body { padding: 16px; }
}

/* ========== 权限矩阵 ========== */
.perm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-main); padding: 8px; border-radius: var(--radius-sm); transition: background .15s; }
.perm-item:hover { background: #f8fafc; }
.perm-item input { width: 16px; height: 16px; accent-color: var(--primary); }

@media (max-width: 768px) {
  .perm-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .perm-item { font-size: 15px; padding: 8px 4px; }
  .perm-item input { width: 18px; height: 18px; }
}

/* ========== Toast ========== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  max-width: 340px;
  display: flex; align-items: center; gap: 8px;
}
.toast-success { background: #fff; color: var(--success-text); border-left: 4px solid var(--success); }
.toast-error { background: #fff; color: var(--danger-text); border-left: 4px solid var(--danger); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 768px) {
  .toast-container { top: auto; bottom: 20px; right: 12px; left: 12px; align-items: center; }
  .toast { max-width: 100%; width: 100%; text-align: center; animation: toastUp .3s ease; justify-content: center; }
  @keyframes toastUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
}

/* ========== 网格布局 ========== */
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

@media (max-width: 1024px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 768px) {
  .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 12px; }
  .grid-5 .stat-card, .grid-4 .stat-card { padding: 16px 18px; }
}

/* ========== 操作链接 ========== */
.action-link { color: var(--primary); font-size: 15px; cursor: pointer; text-decoration: none; padding: 5px 10px; border-radius: var(--radius-sm); transition: all .15s; display: inline-block; min-height: 30px; line-height: 20px; }
.action-link:hover { background: var(--primary-bg); }
.action-link.danger { color: var(--danger); }
.action-link.danger:hover { background: var(--danger-bg); }
.action-link.disabled { color: var(--text-light); cursor: not-allowed; pointer-events: none; opacity: 0.5; }
.action-link.disabled:hover { background: none; }

@media (max-width: 768px) {
  .action-link { font-size: 15px; padding: 6px 10px; min-height: 32px; }
}

/* ========== 表格移动端卡片视图 ========== */
@media (max-width: 768px) {
  .mobile-card-view tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  .mobile-card-view tbody tr:last-child { margin-bottom: 0; }
  .mobile-card-view tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 8px;
    word-break: break-all;
  }
  .mobile-card-view tbody td:last-child { border-bottom: none; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
  .mobile-card-view tbody td::before {
    content: attr(data-label);
    font-weight: 500;
    font-size: 15px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-right: 8px;
  }
  .mobile-card-view thead { display: none; }
  .mobile-card-view .table-wrap { overflow: visible; }
}

/* ========== 桌面端/移动端共存 + Fallback ========== */
.desktop-view { display: block; }
.mobile-view  { display: none; }

@media (max-width: 768px) {
  .desktop-view { display: none; }
  .mobile-view  { display: block; }
  /* Vant 移动端兼容性基础 */
  body {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
  }
  .mobile-view {
    -webkit-overflow-scrolling: touch;
  }
}

/* Fallback：老浏览器或不支持Vue3的环境，强制显示桌面端，隐藏移动端 */
.no-vue3-fallback .desktop-view { display: block !important; }
.no-vue3-fallback .mobile-view  { display: none !important; }

/* ========== 移动端统一字体规范 ========== */
.mobile-view .m-text-xl { font-size: 18px; font-weight: 600; color: var(--text-main); }
.mobile-view .m-text-lg { font-size: 16px; font-weight: 600; color: var(--text-main); }
.mobile-view .m-text-md { font-size: 15px; color: var(--text-main); }
.mobile-view .m-text-sm { font-size: 14px; color: var(--text-main); }
.mobile-view .m-text-xs { font-size: 13px; color: var(--text-muted); }

/* ========== 移动端 Vant 常用色值（与 Vant 4 默认主题对齐，便于统一调整） ========== */
.mobile-view {
  --m-primary: #1989fa;
  --m-success: #07c160;
  --m-danger: #ee0a24;
  --m-warning: #ff976a;
  --m-text-main: #323233;
  --m-text-sub: #646566;
  --m-text-muted: #969799;
  --m-text-light: #c8c9cc;
  --m-bg-page: #f7f8fa;
  --m-bg-card: #ffffff;
  --m-border: #ebedf0;
}

/* ========== 移动端页面容器 ========== */
.mobile-view .m-page { padding: 12px 0; }
.mobile-view .m-page-pad { padding: 12px 8px; }

/* ========== 移动端卡片（列表项） ========== */
.mobile-view .m-card {
  background: var(--m-bg-card);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.mobile-view .m-card-sm {
  background: var(--m-bg-card);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.mobile-view .m-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mobile-view .m-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--m-text-main);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-view .m-card-sub {
  font-size: 13px;
  color: var(--m-text-muted);
  margin-top: 4px;
}
.mobile-view .m-card-info {
  font-size: 14px;
  color: var(--m-text-sub);
  margin-top: 6px;
}
.mobile-view .m-card-info-sm {
  font-size: 12px;
  color: var(--m-text-light);
  margin-top: 4px;
}
.mobile-view .m-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.mobile-view .m-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== 移动端列表项（带箭头，用于 van-cell 替代场景） ========== */
.mobile-view .m-list-item {
  display: flex;
  align-items: center;
  background: var(--m-bg-card);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.mobile-view .m-list-item-content {
  flex: 1;
  min-width: 0;
}

/* ========== 移动端区块标题 ========== */
.mobile-view .m-section-title {
  margin: 16px 8px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}
.mobile-view .m-section-title-sm {
  margin: 12px 8px 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

/* ========== 移动端按钮区域 ========== */
.mobile-view .m-btn-group {
  padding: 16px 8px;
  display: flex;
  gap: 10px;
}
.mobile-view .m-btn-group-col {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========== 移动端空状态 ========== */
.mobile-view .m-empty {
  text-align: center;
  color: var(--m-text-muted);
  padding: 32px 0;
}

/* ========== 移动端统计网格 ========== */
.mobile-view .m-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 12px;
}
.mobile-view .m-stat-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 12px;
}
.mobile-view .m-stat-item {
  background: var(--m-bg-card);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.mobile-view .m-stat-item-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--m-text-main);
}
.mobile-view .m-stat-item-label {
  font-size: 13px;
  color: var(--m-text-muted);
  margin-top: 4px;
}

/* ========== 移动端表单块（van-cell-group 替代） ========== */
.mobile-view .m-field-block {
  margin: 0 8px 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.mobile-view .m-form {
  padding: 12px 8px;
}

/* ========== 移动端间距工具类 ========== */
.mobile-view .m-mt-4 { margin-top: 4px; }
.mobile-view .m-mt-6 { margin-top: 6px; }
.mobile-view .m-mt-8 { margin-top: 8px; }
.mobile-view .m-mt-12 { margin-top: 12px; }
.mobile-view .m-mb-8 { margin-bottom: 8px; }
.mobile-view .m-mb-10 { margin-bottom: 10px; }
.mobile-view .m-mb-12 { margin-bottom: 12px; }
.mobile-view .m-ml-8 { margin-left: 8px; }
.mobile-view .m-mr-8 { margin-right: 8px; }
.mobile-view .m-p-8 { padding: 8px; }
.mobile-view .m-p-16 { padding: 16px; }

/* ========== 移动端颜色工具类 ========== */
.mobile-view .m-color-main { color: var(--m-text-main); }
.mobile-view .m-color-sub { color: var(--m-text-sub); }
.mobile-view .m-color-muted { color: var(--m-text-muted); }
.mobile-view .m-color-light { color: var(--m-text-light); }
.mobile-view .m-color-danger { color: var(--m-danger); }
.mobile-view .m-color-primary { color: var(--m-primary); }

/* ========== 移动端 Flex 工具类 ========== */
.mobile-view .m-flex { display: flex; }
.mobile-view .m-flex-1 { flex: 1; min-width: 0; }
.mobile-view .m-flex-center { display: flex; align-items: center; }
.mobile-view .m-flex-between { display: flex; align-items: center; justify-content: space-between; }
.mobile-view .m-shrink-0 { flex-shrink: 0; }

/* ========== 其他 ========== */
.section-title { font-size: 15px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; margin-bottom: 14px; }

.chart-bar { border-radius: 4px 4px 0 0; }

/* ========== Modal 弹窗 ========== */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: #fff; border-radius: 8px; max-width: 480px; width: 90%; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; justify-content: flex-end; }
