/* AI auditor (views-perf-audit.js) and Settings → AI auditor (settings-perf-audit.js). Prefix au- (au-s- in Settings).
   Design tokens only, no literal colours; both themes; works at 400 px. Charts use the shared .po-f-* series classes. */

/* ---- header strip: status chips, tabs, "audited through" ---- */
.au-status{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:-4px 0 12px}
.au-status:empty{display:none}
.au-tabbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;margin:0 0 14px}
.au-tabs{flex-wrap:wrap}
/* the Medium filter (All / Calls / Emails) beside the tabs; the Medium chip in every list */
.au-meds[hidden]{display:none}
.au-med{white-space:nowrap}
.au-thru{font-size:12.5px}
.au-n{display:inline-block;min-width:18px;padding:0 6px;border-radius:99px;background:var(--mut-bg);color:var(--ink2);font:600 11px var(--mono);text-align:center;vertical-align:1px}
.seg .on .au-n{background:var(--brand-tint);color:var(--ink)}
.au-link{border:0;background:none;padding:0;color:var(--brand);font:inherit;font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.au-link:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:4px}
.au-body.is-loading{opacity:.6;transition:opacity .2s}
.au-off .empty{display:flex;flex-direction:column;align-items:center;gap:10px}
.au-off-sw{display:flex;gap:6px;flex-wrap:wrap;justify-content:center}

/* ---- Agents ---- */
.au-tiles{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}
.au-unit{font-size:.5em;font-weight:600;color:var(--ink3);margin-left:2px}
.au-tools{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:14px 0 0}
.au-charts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 14px}
.au-charts>.card:only-child{grid-column:1 / -1}
@media (max-width:1020px){.au-charts{grid-template-columns:minmax(0,1fr)}}
.au-legend{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:12px;color:var(--ink2);margin:0 0 6px}
.au-legend:empty{display:none}
.au-legend span{display:inline-flex;align-items:center;gap:6px}
.au-tbl td{vertical-align:top}
.au-tbl th{white-space:normal;vertical-align:bottom}
/* the first text column keeps room for a name; the queue's tick column stays narrow */
.au-tbl td:first-child:not(.au-tk){min-width:150px}
.au-tbl .num{text-align:right;white-space:nowrap}
.au-q{font:650 15px var(--mono);color:var(--ink)}
.au-spark{display:block;overflow:visible}
.au-spark path{fill:none;stroke:var(--brand);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.au-foot{font-size:12px;margin:12px 2px 0}
.au-code{font-family:var(--mono);font-size:12.5px;overflow-wrap:anywhere}
.au-why{max-width:260px;color:var(--ink2);font-size:12.5px}
.au-score{font:650 13.5px var(--mono);color:var(--ink)}
.au-score.is-fatal{color:var(--crit-ink)}
/* scorecard v2: a critical waiting for QA makes the audit 0/50 once confirmed — said beside the score */
.au-ifqa,.tbl .cell-sub.au-ifqa{color:var(--crit-ink);font-weight:600}
.tbl .au-ifqa{white-space:nowrap}
.au-big .au-ifqa{font-size:14px;letter-spacing:0;white-space:nowrap}
.au-strong{font-weight:700;color:var(--warn-ink)}
.au-note{margin:10px 0 0;font-size:12.5px;color:var(--ink2)}
.au-more{margin:8px 2px 0;font-size:12px}
/* a booking code stays on one line (the table scrolls inside its card); No call / reply found's To check leads with
   the day, which needs no name-wide first column */
.au-tbl td.au-code{white-space:nowrap;overflow-wrap:normal}
.au-tbl.au-nci td:first-child{min-width:0;white-space:nowrap}

/* one person */
.au-one-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 12px}
.au-one-head h3{margin:0;font-size:18px;font-weight:650;letter-spacing:-.02em}
.au-kpis{display:flex;flex-wrap:wrap;gap:6px 18px;margin:12px 0 0;font-size:13px;color:var(--ink2)}
.au-kpis b{color:var(--ink);font-weight:650}

