/* ═══════════════════════════════════════════════════════
   CTB Realty — Agent Leaderboard Page
   ═══════════════════════════════════════════════════════ */

.lb-body { padding: 28px 28px 40px; max-width: 1440px; margin: 0 auto; }

/* ── KPI Strip ── */
.lb-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.lb-kpi-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex; flex-direction: column;
}
.lb-kpi-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.lb-kpi-label { font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.lb-kpi-icon {
  width: 30px; height: 30px; border-radius: 8px; background: rgba(99,91,255,0.08); color: #635bff;
  display: flex; align-items: center; justify-content: center;
}
.lb-kpi-icon svg { width: 14px; height: 14px; }
.lb-kpi-value { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; margin-bottom: 4px; line-height: 1; }
.lb-kpi-sub { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

/* ── Charts Row ── */
.lb-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.lb-chart-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden;
}
.lb-card-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: flex-start; }
.lb-card-title { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.lb-card-sub { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.lb-chart-wrap { padding: 16px 20px 20px; height: 240px; }

/* ── Rankings Table ── */
.lb-table-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; margin-bottom: 24px;
}
.lb-table-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  text-align: left; padding: 10px 16px; font-size: 9px; font-weight: 700;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border); background: var(--bg); white-space: nowrap;
}
.lb-table th:not(:first-child):not(:nth-child(2)):not(:last-child) { text-align: right; }
.lb-table td { padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-row:hover td { background: rgba(99,91,255,0.02); }

.lb-rank-cell { font-size: 18px; width: 28px; text-align: center; }
.lb-rank-num { font-size: 12px; font-weight: 700; color: var(--ink-faint); }

.lb-agent-cell { display: flex; align-items: center; gap: 10px; }
.lb-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.lb-agent-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.lb-agent-code { font-size: 9px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px; }

.lb-gci { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.lb-target-bar { height: 3px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-bottom: 3px; width: 120px; }
.lb-target-fill { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.lb-target-pct { font-size: 9px; font-weight: 600; }

.lb-num-cell { text-align: right; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.lb-last-close { font-size: 11px; font-weight: 500; color: var(--ink-muted); }
.lb-score { font-size: 14px; font-weight: 800; text-align: right; }

/* ── Activity Metrics ── */
.lb-activity-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.lb-act-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); text-align: center;
}
.lb-act-value { font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; margin-bottom: 4px; }
.lb-act-label { font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.lb-act-trend { font-size: 10px; font-weight: 600; color: var(--emerald); margin-top: 6px; }

/* ── Badge chip in table head ── */
.lb-fresh-badge { font-size: 10px; font-weight: 600; color: var(--ink-muted); background: var(--bg); border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px; }

/* ── Score legend ── */
.lb-score-legend { display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg); }
.lb-score-legend-item { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; color: var(--ink-muted); }
.lb-score-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Dark Mode ── */
[data-theme="dark"] .lb-kpi-card,
[data-theme="dark"] .lb-chart-card,
[data-theme="dark"] .lb-table-card,
[data-theme="dark"] .lb-act-card { background: var(--surface); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .lb-charts-row { grid-template-columns: 1fr; }
  .lb-activity-row { grid-template-columns: 1fr 1fr; }
  .lb-kpi-row { grid-template-columns: 1fr 1fr; }
  .lb-table-wrap { overflow-x: auto; }
}
@media (max-width: 768px) {
  /* Hide less critical columns in leaderboard rankings for small screens */
  .lb-table th:nth-child(5), .lb-table td:nth-child(5), /* Active */
  .lb-table th:nth-child(6), .lb-table td:nth-child(6), /* Pipeline */
  .lb-table th:nth-child(7), .lb-table td:nth-child(7), /* Avg Deal */
  .lb-table th:nth-child(9), .lb-table td:nth-child(9)  /* Last Close */
  { display: none; }
  .lb-kpi-value { font-size: 20px; }
  .lb-act-value { font-size: 22px; }
}
@media (max-width: 640px) {
  .lb-kpi-row { grid-template-columns: 1fr; }
  .lb-activity-row { grid-template-columns: 1fr; }
  .lb-body { padding: 16px; }
}
