:root {
  --performance-blue: #1d4ed8;
  --performance-green: #087a55;
  --performance-amber: #c07a06;
  --performance-red: #c2414b;
  --performance-ink: #172033;
  --performance-muted: #64748b;
  --performance-line: #d9e0ea;
}

.performance-body {
  min-width: 320px;
  background: #f3f6fa;
}

.performance-header {
  min-height: 78px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid var(--performance-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.performance-brand,
.performance-header-actions,
.performance-dialog-head,
.setting-section-head,
.performance-sync-section,
.team-progress-head,
.leaderboard-head {
  display: flex;
  align-items: center;
}

.performance-brand {
  gap: 14px;
}

.performance-brand img {
  width: 96px;
  height: 56px;
  object-fit: contain;
  border: 1px solid #edf0f4;
  border-radius: 6px;
}

.performance-brand h1,
.performance-brand p,
.leaderboard-head h2,
.leaderboard-head p,
.team-progress-head h2,
.team-progress-head p,
.performance-dialog h2,
.performance-dialog h3,
.performance-dialog p {
  margin: 0;
}

.performance-brand h1 {
  color: var(--performance-ink);
  font-size: 24px;
}

.performance-brand p,
.leaderboard-head p,
.team-progress-head p,
.performance-dialog p {
  margin-top: 4px;
  color: var(--performance-muted);
  font-size: 13px;
}

.performance-header-actions {
  justify-content: flex-end;
  gap: 10px;
  color: var(--performance-muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.sync-status {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid #b8dfcc;
  border-radius: 999px;
  color: var(--performance-green);
  background: #edf9f3;
  white-space: nowrap;
}

.sync-status.empty {
  color: #8a5b08;
  background: #fff8e8;
  border-color: #ead7a7;
}

.performance-page {
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.performance-hero {
  min-height: 164px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  border-radius: 0;
  background-image: url("/performance-bg.jpg");
  background-size: cover;
  background-position: center 48%;
  color: #fff;
  display: flex;
  align-items: flex-end;
}

.performance-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 17, 32, 0.48);
}

.performance-hero-content {
  position: relative;
  z-index: 1;
  padding: 24px 28px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.performance-hero-content p,
.performance-hero-content h2 {
  margin: 0;
}

.performance-hero-content p {
  font-size: 13px;
  font-weight: 700;
}

.performance-hero-content h2 {
  margin-top: 5px;
  font-size: 26px;
}

.performance-hero-content strong,
.performance-hero-content span {
  display: block;
}

.performance-hero-content strong {
  margin-top: 7px;
  font-size: 21px;
}

.performance-hero-content span {
  margin-top: 5px;
  font-size: 13px;
}

.performance-controls {
  min-height: 74px;
  padding: 12px;
  background: #fff;
  border-block: 1px solid var(--performance-line);
  border-radius: 0;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.performance-controls > label {
  width: 240px;
}

.performance-controls > .performance-quarter-select {
  width: 220px;
  max-width: 100%;
}

.performance-controls > .performance-month-select {
  width: 140px;
  max-width: 100%;
}

.performance-controls label span,
.performance-range span {
  color: var(--performance-muted);
  font-size: 12px;
}

.performance-periods {
  min-height: 42px;
  display: inline-flex;
  border: 1px solid #cfd7e3;
  border-radius: 6px;
  overflow: hidden;
}

.performance-periods button {
  min-width: 76px;
  border: 0;
  border-right: 1px solid #cfd7e3;
  background: #fff;
  color: #344054;
  padding: 9px 13px;
}

.performance-periods button:last-child {
  border-right: 0;
}

.performance-periods button.active {
  color: #fff;
  background: var(--performance-blue);
  font-weight: 700;
}

.performance-custom-dates {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.performance-custom-dates[hidden] {
  display: none;
}

.performance-custom-dates label {
  width: 150px;
}

.performance-range {
  margin-left: auto;
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: 3px;
  text-align: right;
}

.performance-range strong {
  color: var(--performance-ink);
  font-size: 14px;
}

.performance-metrics {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.performance-metrics article {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--performance-line);
  border-top: 4px solid #7890aa;
  border-radius: 8px;
  background: #fff;
  display: grid;
  align-content: center;
  gap: 7px;
}

.performance-metrics .metric-achieved { border-top-color: var(--performance-blue); }
.performance-metrics .metric-cny { border-top-color: #0f8a72; }
.performance-metrics .metric-target { border-top-color: #5b6475; }
.performance-metrics .metric-rate { border-top-color: var(--performance-green); }
.performance-metrics .metric-remaining { border-top-color: var(--performance-red); }
.performance-metrics .metric-days { border-top-color: var(--performance-amber); }

.performance-metrics span,
.performance-metrics small {
  color: var(--performance-muted);
  font-size: 13px;
}

.performance-metrics strong {
  color: var(--performance-ink);
  font-size: 28px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.team-progress-panel,
.leaderboard-panel {
  margin-top: 14px;
  background: #fff;
  border-block: 1px solid var(--performance-line);
  border-radius: 0;
}

.performance-body [hidden] { display: none !important; }
.leaderboard-filters { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.leaderboard-filters label { min-width: 160px; }
.leaderboard-filters span { color: var(--performance-muted); font-size: 12px; }
.visibility-only { grid-template-columns: minmax(0, 1fr) 84px; }
.performance-body input[readonly] { background: transparent; border-color: transparent; }
.sync-status { white-space: normal; overflow-wrap: anywhere; }

.team-progress-panel {
  padding: 16px;
}

.team-progress-head,
.leaderboard-head,
.performance-dialog-head,
.setting-section-head,
.performance-sync-section {
  justify-content: space-between;
  gap: 16px;
}

.team-progress-head h2,
.leaderboard-head h2 {
  color: var(--performance-ink);
  font-size: 17px;
}

.team-progress-head > strong {
  color: var(--performance-green);
  font-size: 24px;
}

.team-progress-track {
  height: 16px;
  margin-top: 14px;
  overflow: hidden;
  background: #e8edf4;
  border-radius: 4px;
}

.team-progress-track > div {
  width: 0;
  height: 100%;
  background: var(--performance-green);
  transition: width 300ms ease;
}

.campaign-time-progress {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--performance-line);
}

.campaign-time-progress .team-progress-head > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.campaign-time-progress .team-progress-head > strong {
  flex-shrink: 0;
  color: var(--performance-amber);
  font-variant-numeric: tabular-nums;
}

.campaign-time-progress .team-progress-track > div {
  background: var(--performance-amber);
}

.time-progress-dates {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--performance-muted);
  font-size: 12px;
}

.leaderboard-head {
  min-height: 66px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--performance-line);
}

.leaderboard-head > span {
  color: var(--performance-muted);
  font-size: 13px;
}

.leaderboard-table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 14px 15px;
  border-bottom: 1px solid #e5eaf1;
  text-align: left;
  white-space: nowrap;
}

.leaderboard-table th {
  color: #526174;
  background: #f7f9fc;
  font-size: 13px;
  font-weight: 700;
}

.leaderboard-table td {
  color: var(--performance-ink);
  font-size: 14px;
}

.leaderboard-table tr:last-child td {
  border-bottom: 0;
}

.rank-number {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #4b5b70;
  background: #eef2f7;
  font-weight: 800;
}

.rank-number.top-1 { color: #744b00; background: #fff1ba; }
.rank-number.top-2 { color: #415168; background: #e8edf4; }
.rank-number.top-3 { color: #87431f; background: #f7dfd1; }

.salesperson-cell strong {
  display: block;
  font-size: 15px;
}

.salesperson-cell small {
  display: block;
  margin-top: 3px;
  color: var(--performance-muted);
}

.performance-amount-cell strong,
.performance-amount-cell small {
  display: block;
}

.performance-amount-cell small {
  margin-top: 4px;
  color: var(--performance-green);
  font-size: 12px;
  font-weight: 700;
}

.row-progress {
  width: 210px;
}

.row-progress-track {
  height: 9px;
  border-radius: 3px;
  background: #e8edf4;
  overflow: hidden;
}

.row-progress-track > div {
  height: 100%;
  background: var(--performance-blue);
}

.row-progress > span {
  display: block;
  margin-top: 5px;
  color: var(--performance-muted);
  font-size: 12px;
}

.performance-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid #c9d3df;
  border-radius: 999px;
  color: #526174;
  background: #f7f9fc;
  font-size: 12px;
}

.performance-status.done {
  color: var(--performance-green);
  background: #edf9f3;
  border-color: #b8dfcc;
}

.performance-status.active {
  color: var(--performance-blue);
  background: #edf4ff;
  border-color: #bfd2fa;
}

.performance-empty {
  padding: 34px;
  color: var(--performance-muted);
  text-align: center;
}

.performance-dialog {
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 44px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28);
}

.performance-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.performance-dialog form {
  padding: 20px;
  max-height: calc(100vh - 44px);
  overflow-y: auto;
}

.performance-dialog-head {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--performance-line);
}

.performance-dialog h2 { font-size: 20px; }
.performance-dialog h3 { font-size: 15px; }

.performance-setting-section {
  padding: 17px 0;
  border-bottom: 1px solid var(--performance-line);
}

.campaign-form-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.2fr 160px 160px;
  gap: 10px;
  align-items: end;
}

.campaign-url-field {
  grid-column: 1 / 3;
}

.member-editor-head,
.member-editor-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) minmax(130px, 1fr) 84px 64px 44px;
  gap: 10px;
  align-items: center;
}

.member-editor-head {
  margin-top: 13px;
  padding: 0 8px 7px;
  color: var(--performance-muted);
  font-size: 12px;
}

.member-editor-row {
  padding: 8px;
  border-top: 1px solid #e7ebf1;
}

.member-visible-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-visible-toggle input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.member-remove-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #efc2c7;
  border-radius: 6px;
  color: var(--performance-red);
  background: #fff;
}

.target-amount-cell strong,
.target-amount-cell small {
  display: block;
  white-space: nowrap;
}

.target-amount-cell small {
  margin-top: 3px;
  color: var(--performance-muted);
  font-size: 11px;
}

.performance-import-btn {
  flex: 0 0 auto;
}

.performance-sync-dialog {
  width: min(700px, calc(100% - 32px));
}

.sync-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.sync-editor-head,
.sync-editor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
}

.sync-editor-head {
  padding: 0 8px 7px;
  color: var(--performance-muted);
  font-size: 12px;
}

.sync-editor-row {
  padding: 8px;
  border-top: 1px solid #e7ebf1;
}

.sync-editor-row > span {
  color: var(--performance-ink);
  font-weight: 700;
}

.performance-dialog-actions {
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

@media (max-width: 1100px) {
  .performance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-range { margin-left: 0; text-align: left; }
  .performance-header { align-items: flex-start; }
  .performance-header-actions { max-width: 62%; }
}

@media (max-width: 720px) {
  .performance-header { position: static; padding: 10px 14px; flex-direction: column; }
  .performance-header-actions { max-width: none; justify-content: flex-start; }
  .performance-page { padding: 14px; }
  .performance-hero { min-height: 164px; background-position: center; }
  .performance-hero-content { padding: 18px; }
  .performance-hero-content h2 { font-size: 28px; }
  .performance-controls { align-items: stretch; }
  .leaderboard-head { align-items: flex-start; flex-direction: column; }
  .performance-controls > label { width: 100%; }
  .performance-periods { width: 100%; overflow-x: auto; }
  .performance-periods button { flex: 1 0 76px; }
  .performance-custom-dates { width: 100%; flex-wrap: wrap; }
  .performance-custom-dates label { flex: 1 1 140px; }
  .performance-metrics { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
  .performance-metrics article { min-height: 104px; }
  .performance-metrics strong { font-size: 22px; }
  .campaign-form-grid { grid-template-columns: 1fr; }
  .campaign-url-field { grid-column: auto; }
  .member-editor-head { display: none; }
  .member-editor-row { grid-template-columns: minmax(100px, 1fr) 76px 48px 38px; gap: 6px; }
  .member-editor-row [data-member-field="name"] { grid-column: 1 / -1; }
  .member-editor-row.visibility-only { grid-template-columns: minmax(0, 1fr) 64px; }
  .member-editor-row.visibility-only [data-member-field="name"] { grid-column: auto; }
  .sync-period-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .performance-metrics { grid-template-columns: 1fr; }
  .performance-brand img { width: 74px; height: 46px; }
  .performance-brand h1 { font-size: 21px; }
}
