/* ========================================
   BLOCK 2: Page-Specific CSS (pvi-reassign-photographers)
   (this page only; Block 1 lives in pvi-master-frame.css)

   The drill-down half of the unassigned pair. Structurally
   pvi-unassigned-photographers.css with four swaps: the filter bar
   becomes a prefix summary card, the selection tray becomes a pending-
   changes tray, the Select column gains an Assign-To column beside it,
   and the page adds a single-job mode in which the summary card owns
   the assignment and the table drops to read-only.

   The table chrome itself (.pv-lb-table, .scored, .pct-*, the pivot
   family, .cb-col) is deliberately the SAME vocabulary as the sibling
   page rather than a private copy under new names — the two pages are
   read one after the other and any drift between them shows up as the
   table changing shape mid-flow.

   COLOR POLICY: every color in this file resolves to a Block 1 design
   token. The source design's private navy/slate palette (#1b1f2e,
   #252b3b, #dde1ea, #9ba5c0, #c8d0e0, #f6f8fc, #f8f9ff, #eef0f5,
   #6c757d, #adb5bd, #2e9e6b, #1e3a2e, #fffdf5, #fffbec, #fff6d6,
   #f0faf5, #f0e4c0, #d4f5e2, #fde8e8, #fef3dd, #fff3cd …) has been
   mapped onto the frame tokens instead — dark chrome to --dark-grey,
   secondary chrome to --mid-grey, borders to --light-grey, panel fills
   to --surface, in-card dividers to --rule, text on dark to
   --light-grey / --white, the amber summary card to the --amber-warn
   cluster. Nothing here paints from a literal hex except the two shim
   tokens declared below, which are marked for promotion to Block 1.
   ======================================== */

/* ── Token shims — DELETE WHEN BLOCK 1 ADOPTS THEM ────────────────
   Identical to the shim block in pvi-unassigned-photographers.css and
   carried for the same two reasons. Kept as a verbatim copy on purpose:
   both pages must stop shimming on the same day, and a reworded copy
   is harder to grep for when that day comes.

   1. --red. scoreColor() in pvi-shared.js returns var(--green) /
      var(--orange) / var(--red). Block 1 supplies --green (#5cb85c)
      and --orange (#f0ad4e) but not --red, so the low band would
      resolve to nothing. Aliased to --dull-red, the frame's existing
      danger accent — no new hex, and the value is already right on
      the day Block 1 declares --red itself.

   2. The green soft-fill pair. Block 1 has a complete amber cluster
      (--amber-warn / --amber-warn-bg / --amber-warn-text) and the red
      equivalent (--dull-red / --dull-red-bg), but no green counterpart
      for the same pattern. This page needs it in three places: the
      % Green pill, the "assignment set" tint on a filled dropdown, and
      the selected-row tint. These two are the only literal hexes in
      this file; they belong in the Block 1 palette as --green-bg /
      --green-text, completing the third cluster. ── */
.pv-content {
    --red:        var(--dull-red);
    --green-bg:   #eaf7ea;  /* parallel to --amber-warn-bg / --dull-red-bg */
    --green-text: #2f6b2f;  /* parallel to --amber-warn-text */

    font-size: 0.875rem;
    padding: 1.5rem;
}

/* ── Breadcrumb ──
   The only path back to the list view other than the buttons at the
   foot of the page, and the only place the parent report is named. ── */
.pv-breadcrumb {
    font-size: 0.78rem; color: var(--mid-grey); margin-bottom: 1rem;
}
.pv-breadcrumb a { color: var(--green); text-decoration: none; }
.pv-breadcrumb a:hover { text-decoration: underline; }

/* Page title — matches the sibling: green rule by default, red when the
   page is carrying an exception. Reassign is always reached from the
   exception queue, so .pv-page-title-alert is expected to be present. */
