/*
  view-audit styles — the Audit Editor, folded into the shell (Phase 2d).
  Editor-specific rules; generic base dropped (tms.css supplies it). Custom
  properties re-scoped to #view-findings (the audit host) and mapped to the
  shell palette (accent = --blue). #toolbar renamed to #av-toolbar.
*/
/* TWO hosts carry this surface: the web shell's #view-findings and the PC shell's
   #view-shared-audit. Both must define the tokens below.

   SCOPING RULE (P2.1): #view-findings means OPPOSITE things in the two hosts —
   the shared surface on the web app, but the PC's OWN local review. So class
   rules that the PC also uses on its own chrome (.sevchip, .stat, .viewtoggle,
   .scr-*, .st2-tier) cannot be scoped by id; they are scoped to the
   [data-av-surface] marker that each host sets on whichever element hosts this
   surface. Unscoped rules below are ones only this module ever renders —
   verified empirically by developer/tests/e2e/css_bleed_guard.cjs, which fails
   if a rule here matches an element outside the marker. The token rule itself
   stays id-scoped: the tokens are unused by PC-local chrome, so they are inert
   there. */
#view-findings,#view-shared-audit{--accent:var(--blue);--accent-soft:#eaf1fb;--bg:#fff;--line2:#eef0f3;
  --radius:8px;--shadow:0 1px 3px rgba(20,30,50,.07),0 1px 2px rgba(20,30,50,.04);
  flex-direction:column;overflow:auto}
/* top bar */
#topbar{display:flex;align-items:center;gap:10px;padding:10px 18px;background:var(--panel);
  border-bottom:1px solid var(--line)}
#topbar .brandlogo{width:26px;height:26px;border-radius:7px;object-fit:contain;box-shadow:0 2px 6px rgba(20,25,35,.14)}
#topbar .brand{font-weight:800;color:var(--accent);letter-spacing:.3px}
.badge{display:inline-block;background:var(--accent);color:#fff;font-size:11px;font-weight:600;
  padding:3px 9px;border-radius:20px;letter-spacing:.3px}
#topbar h1{font-size:15px;font-weight:600;margin:0}
#topbar .spacer{flex:1}
#topbar .navlink{font-size:13px;color:var(--mut)}
#topbar .navlink:hover{color:var(--ink)}

/* gate / login */
#gate{margin:auto;text-align:center;color:var(--mut);max-width:560px;padding:40px}
.loginbox{padding:24px;display:flex;flex-direction:column;gap:12px}
.loginbox h3{margin:0}
.loginbox label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--mut)}

/* toolbar */
#av-toolbar{display:flex;align-items:center;gap:10px;padding:12px 18px;background:var(--panel);
  border-bottom:1px solid var(--line);flex-wrap:wrap}
#av-toolbar select#audit-sel{width:auto;min-width:280px;font-weight:600}
#av-toolbar .spacer{flex:1}
[data-av-surface] .stat{font-size:12.5px;color:var(--mut);white-space:nowrap}
[data-av-surface] .stat b{color:var(--ink);font-weight:600}
#a-live .live{color:var(--green)}
#a-live .down{color:var(--amber)}

/* audit summary */
#summary{padding:10px 18px;background:var(--panel);border-bottom:1px solid var(--line2)}
#summary summary{cursor:pointer;font-weight:600;font-size:13px;color:var(--ink);list-style:none}
#summary summary::-webkit-details-marker{display:none}
#summary summary::before{content:"▸ ";color:var(--accent)}
#summary[open] summary::before{content:"▾ "}
#summary .body{margin-top:8px;font-size:13px;color:#3a4150;white-space:pre-wrap;max-width:900px}

/* filter bar */
#filterbar{display:flex;align-items:center;gap:10px;padding:10px 18px;background:var(--panel);
  border-bottom:1px solid var(--line2);flex-wrap:wrap}
