:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --primary-gradient: linear-gradient(135deg, #1a73e8, #4285f4);
  --primary-gradient-alt: linear-gradient(135deg, #667eea, #764ba2);
  --success: #34a853;
  --success-light: #e6f4ea;
  --warning: #fbbc04;
  --warning-light: #fef7e0;
  --danger: #ea4335;
  --danger-light: #fce8e6;
  --info: #4285f4;
  --info-light: #e8f0fe;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f4;
  --gray-200: #e8eaed;
  --gray-300: #dadce0;
  --gray-400: #bdc1c6;
  --gray-500: #9aa0a6;
  --gray-600: #80868b;
  --gray-700: #5f6368;
  --gray-800: #3c4043;
  --gray-900: #202124;
  --white: #ffffff;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.12), 0 6px 16px rgba(0,0,0,0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-width: 240px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  --h-sm: 32px;
  --h-md: 40px;
  --h-lg: 48px;
  --input-padding-x: 14px;
  --input-padding-y: 0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  background: #f0f2f5;
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease, transform 0.25s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,0.04);
  flex-shrink: 0;
}
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-gradient);
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.sidebar-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.sidebar-header h2 { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; position: relative; z-index: 1; }
.sidebar-toggle { background: none; border: none; color: var(--white); font-size: 24px; cursor: pointer; display: none; position: relative; z-index: 1; }
.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray-100);
}
.user-avatar {
  width: 38px; height: 38px;
  background: var(--primary-gradient);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 8px rgba(26,115,232,0.3);
  flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 14px; color: var(--gray-800); }
.user-role { font-size: 11px; color: var(--gray-500); margin-left: auto; padding: 2px 10px; background: var(--gray-100); border-radius: 10px; }
.sidebar-nav { padding: 8px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--gray-700);
  font-size: 14px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 2px 0;
  position: relative;
}
.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary-gradient);
  border-radius: 0 3px 3px 0;
}
.nav-item.logout { margin-top: 8px; border-top: 1px solid var(--gray-200); color: var(--danger); }
.nav-item.logout:hover { background: var(--danger-light); color: var(--danger); }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
  padding: 24px 28px;
  min-height: 100vh;
  transition: var(--transition);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  position: relative;
  padding-left: 16px;
}
.page-header h1::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  height: var(--h-md);
  min-height: var(--h-md);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
  vertical-align: middle;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
