/* ============================================
   卡速网 V2 - 后台管理系统样式
   设计规范参考: 深蓝侧边栏 + 现代化仪表盘
   ============================================ */

:root {
  --primary: #1677ff;
  --primary-light: #e8f0fe;
  --primary-dark: #0958d9;
  --sidebar-bg: #1677ff;
  --sidebar-hover: #1a7efc;
  --sidebar-active: rgba(255,255,255,0.18);
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ff4d4f;
  --danger-light: #fff2f0;
  --info: #722ed1;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --bg-body: #f5f6fa;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 200px;
  --header-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.admin-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; height: auto; }
input, button, select, textarea { outline: none; font-family: inherit; font-size: inherit; }

/* ====== 主容器 ====== */
.admin-container {
  display: flex;
  min-height: 100vh;
}

/* ====== 子页面布局（header + admin-main(aside+content)）兼容 ====== */
.admin-container > .admin-header:first-child {
  position: sticky; top: 0; z-index: 1000;
  width: 100%; flex-shrink: 0;
}
.admin-container > .admin-main {
  display: flex; flex: 1; min-width: 0; width: 100%;
}
.admin-container > .admin-main .admin-sidebar {
  position: relative !important; /* 非fixed，跟随文档流 */
  transform: none !important;
  top: auto !important; left: auto !important; bottom: auto !important;
  box-shadow: none !important;
  height: auto !important; min-height: calc(100vh - var(--header-height));
  z-index: auto !important;
}
.admin-container > .admin-main .admin-content {
  flex: 1; padding: 24px;
  background: var(--bg-body); overflow-x: hidden;
}

/* ====== 左侧菜单栏（核心改动：深蓝背景） ====== */
.admin-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1564d9 0%, #1677ff 50%, #1890ff 100%);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1100;
  overflow: hidden;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 12px rgba(22,119,255,0.15);
}
.admin-sidebar.collapsed { width: 64px; }

/* Logo 区域 */
.sidebar-logo {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.95);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: var(--primary);
  letter-spacing: -1px;
  flex-shrink: 0;
}
.sidebar-logo-text {
  color: #fff; font-size: 15px; font-weight: 700;
  letter-spacing: 1px; white-space: nowrap;
}
.sidebar-logo-sub { color: rgba(255,255,255,0.65); font-size: 11px; margin-top: 1px; letter-spacing: 2px; }

.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

