/* The Teams section of the Team page (teams-ui.js). Uses the theme colours of styles.css, so light and dark follow by themselves. */
.tm-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin: 24px 0 12px; }
.tm-head h2 { margin: 0 0 2px; font-size: 20px; }
.tm-small { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.tm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 16px; }
.tm-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; }
.tm-title { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tm-name { font: inherit; font-size: 18px; font-weight: 600; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 8px; margin-left: -8px; max-width: 22ch; min-height: 40px; }
.tm-name:hover { border-color: var(--line); background: var(--surface-2); }
.tm-name:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface-2); }
.tm-sub { margin: 0; font-size: 12px; color: var(--muted); }
.tm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tm-mgr { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tm-chip { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; white-space: nowrap; }

.tm-people { list-style: none; margin: 0; padding: 0; }
.tm-people li { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); }
.tm-people li:first-child { border-top: 0; }
.tm-people li.tm-empty { display: block; color: var(--muted); font-size: 13px; }
.tm-num { flex: none; width: 16px; text-align: right; font-size: 13px; color: var(--muted); }
.tm-person { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.tm-rm { margin-left: auto; }
.tm-join { margin-left: auto; }
.tm-join select { min-height: 40px; }

.tm-av { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.tm-av-dark { width: 36px; height: 36px; background: var(--ink); border-color: var(--ink); color: var(--surface); font-size: 13px; }

.tm-add { padding: 12px 18px; border-top: 1px solid var(--line); }
.tm-addbtn { width: 100%; justify-content: center; border-style: dashed; color: var(--accent); }
.tm-stray { background: var(--surface-2); padding: 16px 18px; }
.tm-stray h3 { margin: 0 0 3px; font-size: 16px; }
.tm-stray .tm-people li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; padding: 10px 14px; }

/* a label that is there for a screen reader but takes no room on the page */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
  .tm-top, .tm-mgr, .tm-people li { padding-left: 14px; padding-right: 14px; }
  .tm-rm, .tm-join, .tm-chip { margin-left: 0; }
  .tm-name { max-width: 100%; }
}

/* "How WhatsApp leaves this CRM" (wa-pipe-ui.js) */
.wp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 14px; }
.wp-card h3 { margin: 0 0 4px; font-size: 16px; }
.wp-small { margin: 0 0 8px; font-size: 12px; color: var(--muted); line-height: 1.55; }
.wp-bad { color: var(--status-invalid); }
.wp-ok { margin: 0; font-size: 13px; color: var(--muted); }
.wp-pipes { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.wp-pipe { flex: 1 1 240px; display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--surface-2); }
.wp-pipe.on { border-color: var(--ink); background: var(--surface); }
.wp-pipe input { margin: 2px 0 0; width: 18px; height: 18px; flex: none; }
.wp-pipe input:disabled { cursor: not-allowed; }
.wp-problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wp-problems li { font-size: 13px; line-height: 1.5; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.wp-problems li.wp-blocking { border-color: var(--status-invalid); }
.wp-starters { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.wp-starters label { display: flex; gap: 7px; align-items: center; font-size: 13px; min-height: 32px; }
.wp-test { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); margin-top: 4px; }
.wp-test b { font-size: 13px; }
.wp-testrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wp-testrow input { min-width: 200px; min-height: 40px; }

/* The team report on a senior manager's Reports tab (team-report-ui.js). Theme colours only, so night mode follows. */
.tr-sub { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.tr-periods { margin-bottom: 14px; }
.tr-dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.tr-dates input { min-height: 40px; }
.tr-tiles { margin: 0; }
.emp-card.tr-warn { border-color: var(--status-invalid); }
.emp-card.tr-warn .num { color: var(--status-invalid); }

.tr-scroll { overflow-x: auto; }
.tr-table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 13px; }
.tr-table th, .tr-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; }
.tr-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.tr-table th:first-child, .tr-table td:first-child { text-align: left; }
.tr-table td { font-variant-numeric: tabular-nums; }
.tr-table tbody tr:last-child td { border-bottom: 0; }
.tr-table tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; border-top: 1px solid var(--line); }
.tr-table td[role="button"] { cursor: pointer; color: var(--accent); font-weight: 600; }
.tr-table td[role="button"]:hover { background: var(--surface-2); }
.tr-table td.tr-zero { color: var(--muted); font-weight: 400; cursor: default; }
.tr-table td.tr-bad { color: var(--status-invalid); font-weight: 700; }
.tr-flagged td:first-child { box-shadow: inset 3px 0 0 var(--status-invalid); }
.tr-person { display: flex; gap: 10px; align-items: center; }
.tr-name { font-weight: 600; color: var(--ink); }
.tr-role { font-size: 11px; color: var(--muted); font-weight: 400; }
.tr-you { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; }