a.btn { text-decoration: none; color: inherit; }
.btn-primary {
  background: var(--primary-gradient);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(26,115,232,0.25);
}
.btn-primary:hover { background: var(--primary-gradient); box-shadow: 0 4px 16px rgba(26,115,232,0.35); transform: translateY(-1px); color: var(--white); }
.btn-success {
  background: linear-gradient(135deg, #34a853, #2d9249);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(52,168,83,0.25);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(52,168,83,0.35); transform: translateY(-1px); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--gray-900); }
.btn-warning:hover { background: #e5aa00; }
.btn-danger {
  background: linear-gradient(135deg, #ea4335, #d33426);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(234,67,53,0.25);
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(234,67,53,0.35); transform: translateY(-1px); color: var(--white); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0 10px; height: var(--h-sm); min-height: var(--h-sm); font-size: 12px; }
td .btn + .btn { margin-left: 4px; }
.btn-lg { padding: 0 28px; height: var(--h-lg); min-height: var(--h-lg); font-size: 16px; border-radius: var(--radius-md); }
.btn-group { display: inline-flex; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--gray-300); height: var(--h-md); }
.btn-group .btn { border-radius: 0; border: none; margin: 0; height: 100%; }
.btn-group .btn + .btn { border-left: 1px solid var(--gray-300); }

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 16px;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gray-800);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: default;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: transparent;
}
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
  transition: var(--transition-bounce);
}
.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-5deg); }
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 500;
}

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}
.table-container table {
  border-collapse: collapse;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  user-select: none;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 2;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { background: var(--gray-100); }
thead th .sort-icon { margin-left: 4px; font-size: 10px; }
tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  line-height: 1.5;
}
tbody tr { transition: background 0.15s ease; }
tbody tr:nth-child(even) td { background: var(--gray-50); }
tbody tr:hover td { background: #e8f0fe; }
tbody tr:last-child td { border-bottom: none; }

.table-compact tbody td {
  padding: 8px 12px;
  font-size: 13px;
}
.table-compact thead th {
  padding: 8px 12px;
  font-size: 12px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  line-height: 1.4;
}
.form-group .form-control + .form-control { margin-top: 8px; }
.form-group .help-text { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-control {
  width: 100%;
  height: var(--h-md);
  min-height: var(--h-md);
  padding: 0 var(--input-padding-x);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
  background: var(--white);
  color: var(--gray-900);
  outline: none;
  line-height: normal;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.12);
}
textarea.form-control { height: auto; min-height: 80px; padding: 10px var(--input-padding-x); resize: vertical; }
select.form-control { appearance: auto; cursor: pointer; padding-right: 8px; }
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control { line-height: 1; }
.form-control-sm {
  height: var(--h-sm);
  min-height: var(--h-sm);
  font-size: 13px;
  padding: 0 10px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; align-items: center; flex-wrap: wrap; }
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group .form-control { flex: 1; }
.input-group .btn { flex-shrink: 0; }

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--white);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
}
.filter-bar .form-control,
.filter-bar select,
.filter-bar input[type="date"],
.filter-bar input[type="time"] { width: auto; min-width: 140px; height: var(--h-md); flex: 0 1 auto; }
.filter-bar .btn { height: var(--h-md); flex-shrink: 0; }
.filter-bar label { white-space: nowrap; font-size: 13px; color: var(--gray-600); font-weight: 500; }
.filter-bar .btn { flex-shrink: 0; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 300px; }
.search-box input {
  width: 100%;
  height: var(--h-md);
  min-height: var(--h-md);
  padding: 0 12px 0 36px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
  background: var(--white);
  outline: none;
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.12);
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  font-size: 16px;
  pointer-events: none;
}

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #e37400; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-700);
  transition: var(--transition);
  min-width: 36px;
  text-align: center;
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary-gradient); color: var(--white); border-color: transparent; box-shadow: 0 2px 8px rgba(26,115,232,0.3); }
.pagination .disabled { color: var(--gray-400); cursor: not-allowed; background: var(--gray-50); }

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none;
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 50%;
  transition: var(--transition);
}
.modal-close:hover { color: var(--gray-800); background: var(--gray-100); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}
.toast-success { background: linear-gradient(135deg, #34a853, #2d9249); }
.toast-error { background: linear-gradient(135deg, #ea4335, #d33426); }
.toast-warning { background: linear-gradient(135deg, #fbbc04, #e5aa00); color: var(--gray-900); }
.toast-info { background: linear-gradient(135deg, #1a73e8, #1557b0); }
.toast .toast-close {
  margin-left: auto;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  opacity: 0.7;
  padding: 0 4px;
}
.toast .toast-close:hover { opacity: 1; }

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.stat-card.animate-in {
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
.stat-card.animate-in:nth-child(1) { animation-delay: 0.05s; }
.stat-card.animate-in:nth-child(2) { animation-delay: 0.1s; }
.stat-card.animate-in:nth-child(3) { animation-delay: 0.15s; }
.stat-card.animate-in:nth-child(4) { animation-delay: 0.2s; }
.stat-card.animate-in:nth-child(5) { animation-delay: 0.25s; }
.stat-card.animate-in:nth-child(6) { animation-delay: 0.3s; }
.stat-card.animate-in:nth-child(7) { animation-delay: 0.35s; }
.stat-card.animate-in:nth-child(8) { animation-delay: 0.4s; }

.card.animate-in {
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
.card.animate-in:nth-child(1) { animation-delay: 0.3s; }
.card.animate-in:nth-child(2) { animation-delay: 0.4s; }
.card.animate-in:nth-child(3) { animation-delay: 0.5s; }

.modal-footer .btn { min-width: 80px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.6; }
.empty-state p { font-size: 15px; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #1a73e8 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 60%);
  animation: pulse 15s ease-in-out infinite;
}
.login-card {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 8px 20px rgba(0,0,0,0.1);
  position: relative;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-card .login-logo { text-align: center; margin-bottom: 32px; }
.login-card .login-logo h1 {
  font-size: 24px;
  background: linear-gradient(135deg, #1a73e8, #667eea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}
.login-card .login-logo p { font-size: 13px; color: var(--gray-500); margin-top: 6px; }
.login-tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 28px; }
.login-tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  position: relative;
}
.login-tab:hover { color: var(--gray-700); }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.login-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 2px;
  background: var(--primary-gradient);
  border-radius: 1px;
}
.login-form { display: none; animation: fadeIn 0.3s ease; }
.login-form.active { display: block; }

.qr-display { text-align: center; padding: 20px; }
.qr-display canvas, .qr-display img { max-width: 200px; border-radius: var(--radius-md); }
.qr-timer { font-size: 14px; color: var(--gray-500); margin-top: 12px; font-weight: 500; }

.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--primary-gradient);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26,115,232,0.4);
  transition: var(--transition-bounce);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}
.fab:hover { transform: scale(1.12) rotate(90deg); box-shadow: 0 6px 28px rgba(26,115,232,0.5); }
.fab:active { transform: scale(0.92); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray-500); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

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

.welcome-banner {
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: var(--white);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.welcome-banner h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; position: relative; z-index: 1; }
.welcome-banner p { font-size: 14px; opacity: 0.85; position: relative; z-index: 1; }
.welcome-banner .welcome-time { font-size: 13px; opacity: 0.7; margin-top: 8px; position: relative; z-index: 1; }

.progress-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary-gradient);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.stat-change-badge.up { background: var(--success-light); color: var(--success); }
.stat-change-badge.down { background: var(--danger-light); color: var(--danger); }

.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.table-header-row h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.list-item:last-child { border-bottom: none; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.info-grid .info-item { padding: 8px 0; }
.info-grid .info-item strong { display: block; font-size: 12px; color: var(--gray-500); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.info-grid .info-item span { font-size: 14px; color: var(--gray-800); font-weight: 500; }

@media (min-width: 769px) {
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }
  .sidebar-toggle:hover { background: rgba(255,255,255,0.15); }
  .sidebar.collapsed { width: 60px; }
  .sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; }
  .sidebar.collapsed .sidebar-header h2 { display: none; }
  .sidebar.collapsed .sidebar-header .sidebar-toggle { width: 40px; height: 40px; font-size: 20px; }
  .sidebar.collapsed .sidebar-user { justify-content: center; padding: 12px 0; }
  .sidebar.collapsed .sidebar-user .user-name,
  .sidebar.collapsed .sidebar-user .user-role { display: none; }
  .sidebar.collapsed .sidebar-user .user-avatar { width: 34px; height: 34px; font-size: 13px; }
  .sidebar.collapsed .nav-item { justify-content: center; padding: 14px 0; gap: 0; }
  .sidebar.collapsed .nav-item span:not(.nav-icon),
  .sidebar.collapsed .nav-item .badge { display: none; }
  .sidebar.collapsed .nav-item .nav-icon { font-size: 22px; margin: 0; }
  .sidebar.collapsed .nav-item.logout { margin-top: 4px; border-top: none; }
  .sidebar.collapsed .nav-item.logout::before { content: ''; position: absolute; top: -4px; left: 12px; right: 12px; height: 1px; background: var(--gray-200); }
  .sidebar.collapsed .nav-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-800);
    color: #fff;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 500;
    animation: tooltipIn 0.2s ease;
  }
  @keyframes tooltipIn { from { opacity: 0; transform: translateY(-50%) scale(0.95); } to { opacity: 1; transform: translateY(-50%) scale(1); } }
  .sidebar.collapsed ~ .main-content { margin-left: 60px; }
  .sidebar:not(.collapsed) ~ .main-content { margin-left: var(--sidebar-width); }
}

@media print {
  .sidebar, .bottom-nav, .fab, .page-actions, .filter-bar, .pagination { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* ============================================================
   工作台 v2 —— 首屏「今日要办什么」布局
   目标：KPI 4 卡 → 今日待办 → 进行中活动 → 趋势主图 → 其余图表 Tab 收纳
   ============================================================ */

/* ---------- KPI 四卡 ---------- */
.wkpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.wkpi-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}
.wkpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.wkpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
}
.wkpi-card.is-good::before  { background: var(--success); }
.wkpi-card.is-warn::before  { background: var(--warning); }
.wkpi-card.is-bad::before   { background: var(--danger); }
.wkpi-label {
  font-size: 12px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.wkpi-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--gray-900);
}
.wkpi-value small { font-size: 15px; font-weight: 600; margin-left: 2px; }
.wkpi-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.wkpi-delta { font-weight: 700; font-size: 12px; }
.wkpi-delta.up   { color: var(--success); }
.wkpi-delta.down { color: var(--danger); }
.wkpi-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--gray-100);
  color: var(--gray-700);
}
.wkpi-badge.good { background: var(--success-light); color: var(--success); }
.wkpi-badge.warn { background: var(--warning-light); color: #b06000; }
.wkpi-badge.bad  { background: var(--danger-light);  color: var(--danger); }

/* ---------- 今日待办 ---------- */
.wtodo { list-style: none; }
.wtodo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  transition: background var(--transition-fast);
}
.wtodo-item:last-child { border-bottom: none; }
.wtodo-item:hover { background: var(--gray-50); }
.wtodo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
  background: var(--gray-400);
}
.wtodo-dot.p1 { background: var(--danger);  box-shadow: 0 0 0 3px var(--danger-light); }
.wtodo-dot.p2 { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-light); }
.wtodo-dot.p3 { background: var(--info);    box-shadow: 0 0 0 3px var(--info-light); }
.wtodo-body { flex: 1; min-width: 0; }
.wtodo-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.wtodo-meta  { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.wtodo-act {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  align-self: center;
}
.wtodo-act:hover { color: var(--primary-dark); }
.wtodo-empty { padding: 22px; text-align: center; color: var(--gray-500); font-size: 13px; }

/* ---------- 进行中活动 ---------- */
.wact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.wact {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--white);
  transition: var(--transition);
}
.wact:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.wact-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.wact-meta  { font-size: 12px; color: var(--gray-500); margin-bottom: 10px; }
.wact-nums  { display: flex; align-items: baseline; gap: 6px; font-size: 20px; font-weight: 700; }
.wact-nums small { font-size: 12px; font-weight: 500; color: var(--gray-500); }

