/*
  view-corpus styles — the Corpus Editor, folded into the shell (Phase 2).
  Corpus-editor-specific rules only; the generic base (:root, body, button,
  input, a) and the standalone topbar/login are dropped — tms.css supplies
  them. The corpus's own custom properties are re-scoped to #view-corpus and
  mapped onto the shell palette (accent = --blue #1a5fb4), so the editor picks
  up the PC-parity tokens automatically.

  SCOPING RULE (P2.1): this sheet is loaded document-wide by BOTH hosts, and the
  PC shell owns a lot of markup that reuses these class names. Any selector
  whose class/id the host also uses on its OWN chrome must be scoped to
  #view-corpus, or it restyles that chrome uninvited. Deliberate exceptions:
  `.hide` is a document-wide utility both hosts depend on (the shared audit
  surface alone relies on it 9 times), and `.row` is layout-only. Verified
  empirically — see developer/tests/e2e/css_bleed_guard.cjs. */
#view-corpus{--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}
/* toolbar */
#toolbar{display:flex;align-items:center;gap:10px;padding:12px 18px;background:var(--panel);
  border-bottom:1px solid var(--line);flex-wrap:wrap}
#toolbar select#corpus-sel{width:auto;min-width:240px;font-weight:600}
#toolbar .spacer{flex:1}
#wsc-msg{font-size:12.5px;color:var(--mut)}

/* split master-detail */
#split{flex:1;min-height:0;display:flex}
#list-pane{width:360px;min-width:280px;display:flex;flex-direction:column;border-right:1px solid var(--line);background:var(--panel)}
#list-head{padding:12px 14px;border-bottom:1px solid var(--line2);display:flex;flex-direction:column;gap:8px}
#list-filters{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
#list-filters label{font-size:12.5px;color:var(--mut);display:flex;align-items:center;gap:5px;white-space:nowrap}
#list-filters select{width:auto;padding:5px 8px;font-size:12.5px}
#term-list{flex:1;overflow:auto;padding:6px}
.term-item{display:block;width:100%;text-align:left;border:1px solid transparent;background:none;
  border-radius:10px;padding:9px 11px;margin-bottom:2px}
.term-item:hover{background:var(--accent-soft);border-color:transparent}
.term-item.sel{background:var(--accent-soft);border-color:#cfe0f7}
.term-item .ti-en{font-weight:600}
.term-item .ti-sub{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:3px}
.count-note{padding:6px 14px;font-size:12px;color:var(--mut);border-bottom:1px solid var(--line2)}

/* detail pane */
#detail-pane{flex:1;min-width:0;overflow:auto;padding:22px 26px;--dp-pad:26px}
#detail-empty{height:100%;display:flex;align-items:center;justify-content:center;color:var(--mut)}
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:18px 20px;margin-bottom:16px;max-width:860px}
.card h2{margin:0 0 2px;font-size:20px}
.card h3{margin:0 0 10px;font-size:13px;text-transform:uppercase;letter-spacing:.5px;color:var(--mut)}
/* Scoped to the host: .field is the PC shell's own form idiom too (32 sites
   across 13 dialogs, Corpus Builder and Stage 3), and unscoped these overrode
   its label metrics. See the header note. */
#view-corpus .field{margin-bottom:12px}
#view-corpus .field label{display:block;font-size:12.5px;color:var(--mut);margin-bottom:4px}
.row{display:flex;gap:12px;flex-wrap:wrap}
#view-corpus .row > .field{flex:1;min-width:200px}
.detail-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px;max-width:860px}
.detail-head h2{margin:0;font-size:22px}