[data-av-surface] .viewtoggle{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden}
[data-av-surface] .viewtoggle .vt{border:none;border-radius:0;padding:6px 14px;font-size:12.5px;font-weight:600;color:var(--mut);background:var(--panel)}
[data-av-surface] .viewtoggle .vt+.vt{border-left:1px solid var(--line)}
[data-av-surface] .viewtoggle .vt.on{background:var(--accent,var(--blue));color:#fff}
#filterbar #a-search{flex:1;min-width:180px;max-width:380px}
#filterbar select{width:auto;padding:6px 9px}
#pager{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--mut);margin-left:auto}

/* ============ findings list view ============ */
#a-list{flex:1;min-height:0;overflow:auto;padding:18px;display:flex;flex-direction:column;gap:12px;align-items:center}
[data-av-surface] .sevchip{font-size:11px;font-weight:800;letter-spacing:.4px;padding:2px 8px;border-radius:20px;border:1px solid}
.sa-cat{font-size:11.5px;font-weight:600;color:#3a4150;background:#f1f3f6;border:1px solid var(--line);border-radius:6px;padding:1px 7px}
.sa-seg{font-size:12px}
/* the segment number as a jump into the document ("Show in document") */
.sa-seg.link{cursor:pointer;text-decoration:underline dotted;text-underline-offset:2px}
.sa-seg.link:hover{color:var(--accent)}
.sa-lock{font-size:11.5px;color:var(--amber)}
.sa-res{width:auto;padding:4px 8px;font-size:12.5px;font-weight:600}
.f-top{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.f-issue{margin-top:8px;font-size:13.5px;color:var(--ink);white-space:pre-wrap}
.f-rec{margin-top:6px;font-size:13px;color:#1a5fb4;background:#f3f8ff;border:1px solid #dbe6f6;border-radius:8px;padding:6px 10px;white-space:pre-wrap}
.f-txt{margin-top:6px;font-size:12.5px;color:#3a4150}
.f-txt b{display:inline-block;min-width:30px;color:var(--mut);font-size:11px}
.f-by{margin-top:6px;font-size:11px}
.sa-f{width:100%;max-width:900px;background:var(--panel);border:1px solid var(--line);border-left:4px solid var(--mut);
  border-radius:var(--radius);box-shadow:var(--shadow);padding:12px 15px}
.sa-f.res-open{border-left-color:var(--amber)}
.sa-f.res-fixed{border-left-color:var(--green)}
.sa-f.res-accepted{border-left-color:#2a7a2a}
.sa-f.res-dismissed{border-left-color:var(--mut);opacity:.72}
/* U3.1 — advisories ("potential issues"): machine-flagged and uncertain, so present and
   resolvable but visibly not review work. Violet echoes the PC's own advisory colour.
   COMPOUND selectors throughout (`.sa-f.advisory`, never a bare `.advisory`): user/tms.html
   puts the class `advisory` on its own `.frow` rows in 26 places, and a bare rule here would
   bleed into the PC's findings table — which css_bleed_guard.cjs exists to catch. */
.sa-f.advisory{border-left-color:#7a6ba8;opacity:.85}
.a-potential{color:#6b5f91}
/* scripture (Bible Verse audit) card extras */
.scr-judge{margin-top:6px;font-size:11.5px;color:var(--mut)}
.scr-ref{font-weight:700;color:#3a4150}
[data-av-surface] .scr-cebulb{margin-top:6px;font-size:12.5px;color:#3a4150;border-left:3px solid #b7791f;
  padding:4px 8px;background:#fbf7ef;border-radius:4px;white-space:pre-wrap}
[data-av-surface] .scr-cebulb.proposed{border-left-color:#6a4ec2;background:#f4f1fb}
[data-av-surface] .scr-diff{margin-top:6px;font-size:12.5px;line-height:1.75;background:#fafbfc;border:1px solid var(--line2);
  border-radius:6px;padding:6px 8px}
[data-av-surface] .scr-diff .d-del{background:#fde2e1;color:#8a1c13;text-decoration:line-through;border-radius:3px;padding:0 2px}
[data-av-surface] .scr-diff .d-ins{background:#dcf3e3;color:#146c2e;border-radius:3px;padding:0 2px}
[data-av-surface] .st2-tier{font-size:10px;font-weight:700;letter-spacing:.3px;padding:1px 6px;border-radius:10px;border:1px solid}
[data-av-surface] .st2-tier.AUTO{color:#146c2e;background:#e7f6ec;border-color:#b6e0c2}
[data-av-surface] .st2-tier.PROPOSE{color:#8a5a00;background:#fbf1de;border-color:#e6d4a6}
[data-av-surface] .st2-tier.REFUSE{color:#8a1c13;background:#fdeceb;border-color:#f2c3bf}
#a-phase{background:#6a4ec2}
.ew-finding .ew-apply{padding:2px 8px;font-size:11.5px}

/* ============ document view (stacked panes + right edit window) ============ */
#docview{flex:1;min-height:0;display:flex}
#doc-panes{flex:1;min-width:0;display:flex;flex-direction:column}
.docpane{flex:1;min-height:0;overflow:auto;padding:0 18px 16px;background:var(--panel)}
.docpane+.docpane{border-top:1px solid var(--line)}
.docpane h3{position:sticky;top:0;margin:0 -18px 8px;padding:8px 18px;background:#f7f8fa;
  border-bottom:1px solid var(--line2);font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--mut);z-index:1}
.docpane.tl .body{font-size:14.5px;line-height:1.9}
.docpane.en .body{font-size:13.5px;line-height:1.9;color:#3a4150}
/* The "no document to show" state (review D4). It used to be two entirely blank panes
   whose only explanation was a muted phrase up in the toolbar — so the explanation now
   lives where the user is looking. Readable measure, not full-bleed, because it is prose
   rather than a document. */
.doc-empty{max-width:46em;margin:26px auto;padding:16px 18px;border:1px solid var(--line);
  border-radius:8px;background:#fbfcfd;font-size:13.5px;line-height:1.65;color:var(--mut)}
/* Only the HEADING is a block. Scoped to the first child on purpose: `b{display:block}`
   here turned the inline <b>Findings</b> inside the body copy into a block and split the
   sentence across three lines — caught by looking at the rendered screen, not the DOM. */
.doc-empty > b:first-child{display:block;margin-bottom:6px;font-size:14.5px;color:var(--ink,#222)}
.doc-empty div+div{margin-top:8px}
.dseg{cursor:pointer;padding:1px 4px;border-radius:4px;box-decoration-break:clone;-webkit-box-decoration-break:clone}
.dseg:hover{background:var(--accent-soft)}
.dseg.flagged{background:#fff5e6;box-shadow:inset 2px 0 0 var(--amber)}
.dseg.flagged.sev-CRITICAL{background:#fdeaea;box-shadow:inset 2px 0 0 #b3261e}
.dseg.flagged.sev-HIGH{box-shadow:inset 2px 0 0 #c05a1e}
/* The BT tiers are the other scale segTopSev can return. Same gradient job as
   the severities above: without these, every sentence flagged by the default
   engine painted the same flat amber and the document view lost its triage. */
.dseg.flagged.sev-LIKELY{background:#fff3ea;box-shadow:inset 2px 0 0 #7c2d12}
.dseg.flagged.sev-PROBABLE{box-shadow:inset 2px 0 0 #1e4c8f}
.dseg.flagged.sev-POSSIBLE{box-shadow:inset 2px 0 0 #6b7280}
/* a segment carrying ONLY advisories: distinguishable from both "needs review" and "clean",
   because reading as clean is what made the advisory channel invisible in the first place */
.dseg.potential{background:#f6f4fa;box-shadow:inset 2px 0 0 #7a6ba8;opacity:.85}
.dseg.potential:hover{background:#efeaf7}
.dseg.sel{background:var(--accent-soft);box-shadow:inset 0 0 0 2px #9dc0ee}
.dseg .dnum{font-size:9.5px;color:var(--mut);vertical-align:super;margin-right:2px;user-select:none}
/* faithful rendered document (uploaded self-contained HTML, shown in an iframe) */
.docframe{width:100%;border:0;display:block;background:#fff;min-height:140px}

#edwin{width:390px;flex:none;border-left:1px solid var(--line);background:#fbfcfe;overflow-y:auto;
  display:flex;flex-direction:column}
#edwin .ew-sec{padding:12px 14px;border-bottom:1px solid var(--line2)}
#edwin h4{margin:0 0 6px;font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--mut)}
#ew-nav{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
#ew-nav button{padding:4px 9px;font-size:13px}
#ew-nav .seglabel{font-weight:700;margin-left:auto}
#ew-en{font-size:13.5px;color:#3a4150;background:#fff;border:1px solid var(--line);border-radius:6px;padding:8px 10px;white-space:pre-wrap}
[data-av="ew-tl"]{min-height:80px;font-size:14.5px;white-space:pre-wrap}
[data-av="ew-save-row"]{display:flex;gap:8px;align-items:center;margin-top:8px}
[data-av="ew-msg"]{font-size:12px}
/* Phase 4 — formatting-aware translation editor (Quill). Mirrors the PC app's
   #ed-quill: pre-existing bold/italic/font/colour render and round-trip, but the
   compact box shows text at its own readable size (a 72pt title shouldn't fill
   the box) — size/family are display-normalised, formatting still shows. */
[data-av="ew-quill"]{background:#fff;border:1px solid var(--line);border-radius:6px}
[data-av="ew-quill"] .ql-editor{min-height:80px;font-size:14.5px;padding:8px 10px}
[data-av="ew-quill"] .ql-editor span[style*="font-size"]{font-size:inherit !important}
[data-av="ew-quill"] .ql-editor span[style*="font-family"]{font-family:inherit !important}
/* MateCAT-style inline formatting-tag chips: atomic, non-editable markers for
   opaque inline content (footnote refs, fields, …). A shared number badge pairs
   an open/close; the memory (base64 of the original XML) rides on the chip so it
   round-trips through save. */
.fmt-tag{display:inline-block;background:#2c3340;color:#fff;font:600 10px/1.5 -apple-system,Segoe UI,Roboto,Arial,sans-serif;
  letter-spacing:.02em;padding:0 5px;margin:0 1px;border-radius:3px;vertical-align:1px;white-space:nowrap;
  cursor:default;user-select:none;-webkit-user-select:none}
.fmt-tag.close{background:#5b6472}
.fmt-tag.single,.fmt-tag.opaque{background:#1a5fb4}
.fmt-tag .fmt-num{display:inline-block;background:rgba(255,255,255,.28);border-radius:2px;
  padding:0 3px;margin-right:4px;font-weight:700}
.ew-finding{border:1px solid var(--line);border-left:4px solid var(--mut);border-radius:6px;background:#fff;padding:8px 10px;margin-bottom:8px}
.ew-finding.res-open{border-left-color:var(--amber)}
.ew-finding.res-fixed,.ew-finding.res-accepted{border-left-color:var(--green)}
.ew-finding.res-dismissed{border-left-color:var(--mut);opacity:.72}
.ew-finding .ftop{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ew-finding .fissue{margin-top:6px;font-size:12.5px;white-space:pre-wrap}
.ew-finding .frec{margin-top:5px;font-size:12.5px;color:#1a5fb4;background:#f3f8ff;border:1px solid #dbe6f6;border-radius:6px;padding:5px 8px}
.ew-finding .facts{margin-top:6px;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.ew-finding .facts button{padding:2px 8px;font-size:11.5px}

/* Notes on a sentence. Deliberately quieter than a finding card — no severity
   rail, no accent border: a note is a person talking, not a machine verdict, and
   the two must not read as the same kind of object in one column. */
.ew-note{border:1px solid var(--line);border-radius:6px;background:#fff;padding:7px 9px;margin-bottom:7px}
.ew-note-top{display:flex;align-items:center;gap:7px;font-size:11.5px;color:var(--mut)}
.ew-note-top b{color:var(--ink);font-size:12px}
.ew-note-top .ew-note-del{padding:0 6px;font-size:11.5px;line-height:1.6}
.ew-note-text{margin-top:4px;font-size:12.5px;color:var(--ink);white-space:pre-wrap;word-break:break-word}
#ew-note-add-row{margin-top:8px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
#ew-note-add-row textarea{width:100%;box-sizing:border-box;font:inherit;font-size:13px;
  border:1px solid var(--line);border-radius:6px;padding:6px 8px;resize:vertical;min-height:46px}

@media (max-width:820px){
  #topbar h1{display:none}
  #docview{flex-direction:column}
  #edwin{width:auto;border-left:none;border-top:1px solid var(--line)}
}

/* ---------------- BT-engine (two-register) finding cards ---------------- */
/* Tier chips: evidence-language, not severity. Distinct from the MAP sevchip
   palette so the two vocabularies cannot be misread as one scale. */
.bt-tierchip{display:inline-block;padding:1px 7px;border-radius:9px;font-size:10.5px;
  font-weight:700;letter-spacing:.4px;border:1px solid}
.bt-tierchip.bt-likely{color:#7c2d12;background:#fff3ea;border-color:#f3c9ad}
.bt-tierchip.bt-probable{color:#1e4c8f;background:#eef4fd;border-color:#c4d8f4}
.bt-tierchip.bt-possible{color:#4b5563;background:#f4f5f7;border-color:#dcdfe4}
.bt-track{display:inline-block;padding:1px 7px;border-radius:9px;font-size:10.5px;
  font-weight:700;letter-spacing:.4px;color:#5b3fa8;background:#f4f0fc;border:1px solid #ddd0f2}
.bt-class{display:inline-block;padding:1px 6px;border-radius:4px;font-size:10.5px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  color:#334155;background:#f1f5f9;border:1px solid #dbe3ec}
.bt-xseg{display:inline-block;padding:1px 6px;border-radius:9px;font-size:10.5px;
  color:#0f5c5a;background:#ecf8f7;border:1px solid #c8e8e6}
/* The technical headline: one expert line, monospace — the consultant's index
   line. The plain block below serves the translator. */
.bt-tech{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:12px;line-height:1.5;color:#1f2937;background:#f8fafc;
  border-left:3px solid #cbd5e1;padding:6px 9px;border-radius:0 4px 4px 0;margin:6px 0 4px}
.bt-evidence{font-size:11.5px;margin:2px 0}
.bt-plain{margin:6px 0;border:1px solid #e5e9ef;border-radius:6px;padding:0}
.bt-plain summary{cursor:pointer;padding:7px 10px;font-weight:600;font-size:13px}
.bt-plain[open] summary{border-bottom:1px solid #eef1f5}
.bt-plain .bt-row{padding:4px 12px}
.bt-row{font-size:12.5px;line-height:1.5}
.bt-words{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}
/* The parity hedge stays visible by default — it labels the decision the
   translator is making, not a second-class finding. */
.bt-parity{font-size:12px;color:#634d1f;background:#fdf8ec;border:1px solid #f1e4bd;
  border-radius:5px;padding:5px 9px;margin:5px 0}
.bt-caveat{display:inline-block;margin:3px 6px 3px 0;padding:1px 7px;border-radius:9px;
  font-size:10.5px;font-weight:600;color:#8a3b12;background:#fdf1e7;border:1px solid #f0d4bb;
  cursor:help}
/* Two result sets, visibly separated */
.f-section{margin:14px 0 6px;padding:6px 10px;font-weight:700;font-size:12.5px;
  letter-spacing:.3px;color:#5b3fa8;background:#f4f0fc;border:1px solid #ddd0f2;border-radius:6px}
.bt-summary{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:0 0 10px;
  padding:8px 10px;background:#fbfcfe;border:1px solid #e5e9ef;border-radius:6px}
.bt-count{font-size:11.5px;color:#475569;white-space:nowrap}
.bt-sep{width:1px;height:16px;background:#dde3ea;margin:0 4px}
.sa-f.bt-theo{border-left:3px solid #ddd0f2}