/* ---------- 趋势图范围切换 ---------- */
.wseg { display: inline-flex; background: var(--gray-100); border-radius: 8px; padding: 2px; gap: 2px; }
.wseg button {
  border: none; background: transparent;
  font-size: 12px; font-weight: 600; color: var(--gray-600);
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.wseg button:hover { color: var(--gray-900); }
.wseg button.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-xs); }

/* ---------- 图表 Tab 收纳 ---------- */
.wtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 16px; flex-wrap: wrap; }
.wtabs button {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  padding: 8px 14px; border-bottom: 2px solid transparent;
  font-family: inherit; transition: var(--transition-fast);
}
.wtabs button:hover { color: var(--gray-900); }
.wtabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.wpanel { display: none; }
.wpanel.active { display: block; }

/* ---------- 数据新鲜度 ---------- */
.wfresh {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--gray-500);
  padding: 8px 16px; border-top: 1px solid var(--gray-200);
}
.wfresh .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .wkpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wkpi { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .wkpi-value { font-size: 26px; }
  .wtodo-item { padding: 12px; }
}

/* ============================================================
   SAMS 2.0 设计令牌与组件样式
   类名体系：.sb (sidebar-v2) / .topbar / .kpi / .panel / .rank / .todo / .live / .tabs
   ============================================================ */