.pv-page-title {
    font-size: 1.2rem; font-weight: 700; color: var(--dark-grey);
    border-left: 4px solid var(--green);
    padding-left: 0.65rem; margin-bottom: 1.25rem;
}
.pv-page-title-alert { border-left-color: var(--red); }
.pv-page-title-alert i { color: var(--red); }

/* ── Prefix summary card ──
   Amber cluster rather than plain white chrome: this card is the
   statement of the problem being fixed, not a neutral header. Same
   three tokens the sibling page uses for its "unmatched" badge, so the
   two pages read as one flow. ── */
.pv-summary-card {
    background: var(--amber-warn-bg);
    border: 1px solid var(--amber-warn);
    border-radius: 8px;
    padding: 1rem 1.25rem; margin-bottom: 1.25rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
}
/* Stacks prefix code + issue badge in a column so the badge sits
   beneath the code block rather than beside it on narrow viewports */
.pv-prefix-stack {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 0.3rem; flex-shrink: 0;
}
.pv-prefix-big {
    font-size: 1.5rem; font-weight: 900;
    background: var(--dark-grey); color: var(--light-grey);
    padding: 0.2rem 0.65rem; border-radius: 5px;
    letter-spacing: 0.05em; flex-shrink: 0;
}
.pv-summary-meta {
    display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem;
    font-size: 0.82rem; color: var(--dark-grey); flex: 1; min-width: 0;
}
.pv-summary-meta span { white-space: nowrap; }
.pv-summary-meta .meta-val { font-weight: 600; color: var(--dark-grey); }
.pv-summary-meta i { color: var(--mid-grey); }

/* Average grade for the whole prefix. Banded by scoreColor() from
   data-val, same as any .scored cell — the circle is a shape change,
   not a different coloring rule. */
.pv-grade-circle {
    display: flex; align-items: center; justify-content: center;
    width: 54px; height: 54px; border-radius: 50%;
    font-size: 1.25rem; font-weight: 900; color: var(--white);
    flex-shrink: 0;
}
/* No parsable prefix means no metrics and therefore no grade to band.
   Neutral chrome rather than a red circle: absent is not bad. */
.pv-grade-na {
    display: flex; align-items: center; justify-content: center;
    width: 54px; height: 54px; border-radius: 50%;
    background: var(--surface); color: var(--mid-grey);
    font-size: 0.65rem; font-weight: 700; text-align: center;
    line-height: 1.2; flex-shrink: 0;
}

/* ── Issue-type badges ──
   Lifted verbatim from the sibling page: color comes from the row's (or
   here the card's) data-issue value, so no class token is needed and a
   badge class cannot drift apart from a filter value. Unmatched maps to
   the amber cluster, no-underscore to the red cluster; an unknown issue
   type falls back to neutral chrome rather than to no styling. ── */
.issue-badge {
    display: inline-block; font-size: 0.72rem; font-weight: 600;
    padding: 0.15rem 0.5rem; border-radius: 3px; vertical-align: middle;
    flex-shrink: 0;
    background: var(--surface); color: var(--dark-grey);
}
[data-issue="unmatched"] .issue-badge {
    background: var(--amber-warn-bg); color: var(--amber-warn-text);
}
[data-issue="no-underscore"] .issue-badge {
    background: var(--dull-red-bg); color: var(--dull-red);
}
/* On the amber card the "unmatched" badge would be fill-on-fill, so it
   takes the white backdrop there to stay legible. */
.pv-summary-card [data-issue="unmatched"] .issue-badge,
.pv-summary-card.issue-unmatched .issue-badge { background: var(--white); }

/* ── Single-job assignment form (mode-single only) ──
   Sits inside the summary card, below the meta row. In single-job mode
   the card owns the assignment and the table is read-only detail. ── */
.pv-single-assign {
    width: 100%; padding-top: 0.75rem; margin-top: 0.25rem;
    border-top: 1px solid var(--amber-warn);
    flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
}
.pv-single-assign label {
    font-size: 0.82rem; font-weight: 600; color: var(--dark-grey);
    white-space: nowrap;
}
.pv-single-assign select { min-width: 220px; max-width: 340px; font-size: 0.82rem; }

