:root {
  --ink: #21112f;
  --muted: #7d7488;
  --line: #e8e2ee;
  --bg: #f7f4fa;
  --panel: #ffffff;
  --purple: #6f35a5;
  --purple-dark: #24103d;
  --green: #1f9d70;
  --red: #c24141;
  --gold: #c88719;
  --teal: #167d84;
  --coral: #d25b45;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: #f3f5f7;
  border-top: 8px solid var(--purple-dark);
}
.login-card {
  width: min(440px, 100%);
  background: white;
  border: 1px solid #e2e5e9;
  border-radius: 10px;
  padding: 34px;
  box-shadow: 0 22px 60px rgba(28, 20, 36, .12);
}
.brand-row { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-mark { width: 52px; height: 52px; border-radius: 12px; background: #f4edf9; display: grid; place-items: center; font-weight: 900; font-size: 30px; color: var(--purple-dark); }
.brand-row strong { display: block; font-size: 22px; }
.brand-row small { color: var(--muted); }
.login-heading { padding-top: 22px; border-top: 1px solid var(--line); }
.login-heading h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
.login-heading p { margin: 8px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.login-alert { margin-bottom: 16px; padding: 11px 12px; border-left: 4px solid var(--red); background: #fff5f5; color: #9f2929; font-size: 13px; line-height: 1.55; }
.wecom-button {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border-radius: 8px;
  color: white;
  background: #16865b;
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(22, 134, 91, .2);
}
.wecom-button:hover { background: #11764f; }
.wecom-button:focus-visible { outline: 3px solid rgba(22, 134, 91, .24); outline-offset: 3px; }
.qr-login-icon { width: 20px; height: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.qr-login-icon i { display: block; border: 2px solid currentColor; }
.qr-login-icon i:last-child { border-width: 0 2px 2px 0; }
.auth-pending { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 5px; }
.auth-pending strong { font-size: 15px; }
.auth-pending span { color: var(--muted); font-size: 13px; }
.login-card label { display: block; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.login-card select, .login-card input, .login-card button { width: 100%; border-radius: 8px; padding: 12px 14px; }
.login-card select, .login-card input { border: 1px solid var(--line); background: white; color: var(--ink); }
.login-card input:focus, .login-card select:focus { outline: 2px solid rgba(111, 53, 165, .18); border-color: var(--purple); }
.primary-button { border: 0; color: white; background: var(--purple); font-weight: 800; box-shadow: 0 10px 22px rgba(111, 53, 165, .25); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.login-card .primary-button { margin-top: 14px; }
.login-note { margin-top: 14px; color: var(--muted); line-height: 1.65; font-size: 12px; text-align: center; }
.emergency-login, .dev-login { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.emergency-login summary, .dev-login summary { color: var(--muted); font-size: 12px; cursor: pointer; text-align: center; }
.emergency-login-fields, .dev-login-fields { display: grid; margin-top: 14px; }
.emergency-login-fields label { margin-top: 10px; }
.emergency-login-fields label:first-of-type { margin-top: 0; }
.emergency-login-fields .ghost-button, .dev-login-fields .ghost-button { margin-top: 12px; }
.field-error { margin-bottom: 12px; color: var(--red); font-size: 12px; line-height: 1.5; }
.login-security { margin-top: 22px; color: #8a9098; text-align: center; font-size: 11px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: var(--purple-dark); color: white; padding: 24px 14px; display: flex; flex-direction: column; }
.sidebar .brand-row { padding: 0 8px; margin-bottom: 34px; }
.sidebar .brand-mark { background: white; }
.sidebar small { color: rgba(255,255,255,.62); }
.nav { display: grid; gap: 8px; }
.nav button {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.68);
  text-align: left;
  border-radius: 8px;
  padding: 13px 14px;
  font-weight: 800;
}
.nav button.active { background: white; color: var(--purple-dark); }
.sidebar-foot { margin-top: auto; color: rgba(255,255,255,.62); font-size: 12px; padding: 12px; line-height: 1.6; }
.main { min-width: 0; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: white;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-info { display: flex; gap: 22px; align-items: center; }
.topbar-info span { color: var(--muted); font-size: 13px; display: block; }
.topbar-info strong { font-size: 15px; }
.user-pill { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--purple); color: white; display: grid; place-items: center; font-weight: 900; }
.ghost-button { border: 1px solid var(--line); color: var(--ink); background: white; border-radius: 8px; padding: 9px 12px; }
.content { padding: 32px; }
.page-title { margin-bottom: 24px; }
.eyebrow { color: var(--purple); letter-spacing: 2px; font-weight: 900; font-size: 13px; }
.page-title h1 { margin: 8px 0; font-size: 36px; }
.page-title p { margin: 0; color: var(--muted); font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card, .panel { background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(40, 16, 61, .05); }
.card { padding: 18px; min-height: 124px; }
.card span { color: var(--muted); font-weight: 800; font-size: 13px; }
.card strong { display: block; margin-top: 12px; font-size: 26px; }
.card small { display: block; margin-top: 8px; color: var(--muted); }
.progress { height: 8px; background: #eee7f4; border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress i { display: block; height: 100%; width: 0; background: var(--purple); }
.progress.green i { background: var(--green); }
.progress.gold i { background: var(--gold); }
.panel { padding: 18px; margin-bottom: 18px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 18px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 8px 12px; color: var(--ink); }
.tabs button.active { background: var(--purple); color: white; border-color: var(--purple); }
.tips { display: grid; gap: 8px; }
.tip { padding: 10px 12px; border-radius: 8px; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; font-weight: 700; }
.tip-button { width: 100%; text-align: left; display: grid; gap: 4px; }
.tip-button strong { font-size: 15px; }
.tip-button span { color: #b45309; font-size: 12px; }
.tip-button:not(:disabled):hover { background: #ffedd5; border-color: #fdba74; }
.tip-button:disabled { cursor: not-allowed; opacity: .72; }
.filter-panel { padding: 16px 18px; }
.filter-grid { display: grid; grid-template-columns: 160px 160px 160px minmax(220px, 1fr) 180px auto; gap: 12px; align-items: end; }
.filter-grid label { display: grid; gap: 7px; color: var(--muted); font-weight: 800; font-size: 12px; }
.filter-grid select,
.filter-grid input { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: white; color: var(--ink); }
.search-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.search-field .ghost-button { height: 40px; padding: 0 14px; border-radius: 8px; white-space: nowrap; }
.table-search-field { min-width: min(520px, 100%); flex: 1 1 420px; }
.filter-grid .check-row { display: flex; align-items: center; gap: 8px; height: 40px; color: var(--ink); white-space: nowrap; }
.filter-grid .check-row input { width: 16px; height: 16px; }
.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 8px; }
.table-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: -2px 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf9fd;
}
.table-filter-bar input[type="text"],
.table-filter-bar .table-filter-keyword,
.table-filter-bar select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}
.table-filter-keyword { min-width: 0; width: 100%; }
.table-filter-bar label { display: flex; align-items: center; gap: 6px; color: #594764; font-weight: 800; font-size: 13px; }
.table-filter-bar input[type="checkbox"] { width: 16px; height: 16px; }
.table-filter-bar .ghost-button { height: 36px; padding: 0 12px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; background: white; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: 13px; }
th { position: sticky; top: 0; background: #fbf9fd; z-index: 1; color: #594764; }
.link-button { border: 0; background: transparent; color: var(--purple); padding: 0; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
.map-frame { width: 100%; height: calc(100vh - 180px); min-height: 620px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.forbidden { padding: 30px; border-radius: 10px; background: white; border: 1px solid var(--line); color: var(--red); font-weight: 800; }
.empty { color: var(--muted); padding: 16px; }
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 34, .42);
  z-index: 30;
  display: flex;
  justify-content: flex-end;
}
.detail-panel {
  width: min(1120px, calc(100vw - 44px));
  height: 100vh;
  overflow: auto;
  background: var(--bg);
  padding: 24px;
  box-shadow: -20px 0 60px rgba(0, 0, 0, .2);
}
.detail-cards { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
.admin-cards { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.admin-actions { display: grid; grid-template-columns: 180px 180px 180px minmax(260px, 1fr); gap: 12px; align-items: center; }
.admin-actions .primary-button { height: 42px; border-radius: 8px; }
.admin-actions .ghost-button { height: 42px; border-radius: 8px; }
.admin-actions .publish { background: var(--green); }
.admin-actions input { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
.admin-message { margin-top: 14px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; border-radius: 8px; padding: 10px 12px; font-weight: 800; }
.publish-warning { margin-top: 12px; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 10px 12px; font-size: 13px; font-weight: 800; }
.preview-panel { border-color: #c7d2fe; box-shadow: 0 12px 36px rgba(67, 56, 202, .08); }
.preview-frame { min-height: 720px; }

.ranking-title-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: -32px -32px 20px;
  padding: 30px 32px;
  color: white;
  background: #24103d;
  border-bottom: 5px solid var(--gold);
}
.ranking-title-band .eyebrow { color: #e8bd64; }
.ranking-title-band h1 { margin: 8px 0; font-size: 36px; }
.ranking-title-band p { margin: 0; color: rgba(255,255,255,.72); font-weight: 700; }
.ranking-headline {
  width: 220px;
  flex: 0 0 220px;
  padding-left: 24px;
  border-left: 1px solid rgba(255,255,255,.24);
}
.ranking-headline span,
.ranking-headline small { display: block; color: rgba(255,255,255,.68); }
.ranking-headline strong { display: block; margin: 5px 0; color: #f4cc78; font-size: 24px; }
.ranking-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px; }
.segmented-control,
.metric-segments { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fbf9fd; }
.segmented-control button,
.metric-segments button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #594764;
  padding: 0 14px;
  font-weight: 800;
}
.segmented-control button:last-child,
.metric-segments button:last-child { border-right: 0; }
.segmented-control button.active { background: var(--purple-dark); color: white; }
.metric-segments button.active { background: var(--purple); color: white; }
.ranking-role-filter { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 800; }
.ranking-role-filter select { height: 38px; min-width: 150px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: white; color: var(--ink); }
.ranking-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}
.podium-card {
  position: relative;
  min-height: 176px;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--teal);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 34px rgba(40,16,61,.08);
}
.podium-card.champion { min-height: 202px; border-top-color: var(--gold); background: #fffaf0; }
.podium-card.runner-up { border-top-color: #788497; }
.podium-card.third { border-top-color: var(--coral); }
.podium-rank { color: var(--muted); font-weight: 900; font-size: 12px; }
.podium-card strong { display: block; margin-top: 16px; font-size: 22px; }
.podium-card small { display: block; margin-top: 5px; color: var(--muted); }
.podium-card b { display: block; margin-top: 18px; font-size: 30px; color: var(--purple-dark); }
.podium-card em {
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #edf8f4;
  color: #177153;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}
.ranking-list-panel { padding: 0; overflow: hidden; }
.ranking-list-panel .panel-header { padding: 18px 18px 4px; }
.ranking-count { color: var(--muted); font-size: 13px; font-weight: 800; }
.ranking-list { padding: 0 18px 12px; }
.ranking-row {
  display: grid;
  grid-template-columns: 42px minmax(170px, 1fr) minmax(140px, 1.4fr) minmax(160px, .8fr) minmax(130px, .7fr) 64px;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  border-top: 1px solid var(--line);
}
.ranking-row.top-1 { background: #fffbf1; }
.ranking-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1edf5;
  color: #594764;
  font-weight: 900;
}
.top-1 .ranking-number { background: var(--gold); color: white; }
.top-2 .ranking-number { background: #788497; color: white; }
.top-3 .ranking-number { background: var(--coral); color: white; }
.ranking-identity { min-width: 0; }
.ranking-identity strong,
.ranking-person-link { display: block; color: var(--ink); font-weight: 900; }
.ranking-person-link { border: 0; padding: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.ranking-identity small,
.ranking-result small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.ranking-track { height: 9px; overflow: hidden; border-radius: 999px; background: #eee7f4; }
.ranking-track i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.top-1 .ranking-track i { background: var(--gold); }
.ranking-result { text-align: right; }
.ranking-result strong { font-size: 18px; }
.ranking-gap { color: var(--muted); font-size: 12px; font-weight: 800; }
.ranking-tier { padding: 5px 7px; border-radius: 6px; text-align: center; background: #f1edf5; color: #594764; font-size: 12px; font-weight: 900; }
.ranking-tier.卓越,
.ranking-tier.达成 { background: #e7f7f0; color: #177153; }
.ranking-tier.冲刺 { background: #fff5dc; color: #9a6100; }
.ranking-policy {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-left: 4px solid var(--teal);
  background: white;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.ranking-policy strong { flex: 0 0 auto; color: var(--ink); }

@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .detail-cards { grid-template-columns: repeat(2, 1fr); }
  .admin-cards { grid-template-columns: repeat(2, 1fr); }
  .admin-actions { grid-template-columns: 1fr; }
  .ranking-row { grid-template-columns: 42px minmax(150px, 1fr) minmax(130px, 1fr) minmax(150px, .8fr) 64px; }
  .ranking-gap { display: none; }
}
@media (max-width: 820px) {
  .login-page { padding: 20px 14px; }
  .login-card { padding: 26px 22px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .cards { grid-template-columns: 1fr 1fr; }
  .content { padding: 20px; }
  .ranking-title-band { margin: -20px -20px 18px; padding: 24px 20px; align-items: flex-start; }
  .ranking-headline { width: auto; flex-basis: 150px; }
  .ranking-podium { grid-template-columns: 1fr; align-items: stretch; }
  .podium-card.champion { order: -1; min-height: 176px; }
  .ranking-row { grid-template-columns: 36px minmax(130px, 1fr) minmax(120px, .8fr) 58px; gap: 10px; }
  .ranking-track,
  .ranking-gap { display: none; }
  .metric-segments { width: 100%; overflow-x: auto; }
  .metric-segments button { flex: 0 0 auto; }
  .ranking-role-filter { width: 100%; margin-left: 0; }
}
