:root {
  --sidebar-w: 240px;
  --sidebar-bg: #1e2a44;
  --sidebar-active: #2f4a8f;
  --primary: #2f6bff;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f3f5f9; color: #212529; font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #dbe4f5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .2s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-toggle {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #cdd8ee;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo.large { width: 52px; height: 52px; font-size: 18px; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; opacity: .65; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #cdd8ee;
  text-decoration: none;
  font-size: 14px;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: none;
  cursor: pointer;
  padding: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-link { font-size: 12px; color: #9fb4dd; text-decoration: none; }
.logout-link:hover { color: #fff; text-decoration: underline; }

/* 侧边栏折叠态 */
.app-shell.sidebar-collapsed .sidebar { width: 64px; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 18px 8px; }
.app-shell.sidebar-collapsed .brand-title,
.app-shell.sidebar-collapsed .brand-sub,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .user-meta { display: none; }
.app-shell.sidebar-collapsed .sidebar-toggle { display: none; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.app-shell.sidebar-collapsed .nav-icon { width: auto; font-size: 18px; }
.app-shell.sidebar-collapsed .sidebar-user { justify-content: center; padding: 14px 8px; }
.app-shell.sidebar-collapsed .logout-link { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e8ef;
  position: sticky;
  top: 0;
  z-index: 100;
}
.page-title { font-size: 18px; font-weight: 700; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 20px 24px 32px; }

.btn-expand-sidebar {
  display: none;
  background: transparent;
  border: 1px solid #e5e8ef;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 15px;
  line-height: 1.5;
  color: #374151;
  cursor: pointer;
}
.btn-expand-sidebar:hover { background: #f3f5f9; }
.app-shell.sidebar-collapsed .btn-expand-sidebar { display: inline-flex; }

.chart-card .chart { height: 280px; }
.chart-card .chart.tall { height: 340px; }
.chart { width: 100%; }

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(16,24,40,.08);
  display: flex;
  align-items: center;
  gap: 14px;
}
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.kpi-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: 12px; color: #6b7280; }

.grade-S { background: #f5c518; color: #333; }
.grade-A { background: #2ecc71; color: #fff; }
.grade-B { background: #3b82f6; color: #fff; }
.grade-C { background: #f39c12; color: #fff; }
.grade-D { background: #e74c3c; color: #fff; }

.row-skip { background-color: #ffe5e5 !important; }
.row-pip { background-color: #fff3cd !important; }
.flag-skip { color: #dc3545; font-weight: 700; }
.flag-pip { color: #e67e22; font-weight: 700; }

.org-tree ul { list-style: none; padding-left: 16px; margin: 4px 0; }
.org-tree li { margin: 3px 0; }
.org-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  text-decoration: none;
}
.org-node:hover { background: #eef2ff; }
.org-node.selected { background: #dbe6ff; font-weight: 600; }
.org-node .count { color: #6b7280; font-size: 12px; }
.caret { transition: transform .15s; display: inline-block; }
.caret.open { transform: rotate(90deg); }

#toast-area { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  min-width: 240px;
  max-width: 380px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: slideIn .2s ease;
}
.toast-item.success { background: #1f9d55; }
.toast-item.error { background: #d64545; }
.toast-item.info { background: #2b6cb0; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2a44, #2f4a8f);
}
.login-card { width: 460px; border-radius: 14px; }
.login-brand h2 { font-size: 21px; white-space: nowrap; }
.login-brand { text-align: center; margin-bottom: 8px; }
.login-brand .brand-logo { margin: 0 auto 12px; }

.table td, .table th { vertical-align: middle; }
.modal-backdrop.show { opacity: .45; }

/* 绩效配额表：固定列宽、标签列统一 */
.quota-table { table-layout: fixed; }
.quota-table th, .quota-table td { text-align: center; }
.quota-table th:first-child, .quota-table td:first-child { width: 72px; }
.quota-table th:last-child, .quota-table td:last-child { width: 92px; }