/* ---------- 1. 新设计令牌 ---------- */
:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --blue-50: #eef4fe;
  --blue-100: #dbe8fd;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --ink-4: #cbd5e1;
  --line: #e6eaf0;
  --bg: #f6f8fb;
  --card: #ffffff;
  --green: #12b76a;
  --green-50: #e9f9f1;
  --amber: #f79009;
  --amber-50: #fff6e8;
  --red: #f04438;
  --red-50: #feecea;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 16px rgba(16, 24, 40, .05);
}

/* ---------- 2. 新版侧边栏 (.sb 体系) ---------- */
.sb {
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding-bottom: 14px;
  width: 232px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
}

.sb-logo .mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.sb-logo .mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sb-logo .txt strong {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -.2px;
  line-height: 1.25;
  color: var(--ink);
}

.sb-logo .txt span {
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .4px;
}

.sb-group {
  padding: 6px 10px 0;
}

.sb-group .lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 1px;
  padding: 12px 10px 6px;
  text-transform: uppercase;
}

.navi {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
  margin-left: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.navi svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
  color: var(--ink-3);
  flex-shrink: 0;
}

.navi:hover {
  background: var(--bg);
  color: var(--ink);
}

.navi:hover svg {
  color: var(--ink-2);
}

.navi.active {
  background: var(--blue-50);
  color: var(--blue);
  font-weight: 700;
}