/* ---- Red flags / queue ---- */
.au-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.au-qhead{display:flex;align-items:center;justify-content:space-between;gap:8px 14px;flex-wrap:wrap;margin:0 0 4px}
.au-qhead p{margin:0;font-size:12.5px}
.au-qhead kbd{font:600 11px var(--mono);padding:1px 5px;border:1px solid var(--line);border-radius:5px;background:var(--mut-bg);color:var(--ink2)}
.au-qsec .card-head h3{display:flex;align-items:center;gap:8px}
.au-tbl .au-tk{width:34px;min-width:0;padding-right:4px}
.au-list .au-code{overflow-wrap:normal;white-space:nowrap}
.au-tk input{width:16px;height:16px;accent-color:var(--brand);margin:0}
.au-bar{position:sticky;bottom:12px;z-index:5;display:flex;align-items:center;gap:8px 10px;flex-wrap:wrap;margin-top:14px;padding:10px 14px;border:1px solid var(--line);border-radius:var(--radius);background:color-mix(in srgb,var(--solid) 88%,transparent);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);box-shadow:var(--shadow)}
.au-bar[hidden]{display:none}
.au-bar>span{margin-right:auto;font-size:13px;font-weight:600}
.au-oc{display:inline-flex;gap:6px;align-items:center;flex-wrap:wrap}
.au-oc select{max-width:220px}
.au-modal{max-width:460px}

