/* Manager tools: the leaderboard (Dialer + Team page), the Team page, lead assignment on the
   Leads page and the deal owner on a lead's Deal section. (app/static/js/team-board.js, pages/team.js) */

/* ---------- leaderboard ---------- */
.lb-card { margin-bottom: 1rem; }
.lb-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.lb-head h2 { margin: 0; }
.lb-head .chip-group { margin: 0; }
.lb-body .table-wrap { margin-top: 0.7rem; }
.lb-table { width: 100%; min-width: 640px; }
.lb-table.lb-compact { min-width: 0; }
.lb-table td, .lb-table th { padding: 0.5rem 0.75rem; white-space: nowrap; }
.lb-table th:nth-child(n+3), .lb-n { text-align: right; font-variant-numeric: tabular-nums; }
.lb-rank { width: 2.2rem; color: var(--muted); font-weight: 700; }
.lb-name { font-weight: 600; }
.lb-me td { background: var(--accent-weak); }
.lb-foot { margin: 0.6rem 0 0; }
.lb-card-compact .lb-table td, .lb-card-compact .lb-table th { padding: 0.4rem 0.6rem; }

/* ---------- Team page ---------- */
.tm-section { margin-bottom: 1rem; }
.tm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.tm-head h2 { margin: 0; }
.tm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tm-tools input[type="month"], .tm-tools select { padding: 0.3rem 0.5rem; color-scheme: dark; }
.tm-table { width: 100%; min-width: 720px; }
.tm-table tfoot td { border-top: 1px solid var(--border-strong); padding-top: 0.6rem; }
.tm-n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-actions { text-align: right; white-space: nowrap; }
.tm-mine { margin-top: 0.7rem; }
.tm-history { margin-top: 0.8rem; }
.tm-rule { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.9rem; margin-top: 0.7rem; }
.tm-rule h3, .tm-own h3 { flex: 1 0 100%; margin: 0.4rem 0 0; font-size: 0.95rem; }
.tm-rule-fields { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; }
.tm-rule-fields .dl-field input { width: 7.5rem; }
.tm-months input { width: 5rem; }
.tm-own { margin-top: 1rem; }
.tm-own-list { margin: 0.4rem 0; padding-left: 1.1rem; }
.tm-own-list li { margin: 0.25rem 0; }
.tm-rec-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.tm-rec { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; }
.tm-rec-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; margin-bottom: 0.4rem; }
.tm-rec audio { width: 100%; max-width: 520px; height: 36px; }
.tm-settings { display: grid; gap: 0.7rem; margin-top: 0.6rem; max-width: 760px; }
.tm-keep input { width: 6rem; }
.tm-gdpr { margin: 0; }

/* ---------- Leads page: assigning leads ---------- */
.lead-pick { margin-right: 0.45rem; vertical-align: middle; }
.lead-assign { margin: -0.3rem 0 0.8rem; }
.lead-assign-box summary { cursor: pointer; font-weight: 600; color: var(--text-soft); }
.lead-assign-box[open] { padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 10px; }
.lead-assign-people { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.5rem 0; }
.lead-assign-person, .lead-assign-only { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; }
.lead-assign-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }

/* ---------- a lead's deal: who it is credited to ---------- */
.dl-owner { margin-top: 0.4rem; }
.dl-owner-pick { display: inline-flex; align-items: center; gap: 0.4rem; }
.dl-owner-pick select { padding: 0.2rem 0.4rem; font-size: 0.82rem; max-width: 15rem; }

@media (max-width: 640px) {
  .tm-rule-fields .dl-field input { width: 100%; }
  .tm-rule-fields .dl-field { flex: 1 1 calc(50% - 0.9rem); }
}
/* The Dialer's compact board fits a phone without sideways scrolling: long names wrap. */
.lb-compact .lb-name { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 560px) { .lb-card-compact .lb-table td, .lb-card-compact .lb-table th { padding: 0.4rem 0.35rem; } }