/* ── Quick-fill bar ──
   Sets the Assign-To dropdown on checked rows, or on every row when
   nothing is checked. Client-side only — nothing commits until save. ── */
.pv-quickfill {
    background: var(--white); border: 1px solid var(--light-grey);
    border-radius: 6px; padding: 0.65rem 1rem; margin-bottom: 1rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
}
.pv-quickfill .qf-label {
    font-size: 0.72rem; font-weight: 700; color: var(--mid-grey);
    text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.pv-quickfill select { font-size: 0.82rem; min-width: 220px; }
.pv-quickfill .qf-scope { font-size: 0.78rem; color: var(--mid-grey); margin-left: auto; }

/* ── Pending-changes tray (between quick-fill and table) ──
   Same shell as the sibling page's selection tray, holding a different
   payload: one chip per pending assignment rather than per selected
   record. Save and Discard live here rather than in a persistent bar,
   so neither is reachable until there is actually something to save —
   the parallel of Delete and Hide being unreachable at zero selection
   on the list page. ── */
.pv-sel-tray {
    background: var(--dark-grey); border-radius: 6px;
    padding: 0.6rem 1rem; margin-bottom: 1rem;
}
.pv-sel-tray-inner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.75rem;
}
.sel-tray-label {
    color: var(--light-grey); font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.sel-tray-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; flex: 1; min-width: 0; }
.sel-tag {
    background: var(--mid-grey); color: var(--light-grey); font-size: 0.76rem;
    padding: 0.2rem 0.6rem; border-radius: 4px;
    display: inline-flex; align-items: center; gap: 0.35rem;
}
/* The chip reads "FOLDER -> CODE", so the arrow needs to be dimmer than
   both ends of it or it competes with the values it separates. */
.sel-tag .tag-arrow { color: var(--light-grey); opacity: .65; }
.sel-tag .rm-tag {
    cursor: pointer; color: var(--light-grey); border: none; background: none;
    padding: 0; font-size: 1.1rem; line-height: 1;
}
.sel-tag .rm-tag:hover { color: var(--white); }
.sel-tray-count { color: var(--light-grey); font-size: 0.72rem; white-space: nowrap; font-style: italic; }
.sel-tray-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* ── Selection checkbox column ──
   Green rather than the sibling's red: selecting rows here scopes a
   quick-fill, it does not arm a delete. ── */
.cb-col { width: 36px !important; min-width: 36px; text-align: center !important; padding: 0.3rem 0.25rem !important; }
.pv-sel { cursor: pointer; width: 16px; height: 16px; accent-color: var(--green); vertical-align: middle; }

/* Pivot: checkbox in column header */
.pv-pivot-cb-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pv-pivot-cb { cursor: pointer; width: 15px; height: 15px; accent-color: var(--green); margin-top: 3px; }

/* ── Leaderboard-family table ── */
.pv-table-wrap { overflow-x: auto; }
/* Scale the wide table so it always fits without a scrollbar between the
   pivot breakpoint (1400px) and ~1750px. The window is wider than the
   sibling's (1401–1550px) because this table carries a 200px Assign-To
   select the list page does not have. */