.navi.active svg {
  color: var(--blue);
}

.navi.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

.navi .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.navi .badge.soft {
  background: var(--blue-100);
  color: var(--blue-dark);
}

.sb-user {
  margin: auto 12px 0;
  padding: 10px 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 14px;
}

.sb-user .av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #6aa1f5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sb-user .nm {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

.sb-user .rl {
  font-size: 10.5px;
  color: var(--ink-3);
}

/* ---------- 3. 新版顶部栏 (.topbar) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  border-bottom: 1px solid var(--line);
  margin: 0 -28px 22px;
  padding: 0 28px;
  background: var(--card);
}

.crumb {
  font-size: 12px;
  color: var(--ink-3);
}

.crumb b {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  display: block;
  letter-spacing: -.2px;
  line-height: 1.3;
}

.search {
  margin-left: auto;
  width: 250px;
  height: 34px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.search svg {
  width: 14px;
  height: 14px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--ink-4);
  background: var(--bg);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
}

.icon-btn .dotbadge {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}

.btn-primary {
  height: 34px;
  padding: 0 15px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  border: none;
  font-size: 12.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(26, 115, 232, .28);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(26, 115, 232, .35);
  color: #fff;
}

.btn-primary svg {
  width: 14px;
  height: 14px;
}

/* ---------- 4. 新版 KPI 卡片 (.kpis / .kpi) ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 17px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi:hover {
  box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 10px 24px rgba(16, 24, 40, .08);
  transform: translateY(-1px);
}

.kpi .k-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi .k-lbl {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
}

.kpi .k-ico {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi .k-ico svg {
  width: 14px;
  height: 14px;
}

.ico-blue {
  background: var(--blue-50);
  color: var(--blue);
}

.ico-green {
  background: var(--green-50);
  color: var(--green);
}

.ico-amber {
  background: var(--amber-50);
  color: var(--amber);
}

.ico-red {
  background: var(--red-50);
  color: var(--red);
}

.kpi .k-num {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--ink);
}

.kpi .k-num small {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0;
}

.kpi .k-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
}

.trend.up {
  background: var(--green-50);
  color: var(--green);
}

.trend.down {
  background: var(--red-50);
  color: var(--red);
}

/* ---------- 5. 新版面板/卡片 (.panel) ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-h {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: -.1px;
  color: var(--ink);
}

.panel-h .sub {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 2px;
}

.panel-h .right {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-b {
  padding: 14px 17px;
}

.panel-b.flush {
  padding: 0;
}

/* ---------- 6. 排行榜样式 (.rank-wrap / .rtable) ---------- */
.rank-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.rank-col {
  padding: 14px 17px;
}