/* ---- the audit panel ---- */
.au-panel{width:min(620px,100%)}
/* one's own audit (opened from the agent page): checked by their reviewer or not, under the panel's title */
.au-own{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin:-6px 0 12px;font-size:13px;color:var(--ink2)}
.au-own-t{min-width:0;overflow-wrap:anywhere}
.au-big{margin:0;font:650 22px var(--mono);letter-spacing:-.02em;color:var(--ink)}
.au-call{margin:0 0 12px}
.au-call-t{font-size:13px;margin:0 0 6px}
.au-strip{position:relative;height:14px;border-radius:7px;background:var(--brand-tint);border:1px solid var(--line2);overflow:hidden}
.au-gap{position:absolute;top:0;bottom:0;background:repeating-linear-gradient(135deg,var(--mut-bg) 0 4px,var(--line) 4px 6px)}
.au-mark{position:absolute;top:1px;bottom:1px;width:3px;margin-left:-1px;border-radius:2px;background:var(--good)}
.au-mark.is-lost{background:var(--amber)}
.au-mark.is-flag{background:var(--crit)}
.au-param{padding:10px 0;border-top:1px solid var(--line2)}
.au-param:first-child{border-top:0;padding-top:0}
.au-param-h{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13.5px}
.au-param-h .chip{margin-left:auto}
.au-param.is-wait{margin:0 -8px;padding:10px 8px;border-radius:8px;background:var(--warn-bg)}
.au-pts{font:650 13px var(--mono);color:var(--good-ink)}
.au-pts.is-lost{color:var(--warn-ink)}
.au-pts.is-nh{color:var(--ink3);font-family:inherit;font-weight:550}
.au-chks{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:6px}
.au-chk{font-size:13px}
.au-chk .chip{margin-left:6px}
.au-chk-n{color:var(--ink2)}
.au-at{font:500 12px var(--mono)}
.au-chk-note{margin-top:3px;padding:6px 9px;border-radius:8px;background:var(--mut-bg);font-size:12.5px;color:var(--ink)}
.au-shown{font-size:12px;margin:6px 0 0}
.au-fullp{font-size:13px;color:var(--ink2);margin:10px 0 0}
.au-flags{list-style:none;margin:0;padding:0;display:grid;gap:8px;font-size:13px}
.au-agree,.au-edit{display:grid;gap:8px;margin:0 0 10px}
.au-agree .switch-row input,.au-edit .switch-row input{accent-color:var(--brand);width:16px;height:16px;margin:0}
.au-edit-r{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px}
.au-edit-r select{max-width:180px}
.au-edit-fh{margin:6px 0 0;font:600 10.5px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--ink3)}
.au-edit-sc{margin:4px 0 0;font-size:13px}
/* scorecard v3/v4: the HCN answers (effort pushed, guest-name check-in), set under the HCN in QA's forms, and shown under the HCN in the parts */
.au-edit-sub{padding-left:14px;border-left:2px solid var(--line);color:var(--ink2)}
.au-edit-sub label .faint{font-size:12px}
.au-nudge{margin-top:2px;color:var(--ink2)}
/* under the effort on a v3 "didn't ask again" (shown as not known): QA picks how hard the agent pushed */
.au-edit-hint{display:block;font-size:12px;margin:-4px 0 0 16px}
/* the HCN's critical flag, ticked and locked while the HCN is "wrong" (the change form and the blind label) */
.au-edit-lock{display:block;font-size:12px;margin:-4px 0 0 26px}
.au-edit-lock[hidden]{display:none}
/* "How parts lose points" under the parts (the same sentences as Settings → AI auditor) */
.au-rules{margin:8px 0 0;font-size:12.5px;color:var(--ink2)}
.au-rules summary{cursor:pointer;color:var(--brand);font-weight:600}
.au-rules summary:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:4px}
.au-rules ul,.au-s-rules{margin:6px 0 0;padding-left:18px;display:grid;gap:4px}
.au-reason textarea{width:100%;resize:vertical}
.au-reason textarea[aria-invalid="true"]{border-color:var(--crit)}
.au-acts{display:flex;flex-wrap:wrap;gap:6px}
/* QA's decisions: each button with one short line under it saying when to use it; two columns where the panel has room */
.au-decs{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px 16px;margin-top:4px}
.au-dec{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
.au-hint{margin:0;font-size:12px;line-height:1.4;font-weight:400;color:var(--ink3)}
/* the second step before an audit is thrown out (in the panel, never a browser dialog) */
.au-out-step{display:grid;gap:8px;padding:10px 12px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--crit-bg)}
.au-out-h{margin:0;font-size:13px;color:var(--ink)}
.au-out-h b{color:var(--crit-ink)}
/* a thrown-out audit: said in words where a score would be (the old score small under it) */
.au-out{font-size:12.5px;font-weight:600;color:var(--ink2)}
.au-big.is-out{font:650 18px var(--font);letter-spacing:-.01em;color:var(--ink2)}
/* the queue's bulk bar: the count with its hint under it */
.au-bar-n{display:flex;flex-direction:column;gap:1px;min-width:0}
.au-bar .au-hint{font-size:11.5px}
.au-clips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px}
.au-audio{width:100%;margin:0 0 8px}
.au-tl{list-style:none;margin:0;padding:0;display:grid;gap:8px;font-size:12.5px}
.au-tl li{padding-left:12px;border-left:2px solid var(--line)}
@media (max-width:560px){.au-panel .kv{grid-template-columns:minmax(0,1fr)}.au-panel .kv dd{margin-bottom:6px}.au-edit-r{flex-wrap:wrap}}

/* ---- Reviewers: one row per reviewer with a strip of day marks (✓ done · ✗ missed · … today · · nobody assigned) ---- */
.au-mk-legend{display:flex;flex-wrap:wrap;gap:4px 14px;margin:0 0 10px;font-size:12px;color:var(--ink2)}
.au-mk-legend>span{display:inline-flex;align-items:center;gap:6px}
.au-mks{display:inline-flex;gap:3px;white-space:nowrap}
.au-mk{display:inline-grid;place-items:center;width:18px;height:18px;border-radius:5px;font:700 11px/1 var(--mono);background:var(--mut-bg);color:var(--ink3)}
.au-mk.is-done{background:var(--good-bg);color:var(--good-ink)}
.au-mk.is-missed{background:var(--crit-bg);color:var(--crit-ink)}
.au-mk.is-pending{background:var(--warn-bg);color:var(--warn-ink)}
.au-mk.is-none{background:transparent;color:var(--ink4)}
.au-revs .au-rv-by{white-space:normal;min-width:120px}
.au-revs .au-rv-last{white-space:nowrap}