.tr-bars { display: grid; gap: 12px; }
.tr-barrow { display: grid; grid-template-columns: minmax(0, 120px) 1fr auto; gap: 12px; align-items: center; }
.tr-barname { font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-track { display: flex; gap: 2px; min-width: 0; height: 22px; }
.tr-seg { min-width: 3px; border-radius: 2px; }
.tr-track .tr-seg:first-child { border-radius: 4px 2px 2px 4px; }
.tr-track .tr-seg:last-child { border-radius: 2px 4px 4px 2px; }
.tr-bartot { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.tr-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.tr-legend span { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.tr-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.tr-s-new { background: var(--status-new); }
.tr-s-contacted { background: var(--status-contacted); }
.tr-s-followup { background: var(--status-followup); }
.tr-s-sitevisit { background: var(--status-sitevisit); }
.tr-s-meeting { background: var(--status-meeting); }
.tr-s-converted { background: var(--status-converted); }
.tr-s-closed { background: var(--status-notinterested); }

@media (max-width: 560px) {
  .tr-barrow { grid-template-columns: 1fr auto; }
  .tr-track { grid-column: 1 / -1; }
}

/* Picking several leads at once, on the leads list a manager already works in (app.js renderEmpLeads). */
.tr-pickbar { position: sticky; bottom: 0; z-index: 4; margin-top: 14px; background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tr-pickbar .tr-count { font-size: 13px; font-weight: 700; }
.tr-pickbar .tr-spacer { flex: 1 1 0; min-width: 0; }
.tr-pickbar select { min-height: 38px; max-width: 210px; }
.tr-pickcell { width: 38px; text-align: center !important; }
.tr-pickcell input { width: 17px; height: 17px; accent-color: var(--accent); }
.tr-picked > td { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.tr-pickhint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

/* The WhatsApp message report (wa-report-ui.js), on the admin's WhatsApp tab above the outbox. */
.wr-filters { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.wr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wr-row select, .wr-row input { font: 500 .82rem var(--body-font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; min-height: 38px; max-width: 220px; }
.wr-row input[type="search"] { flex: 1 1 150px; min-width: 0; max-width: none; }
.wr-lab { font-size: .78rem; color: var(--muted); }
.wr-grow { flex: 1 1 0; min-width: 0; }
.wr-note { margin: 10px 0 0; font-size: .74rem; color: var(--muted); }
#wr-dl { text-decoration: none; display: inline-flex; align-items: center; }

.wr-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wr-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.wr-num { font-family: var(--display-font); font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wr-lbl { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.wr-tile.bad { border-color: var(--status-invalid); }
.wr-tile.bad .wr-num { color: var(--status-invalid); }
.wr-tile.good .wr-num { color: var(--status-converted); }

.wr-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.wr-h { font-family: var(--display-font); margin: 0 0 3px; font-size: 1rem; }
.wr-small { margin: 0 0 12px; font-size: .78rem; color: var(--muted); }
.wr-allgood { margin: 0; font-size: .88rem; color: var(--status-converted); font-weight: 600; }

.wr-why { border-left: 3px solid var(--status-invalid); background: var(--surface-2); border-radius: 9px; padding: 13px 15px; }
.wr-why h4 { font-family: var(--display-font); margin: 0 0 6px; font-size: .98rem; color: var(--status-invalid); }
.wr-why p { margin: 0 0 7px; font-size: .85rem; max-width: 74ch; }
.wr-why p:last-of-type { margin-bottom: 0; }
.wr-why code { font-size: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.wr-fix { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 8px; padding: 9px 12px; font-size: .82rem; margin-top: 10px; }
.wr-reasons { list-style: none; margin: 13px 0 0; padding: 0; display: grid; gap: 7px; }
.wr-reasons li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: .83rem; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.wr-n { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px; color: var(--status-invalid); }
.wr-where { color: var(--muted); font-size: .76rem; margin-left: auto; }

.wr-scroll { overflow-x: auto; }
.wr-table { border-collapse: collapse; width: 100%; min-width: 680px; font-size: .83rem; }
.wr-table th, .wr-table td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.wr-table th { font-size: .67rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.wr-table th:first-child, .wr-table td:first-child { text-align: left; }
.wr-table td { font-variant-numeric: tabular-nums; }
.wr-table tbody tr:last-child td { border-bottom: 0; }
.wr-table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.wr-tpl { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .79rem; font-weight: 600; }
.wr-for { font-size: .7rem; color: var(--muted); }
.wr-bad { color: var(--status-invalid); font-weight: 700; }
.wr-zero { color: var(--muted); }
.wr-worst td:first-child { box-shadow: inset 3px 0 0 var(--status-invalid); }
.wr-rate { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.wr-track { width: 50px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; }
.wr-track i { display: block; height: 100%; background: var(--status-invalid); }

.wr-days { display: flex; gap: 10px; align-items: flex-end; overflow-x: auto; padding-bottom: 4px; }
.wr-day { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1 1 0; min-width: 46px; }
.wr-dn { font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wr-stack { width: 100%; max-width: 44px; display: flex; flex-direction: column; justify-content: flex-end; }
.wr-stack i { display: block; width: 100%; }
.wr-stack .wr-ok { background: var(--accent2, var(--accent)); border-radius: 3px 3px 0 0; }
.wr-stack .wr-badbar { background: var(--status-invalid); border-radius: 0 0 3px 3px; }
.wr-dl2 { font-size: .67rem; color: var(--muted); text-align: center; line-height: 1.25; }
.wr-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.wr-legend span { display: flex; gap: 7px; align-items: center; font-size: .75rem; color: var(--muted); }
.wr-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.wr-dot.wr-ok { background: var(--accent2, var(--accent)); }
.wr-dot.wr-badbar { background: var(--status-invalid); }

/* ---- Update 75: the People list of the Team page ---------------------------------------------------------------
   On a computer it is the same table as before (only a search box above it). On a phone (760 px wide or less) each person
   becomes a card, and the five extra buttons fold into one "Manage" menu, so nothing runs off the side of the screen. */
.team-people-h { font-size: 20px; margin: 24px 0 8px; }
.team-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; }
.team-tools input[type="search"] { flex: 1 1 260px; max-width: 440px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.team-tools input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.team-none { margin: 10px 2px; }
.team-error { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); max-width: 560px; }
.team-error p { margin: 0 0 10px; }
[data-team-manage] { display: none; }
.team-menu { display: flex; flex-direction: column; gap: 8px; }
.team-menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 52px; padding: 10px 14px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.team-menu-item:hover, .team-menu-item:focus { background: var(--surface-2); outline: none; border-color: var(--accent); }
.team-menu-item span { font-size: 12px; color: var(--muted); }
.team-menu-item.danger b { color: var(--status-invalid); }
@media (max-width: 760px) {
  [data-mode] .team-wrap { overflow: visible; border: 0; background: transparent; }
  [data-mode] table.team-table, [data-mode] table.team-table tbody { display: block; min-width: 0; width: 100%; }
  [data-mode] table.team-table thead { display: none; }
  [data-mode] table.team-table tr { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 10px; background: var(--surface); cursor: default; }
  [data-mode] table.team-table tbody tr:hover { background: var(--surface); }
  [data-mode] table.team-table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
  [data-mode] table.team-table td::before { content: attr(data-label); flex: 0 0 auto; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; padding-top: 2px; }
  [data-mode] table.team-table td[data-label=""]::before, [data-mode] table.team-table td.team-name::before { display: none; }
  [data-mode] table.team-table td.team-name { display: block; text-align: left; font-size: 15px; font-weight: 600; padding-top: 10px; }
  [data-mode] table.team-table td.row-actions { justify-content: flex-end; flex-wrap: wrap; gap: 8px; border-bottom: 0; padding: 10px 0 8px; }
  [data-mode] table.team-table td.row-actions .btn { min-height: 42px; min-width: 88px; justify-content: center; }
  [data-mode] table.team-table .team-inline { display: none; }
  [data-mode] table.team-table [data-team-manage] { display: inline-flex; }
}
