/* Team performance: the leadership dashboard (2026-11-02).
   Series colours are checked for colour blindness (the dataviz validator) in
   light and dark: three for calls, emails and visits, three for teams. Every
   series is also named in a legend or at its end, so colour never stands
   alone. Neutrals, ink and lines come from the theme. */
:root{
  --perf-calls:#056BB6; --perf-emails:#EB6834; --perf-visits:#1BAF7A;
  --perf-good:#1F7A4D; --perf-bad:#A33030; --perf-close:#7A4E00;
  --perf-good-soft:#E4F3EA; --perf-bad-soft:#F8E3E3; --perf-close-soft:#FFF2D6;
  --perf-goal:#0D2A4A;
}
html[data-theme="midnight"], html[data-theme="slate"], html[data-theme="dusk"], html[data-theme="ember"], html[data-theme="obsidian"]{
  --perf-calls:#3987E5; --perf-emails:#D95926; --perf-visits:#199E70;
  --perf-good:#7FD3A6; --perf-bad:#F2A0A0; --perf-close:#FFD27A;
  --perf-good-soft:rgba(127,211,166,.14); --perf-bad-soft:rgba(242,160,160,.14); --perf-close-soft:rgba(255,210,122,.14);
  --perf-goal:#E9ECF5;
}

.perf .dp-empty{ padding:14px 16px; }
.perf-period-pick select{ min-height:38px; border:1px solid var(--line-strong); border-radius:999px; padding:0 14px; background:var(--paper); color:var(--ink); font:inherit; font-weight:700; font-size:13px; }

/* Legends, keys and the controls row. */
.perf-legend{ display:flex; flex-wrap:wrap; gap:6px 16px; padding:8px 16px 0; font-size:12.5px; color:var(--ink-soft); }
.perf-key{ display:inline-flex; align-items:center; gap:6px; }
.perf-sw{ width:10px; height:10px; border-radius:3px; display:inline-block; flex:none; }
.perf-lk{ width:16px; height:2px; border-radius:2px; display:inline-block; flex:none; }
.perf-lk.cur{ background:var(--perf-calls); } .perf-lk.prior{ background:var(--line-strong); }
.perf-lk.is-team{ background:var(--team); }
.perf-lk.goal{ background:var(--perf-goal); opacity:.8; }
/* Beside team lines the goal is any team's colour, so its key shows the dash, not a colour. */
.perf-legend:has(.perf-lk.is-team) .perf-lk.goal{ background:repeating-linear-gradient(90deg, var(--perf-goal) 0 6px, transparent 6px 10px); }
.perf-k-calls{ fill:var(--perf-calls); background:var(--perf-calls); }
.perf-k-emails{ fill:var(--perf-emails); background:var(--perf-emails); }
.perf-k-visits{ fill:var(--perf-visits); background:var(--perf-visits); }
.perf-ctl{ display:flex; align-items:center; flex-wrap:wrap; gap:8px 10px; padding:10px 16px 2px; }
.perf-ctl .ml, .perf-select.ml{ margin-left:auto; }
.perf-seg{ display:inline-flex; border:1px solid var(--line-strong); border-radius:999px; background:var(--subtle-bg); padding:3px; gap:2px; }
.perf-seg.wrap{ flex-wrap:wrap; border-radius:12px; }
.perf-seg button{ border:0; background:transparent; border-radius:999px; min-height:32px; padding:0 14px; font:inherit; font-weight:700; font-size:12.5px; color:var(--ink-soft); cursor:pointer; }
.perf-seg button.on{ background:var(--paper); color:var(--blue, var(--ink)); box-shadow:0 1px 3px rgba(0,5,64,.15); }
.perf-select{ display:inline-flex; align-items:center; gap:6px; }
.perf-select select{ min-height:36px; border:1px solid var(--line-strong); border-radius:8px; padding:0 10px; background:var(--paper); color:var(--ink); font:inherit; font-size:13px; font-weight:700; max-width:220px; }
.perf-lbl{ font-size:12.5px; color:var(--text-muted); }
.perf-back{ border:0; background:none; padding:6px 2px; font:inherit; font-weight:700; font-size:13px; color:var(--blue, var(--ink)); cursor:pointer; }
.perf-subject{ margin:6px 16px 0; font-weight:700; font-size:13px; color:var(--ink); }
.perf-foot{ margin:0; padding:4px 16px 14px; font-size:12px; color:var(--text-muted); line-height:1.5; }
/* The rep view's only control is the period: it shares the legend's line rather than holding a band alone. */
@media (min-width:821px){
  #perf-act-body:has(> .perf-ctl > .perf-select:only-child){ display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; }
  #perf-act-body:has(> .perf-ctl > .perf-select:only-child) > .perf-ctl{ grid-area:1 / 2; padding-left:0; }
  #perf-act-body:has(> .perf-ctl > .perf-select:only-child) > .perf-legend{ grid-area:1 / 1; }
  #perf-act-body:has(> .perf-ctl > .perf-select:only-child) > .perf-act{ grid-column:1 / -1; }
}