/* ---- Review log: a table where there is room, cards below 560 px ---- */
.au-logc{display:none;list-style:none;margin:0;padding:0}
.au-logc li{display:grid;gap:3px;padding:10px 0;border-bottom:1px solid var(--line2);font-size:13px}
.au-logc li:last-child{border-bottom:0}
.au-logc-h,.au-logc-f{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px 10px}
.au-logc-h .faint,.au-logc-f .faint{font-size:12px}
@media (max-width:560px){.au-log-wide{display:none}.au-logc{display:block}}

/* ---- Settings → AI auditor ---- */
.au-s-est{margin:4px 0 6px;font-size:13px;line-height:1.5}
.au-s-est .chip{margin-left:6px}
.au-s-est-n{display:block;font-size:12px}
.au-s-est:empty{display:none}
/* How audits are scored (read only: the scorecard is in the code) */
.au-s-rules{font-size:13px;color:var(--ink2);line-height:1.45}
/* the card-skip note under the switches (one line, always shown) */
.au-s-note{margin:10px 0 0;padding:8px 11px;border-radius:8px;background:var(--mut-bg);font-size:12.5px;line-height:1.45;color:var(--ink2)}
.unit-in.au-s-wide input{width:96px}
.au-s-draw{display:inline-flex;gap:6px;align-items:center;flex-wrap:wrap}
.pf-conn-form.au-s-k-form{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"key key" "billed go";align-items:center}
.au-s-k-form .field{grid-area:key}
.au-s-billed{grid-area:billed;font-size:13px}
.au-s-billed input{accent-color:var(--brand);width:16px;height:16px;margin:0}
.au-s-k-form .pf-conn-go{grid-area:go}
@container setpage (max-width:480px){.pf-conn-form.au-s-k-form{grid-template-columns:minmax(0,1fr);grid-template-areas:"key" "billed" "go"}}
.au-s-gate td{vertical-align:top}
.au-s-gate .chip{margin-left:4px}
/* narrow: each measure as a card (name and pass chip, then now · pass mark), so nothing hides past the card's edge */
@container setpage (max-width:480px){
  .au-s-gate thead{display:none}
  .au-s-gate,.au-s-gate tbody{display:block}
  .au-s-gate tr{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 12px;padding:9px 0;border-bottom:1px solid var(--line2)}
  .au-s-gate td{display:block;padding:0;border:0}
  .au-s-gate td:first-child{grid-column:1 / -1}
  .au-s-gate td.num{text-align:left;white-space:normal}
}
.au-s-why textarea{width:100%;resize:vertical}
/* the Settings nav's icon for this page (views-settings.js draws none for it): the screen's own mark, in currentColor */
.set-nav button[data-sp="perf-audit"]:not(:has(svg))::before{content:"";width:16px;height:16px;flex:none;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 3.5h5M10 3.5v2'/%3E%3Crect x='3.5' y='5.5' width='13' height='10' rx='3'/%3E%3Cpath d='M7 10.5l1.8 1.8L13 8.2M6 15.5v1.5M14 15.5v1.5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 3.5h5M10 3.5v2'/%3E%3Crect x='3.5' y='5.5' width='13' height='10' rx='3'/%3E%3Cpath d='M7 10.5l1.8 1.8L13 8.2M6 15.5v1.5M14 15.5v1.5'/%3E%3C/svg%3E") center/contain no-repeat}
.set-nav button.on[data-sp="perf-audit"]:not(:has(svg))::before{background:var(--brand)}
@media (prefers-reduced-motion:reduce){.au-body.is-loading{transition:none}}