/* chips & badges */
.chip{display:inline-block;font-size:11px;font-weight:600;padding:2px 9px;border-radius:20px;border:1px solid}
.chip.unreviewed{color:#6b7280;border-color:#d6dae0;background:#f3f4f6}
.chip.under_review{color:#b7791f;border-color:#ecd9b0;background:#fdf6e7}
.chip.finalized{color:#1e8e3e;border-color:#bfe3c8;background:#eaf7ee}
.tag{display:inline-block;font-size:11px;color:var(--mut);background:#f3f4f6;border:1px solid var(--line);
  border-radius:6px;padding:1px 7px}
.tag.bib{color:#166534;background:#dcfce7;border-color:#bbf7d0}
.warn{color:var(--red);font-size:11px}
.lockmark{color:var(--amber);font-size:11.5px}
/* Scoped: bare `details` reached every disclosure widget in the host document
   (the PC's Stage-2/Stage-3 panels, dlg-admin and the shared audit's #summary),
   replacing the native marker and adding padding they never asked for. */
#view-corpus details{border-top:1px solid var(--line2);padding:10px 0 2px}
#view-corpus details > summary{cursor:pointer;font-weight:600;font-size:13px;list-style:none}
#view-corpus details > summary::-webkit-details-marker{display:none}
#view-corpus details > summary::before{content:"▸ ";color:var(--accent)}
#view-corpus details[open] > summary::before{content:"▾ "}
.evi{margin:8px 0}
.bar{background:#eef0f3;height:6px;border-radius:4px;max-width:240px;margin-top:3px}
.bar > i{display:block;background:var(--accent);height:6px;border-radius:4px}
.ex{font-size:12px;color:var(--mut);margin:2px 0 2px 10px}
.recs{list-style:none;margin:6px 0;padding:0}
.recs li{padding:7px 0;border-bottom:1px solid var(--line2)}
.cmt{font-size:13px;margin:6px 0}
.cmt .meta{font-size:11px;color:var(--mut)}
.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:6px}
.hide{display:none!important}

/* two-column detail: main content + a narrow discussion rail */
.detail-grid{display:flex;gap:18px;align-items:flex-start;max-width:1220px}
.detail-main{flex:1;min-width:0}
.detail-main .card{max-width:none}
.detail-side{width:312px;flex:none}
.detail-side .card{margin-bottom:0;position:sticky;top:0}

/* merged renderings + evidence — a large [+] expands each rendering's evidence */
.rend{border:1px solid var(--line);border-radius:10px;margin:8px 0;background:#fff}
.rend.is-primary{border-color:#cfe0f7;background:#f8fbff}
.rend.is-obs{background:#fbfbf9;border-style:dashed}
.rend-head{display:flex;align-items:center;gap:9px;padding:7px 10px;flex-wrap:wrap}
.rend-caret{border:1px solid #cfe0f7;background:var(--accent-soft);color:var(--accent);font-size:19px;font-weight:700;
  line-height:1;width:30px;height:30px;flex:none;border-radius:8px;cursor:pointer;padding:0}
.rend-caret:hover{background:#dbe8fa}
.rend-word{font-size:15px;font-weight:700}
.rend-role{width:auto;padding:3px 6px;font-size:12px;flex:none}
.rend-acts{display:flex;gap:4px;margin-left:auto}
.rend-acts button{padding:3px 8px;font-size:12px}
.rend-evi{padding:5px 12px 12px 49px;border-top:1px solid var(--line2);font-size:12.5px}
.rend-evi .why{color:var(--mut);margin:4px 0}
/* Where a reading came from, always on screen (bug-260911-232957). Indented to
   the same 49px gutter as .rend-evi so the flag column lines up whether the row
   is expanded or not. No top border: this belongs to the head above it, not to
   the evidence below — the border is what separates the two. */
.rend-src{padding:0 12px 8px 49px;display:flex;flex-direction:column;gap:3px}
.rs-row{display:flex;align-items:baseline;gap:7px;flex-wrap:wrap;font-size:12px}
.rs-flag{display:inline-block;font-size:11px;font-weight:600;border-radius:4px;
  padding:1px 7px;white-space:nowrap;border:1px solid}
.rs-document{color:#1d4ed8;background:#eff6ff;border-color:#bfdbfe}
.rs-bible{color:#166534;background:#dcfce7;border-color:#bbf7d0}
.rs-ai{color:#9a3412;background:#fff7ed;border-color:#fed7aa}
.rs-manual,.rs-imported{color:var(--mut);background:#f3f4f6;border-color:var(--line)}
.rs-stat{color:var(--mut)}
.rs-quote{font-size:12px;color:var(--mut);margin:0 0 2px 10px}
/* A term the documents carry but nothing matched in (bug-260911-000721). Amber,
   not grey: this is a finding the alignment pass wants, and grey would file it
   next to "nothing here" — which is what the old wording did. */
.no-rend{font-size:12.5px;background:#fffbeb;border:1px solid #fde68a;border-radius:8px;padding:9px 11px}
.no-rend .nr-head{color:#92400e;margin-bottom:4px}
.no-rend .nr-why{color:var(--mut);margin-bottom:6px}
.no-rend .nr-sub{color:var(--mut);font-weight:600;margin:6px 0 2px}
.no-rend .ex{margin-left:0}
.flowhint{font-size:12px;color:var(--mut);background:#f3f6fb;border:1px solid #dbe6f6;border-radius:8px;padding:6px 10px;margin:0 0 12px;max-width:1220px}

@media (max-width:980px){
  .detail-grid{flex-direction:column}
  .detail-side{width:auto;align-self:stretch}
  .detail-side .card{position:static}
}

/* The narrow layout (M8) — see the block above applyPushed() in view-corpus.js.
   Under 1024px the panes stop sharing the screen: the list IS the screen, and
   selecting a term pushes the term over it. Stacking them (what this block did
   at 860px until 1.83.2) left the term 433px of a 4,000px detail pane with the
   list keeping 40% of the height for a job the reviewer had finished.

   Everything here keys off `.is-pushed`, which only this width reads — the two
   panes at desktop widths are untouched. */
#wsc-back, #lc-sticky{display:none}
@media (max-width:1024px){
  #split{flex-direction:column}
  #list-pane{width:auto;min-width:0;flex:1;min-height:0;border-right:none;border-bottom:1px solid var(--line)}
  #detail-pane{display:none;padding:14px;--dp-pad:14px}
  #view-corpus.is-pushed #list-pane{display:none}
  #view-corpus.is-pushed #detail-pane{display:block;flex:1;min-height:0}
  #view-corpus.is-pushed #wsc-back{display:inline-flex;align-items:center}
  #detail-pane .card{padding:12px}
  .detail-head h2{font-size:18px}
  #toolbar{padding:10px 12px}
  #toolbar select#corpus-sel{min-width:0;flex:1}
  /* The thumb floor. Every control in this pane was under 40px, on a surface
     whose whole job is pressing them. */
  #view-corpus button, #view-corpus select, #view-corpus input{min-height:40px}
  .rend-caret{width:40px;height:40px;font-size:21px}
  .rend-acts{margin-left:0;width:100%}
  .rend-acts button{flex:1;min-height:40px;font-size:13px}
  .rend-role{padding:6px 8px;font-size:13px}
  .rend-evi{padding-left:14px}
  .rend-src{padding-left:14px}
  /* The lifecycle action is the reason this screen is open, and .detail-head
     scrolls away with everything else. Pinned to the pane's bottom edge, it
     presses the head's own button — see ensureNarrowChrome(). */
  #view-corpus.is-pushed #lc-sticky{display:block;flex:none;padding:9px 14px calc(9px + env(safe-area-inset-bottom,0px));
    background:var(--panel);border-top:1px solid var(--line)}
  #view-corpus.is-pushed #lc-sticky.hide{display:none}
  #lc-sticky #lc-go{width:100%;min-height:46px;font-size:15px;font-weight:600;border-radius:10px}
  #lc-sticky #lc-go.primary{background:var(--blue);color:#fff;border-color:var(--blue)}
}

/* ---- a rendering's verdict: rejected, ignored, or live -------------------
   bug-260901-225433. The owner: *"On ignore grey it out to show that it is no
   longer being a candidate for anything."*

   Greyed, not hidden. A row that vanishes leaves the reviewer wondering whether
   the press worked and gives them nothing to undo; a greyed row says the
   decision took and stays where they can reverse it. The rendering is still in
   the term's evidence until the next build strips it, so hiding it here would
   also be a lie about what the corpus currently holds.

   The two states look different from each other on purpose. Rejected keeps its
   colour, because it is in a list the reviewer can work through; ignored is
   desaturated and struck, because it is out of consideration entirely. */
.rend.is-ignored{opacity:.55}
.rend.is-ignored .rend-word{text-decoration:line-through}
.rend.is-rejected{opacity:.8}
.rend.is-rejected .rend-word{text-decoration:line-through;text-decoration-color:var(--red)}
.tag.rend-rejected{background:var(--red-bg);border-color:var(--red);color:var(--red)}
.tag.rend-ignored{background:#eee;border-color:var(--line);color:var(--mut)}

/* ---- "Previously Rejected Terms" ---------------------------------------
   Collapsed by default, as asked. The toggle is a plain full-width button so
   the whole header is the hit target rather than a caret a reader has to aim
   at. */
/* "Needs your attention" (bug-260910-234754). The lines are full sentences now,
   so they get a sentence's size and leading — `.warn` alone is 11px, which was
   readable for three words and is not for three clauses. Declared after `.warn`
   so the pair `.warn.an-line` lands on this size. */
.an-line{font-size:12.5px;line-height:1.5;margin-bottom:7px}
/* One note per line, not six joined by " · ". `list-style:none` with a hanging
   marker, because the notes are things to READ and act on, not a ranked list. */
.an-notes{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.an-notes > li{font-size:12.5px;line-height:1.5;color:var(--mut);
  padding-left:11px;border-left:2px solid #fde68a}
.an-tag{display:inline-block;font-size:10.5px;font-weight:700;letter-spacing:.04em;
  text-transform:uppercase;color:#92400e;margin-right:6px}

.card.prev-rejected{padding:10px 12px}
/* At the foot of the term list, not in a term's detail pane (bug-260911-233127).
   Its own top rule separates it from the last term; the list's own 6px padding
   is the gutter, so it takes none of its own on the sides. */
#term-list > .card.prev-rejected{margin:10px 0 4px;border-radius:8px}
.pr-toggle{display:block;width:100%;text-align:left;font:inherit;font-size:13px;font-weight:600;
  background:none;border:0;padding:2px 0;cursor:pointer;color:var(--ink)}
.pr-toggle:hover{color:var(--blue)}
.pr-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  padding:6px 0;border-bottom:1px dashed var(--line);font-size:13px}
.pr-row:last-of-type{border-bottom:0}
.pr-approve,.pr-dismiss{font:inherit;font-size:12.5px;padding:4px 11px;
  border:1px solid var(--line);border-radius:6px;background:#fff;cursor:pointer}
.pr-approve:hover,.pr-dismiss:hover{filter:brightness(.97)}

/* ---- the decision row, pinned -------------------------------------------
   bug-260901-225304 pulled Approve and Reject out of two different corners of
   the screen and stacked them in one grey panel. bug-260908-102510 is the next
   word on the same controls: *"approve and next + Reject from corpus buttons
   and the prev / next buttons should all be on the same row and should not
   scroll down with the rest of the corpus issue siction. That way user can
   always use them wherever in the corpus issue they have scrolled to."*

   THE ROW IS THE FIX AND THE STICKINESS IS THE POINT. A term's evidence runs
   well past one screen — renderings with their when-to-use, all-evidence,
   classification, notes, discussion — and the reviewer reads to the bottom of
   it before deciding. Every control the decision needs was above that, so
   deciding meant scrolling back up, and the four presses that make up the whole
   of this screen's work were the four hardest to reach.

   `#detail-pane` is the scroller (`overflow:auto`), so `position:sticky;top:0`
   pins to the top of the pane and not the window — correct in the narrow
   single-pane layout too, where the pane is the whole screen. The negative
   inline margins pull the row out to the pane's edges so the ground it carries
   covers the full width of what scrolls under it; `--dp-pad` keeps that in step
   with the pane's own padding at both widths rather than hard-coding 26px here
   and 14px in the media query. It is declared on `#detail-pane`'s own rule at
   the top of this file rather than beside these lines, because the narrow
   layout overrides it at equal specificity and the later declaration wins — a
   default written down HERE would sit after that override and beat it. */
.rv-bar{
  position:sticky;top:0;z-index:6;
  display:flex;align-items:center;gap:10px 16px;flex-wrap:wrap;
  margin:0 calc(var(--dp-pad) * -1) 14px;padding:8px var(--dp-pad) 10px;
  background:var(--bg);border-bottom:1px solid var(--line);
}
.rv-queue{display:flex;align-items:center;gap:10px;font-size:13px;flex-wrap:wrap}
/* One row now, not a stack: `flex-direction:row` is the whole of the change
   bug-260908-102510 asked for, and the panel keeps its grey ground so the two
   verdicts still read as a pair against the queue controls beside them. */
.rv-decide{
  display:flex;flex-direction:row;align-items:center;gap:10px;flex-wrap:wrap;
  background:var(--panel);border:1px solid var(--line);border-radius:8px;
  padding:7px 10px;margin:0;
}
/* The blocker note `lifecycleBtns` renders after Approve. It was a stretched
   block under the button when the box was a column; in a row it sits beside the
   button it belongs to and must not claim the width. */
.rv-decide > div{text-align:left !important;align-self:center;max-width:26ch}

/* LIGHT GREEN, as asked, and it has to say so louder than `.primary` does —
   `.primary` is the app's blue and is set on this same button. Approve is not
   destructive and does not need the weight red carries; it needs to be the
   obvious next press. */
.lc-approve{
  background:var(--green-bg) !important;color:#14622c !important;
  border:1px solid var(--green) !important;
  font-weight:600;padding:7px 16px;border-radius:6px;cursor:pointer;
}
.lc-approve:hover:not(:disabled){filter:brightness(.97)}
.lc-approve:active:not(:disabled){transform:translateY(1px)}
.lc-approve:focus-visible{outline:3px solid var(--green);outline-offset:2px}
.lc-approve:disabled{opacity:.55;cursor:default}

/* ---- Reject from Corpus ------------------------------------------------
   The one control on this screen that is not an edit: it takes a term out and
   keeps it out, and a later build will not bring it back. So it is red, it is
   filled rather than outlined, and it does not sit in the same visual class as
   prev / next — a reviewer stepping through the queue at speed must never
   press it by reflex, and must never miss it when they want it.

   `!important` on nothing: the bar's own buttons carry no colour rules, so
   this needs no weight beyond its own class. */
.rv-reject{
  background:#DC2626;color:#fff;border:1px solid #B91C1C;
  font:inherit;font-size:13px;font-weight:600;
  padding:6px 14px;border-radius:6px;cursor:pointer;
  box-shadow:0 1px 2px rgba(0,0,0,.15);
}
.rv-reject:hover:not(:disabled){background:#B91C1C}
.rv-reject:active:not(:disabled){transform:translateY(1px)}
.rv-reject:focus-visible{outline:3px solid #FCA5A5;outline-offset:2px}
.rv-reject:disabled{opacity:.55;cursor:default}

/* THE TWO ANSWERS TO A BIBLE-VS-COURSE DIFFERENCE, revealed by `Resolve ▸` on
   the term's primary. On the card, not in a window: there are two of them and
   they are a line each. Stacked rather than side by side so neither reads as
   the default — the whole point is that the reviewer chooses. */
.lc-choices{ display:flex; flex-direction:column; gap:6px; margin-top:6px }
.lc-choices[hidden]{ display:none }
.lc-choices button{
  text-align:left; font-size:12px; padding:6px 9px;
  border:1px solid var(--line); border-radius:7px; background:#fff; cursor:pointer;
}
.lc-choices button:hover{ border-color:var(--accent, #1a5fb4) }