.nav-menu { padding: 0 10px; }
.nav-item { position: relative; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  color: rgba(255,255,255,0.82);
  font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  margin-bottom: 2px;
  white-space: nowrap; cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-link:hover {
  background: var(--sidebar-active);
  color: #fff;
}
/* 父级菜单激活态（子页面访问时也保持高亮） */
.nav-item.active > .nav-link,
.nav-item.has-submenu.active > .nav-link {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: #ffd666;
  font-weight: 600;
}
.nav-link i {
  width: 20px; text-align: center; font-size: 15px; flex-shrink: 0;
  opacity: 0.9;
}
.nav-item.active > .nav-link i { opacity: 1; }
.nav-text { transition: opacity 0.25s, width 0.25s; overflow: hidden; }

/* 导航展开切换按钮（父级可点击展开） */
.nav-toggle {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  color: rgba(255,255,255,0.82); font-size: 13.5px; font-weight: 500;
  border-radius: var(--radius-sm); transition: all 0.2s;
  margin-bottom: 2px; white-space: nowrap; cursor: pointer;
  width: 100%; border-left: 3px solid transparent;
}
.nav-toggle:hover { background: var(--sidebar-active); color: #fff; }
.admin-sidebar.collapsed .nav-text { opacity: 0; width: 0; }
.admin-sidebar.collapsed .sidebar-logo-text,
.admin-sidebar.collapsed .sidebar-logo-sub { display: none; }
/* 折叠时子菜单自动隐藏（64px 放不下）*/
.admin-sidebar.collapsed .submenu { display: none !important; }
/* 折叠时点击父级菜单 → 自动展开侧边栏后再操作 */
.admin-sidebar.collapsed .nav-toggle { cursor: pointer; }

.submenu-toggle {
  margin-left: auto; font-size: 10px;
  transition: transform 0.28s; color: rgba(255,255,255,0.5);
}
.nav-item.has-submenu.open .submenu-toggle { transform: rotate(90deg); color: #ffd666; }

.submenu {
  list-style: none; padding: 0; margin: 0;
  background: rgba(0,0,0,0.08);
  border-radius: var(--radius-sm);
  display: none;
  margin: 2px 0 4px 0;
  overflow: hidden;
}
.nav-item.has-submenu.open > .submenu { display: block; }

.submenu li {
  position: relative;
}
.submenu li a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px 9px 44px;
  font-size: 13px;
  color: rgba(255,255,255,0.68);
  border-radius: 6px; transition: all 0.15s;
}
.submenu li a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.submenu li a.active { background: rgba(255,255,255,0.16); color: #ffd666; font-weight: 600; }
.submenu li a.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; background: #ffd666; border-radius: 2px;
}
.submenu li a i { font-size: 11px; width: 16px; text-align: center; }

/* 侧边栏底部 */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: space-between;
}
.system-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: rgba(255,255,255,0.6);
}
.system-status::before {
  content: ''; width: 7px; height: 7px;
  background: #52c41a; border-radius: 50%;
  animation: pulse 2s infinite; box-shadow: 0 0 6px #52c41a;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.sidebar-collapse {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; cursor: pointer;
  color: rgba(255,255,255,0.6); transition: all 0.2s;
}
.sidebar-collapse:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ====== 右侧区域（顶部+内容） ====== */
.admin-right {
  flex: 1; margin-left: var(--sidebar-width);
  min-width: 0;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column; min-height: 100vh;
}
.admin-sidebar.collapsed ~ .admin-right { margin-left: 64px; }

/* ====== 顶部导航栏（精简版） ====== */
.admin-header {
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-title {
  font-size: 17px; font-weight: 700; color: var(--text-primary);
  letter-spacing: 0.5px;
}
.header-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.header-breadcrumb a { color: var(--text-muted); transition: color 0.15s; }
.header-breadcrumb a:hover { color: var(--primary); }
.header-breadcrumb .active { color: var(--text-secondary); font-weight: 500; }
.breadcrumb-home-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px;
  background: var(--primary-light);
  color: var(--primary); border-radius: 6px;
  font-size: 12.5px; font-weight: 550;
  transition: all 0.2s;
}
.breadcrumb-home-btn:hover { background: var(--primary); color: #fff; }

.menu-toggle {
  display: none; width: 36px; height: 36px; border: none;
  background: transparent; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-secondary); font-size: 18px;
}
.menu-toggle:hover { background: var(--bg-body); color: var(--primary); }

.header-right { display: flex; align-items: center; gap: 8px; }

.header-action-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--bg-white);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted);
  font-size: 14px; transition: all 0.2s; position: relative;
}
.header-action-btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-sm); }

.notification-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 15px; height: 15px; background: var(--danger); color: white;
  border-radius: 50%; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

.user-profile { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border); background: var(--bg-white);
  border-radius: 22px; cursor: pointer; transition: all 0.2s;
}
.profile-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-name { font-weight: 500; font-size: 12.5px; color: var(--text-primary); }
.profile-btn > i:last-child { font-size: 10px; color: var(--text-muted); margin-left: 2px; }