/* Charts drawn in SVG: thin marks, hairline grid, text in the theme's ink. */
.perf-chart{ padding:6px 12px 10px; min-width:0; }
.perf-svg{ display:block; width:100%; height:auto; overflow:visible; }
.perf-svg text{ font-family:inherit; }
.perf-grid{ stroke:var(--line); stroke-width:1; }
.perf-axis{ stroke:var(--line-strong); stroke-width:1; }
.perf-tick{ fill:var(--text-muted); font-size:11px; }
.perf-act .perf-tick{ font-size:12px; }
.perf-end, .perf-cap{ fill:var(--ink); font-size:12px; font-weight:700; }
.perf-end tspan{ font-weight:700; }
.perf-end{ font-weight:400; }
.perf-l-prior{ fill:none; stroke:var(--line-strong); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.perf-l-area{ fill:var(--perf-calls); fill-opacity:.08; stroke:none; }
.perf-l-cur{ fill:none; stroke:var(--perf-calls); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.perf-dot{ fill:var(--perf-calls); stroke:var(--paper); stroke-width:2; }
.perf-hit{ fill:transparent; cursor:default; }
.perf-hit:hover{ fill:var(--ink); fill-opacity:.04; }
.perf-partial path, .perf-partial rect:not(.perf-hit){ opacity:.55; }
.perf-goal{ stroke:var(--perf-goal); stroke-width:2; stroke-opacity:.8; }
.perf-tl{ fill:none; stroke:var(--team); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.perf-tl-dot{ fill:var(--team); stroke:var(--paper); stroke-width:2; }
.perf-tl-goal{ stroke:var(--team); stroke-width:1.5; stroke-opacity:.6; stroke-dasharray:6 4; }
.perf-spark{ vertical-align:middle; margin:0 2px; }
.perf-spark path{ fill:none; stroke:var(--perf-calls); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.perf-spark circle{ fill:var(--perf-calls); stroke:var(--paper); stroke-width:1.5; }

.perf-tip{ position:fixed; z-index:9000; pointer-events:none; background:#0D2A4A; color:#FFFFFF; font-size:12px; line-height:1.45; border-radius:8px; padding:8px 10px; box-shadow:0 6px 16px rgba(0,5,64,.25); max-width:280px; display:flex; flex-direction:column; }
.perf-tip[hidden]{ display:none; }
.perf-tip b{ font-weight:700; }

/* Changes and verdicts: colour, an arrow or an icon, and words for a screen reader. */
.perf-up{ color:var(--perf-good); font-weight:700; font-size:12px; white-space:nowrap; }
.perf-down{ color:var(--perf-bad); font-weight:700; font-size:12px; white-space:nowrap; }
.perf-same{ color:var(--text-muted); font-size:12px; }
.perf-verdict{ display:inline-flex; align-items:center; gap:5px; font-weight:700; font-size:12px; border-radius:999px; padding:3px 9px; white-space:nowrap; }
.perf-verdict.ok, .perf-vi.ok{ background:var(--perf-good-soft); color:var(--perf-good); }
.perf-verdict.close, .perf-vi.close{ background:var(--perf-close-soft); color:var(--perf-close); }
.perf-verdict.bad, .perf-vi.bad{ background:var(--perf-bad-soft); color:var(--perf-bad); }
.perf-vi{ display:inline-grid; place-items:center; width:18px; height:18px; border-radius:50%; font-size:10px; font-weight:800; flex:none; }

/* Bars with the value at the tip. */
.perf-bars{ display:flex; flex-direction:column; gap:10px; padding:12px 16px 12px; }
.perf-bar-row{ display:grid; grid-template-columns:minmax(96px,190px) minmax(0,1fr); align-items:center; gap:10px; font-size:13.5px; color:var(--ink); }
.perf-name{ border:0; background:none; padding:0; font:inherit; color:inherit; text-align:left; cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
button.perf-name:hover{ text-decoration:underline; }
.perf-bar-track{ display:flex; align-items:center; gap:8px; min-width:0; }
.perf-bar-track[role="button"]{ cursor:pointer; }
.perf-bar-track b{ font-variant-numeric:tabular-nums; white-space:nowrap; }
.perf-bar{ display:block; height:20px; border-radius:0 4px 4px 0; background:var(--perf-calls); min-width:2px; }
.perf-bar.gray{ background:var(--line-strong); }
.perf-bar.is-team{ background:var(--team); }
.perf-stack{ display:flex; gap:2px; height:20px; min-width:2px; }
.perf-stack span{ display:block; height:20px; }
.perf-stack span:last-child{ border-radius:0 4px 4px 0; }

/* Calls, emails and visits over time: the chart, and the totals beside it. */
.perf-act{ display:grid; grid-template-columns:minmax(0,1.55fr) minmax(170px,1fr); align-items:stretch; }
.perf-side{ display:flex; flex-direction:column; gap:12px; padding:12px 16px 14px 14px; border-left:1px solid var(--line); }
.perf-big{ font-family:var(--font-display); font-weight:700; font-size:28px; line-height:1; color:var(--ink); }
.perf-big small{ font-family:inherit; font-weight:400; font-size:13px; color:var(--text-muted); }
.perf-mix{ display:flex; flex-direction:column; gap:8px; }
.perf-mix-row{ display:grid; grid-template-columns:70px minmax(0,1fr) 30px; align-items:center; gap:8px; font-size:13px; color:var(--ink); }
.perf-mix-row b{ text-align:right; font-variant-numeric:tabular-nums; }
.perf-mix-track{ height:8px; border-radius:999px; background:var(--subtle-bg); overflow:hidden; display:block; }
.perf-mix-track span{ display:block; height:8px; border-radius:999px; }
.perf-side-goal{ display:flex; flex-direction:column; align-items:flex-start; gap:6px; font-size:12.5px; color:var(--ink-soft); }

/* Teams and people, and the goals board: one white block, rows split by hairlines. */
.perf-table{ display:flex; flex-direction:column; padding:4px 0 6px; overflow-x:auto; }
.perf-row, .perf-grow{ display:grid; align-items:center; column-gap:12px; padding:9px 16px; border-bottom:1px solid var(--line); font-size:13.5px; color:var(--ink); min-width:min-content; }
.perf-row > *, .perf-grow > *{ min-width:0; }
.perf-row .perf-c:not(:first-child){ text-align:right; justify-self:end; }
.perf-row.team, .perf-grow.team{ background:var(--subtle-bg); font-weight:700; }
.perf-row.total{ font-weight:700; border-top:2px solid var(--line-strong); border-bottom:0; }
.perf-row .perf-who, .perf-grow .perf-who{ padding-left:calc(var(--depth, 0) * 22px); }
.perf-groups{ border-bottom:0; padding-bottom:0; font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--blue, var(--ink)); }
.perf-groups .perf-g:first-of-type{ text-align:right; }
.perf-colhead{ font-size:11.5px; color:var(--text-muted); padding-top:4px; }
.perf-sort{ border:0; background:none; padding:4px 0; font:inherit; font-weight:700; color:inherit; cursor:pointer; white-space:nowrap; }
.perf-sort.on{ color:var(--ink); }
.perf-vline{ width:1px; align-self:stretch; background:var(--line); }
.perf-who{ display:flex; align-items:center; gap:10px; min-width:0; }
.perf-who-text{ display:flex; flex-direction:column; min-width:0; }
.perf-meta{ display:block; font-weight:400; font-size:12px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.perf-car{ flex:none; display:inline-grid; place-items:center; width:26px; height:26px; border-radius:6px; border:1px solid var(--line-strong); background:var(--paper); color:var(--ink); font-size:11px; cursor:pointer; }
.perf-av{ flex:none; width:26px; height:26px; border-radius:50%; background:var(--blue, var(--ink)); color:var(--paper); font-weight:800; font-size:9.5px; display:inline-grid; place-items:center; }
.perf-you{ flex:none; font-size:11px; font-weight:700; border-radius:999px; padding:1px 7px; background:var(--blue, var(--ink)); color:var(--paper); }
.perf-held{ display:inline-flex; align-items:center; justify-content:flex-end; gap:8px; font-variant-numeric:tabular-nums; }
.perf-track{ width:58px; height:6px; border-radius:999px; background:var(--subtle-bg); overflow:hidden; flex:none; display:block; }
.perf-track span{ display:block; height:6px; border-radius:999px; background:var(--perf-calls); }
.perf-c{ font-variant-numeric:tabular-nums; }
.perf-hov{ border-bottom:1px dotted var(--line-strong); cursor:default; }
.perf-pill{ display:inline-block; min-width:26px; text-align:center; border-radius:999px; padding:2px 8px; font-weight:700; font-size:12.5px; color:var(--text-muted); }
.perf-pill.bad{ background:var(--perf-bad-soft); color:var(--perf-bad); }

/* Goals. */
.perf-gcards{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px; padding:12px 16px; }
.perf-gcard{ border:1px solid var(--line); border-radius:10px; padding:12px 14px; display:flex; flex-direction:column; gap:7px; background:var(--paper); }
.perf-gcard .btn{ align-self:flex-start; }
.perf-gcard-label{ font-size:13px; color:var(--text-muted); }
.perf-gcard-value{ font-family:var(--font-display); font-weight:700; font-size:22px; color:var(--ink); }
.perf-gcard-value small{ font-family:inherit; font-weight:400; font-size:13px; color:var(--text-muted); }
.perf-gcard-foot{ display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:12.5px; color:var(--ink-soft); flex-wrap:wrap; }
.perf-meter{ position:relative; display:block; height:10px; border-radius:999px; background:var(--subtle-bg); }
.perf-meter-fill{ position:absolute; left:0; top:0; bottom:0; border-radius:999px; }
.perf-meter-fill.ok{ background:#2F9E5B; } .perf-meter-fill.close{ background:#C98500; } .perf-meter-fill.bad{ background:#C0392B; }
.perf-meter-pace{ position:absolute; top:-4px; width:2px; height:18px; background:var(--perf-goal); border-radius:1px; }
.perf-grow .perf-c:not(:first-child){ min-width:0; }
.perf-gcell{ display:flex; flex-direction:column; gap:5px; }
.perf-gcell .perf-meter{ height:8px; }
.perf-gcell .perf-meter-pace{ height:14px; top:-3px; }
.perf-gcell-top{ display:flex; justify-content:space-between; align-items:center; gap:6px; font-variant-numeric:tabular-nums; }
.perf-gcell-top b span{ font-weight:400; color:var(--text-muted); }
.perf-gcell-none{ font-size:12.5px; color:var(--text-muted); font-weight:400; }

/* The Set a goal form. */
.perf-flabel{ display:block; font-weight:700; font-size:13px; margin-bottom:6px; color:var(--ink); }
.perf-chips{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.perf-chip{ border:1px solid var(--line-strong); border-radius:999px; min-height:34px; padding:0 12px; font:inherit; font-weight:700; font-size:12.5px; color:var(--ink); background:var(--paper); cursor:pointer; }
.perf-chip.on{ background:var(--btn-bg, var(--ink)); border-color:var(--btn-bg, var(--ink)); color:var(--btn-ink, var(--paper)); }
.perf-inline{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.perf-inline input[type="number"]{ width:110px; }
#perf-goal-form select{ margin-top:8px; }
.perf-inline select{ margin-top:0 !important; }
.perf-preview{ background:var(--subtle-bg); border:1px solid var(--line); border-radius:8px; padding:10px 12px; font-size:13.5px; line-height:1.5; color:var(--ink); margin:4px 0 12px; }
.perf-fixed{ margin:0; font-weight:700; }

/* A phone: the charts keep their shape and scale down; the tables become cards. */
@media (max-width:820px){
  .perf-act{ grid-template-columns:minmax(0,1fr); }
  .perf-side{ border-left:0; border-top:1px solid var(--line); padding-left:16px; }
  .perf-ctl .ml, .perf-select.ml{ margin-left:0; }
  /* 16px, or an iPhone zooms the page when a period is picked (design audit 2026-11-11). */
  .perf-period-pick select, .perf-select select{ font-size:16px; }
  .perf-seg{ width:100%; } .perf-seg button{ flex:1; min-height:40px; }
  .perf-table{ overflow-x:visible; }
  .perf-row.perf-groups, .perf-row.perf-colhead, .perf-grow.perf-colhead{ display:none !important; }
  .perf-row, .perf-grow{ display:grid !important; grid-template-columns:repeat(3, minmax(0,1fr)) !important; gap:8px 10px; padding:12px 14px; }
  .perf-row .perf-who, .perf-grow .perf-who{ grid-column:1 / -1; padding-left:calc(var(--depth, 0) * 12px); }
  .perf-vline{ display:none; }
  .perf-row .perf-c:not(:first-child), .perf-grow .perf-c:not(:first-child){ text-align:left; justify-self:stretch; display:flex; flex-direction:column; gap:2px; }
  .perf-row .perf-c[data-label]::before, .perf-grow .perf-c[data-label]::before{ content:attr(data-label); font-size:11px; font-weight:400; color:var(--text-muted); }
  .perf-held{ justify-content:flex-start; }
  .perf-row .perf-c:not(:first-child) > span{ align-self:flex-start; }
  .perf-car{ font-size:14px; }
  .perf-pill:not(.bad){ min-width:0; padding:0; }
  .perf-track{ display:none; }
  .perf-grow{ grid-template-columns:repeat(2, minmax(0,1fr)) !important; }
  .perf-bar-row{ grid-template-columns:142px minmax(0,1fr); }
  /* The hint under Teams and people says a name opens their venues: on a phone it takes its own line, whole. */
  .dp:has(#perf-teams-body) > .dp-head{ flex-wrap:wrap; row-gap:2px; }
  .dp:has(#perf-teams-body) > .dp-head .dp-title{ white-space:nowrap; }
  .dp:has(#perf-teams-body) > .dp-head .dp-sub{ order:3; flex-basis:100%; white-space:normal; }
}
.perf-gcards-one{grid-template-columns:minmax(0,1fr);}
