/* ========================================
   BLOCK 2: Page-Specific CSS (pvi-grade-adjustment)
   (this page only; extracted from the fragment's
    inline <style> — Block 1 lives in pvi-master-frame.css)

   PALETTE NOTE. The report cluster (leaderboard, photographer-activity-pills,
   photographer-profile-donut, this page) renders on its own dark-navy chrome
   palette — #1b1f2e / #252b3b / #dde1ea / #6c757d — which is NOT declared in
   the master frame :root. Those literals are carried here so this page matches
   its siblings pixel for pixel, and they are the cluster's outstanding CSS-
   variable debt, not a new decision: they belong in pvi-master-frame.css :root
   as a report-chrome cluster (ruleset §12 forbids hardcoded hex). The
   Detailed Adjustments table added this edition therefore reuses
   .pv-hist-table's chrome wholesale rather than restating those literals a
   second time; see that block below. Semantic
   colors that DO exist in the frame are referenced as variables below.
   Score-band colors are not set in this file: since 2026-09-16 they come
   from scoreColor() in pvi-shared.js (var(--green) / var(--orange) /
   var(--dull-red)), the same function the sibling report pages use.
   ======================================== */

.pv-content { font-size: 0.875rem; padding: 1.5rem; }

/* Breadcrumb */
.pv-breadcrumb { font-size: 0.78rem; color: #6c757d; margin-bottom: 1rem; }
.pv-breadcrumb a { color: #2e9e6b; text-decoration: none; }
.pv-breadcrumb a:hover { text-decoration: underline; }
.pv-crumb-leaderboard[hidden] { display: none !important; }

/* Titles */
.pv-page-title {
    font-size: 1.2rem; font-weight: 700; color: #1b1f2e;
    border-left: 4px solid var(--green);
    padding-left: 0.65rem; margin-bottom: 1.25rem;
}
.pv-section-title {
    font-size: 0.95rem; font-weight: 700; color: #252b3b;
    border-left: 3px solid #dde1ea;
    padding-left: 0.6rem; margin-bottom: 0.85rem; margin-top: 1.5rem;
}

/* Shared error slot (dictionary §11.5). Hidden until the engine sets
   error_class to is-shown, so an empty error_message never leaves a
   floating empty box on the page. */
.pv-error-block { display: none; }
.pv-error-block.is-shown {
    display: block;
    background: var(--dull-red-bg); border: 1px solid var(--dull-red);
    border-radius: 6px; padding: 0.65rem 1rem; margin-bottom: 1.25rem;
    font-size: 0.82rem; color: var(--dull-red);
}

/* Required-field asterisk */
.req { color: var(--dull-red); }

/* ── Photographer profile card (mirrors pvi-photographer-profile-donut) ── */
.pv-profile-card {
    background: #fff; border: 1px solid #dde1ea; border-radius: 8px;
    padding: 1.25rem; margin-bottom: 1.5rem;
    display: flex; flex-direction: column; gap: 1rem;
}
.pvc-identity { width: 100%; }
.pvc-name-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.pvc-name { font-size: 1.1rem; font-weight: 700; margin: 0; flex: 1; min-width: 0; color: #1b1f2e; }
.pvc-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; align-items: center; }
.code-badge { display: inline-block; background: #252b3b; color: #c8d0e0; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 4px; }
.team-badge { display: inline-block; background: #e8f5ee; color: #1a6b3a; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 4px; }
.pvc-meta { margin-top: 0.6rem; font-size: 0.82rem; color: #343a40; line-height: 1.5; }
.pvc-meta .meta-sub { font-size: 0.72rem; color: #6c757d; }

/* Stat pills — 3-per-row at any width, 2 at ≥600px, all 6 at ≥900px */
.pv-stat-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pv-stat-pill {
    background: #f4f6f9; border: 1px solid #dde1ea; border-radius: 6px;
    padding: 0.5rem 0.65rem; text-align: center;
    flex: 1 1 calc(33% - 0.35rem); min-width: 80px;
}
.pv-stat-pill .stat-num { font-size: 1.1rem; font-weight: 700; color: #1b1f2e; line-height: 1.2; }
.pv-stat-pill .stat-num-sub { font-size: 0.75rem; font-weight: 500; }
.pv-stat-pill .stat-lbl { font-size: 0.63rem; color: #6c757d; text-transform: uppercase; letter-spacing: .03em; line-height: 1.25; }
.pv-stat-pill.pill-warn { border-color: var(--amber-warn); background: var(--amber-warn-bg); }
.pv-stat-pill.pill-warn .stat-num { color: var(--amber-warn-text); }

/* Grade circle — small inline version used in the card header */
/* Same resting grey as .scored, for the same reason: white text on an
   unpainted circle is an invisible grade, not an uncolored one. */
.gc-grade-sm {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 50%;
    font-size: 1.25rem; font-weight: 900; color: #fff; flex-shrink: 0;
    background: var(--mid-grey);
}

/* ── Reviewer context strip ── */
.pv-ctx-strip {
    background: var(--amber-warn-bg); border: 1px solid var(--amber-warn);
    border-radius: 8px; padding: 0.9rem 1.1rem; margin-bottom: 1.25rem;
}
.pv-ctx-strip .ctx-title {
    font-size: 0.78rem; font-weight: 700; color: var(--amber-warn-text);
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 0.65rem;
}
.pv-ctx-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1.25rem; }
.ctx-row { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.82rem; }
.ctx-lbl { color: #6c757d; font-size: 0.72rem; white-space: nowrap; }
.ctx-val { font-weight: 600; color: #1b1f2e; }
.ctx-ok   { color: #1a6b3a; }
.ctx-warn { color: #c0580a; }

/* ── Original result row table ── */
/* ── Table wrapper ─────────────────────────────────────────────────
   overflow-x is auto, not hidden. Above the pivot breakpoint the
   19-column original-results table is expected to fit, and hidden was
   the bet that it always would; when it does not, the overflowing
   columns are clipped away with no scrollbar and no other signal, so
   the page silently shows a reviewer part of a row and looks fine
   doing it. A scrollbar that appears only when it is needed is the
   cheaper failure. See the matching rule in the pivot media query.
   ── */
.pv-table-wrap { overflow-x: auto; }
.pv-table-wrap-orig { margin-bottom: 1.5rem; }
.pv-orig-table {
    width: 100%; border-collapse: collapse;
    background: #fff; border: 1px solid #dde1ea; border-radius: 6px; overflow: hidden;
}
.pv-orig-table th {
    background: #252b3b; color: #c8d0e0;
    font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    padding: 0.5rem 0.55rem; white-space: nowrap; text-align: left;
}
.pv-orig-table td {
    padding: 0.55rem 0.55rem; white-space: nowrap;
    font-size: 0.82rem; vertical-align: middle;
}

/* Scored cell. Background is overridden by pvi-grade-adjustment.js from
   data-val. The resting grey is not decoration: the text is #fff, so a cell
   the script never reaches is white on white and the number vanishes
   completely — no gap, no fallback, just an empty column that looks
   deliberate. A missing script should degrade to an uncolored score, not to
   a missing one. var(--mid-grey) is the frame's neutral and carries white
   text at readable contrast. */
.scored {
    display: inline-block; text-align: center;
    font-weight: 700; color: #fff; background: var(--mid-grey);
    border-radius: 4px; padding: 0.2rem 0.5rem; min-width: 40px;
}
.scored a { color: inherit; text-decoration: none; }
.scored-sm { font-size: 0.8rem; }

/* Distribution percentage badges */
.pct-green  { background: #d4f5e2; color: #1a6b3a; font-size: 0.72rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
.pct-orange { background: #fef3dd; color: #7a5000; font-size: 0.72rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }
.pct-red    { background: #fde8e8; color: #7a1a1a; font-size: 0.72rem; border-radius: 3px; padding: 2px 5px; font-weight: 600; }

/* ── Reviewer-adjustment marker (schema §44.4) ────────────────────
   Marks the Adjusted-row cells a reviewer moved a component of. The
   engine emits mark_adjusted_* as '' or the literal 'adjusted' on a
   wrapper <span class="pv-adj-mark"> inside the cell -- inside, not on
   the <td>, because pvPivot copies a cell's innerHTML but not its class
   (see the fragment's note), so a <td> class vanished whenever the
   19-column table was transposed.

   A DOT, NOT A COLOR CHANGE. The cell's band already says good / okay /
   poor; the mark says "a human moved this", a different fact, so it must
   not restate or tint the band. A small dot riding the top-right corner
   reads on every band and on the plain link cells alike, and is a
   shape as well as a color, so it does not depend on color vision.
   var(--dull-blue) is a frame color no score band uses; the frame already
   uses it for focus, which is an outline, never a filled dot.

   Half the dot overhangs the corner onto the white cell, so it stays
   visible even over a band close to its own color. pointer-events: none
   keeps it from swallowing a click on the drill-down link beneath it.
   ── */
.pv-adj-mark { position: relative; display: inline-block; }
.pv-adj-mark.adjusted::after {
    content: "";
    position: absolute; top: -4px; right: -5px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--dull-blue);
    pointer-events: none;
}
/* A plain link number (High Scores, Penalties, Low Scores) has no pill to
   ride, and on a single digit the corner position sits ON the numeral.
   Clear it, and drop to about cap height. Without :has() support the dot
   keeps the pill position, a little tight but still legible. */
.pv-adj-mark.adjusted:not(:has(.scored))::after { top: -1px; right: -10px; }

/* The legend under the Adjusted table. Hidden unless some cell on the page
   carries a mark, so a job with no adjustments shows no explanation of a
   dot it does not have. :has() needs no engine token; a browser without
   it simply never shows the legend, which is the safe direction to fail.
   The key dot is drawn from its own class, not .pv-adj-mark.adjusted,
   or the legend would satisfy its own :has() test. #6c757d is the
   cluster's muted grey already used throughout this file, not a new
   literal (see the palette note at the top). */
.pv-adj-legend { display: none; }
body:has(.pv-adj-mark.adjusted) .pv-adj-legend {
    display: flex; align-items: center; gap: 0.4rem;
    margin: -1rem 0 1.5rem;
    font-size: 0.75rem; color: #6c757d;
}
.pv-adj-key {
    display: inline-block; flex: 0 0 auto;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--dull-blue);
}

/* ── Supersede banner ── */
.pv-adjusted-banner {
    background: var(--amber-warn-bg); border: 1px solid var(--amber-warn);
    border-radius: 6px; padding: 0.65rem 1rem; margin-bottom: 1rem;
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem; color: var(--amber-warn-text);
}
/* The state_* visibility tokens resolve to the literal hidden attribute;
   this override beats the flex display above. */
.pv-adjusted-banner[hidden] { display: none; }

/* ── Adjustment form ── */
.pv-adj-form-card {
    background: #fff; border: 1px solid #dde1ea; border-radius: 8px;
    padding: 1.25rem; margin-bottom: 1.5rem;
}
.pv-grade-compare {
    display: flex; align-items: center; gap: 1.25rem;
    margin-bottom: 1.25rem; flex-wrap: wrap;
}
.gc-block { text-align: center; }
.gc-block .gc-lbl {
    font-size: 0.68rem; color: #6c757d; text-transform: uppercase;
    letter-spacing: .04em; font-weight: 600; margin-bottom: 4px;
}
.gc-grade {
    display: flex; align-items: center; justify-content: center;
    width: 70px; height: 70px; border-radius: 50%;
    font-size: 1.6rem; font-weight: 900; color: #fff;
    background: var(--mid-grey);
}
/* Resting state of the live preview circle, before a valid grade is typed. */
.gc-grade-empty { background: #adb5bd; }
.gc-arrow { font-size: 1.5rem; color: #adb5bd; }

.pv-adj-form-card label { font-size: 0.78rem; font-weight: 600; color: #252b3b; }
.pv-adj-form-card .form-text { font-size: 0.72rem; }
.pv-adj-form-card .form-control:focus {
    border-color: var(--dull-blue);
    box-shadow: 0 0 0 0.2rem var(--focus-ring-blue);
}

/* ── Adjustment history table ── */
.pv-hist-table {
    width: 100%; border-collapse: collapse;
    background: #fff; border: 1px solid #dde1ea; border-radius: 6px; overflow: hidden;
}
.pv-hist-table th {
    background: #252b3b; color: #c8d0e0;
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    padding: 0.5rem 0.65rem; white-space: nowrap; text-align: left;
}
.pv-hist-table td {
    padding: 0.5rem 0.65rem; border-bottom: 1px solid #eef0f5;
    font-size: 0.82rem; vertical-align: middle;
}
.pv-hist-table tr:last-child td { border-bottom: none; }
.pv-hist-table tr:hover td { background: #f8f9ff; }
.pv-hist-table .hist-reason { max-width: 320px; white-space: normal; }

/* ── Sortable column headers ───────────────────────────────────────
   The affordance is scoped to th[data-sort], so the Reason column keeps
   the default cursor and no hover highlight. The .no-sort class is still
   on that th in the fragment; it carries no styling of its own. The
   direction arrow is drawn off the aria-sort attribute pvSortTables sets
   in pvi-shared.js; the glyphs are the FontAwesome 6 Free solid
   codepoints for fa-sort (f0dc), fa-sort-up (f0de) and fa-sort-down
   (f0dd), escaped rather than embedded, and served locally from
   /css/all.min.css (no CDN). ── */
.pv-hist-table thead th[data-sort] {
    position: relative;
    padding-right: 1.15rem;   /* arrow room, so the label never shifts */
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.pv-hist-table thead th[data-sort]:hover { background: #2e3550; color: #fff; }

/* Keyboard focus. --dull-blue at full strength for the outline;
   --focus-ring-blue is the same hue at 25% alpha and is used as the
   inset glow, matching form controls in the frame. */
.pv-hist-table thead th[data-sort]:focus-visible {
    outline: 2px solid var(--dull-blue);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 4px var(--focus-ring-blue);
}

/* Resting state: the neutral both-ways glyph, dimmed, so every sortable
   column advertises itself without competing with the active one. */
.pv-hist-table thead th[data-sort]::after {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f0dc";
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7em;
    opacity: 0.35;
}
.pv-hist-table thead th[data-sort][aria-sort="ascending"]::after  { content: "\f0de"; opacity: 1; }
.pv-hist-table thead th[data-sort][aria-sort="descending"]::after { content: "\f0dd"; opacity: 1; }

/* ── Detailed-adjustments table ────────────────────────────────────
   Deliberately no chrome of its own. The detail table carries
   .pv-hist-table alongside .pv-detail-table and inherits the dark
   header, cell padding, row rule and hover from the block above, so
   this edition adds no new hardcoded hex to a file that already
   carries the cluster's palette debt (ruleset §12). Two real
   differences only: the filename cell has to wrap instead of running
   the row wide, and every header here is plain, which needs no rule
   because the sortable affordance above is scoped to th[data-sort].
   ── */
.pv-detail-table { margin-bottom: 1.5rem; }

/* Filenames are {original_stem}_{hex}.{ext} with no spaces, so they
   need break-all rather than break-word to wrap at all. This applies
   to the flat table only: pvPivot copies each cell's innerHTML into a
   new td and does not carry the cell's class, so in pivot mode the
   filename is wrapped by .pv-pc instead. */
.pv-detail-table .detail-img {
    white-space: normal;
    word-break: break-all;
    max-width: 240px;
}

/* Below 1400px pvPivot normally transposes this table, so these rules
   are the fallback for when it cannot: six columns of nowrap text
   overflow a phone, and a scrollbar on a six-column table is worse
   than wrapping. Kept deliberately — the whole point of the auto
   overflow above is that a missing script degrades instead of
   breaking, and this is the same principle one level down. */
@media (max-width: 768px) {
    .pv-detail-table th,
    .pv-detail-table td { white-space: normal; }
}

/* ── Visibility-token dependency (registry §4.6) ───────────────────
   The five state_* tokens on this page resolve to the bare hidden
   attribute, which only the UA stylesheet honors — any author-level
   display rule on a gated element outranks it and the gating silently
   does nothing. The supersede banner carries its own override above
   because it sets display: flex. These two selectors set no display
   today, so the attribute happens to work; the overrides are declared
   anyway, because the failure mode is a page that renders both the
   table and its empty state at once with no error anywhere, and the
   next person to add a display rule here will not be looking for it.
   ── */
.pv-table-wrap[hidden],
.pv-empty-state[hidden] { display: none !important; }

/* Grade diff indicator */
.diff-up   { color: var(--green); font-weight: 700; }
.diff-down { color: var(--dull-red); font-weight: 700; }
.diff-same { color: #6c757d; }

/* Empty history state */
.pv-empty-state {
    background: #fff; border: 1px dashed #dde1ea; border-radius: 6px;
    padding: 0.85rem 1rem; font-size: 0.82rem; color: #6c757d;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .pv-content { padding: 0.75rem; }
}
@media (max-width: 500px) {
    .pv-ctx-rows { grid-template-columns: 1fr; }
}
/* ≥600px: identity left, pills right */
@media (min-width: 600px) {
    .pv-profile-card { flex-direction: row; align-items: flex-start; gap: 1.5rem; }
    .pvc-identity { flex: 0 0 210px; border-right: 1px solid #eef0f5; padding-right: 1.25rem; }
    .pv-stat-pills { flex: 1; }
    .pv-stat-pill  { flex: 1 1 calc(50% - 0.25rem); }
}
/* ≥900px: all six pills in one row */
@media (min-width: 900px) {
    .pv-stat-pill { flex: 1 1 0; min-width: 0; }
}

/* ── Column-pivot navigator ────────────────────────────────────────
   Styles the transposed table pvPivot builds in pvi-shared.js.

   NOT inside a media query, deliberately. These rules lived in
   @media (max-width: 1400px) while pvPivot fired on that same width, so
   the two agreed by construction. pvPivot now measures whether the table
   actually fits its wrapper instead, which can be false at any viewport
   width — a 19-column grid overflows at 1435px, and at more than that
   with a larger font or browser zoom. A media-gated rule would leave the
   pivot unstyled in exactly the case the change was made to fix.

   The selectors only match markup pvPivot creates, so on a page where no
   pivot is built they match nothing and cost nothing.
   ── */
.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: #6c757d;
}
.pv-pivot-tbl {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 0.82rem;
}
.pv-pivot-tbl thead th {
    background: #f6f8fc; border-bottom: 2px solid #dde1ea;
    padding: 0.4rem 0.3rem; white-space: normal;
    vertical-align: middle; text-align: center;
    width: 100px; min-width: 100px; max-width: 100px;
}
.pv-pivot-tbl tbody td {
    padding: 0.3rem 0.3rem; border-bottom: 1px solid #f0f2f8;
    vertical-align: middle; word-break: break-word;
}
.pv-pivot-tbl tbody tr:last-child td { border-bottom: none; }
.pv-pl {
    position: sticky; left: 0; background: #f6f8fc;
    border-right: 2px solid #dde1ea; font-size: 0.68rem;
    font-weight: 700; color: #6c757d; text-transform: uppercase;
    letter-spacing: .03em; white-space: normal; word-break: break-word;
    z-index: 2; width: 90px; min-width: 90px; max-width: 90px;
    padding: 0.3rem 0.4rem;
}
.pv-pivot-tbl thead .pv-pl { z-index: 3; }
.pv-pc { text-align: center; white-space: normal; width: 100px; min-width: 100px; max-width: 100px; }