/* ====== 头像下拉菜单（气泡卡片式） ====== */
.user-profile { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid transparent; background: transparent;
  border-radius: 22px; cursor: pointer; transition: all 0.2s;
}
.profile-btn:hover { background: rgba(255,255,255,0.7); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; background: linear-gradient(135deg, #1677ff, #69b1ff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; box-shadow: 0 2px 8px rgba(22,119,255,0.3);
}
.user-name { font-weight: 500; font-size: 13px; color: #1e293b; }
.profile-btn > i:last-child { font-size: 10px; color: #94a3b8; margin-left: 2px; }

.profile-dropdown {
  position: absolute; top: calc(100% + 10px); right: -10px;
  min-width: 180px; background: #fff;
  border-radius: 12px; padding: 8px 0;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid #e8e8e8;
  opacity: 0; visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transition: all 0.22s cubic-bezier(.4,0,.2,1);
  z-index: 9999;
}
.profile-dropdown.show {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
}

/* 小箭头 */
.profile-dropdown::before,
.profile-dropdown::after {
  content: ''; position: absolute;
  border-style: solid;
}
.profile-dropdown::before {
  top: -7px; right: 20px;
  border-width: 0 7px 7px 7px;
  border-color: transparent transparent #fff transparent;
  z-index: 2;
}
.profile-dropdown::after {
  top: -8px; right: 19px;
  border-width: 0 8px 8px 8px;
  border-color: transparent transparent #e8e8e8 transparent;
  z-index: 1;
}

.profile-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; font-size: 13.5px;
  color: #555; transition: all 0.15s; cursor: pointer;
  text-decoration: none;
}
.profile-dropdown a:hover { background: #f5f7fa; color: #1677ff; }
.profile-dropdown a i { width: 18px; text-align: center; font-size: 14px; }
.dropdown-divider { height: 1px; background: #eee; margin: 6px 14px; }
.logout { color: #ff4d4f !important; }
.logout:hover { background: #fff1f0 !important; }

/* ====== 主内容区 ====== */
.admin-content {
  flex: 1; padding: 24px; background: var(--bg-body);
}

.content-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.content-header h1 {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
}

.header-actions { display: flex; gap: 8px; }
.btn-icon {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--bg-white);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted);
  font-size: 14px; transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-sm); }
.btn-icon.refreshing { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== 欢迎横幅（新组件）===== */
.welcome-banner {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  transition: box-shadow 0.25s;
}
.welcome-banner:hover { box-shadow: var(--shadow-md); }

.welcome-left { display: flex; align-items: center; gap: 18px; }
.welcome-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #1677ff, #69b1ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 700;
  flex-shrink: 0; box-shadow: 0 4px 15px rgba(22,119,255,0.3);
}
.welcome-text h2 {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 4px;
}
.welcome-text p {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}
.welcome-text strong { color: var(--primary); }

.welcome-btn {
  padding: 8px 22px;
  background: linear-gradient(135deg, #ffa940, #ff9800);
  color: #fff; border: none; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all 0.25s; white-space: nowrap;
  letter-spacing: 0.5px;
}
.welcome-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255,152,0,0.35);
}

/* ====== 统计卡片网格（重新设计）===== */
.stat-cards-grid {
  display: grid;
  grid-template-columns: 280px 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.25s; position: relative; overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* 主统计卡片（大号渐变） */
.stat-card.featured {
  background: linear-gradient(135deg, #4a8dff 0%, #1677ff 50%, #0958d9 100%);
  border: none; color: #fff;
  grid-row: span 2;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 180px;
}
.stat-card.featured:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(22,119,255,0.35); }
.stat-card.featured .stat-label { color: rgba(255,255,255,0.85); }
.stat-card.featured .stat-value { color: #fff; font-size: 32px; }
.stat-card.featured .stat-change { background: rgba(255,255,255,0.18); color: #fff; }
.stat-card.featured .stat-extra { color: rgba(255,255,255,0.72); font-size: 12.5px; margin-top: 8px; }
.stat-card.featured .stat-icon-wrap {
  position: absolute; right: 20px; bottom: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; backdrop-filter: blur(4px);
}

.stat-icon-wrap {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; margin-bottom: 12px;
}
.stat-info { flex: 1; }
.stat-value {
  font-size: 26px; font-weight: 800; line-height: 1.2;
  letter-spacing: -0.5px; color: var(--text-primary);
}
.stat-label {
  font-size: 13px; color: var(--text-muted); margin-top: 4px;
}
.stat-change {
  font-size: 11.5px; font-weight: 600; padding: 3px 10px;
  border-radius: 12px; margin-top: 10px; display: inline-flex; align-items: center; gap: 3px;
}
.stat-up { background: #ecfdf5; color: var(--success); }
.stat-down { background: #fef2f2; color: var(--danger); }
.stat-neutral { background: #f3f4f6; color: var(--text-muted); }

.stat-card.primary .stat-icon-wrap { background: #e8f0fe; color: var(--primary); }
.stat-card.success .stat-icon-wrap { background: #ecfdf5; color: var(--success); }
.stat-card.warning .stat-icon-wrap { background: #fff8e6; color: #faad14; }
.stat-card.danger .stat-icon-wrap { background: #fef2f2; color: var(--danger); }
.stat-card.info .stat-icon-wrap { background: #f3e8ff; color: var(--info); }

/* ====== 待处理警告条 ===== */
.alert-banner {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-left: 4px solid #f97316;
  border-radius: var(--radius-md); padding: 18px 22px;
  margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.alert-left { display: flex; align-items: flex-start; gap: 12px; flex: 1; }
.alert-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #fb923c, #ea580c);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; flex-shrink: 0;
}
.alert-content h4 { font-size: 14px; font-weight: 650; color: #9a3412; margin-bottom: 3px; }
.alert-content p { font-size: 12.5px; color: #b45309; line-height: 1.45; }
.alert-badge {
  display: inline-block; padding: 2px 8px;
  background: #f97316; color: #fff; border-radius: 6px;
  font-size: 11px; font-weight: 600; margin-left: 6px;
}
.alert-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-alert-primary {
  padding: 7px 18px; background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border: none; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.btn-alert-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(217,119,6,0.35); }
.btn-alert-ghost {
  padding: 7px 16px; background: rgba(249,115,22,0.1);
  color: #c2410c; border: 1px solid rgba(249,115,22,0.25);
  border-radius: 8px; font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.btn-alert-ghost:hover { background: rgba(249,115,22,0.18); }

/* ====== 系统信息面板 ===== */
.info-panel {
  background: var(--bg-white); border-radius: var(--radius-md);
  padding: 20px 24px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border); margin-bottom: 20px;
}
.info-panel-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; font-size: 14px; font-weight: 650; color: var(--text-primary);
}
.info-panel-header i { color: var(--primary); font-size: 15px; }
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 24px;
}
.info-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px dashed #f0f0f0;
}
.info-item:last-child { border-bottom: none; }
.info-label { font-size: 12.5px; color: var(--text-muted); }
.info-value {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  font-family: 'SF Mono', Consolas, monospace;
}
.info-value.highlight { color: var(--primary); }
.info-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ====== 快捷入口（图标卡片）===== */
.quick-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.quick-entry-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer; transition: all 0.25s;
  text-decoration: none; display: block;
}
.quick-entry-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: var(--primary); color: inherit;
}
.quick-entry-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 12px;
  transition: transform 0.25s;
}
.quick-entry-card:hover .quick-entry-icon { transform: scale(1.08); }
.quick-entry-name {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.quick-entry-desc {
  font-size: 11.5px; color: var(--text-muted); margin-top: 3px;
}
.hot-tag {
  position: absolute; top: 10px; right: 10px;
  background: linear-gradient(135deg, #ff4d4f, #ff7875);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 6px;
  letter-spacing: 0.5px;
}

/* 图标颜色 */
.qicon-blue { background: #e8f4fd; color: #1677ff; }
.qicon-green { background: #ecfdf5; color: #16a34a; }
.qicon-orange { background: #fff7ed; color: #f97316; }
.qicon-purple { background: #faf5ff; color: #8b5cf6; }

/* ====== 卡片通用 ====== */
.card {
  background: var(--bg-white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: box-shadow 0.25s; border: 1px solid var(--border);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 15px; background: #fafbfc;
}
.card-body { padding: 20px 22px; }

/* ====== 表格 ====== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); -webkit-overflow-scrolling: touch; }
.table-wrapper table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-wrapper th {
  background: #f9fafb; padding: 11px 16px;
  text-align: left; font-weight: 600; color: var(--text-secondary);
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px;
}
.table-wrapper td { padding: 12px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table-wrapper tbody tr:hover td { background: #faffff; }
.table-wrapper tr.selected td { background: #e8f0fe; }

/* ====== 按钮 ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: all 0.25s; white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(22,119,255,0.35); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { box-shadow: 0 4px 12px rgba(22,163,74,0.35); }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { box-shadow: 0 4px 12px rgba(255,77,79,0.35); }

.btn-outline {
  background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-ghost { background: transparent; border: none; color: var(--text-secondary); padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg-body); color: var(--primary); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: var(--radius-md); }
.btn-block { width: 100%; }

/* 操作按钮 */
.btn-action {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 6px;
  cursor: pointer; color: var(--text-secondary); font-size: 14px; transition: all 0.2s;
}
.btn-action:hover { background: var(--primary-light); color: var(--primary); }

/* ====== 标签/徽章 ====== */
.status-tag {
  display: inline-flex; align-items: center; padding: 3px 12px;
  border-radius: 20px; font-size: 12px; font-weight: 550; line-height: 1.6;
}
.tag-pending { background: #fef3c7; color: #92400e; }
.tag-processing { background: #dbeafe; color: #1e40af; }
.tag-completed { background: #dcfce7; color: #166534; }
.tag-failed { background: #fee2e2; color: #991b1b; }
.tag-cancelled { background: #f3f4f6; color: #374151; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 10px; font-size: 11px; font-weight: 650;
  color: white; background: var(--danger);
}

/* ====== 分页 ====== */
.pagination {
  display: flex; justify-content: center; align-items: center; gap: 6px;
  margin-top: 24px; flex-wrap: wrap;
}
.pagination button {
  min-width: 36px; height: 36px; border: 1.5px solid var(--border);
  background: var(--bg-white); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13.5px; transition: all 0.2s;
  color: var(--text-secondary); font-family: inherit;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination .active-page { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; font-weight: 600; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { padding: 0 12px; font-size: 13px; color: var(--text-muted); }

/* ====== Tab标签页 ====== */
.page-tabs { display: flex; gap: 4px; background: #f0f1f3; padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; width: fit-content; }
.page-tab {
  padding: 8px 20px; border: none; background: transparent;
  border-radius: 6px; cursor: pointer; font-size: 13.5px; font-weight: 500;
  color: var(--text-secondary); transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.page-tab:hover { color: var(--text-primary); }
.page-tab.active { background: var(--bg-white); color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ====== 工具栏 ====== */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 20px; padding: 16px 20px;
  background: var(--bg-white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.toolbar .search-box { flex: 1; min-width: 200px; }
.toolbar select {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; background: var(--bg-white); cursor: pointer; color: var(--text-secondary); min-width: 130px;
}

/* ====== 表单 ====== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 550; font-size: 13.5px; color: var(--text-primary); }
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%; padding: 9px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; transition: all 0.25s;
  background: var(--bg-white); color: var(--text-primary);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,119,255,0.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 88px; }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-row.half .form-group { flex: 0 0 48%; }

/* ====== Toast 提示 ====== */
.admin-toast {
  position: fixed; top: 70px; right: 24px; min-width: 260px; max-width: 400px;
  padding: 14px 20px; border-radius: var(--radius-md); color: white;
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 9999;
  display: flex; align-items: center; gap: 10px; animation: toastIn 0.35s ease-out;
}
.toast-close { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 18px; padding: 0 2px; }
.toast-close:hover { color: white; }
.toast-success { background: linear-gradient(135deg, #16a34a, #22c55e); }
.toast-error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.toast-info { background: linear-gradient(135deg, #2563eb, #3b82f6); }
@keyframes toastIn { from{opacity:0;transform:translateX(60px)} to{opacity:1;transform:translateX(0)} }

/* ====== Modal 弹窗 ====== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(3px);
  z-index: 9000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-dialog {
  background: var(--bg-white); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 85vh;
  overflow: hidden; display: flex; flex-direction: column;
  animation: modalIn 0.3s ease-out;
}
.modal-dialog.sm { max-width: 420px; }
.modal-dialog.lg { max-width: 720px; }
.modal-box {
  background: var(--bg-white); border-radius: var(--radius-lg);
  width: 100%; max-width: 420px;
  overflow: hidden; display: flex; flex-direction: column;
  animation: modalIn 0.3s ease-out;
}
@keyframes modalIn { from{opacity:0;transform:scale(0.95) translateY(16px)} to{opacity:1;transform:scale(1) translateY(0)} }

.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 650; font-size: 16px;
}
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--bg-body); color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ====== 空状态 & 加载状态 ====== */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state i { font-size: 52px; display: block; margin-bottom: 16px; opacity: 0.35; }
.empty-state p { font-size: 14.5px; }

.loading-state { text-align: center; padding: 44px; color: var(--text-muted); }
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid #e5e7eb;
  border-top: 3px solid var(--primary); border-radius: 50%;
  animation: spin 0.75s linear infinite; margin: 0 auto 14px;
}

/* ====== 图表区域 ====== */
.chart-container {
  background: var(--bg-white); border-radius: var(--radius-md);
  padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
  border: 1px solid var(--border);
}
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.chart-header h3 { font-size: 15px; font-weight: 600; }
.chart-canvas {
  width: 100%; height: 280px;
  display: flex; align-items: end; gap: 8px; padding: 10px 0;
}
.chart-bar {
  flex: 1; background: linear-gradient(180deg, var(--primary), #69b1ff);
  border-radius: 4px 4px 0 0; min-height: 20px; position: relative;
  transition: all 0.3s; cursor: pointer;
}
.chart-bar:hover { opacity: 0.85; }
.chart-bar .bar-label { position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.chart-bar .bar-value { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

/* ====== 双列布局（待处理+信息） ====== */
.dual-column { display: grid; grid-template-columns: 1fr 340px; gap: 16px; margin-bottom: 20px; }

/* ====== 工具类 ====== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ====== 响应式适配 ====== */
@media (max-width: 1280px) {
  .stat-cards-grid { grid-template-columns: 240px 1fr 1fr; }
  .stat-card.featured { grid-row: span 1; min-height: auto; }
  .quick-entry-grid { grid-template-columns: repeat(2, 1fr); }
  .dual-column { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  /* ===== 移动端侧边栏：始终 left:0 渲染内容，opacity 控制显隐 ===== */
  .admin-sidebar {
    position: fixed !important;
    top: 0 !important; left: 0 !important; bottom: 0 !important;
    width: var(--sidebar-width) !important;
    z-index: 2000 !important;
    display: flex !important; flex-direction: column !important;
    overflow-y: auto !important; overflow-x: hidden !important;
    transform: none !important;
    /* 隐藏：纯 opacity 不影响 flex 布局（避免 visibility:hidden + flex:1 塌缩 bug）*/
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.28s ease !important;
  }
  .admin-sidebar.show {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  /* 移动端不应用折叠（覆盖 collapsed 造成的 opacity:0 / width:0 / display:none）*/
  .admin-sidebar.collapsed,
  .admin-sidebar.collapsed.show { width: var(--sidebar-width) !important; }
  .admin-sidebar.collapsed .nav-text { opacity: 1 !important; width: auto !important; }
  .admin-sidebar.collapsed .sidebar-logo-text,
  .admin-sidebar.collapsed .sidebar-logo-sub { display: block !important; }
  .admin-sidebar.collapsed .submenu { display: none !important; } /* 子菜单仍默认折叠 */
  /* 移动端隐藏折叠按钮（手机上侧边栏始终全宽） */
  #sidebarCollapse { display: none !important; }
  .admin-right { margin-left: 0 !important; }
  .menu-toggle { display: flex !important; }
  .stat-cards-grid { grid-template-columns: 1fr 1fr; }
  .stat-card.featured { grid-column: span 2; grid-row: auto; }
  /* 手机侧边栏遮罩 */
  .sidebar-mobile-mask { display: block !important; }
  .sidebar-mobile-mask.show { opacity: 1 !important; pointer-events: auto !important; }
  /* ★ 强制显示后台侧边栏的 nav-menu（覆盖 common.css 的移动端规则）*/
  .admin-sidebar .nav-menu {
    display: block !important;
    background: transparent !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 10px !important;
  }
  .admin-sidebar .nav-item { display: list-item !important; }
  .admin-sidebar .nav-link { color: rgba(255,255,255,0.82) !important; }
  .admin-sidebar .nav-link:hover { background: var(--sidebar-active) !important; color: #fff !important; }
}

@media (max-width: 768px) {
  .admin-header { padding: 0 16px; height: 48px; }
  .admin-content { padding: 12px; }
  .content-header h1 { font-size: 19px; }
  .user-name { display: none; }
  .header-title { font-size: 14px; }
  .header-action-btn { width: 34px; height: 34px; font-size: 15px; }
  .welcome-banner { flex-direction: column; text-align: center; padding: 20px; }
  .welcome-left { flex-direction: column; }
  .stat-cards-grid { grid-template-columns: 1fr; }
  .stat-card.featured { grid-column: auto; }
  .quick-entry-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row.half .form-group { flex: 1; }
  .modal-dialog { margin: 10px; max-height: 90vh; }
  .alert-banner { flex-direction: column; }
  .info-grid { grid-template-columns: 1fr; }
  /* 表格横向滚动 */
  .table-wrapper, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrapper table, .table-responsive table { min-width: 650px; }
  /* 按钮触控优化 */
  .btn, .btn-sm, .btn-primary, .btn-secondary, .btn-danger, .btn-outline, .btn-warning,
  button[class*="btn"] { min-height: 40px; padding-top: 10px; padding-bottom: 10px; }
  .btn-sm { min-height: 34px; padding-top: 6px; padding-bottom: 6px; }
  .icon-btn { width: 38px; height: 38px; }
  /* 下拉/输入框高度 */
  .form-control, select.form-control { min-height: 42px; }
  /* iframe 自适应 */
  #spaFrame { height: auto; min-height: calc(100vh - 48px); }
  .spa-content-area { height: auto; min-height: calc(100vh - 48px); }
  /* 通知抽屉全屏 */
  .notif-drawer { width: 100vw !important; right: -100vw !important; }
  #notifDrawer.open { right: 0 !important; }
  /* 分页面表单 */
  .settings-form { grid-template-columns: 1fr !important; }
  .form-row { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stat-cards-grid { grid-template-columns: 1fr; }
  .page-tabs { width: 100%; overflow-x: auto; }
  .page-tab { padding: 7px 14px; font-size: 13px; white-space: nowrap; }
  th, td { padding: 10px 12px; font-size: 12.5px; }
  .quick-entry-grid { grid-template-columns: 1fr; }
  .header-breadcrumb { display: none; }
  .header-left { gap: 6px; }
}

/* ====== 手机侧边栏遮罩 ====== */
.sidebar-mobile-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

/* ============================================
   SPA 单页应用 - iframe 内容区 & 加载动画
   ============================================ */

/* SPA 内容区容器 */
#mainContentArea {
  position: relative;
  flex: 1;
  padding: 0 !important;
  overflow: hidden;
}

/* iframe 自适应填充 */
#spaFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--bg-body);
}

/* 加载遮罩层 */
.spa-loading {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(245, 246, 250, 0.85);
  backdrop-filter: blur(4px);
}
.spa-loading.active {
  display: flex;
}

/* 加载动画 */
.spa-loading .loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.spa-loading .spinner-ring {
  width: 42px;
  height: 42px;
  border: 3.5px solid #e5e7eb;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spa-loading p {
  font-size: 13.5px;
  color: #888;
  font-weight: 500;
  letter-spacing: 1px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