@media (min-width: 1401px) and (max-width: 1750px) {
    .pv-table-wrap { zoom: 0.86; }
}
/* Stacked label for the pivot header row (Folder + Select in one cell) */
.pv-pl-hdr {
    display: flex; flex-direction: column; gap: 3px;
    font-size: 0.68rem; font-weight: 700; color: var(--mid-grey);
    text-transform: uppercase; letter-spacing: .04em; line-height: 1.2;
}
.pv-lb-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--light-grey);
    border-radius: 6px;
    overflow: hidden;
}
.pv-lb-table th {
    background: var(--dark-grey);
    color: var(--light-grey);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 0.55rem 0.6rem;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
/* Hover lifts the header to --mid-grey — the frame has no dark-chrome
   hover token, and mid-grey is the palette's next step up from dark */
.pv-lb-table th:hover { background: var(--mid-grey); color: var(--white); }
/* Neither Select nor Assign To is sortable — no pointer, no hover shift */
.pv-lb-table th.cb-col,
.pv-lb-table th.assign-col { cursor: default; }
.pv-lb-table th.cb-col:hover,
.pv-lb-table th.assign-col:hover { background: var(--dark-grey); color: var(--light-grey); }
.pv-lb-table th.assign-col { min-width: 200px; }
.pv-lb-table th.sort-asc::after  { content: ' \25B2'; font-size: 0.65rem; }
.pv-lb-table th.sort-desc::after { content: ' \25BC'; font-size: 0.65rem; }

.pv-lb-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.82rem;
}
.pv-lb-table tr:last-child td { border-bottom: none; }
.pv-lb-table tr:hover td { background: var(--surface); }

/* Row tints. Two states can be true at once — a row can be checked AND
   carry a pending assignment — so .row-changed is declared last and
   wins on equal specificity. That is the intended precedence: an
   unsaved edit is the more important of the two to see. */
.pv-lb-table tr.row-selected td { background: var(--green-bg); }
.pv-lb-table tr.row-changed  td { background: var(--amber-warn-bg); }

/* Scored cells — background painted by colorizeScored() from data-val */
.scored {
    display: inline-block;
    text-align: center; font-weight: 700;
    color: var(--white); border-radius: 4px;
    padding: 0.25rem 0.4rem;
    min-width: 34px;
}
.scored a { color: inherit; text-decoration: none; }