.rank-col + .rank-col {
  border-left: 1px solid var(--line);
}

.rank-t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 10px;
  color: var(--ink);
}

.rank-t .pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.pill-g {
  background: var(--green-50);
  color: var(--green);
}

.pill-r {
  background: var(--red-50);
  color: var(--red);
}

.rtable {
  width: 100%;
  border-collapse: collapse;
}

.rtable th {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  letter-spacing: .3px;
}

.rtable th:last-child,
.rtable td:last-child {
  text-align: right;
}

.rtable td {
  font-size: 12.2px;
  padding: 8px;
  border-bottom: 1px solid #f4f6fa;
  color: var(--ink);
}

.rtable tr:last-child td {
  border-bottom: none;
}

.rtable .rk {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  background: #f1f4f9;
  color: var(--ink-2);
}

.rtable tr:nth-child(1) .rk {
  background: #fff4d6;
  color: #b45309;
}

.rtable tr:nth-child(2) .rk {
  background: #eef2f7;
  color: #475569;
}

.rtable tr:nth-child(3) .rk {
  background: #fdf0e7;
  color: #b45309;
}

.rate-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.mini-bar {
  width: 52px;
  height: 5px;
  background: #eef2f7;
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
}

.pct {
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  width: 44px;
  text-align: right;
}

.pct.g {
  color: #0d9c5b;
}

.pct.a {
  color: #d97706;
}

.pct.r {
  color: #dc3a30;
}

.dim {
  color: var(--ink-3);
  font-size: 11.5px;
}

/* ---------- 7. 待办列表 (.todo) ---------- */
.todo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid #f1f4f9;
}

.todo:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.todo .ti {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.todo .ti svg {
  width: 15px;
  height: 15px;
}

.todo .tt {
  font-size: 12.8px;
  font-weight: 650;
  line-height: 1.4;
  color: var(--ink);
}

.todo .ts {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 1px;
}

.todo .go {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
  text-decoration: none;
}

.todo .go:hover {
  color: var(--blue-dark);
}

/* ---------- 8. 进行中活动 (.live) ---------- */
.live {
  padding: 12px 0;
  border-bottom: 1px solid #f1f4f9;
}

.live:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.live .lt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.8px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--ink);
}

.live .lt .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-50);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 3px var(--green-50);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(18, 183, 106, .2);
  }
}

.live .lm {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 7px;
}

.bar {
  height: 6px;
  background: #eef2f7;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.bar .fill-b {
  background: linear-gradient(90deg, #1a73e8, #4f8df7);
}

.bar .fill-g {
  background: linear-gradient(90deg, #12b76a, #39cf88);
}

.bar .fill-a {
  background: linear-gradient(90deg, #f79009, #fdb022);
}

.live .lf {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 5px;
}

/* ---------- 9. Tab 切换 (.tabs) ---------- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  padding: 3px;
  border-radius: 8px;
}

.tabs span {
  font-size: 11.5px;
  padding: 4px 11px;
  border-radius: 6px;
  color: var(--ink-2);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tabs span:hover {
  color: var(--ink);
}

.tabs span.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

/* ---------- 响应式：新组件 ---------- */
@media (max-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kpis {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .kpi .k-num {
    font-size: 24px;
  }
  .rank-wrap {
    grid-template-columns: 1fr;
  }
  .rank-col + .rank-col {
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 10px;
  }
  .search {
    width: 100%;
    margin-left: 0;
    order: 3;
  }
}