/* Green/Orange/Red pct pills — soft-fill siblings, one per cluster */
.pct-green  { background: var(--green-bg); color: var(--green-text); font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
.pct-orange { background: var(--amber-warn-bg); color: var(--amber-warn-text); font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
.pct-red    { background: var(--dull-red-bg); color: var(--dull-red); font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
/* Absent metric — a job with no computed metrics has no score to band */
.pct-na     { color: var(--mid-grey); font-size: 0.82rem; }

/* ── Assign-To cell ── */
.assign-cell { min-width: 200px; }
.assign-select { font-size: 0.78rem; width: 100%; }
/* A filled dropdown is tinted green so a scan down the column shows what
   is already decided without reading every option label. */
.assign-select.is-set {
    border-color: var(--green); background: var(--green-bg); font-weight: 600;
}
.assign-select:focus {
    border-color: var(--dull-blue);
    box-shadow: 0 0 0 .2rem var(--focus-ring-blue);
}

/* Changed indicator dot — always in the DOM so the cell does not reflow
   when an assignment is made; only its opacity changes. */
.changed-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--orange); margin-right: 4px; vertical-align: middle;
    opacity: 0; transition: opacity .15s;
}
tr.row-changed .changed-dot { opacity: 1; }

/* ── Adaptive mode: single job vs. multiple jobs ─────────────────
   The page script adds .mode-single or .mode-multi to #reassign-root on
   load, from the row count. Scoped to the page root rather than <body>
   because a fragment owns its own subtree and nothing above it.

   Single mode: the summary card owns the assignment; the table stays
   visible as read-only job detail with no checkboxes and no Assign-To
   column. Multi mode: full table, quick-fill, per-row dropdowns, and
   the summary card's assign form stays hidden.

   These are page-state classes, not engine state, so they are plain CSS
   rather than `hidden` attribute tokens — the count is knowable in the
   browser and needs no marker.
────────────────────────────────────────────────────────────────── */
.pv-single-assign               { display: none; }
.mode-single .pv-single-assign  { display: flex; }
.mode-single .pv-quickfill      { display: none; }
.mode-single .cb-col            { display: none; }
.mode-single .assign-col,
.mode-single .assign-cell       { display: none; }
.mode-single .pv-multi-only     { display: none; }

/* ── Record count line ── */
.pv-record-count { font-size: 0.78rem; }

/* ── Narrow viewports ── */
@media (max-width: 768px) {
    .pv-content { padding: 0.75rem; }
}
@media (max-width: 600px) {
    .pv-quickfill { flex-direction: column; align-items: stretch; }
    .pv-quickfill select { min-width: unset; width: 100%; }
    .pv-quickfill .qf-scope { margin-left: 0; }
    .pv-single-assign select { min-width: unset; width: 100%; }
    .pv-sel-tray-inner { flex-direction: column; align-items: stretch; }
    .pv-sel-tray .sel-tray-actions { justify-content: flex-end; }
    .pv-summary-meta { gap: 0.35rem 0.75rem; }
}

/* ── Column-pivot navigator (breakpoint: 1400px) ─────────────────────
   At <=1400px the table transposes: fields → rows, each job becomes a
   navigable column filling the available screen width. Prev/Next page
   through jobs that don't fit at once. The Assign-To select rides along
   as its own pivot row and stays in sync with the wide table through
   the page script's shared assignment state.
   Column width: 120px each (wider than the sibling's 100px — a column
   here has to hold a usable dropdown). Label column: 90px sticky left. ── */
@media (max-width: 1400px) {
    .pv-table-wrap { overflow: visible; }
    .pv-pivot { margin-bottom: 1.5rem; }
    .pv-pivot-nav {
        display: flex; align-items: center; gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .pv-pivot-nav .pv-nav-pg {
        flex: 1; text-align: center; font-size: 0.78rem; color: var(--mid-grey);
    }
    .pv-pivot-tbl {
        width: 100%; border-collapse: separate; border-spacing: 0;
        font-size: 0.82rem;
    }
    .pv-pivot-tbl thead th {
        background: var(--surface); border-bottom: 2px solid var(--light-grey);
        padding: 0.4rem 0.3rem; white-space: normal;
        vertical-align: middle; text-align: center;
        width: 120px; min-width: 120px; max-width: 120px;
    }
    .pv-pivot-tbl tbody td {
        padding: 0.3rem 0.3rem; border-bottom: 1px solid var(--rule);
        vertical-align: middle; word-break: break-word;
    }
    .pv-pivot-tbl tbody tr:last-child td { border-bottom: none; }
    .pv-pivot-tbl tbody tr.pivot-assign-row td.pv-pc select { width: 100%; font-size: 0.72rem; }
    .pv-pl {
        position: sticky; left: 0; background: var(--surface);
        border-right: 2px solid var(--light-grey); font-size: 0.68rem;
        font-weight: 700; color: var(--mid-grey); text-transform: uppercase;
        letter-spacing: .03em; z-index: 2;
        width: 90px; min-width: 90px; max-width: 90px;
        padding: 0.3rem 0.4rem;
        /* Wraps rather than clips — this page's labels are long
           (Avg Time/Subject) and the folder names are long (a
           timestamped filename), so word-break is set here and on .pv-pc */
        white-space: normal; word-break: break-word;
    }
    .pv-pivot-tbl thead .pv-pl { z-index: 3; }
    /* Job columns: allow the folder name to wrap, center content */
    .pv-pc {
        text-align: center;
        white-space: normal; word-break: break-word;
        width: 120px; min-width: 120px; max-width: 120px;
    }
    /* Row tints carried onto the pivot column, same precedence as the
       wide table: a pending edit outranks a selection. */
    .pv-pivot-tbl .pv-pc.row-selected { background: var(--green-bg); }
    .pv-pivot-tbl .pv-pc.row-changed  { background: var(--amber-warn-bg); }
}

/* NOTE: .save-section / .save-btn / .save-btn-secondary are Block 1 §7
   chrome and are deliberately NOT declared here. The green fill on
   .save-btn-secondary is the documented decision, not a bug. */
