﻿/* People module (pp-): personnel, FTO, FTA, supervisors, Command Center, applications.
   Colors come from the shared variables only, so light and dark themes both work. */

.pp-kpi-link { text-decoration: none; color: inherit; }
.pp-kpi-link:hover { border-color: var(--gold); background: var(--hover); }

/* Two columns that collapse at the shared breakpoint */
.pp-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.pp-cols > * { min-width: 0; }
.pp-cols-wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .pp-cols, .pp-cols-wide { grid-template-columns: minmax(0, 1fr); } }
/* The row of figures at the top of a page. kpiRow() in mod-people.js puts the count in the class: four sit in four columns and six in
   three (six across on a wide screen), so no page ends on a half row, and a phone gets two across. (.grid.kpis in styles.css is as
   specific as these, so each rule names both classes and comes after it.) */
.grid.kpis.pp-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.kpis.pp-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.kpis.pp-kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1560px) { .grid.kpis.pp-kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid.kpis.pp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .grid.kpis.pp-kpis { gap: 12px; }
  .pp-kpis .kpi { padding: 14px; }
  .pp-kpis .kpi-value { font-size: 32px; }
}
/* A name stays on one line. One too long for that (over 28 characters, marked pp-long) wraps inside its cell instead of widening the table. */
.pp-name { white-space: nowrap; }
.pp-name.pp-long { white-space: normal; overflow-wrap: anywhere; min-width: 14ch; max-width: 28ch; }
/* Text that may wrap in a table that otherwise keeps its columns on one line: it keeps a width to wrap at, so a phone scrolls instead of stacking words. */
.pp-minw { display: block; min-width: 200px; }
.pp-statuses { display: flex; flex-wrap: wrap; gap: 4px 6px; }

/* Directory */
.pp-results { min-width: 0; }
.table .pp-group-row th { background: var(--surface); color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; padding: 18px 16px 8px; border-bottom: 0; white-space: normal; }
.table .pp-group-title { font-weight: 700; margin-right: 10px; }
.table tbody.pp-group:not(:first-of-type) .pp-group-row th { border-top: 1px solid var(--line); }
/* A group heading spans every column, so on a phone, where the table scrolls sideways, it would scroll out of sight and be cut off at the
   edge. Its text stays at the left edge (sticky) and wraps inside the visible width (100cqw is the width of the table's frame). */
.pp-wrap { container-type: inline-size; }
.pp-group-label { position: sticky; left: 16px; display: block; width: max-content; max-width: calc(100vw - 96px); max-width: calc(100cqw - 32px); }
.pp-pos { display: inline-flex; align-items: center; gap: 8px; }
.pp-pos .tag { flex: none; white-space: nowrap; }
.pp-activity { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-names { display: flex; flex-wrap: wrap; gap: 4px 10px; }
/* The directory's filter bar: the search box takes a row of its own, and the selects share the next row evenly (one column each on a
   laptop, two by two below that), so the controls never end up at ragged widths. --pp-n is how many selects there are (set in mod-people.js). */
.pp-dir .toolbar { display: grid; grid-template-columns: repeat(var(--pp-n, 4), minmax(0, 1fr)); gap: 12px; }
.pp-dir .toolbar .search { grid-column: 1 / -1; min-width: 0; }
.pp-dir .toolbar .select { width: 100%; min-width: 0; }
@media (max-width: 1100px) { .pp-dir .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Meters. An empty one draws no fill at all (see meter() in mod-people.js): a sliver would read as a small value. */
.pp-meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 70px; }
.pp-meter .fill { display: block; height: 100%; border-radius: 4px; background: var(--fill); min-width: 2px; }
.pp-meter .fill.good { background: var(--good); }
.pp-meter .fill.gold { background: var(--gold); }
.pp-meter .fill.bad { background: var(--bad); }
.pp-mcell { display: flex; flex-direction: column; gap: 4px; min-width: 84px; }
.pp-mval { font-weight: 700; font-size: 13px; }
.pp-mnote { color: var(--bad-fg); font-weight: 600; }
.pp-progress { display: flex; align-items: center; gap: 10px; min-width: 110px; }
.pp-progress .progress { flex: 1; }

/* Performance tiles. The class carries the count (ftoTiles has seven, the FTA page five): the last tile takes the rest of its row, so
   the grid never leaves a lone tile beside a gap. Four across on a wide screen, three on a laptop, two on a phone. */
.pp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pp-metric { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.pp-metric-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.pp-metric-value { font-family: var(--font-head); font-size: 30px; font-weight: 600; line-height: 1.05; }
.pp-metric-detail { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.pp-metrics-7 > :last-child { grid-column: 1 / -1; }
.pp-metrics-5 > :last-child { grid-column: span 2; }
@media (min-width: 1180px) {
  .pp-metrics-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pp-metrics-7 > :last-child { grid-column: span 2; }
}
@media (max-width: 760px) {
  .pp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pp-metrics-7 > :last-child, .pp-metrics-5 > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .pp-metric { padding: 10px 12px; gap: 6px; }
  .pp-metric-value { font-size: 24px; }
}
.pp-tone-good { color: var(--good-fg); }
.pp-tone-bad { color: var(--bad-fg); }
.pp-tone-review { color: var(--warn); }
.pp-flags { margin: 6px 0 0; padding-left: 18px; }
.pp-legend { border-top: 1px solid var(--line); }
.pp-kv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: -8px; }
/* The facts line under an FTO's or FTA's name: each fact is its own item and the gap is the separator, so a line that wraps on a phone never
   starts with a dangling dot. */
.pp-facts { gap: 2px 18px; }
.pp-mcount { font-size: 12px; }
/* The person switcher has a width of its own, so a very long name in its list cannot stretch it (and the page header) past the screen;
   the closed box shows as much of the chosen name as fits. */
.pp-switch { max-width: 100%; min-width: 0; }
.pp-switch .select { width: 15rem; min-height: 36px; max-width: 100%; }

/* Action buttons and plain notes. The Manage card sorts its buttons into labelled groups; removing someone sits at the far end of Status. */
.pp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-act-groups { display: flex; flex-direction: column; gap: 14px; }
.pp-act-group { display: flex; flex-direction: column; gap: 6px; }
.pp-act-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pp-actions .pp-apart { margin-left: auto; }
.pp-notes { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.pp-notes li { display: flex; gap: 8px; align-items: flex-start; }
.pp-notes svg { flex: none; margin-top: 3px; }
.pp-actions + .pp-notes, .pp-act-groups + .pp-notes { margin-top: 14px; }
.pp-actions + .pp-notes-flat { margin-top: 10px; }
.pp-empty-actions { justify-content: center; }
.pp-overview-note { border-top: 1px solid var(--line); padding: 12px 20px; }
.pp-title-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.pp-title-link:hover { border-bottom-color: var(--gold); }

/* Reviews, reports, decisions, applications */
.pp-reviews, .pp-reports, .pp-apps, .pp-decisions { list-style: none; margin: 0; padding: 0; }
.pp-reviews > li, .pp-reports > li, .pp-apps > li, .pp-decisions > li { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pp-reviews > li:last-child, .pp-reports > li:last-child, .pp-apps > li:last-child, .pp-decisions > li:last-child { border-bottom: 0; }
.pp-review-head { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.pp-ratings { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pp-rating { display: inline-flex; align-items: center; gap: 6px; }
.pp-comment { white-space: pre-wrap; overflow-wrap: anywhere; }
.pp-dec-head { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; align-items: baseline; }
.pp-dec-head h3 { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
/* Later outcomes and corrections sit under the outcome, set in by a rule, oldest first. The Director's button follows them. */
.pp-dec-updates { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pp-dec-updates li { min-width: 0; }
.pp-dec-actions { margin-top: 2px; }
.pp-sub-h { font-size: 15px; margin-bottom: 10px; }

/* Activity log */
.pp-log { list-style: none; margin: 0; padding: 0; }
.pp-log li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.pp-log li:last-child { border-bottom: 0; }
.pp-log .pill { justify-self: start; }
.pp-log-main { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .pp-log li { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Supervisor cards and the responsibilities tracker */
.pp-sups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 20px; align-items: start; }
.pp-sup .card-head h2 { font-size: 20px; }
.pp-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.pp-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.pp-stat-n { font-family: var(--font-head); font-size: 26px; font-weight: 600; line-height: 1.1; }
.pp-stat-l { font-size: 13px; font-weight: 600; }
.pp-stat-s { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.pp-last { margin-top: 12px; }
.pp-tracker { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.pp-tracker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.pp-tracker-head h3 { font-size: 15px; }
.pp-duties { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.pp-duties li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.pp-duties li:last-child { border-bottom: 0; }
.pp-duty-note { margin: 2px 0 0 28px; }
.pp-report-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
/* This month's report status with last month's overdue flag beside it: the pills wrap inside their cell rather than widen it */
.pp-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.pp-report-line .pp-pills { justify-content: flex-end; }
/* A Supervisor's actions, and the recruits they supervise (each with the actions the viewer may take) */
.pp-sup-actions { margin-top: 14px; }
.pp-sup-recruits { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.pp-sup-recruits h3 { font-size: 15px; margin-bottom: 2px; }
.pp-recruit-list li { flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; }
.pp-recruit-list .grow { flex: 1 1 180px; }
.pp-rec-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-left: auto; }
.pp-sup .pp-recruit-list li { padding: 10px 0; }
.pp-more { padding: 12px 20px; }
.pp-sup .pp-more { padding: 10px 0 0; }

/* Command Center tiles: four across from a laptop up, two across below (never a row of two and a half) */
.pp-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 1100px) { .pp-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pp-tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; text-decoration: none; color: inherit; min-width: 0; }
.pp-tile:hover { border-color: var(--gold); background: var(--hover); }
.pp-tile h3 { font-size: 15px; margin-bottom: 2px; overflow-wrap: anywhere; }
.pp-tile-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--fill); color: var(--on-fill); }
@media (max-width: 640px) {
  .pp-tiles { gap: 10px; }
  .pp-tile { flex-direction: column; gap: 8px; padding: 12px; }
}

/* Applications */
.pp-apply { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
/* The form is turned off while the applicant cannot apply (rank too low, or an application is already open): the boxes look turned off too. */
.pp-apply .textarea:disabled, .pp-apply .input:disabled { background: var(--surface-2); opacity: 0.75; cursor: not-allowed; resize: none; }
.pp-history summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.pp-history[open] summary { margin-bottom: 12px; }
.pp-linkbtn { background: none; border: 0; padding: 0; font-weight: 600; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); }
.pp-linkbtn:hover { border-bottom-color: var(--gold); }

/* Long unbroken text (a 120-character name, a 200-character note or certification) wraps instead of pushing the page sideways. min-width:0 lets a
   flex or grid child shrink to its row, and overflow-wrap:anywhere lets its text break where it must. These go on the text blocks, never on table
   cells: a table would squeeze its columns to nothing instead of scrolling or turning into cards. .pp-page is the root of every page here. */
.pp-page .page-head > :first-child { min-width: 0; max-width: 100%; }
.pp-page .page-head :is(h1, p) { overflow-wrap: anywhere; }
.pp-list .grow, .pp-list .t, .pp-log-main { min-width: 0; overflow-wrap: anywhere; }
.pp-review-head > *, .pp-dec-head > *, .pp-facts > *, .pp-who > div, .pp-tracker-head > * { min-width: 0; overflow-wrap: anywhere; }
.pp-page .notice > div, .pp-flags li, .pp-notes li span, .pp-stat { min-width: 0; overflow-wrap: anywhere; }
.pp-reports li p, .pp-apps li p, .pp-sub-h { overflow-wrap: anywhere; }

/* Tables that turn into cards. mod-people.js (cardTable, directoryTable) puts .pp-cards on a table whose columns need more width than its card has:
   a phone, a tablet, or a laptop with the menu open. Each row becomes a small card, the first cell its title and every other cell a line with the
   name of its column in front (data-label), so no column (Status, the Review button) is left off the right edge. A cell with no value is left out. */
.table.pp-cards, .table.pp-cards tbody, .table.pp-cards tr, .table.pp-cards td { display: block; width: 100%; }
.table.pp-cards thead { display: none; }
.table.pp-cards tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table.pp-cards tbody tr:last-child { border-bottom: 0; }
.table.pp-cards td, .table.pp-cards td:first-child, .table.pp-cards td:last-child {
  display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 5px 0; border: 0; white-space: normal; text-align: left; overflow-wrap: anywhere;
}
.table.pp-cards td::before {
  content: attr(data-label); flex: none; width: 124px; padding-top: 2px; color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; overflow-wrap: normal;
}
.table.pp-cards td[data-label=""]::before, .table.pp-cards td:first-child::before { display: none; }
.table.pp-cards td:first-child { margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); font-size: 16px; }
.table.pp-cards td.pp-none { display: none; }
.table.pp-cards td > * { min-width: 0; }
.table.pp-cards td > .pp-mcell, .table.pp-cards td > .pp-progress { flex: 1 1 0; }
.table.pp-cards .nowrap, .table.pp-cards .pill { white-space: normal; }
.table.pp-cards .pp-name { white-space: normal; overflow-wrap: anywhere; }
.table.pp-cards .pp-name.pp-long { min-width: 0; max-width: none; }
.table.pp-cards .pp-minw { min-width: 0; }
/* the group headings of the directory sit above their cards, at the table's left edge */
.table.pp-cards .pp-group-row { padding: 0; border-bottom: 0; }
.table.pp-cards .pp-group-row th { display: block; width: 100%; padding: 16px 16px 6px; }
.table.pp-cards .pp-group-label { position: static; width: auto; max-width: none; }

/* Discord sign-in: the line and its buttons on a profile, and the card of people waiting to sign in (remote mode). A row keeps the name and the
   facts together and puts the three buttons under them on a phone. The Discord ID is a long run of digits, so it may break anywhere. */
.pp-discord-actions { margin-top: 16px; }
.pp-mono { font-family: ui-monospace, SFMono-Regular, Consolas, Menlo, monospace; font-size: 0.92em; overflow-wrap: anywhere; }
.pp-wait-body:focus, .pp-wait-body:focus-visible { outline: none; }
.pp-wait-list li { flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; }
.pp-wait-pic { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.pp-wait-who { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
/* the ID is what Command checks, so it is the largest thing in the row; the name is only what the person chose to call themselves */
.pp-wait-id { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.pp-wait-idv { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; color: var(--text); }
.pp-wait-name { font-size: 14px; overflow-wrap: anywhere; }
.pp-wait-name-v { font-weight: 600; }
.pp-wait-status:empty { display: none; }
.pp-wait-actions { flex: 0 1 auto; justify-content: flex-end; }
@media (max-width: 640px) { .pp-wait-actions { flex: 1 1 100%; justify-content: flex-start; } }

/* Print: the Print record button on a personnel profile. The profile page carries a second, print-only copy of the record
   (.pp-sheet): hidden on screen, and the only thing printed. It uses fixed black on white, so the screen theme never reaches the paper. */
.pp-sheet { display: none; }
@media print {
  .pp-printable > .pp-screen { display: none !important; }
  .pp-sheet { display: block; color: #000; background: #fff; font-family: var(--font-body); font-size: 9.5pt; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pp-sheet-head { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
  .pp-sheet-org { font-size: 9pt; letter-spacing: 0.1em; text-transform: uppercase; }
  .pp-sheet-title { font-family: var(--font-head); font-size: 20pt; font-weight: 700; text-transform: uppercase; line-height: 1.1; margin-top: 2px; }
  .pp-sheet-meta { font-size: 8.5pt; color: #333; margin-top: 3px; }
  .pp-sheet-name { font-size: 15pt; font-weight: 700; line-height: 1.2; margin-bottom: 10px; overflow-wrap: anywhere; }
  .pp-sheet-name span { display: block; font-size: 10pt; font-weight: 400; color: #333; }
  .pp-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; align-items: start; margin-bottom: 10px; }
  .pp-sheet-grid > .pp-sheet-block { break-inside: avoid; page-break-inside: avoid; }
  .pp-sheet-block + .pp-sheet-block { margin-top: 10px; }
  .pp-sheet-grid > .pp-sheet-block + .pp-sheet-block { margin-top: 0; }
  .pp-sheet-h { font-size: 8.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid #777; padding-bottom: 2px; margin-bottom: 5px; break-after: avoid; page-break-after: avoid; }
  .pp-sheet-kv { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; }
  .pp-sheet-kv dt { color: #333; font-weight: 600; }
  .pp-sheet-kv dd { margin: 0; overflow-wrap: anywhere; }
  .pp-sheet-sub { margin-top: 6px; font-weight: 600; }
  .pp-sheet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
  .pp-sheet-list li { break-inside: avoid; page-break-inside: avoid; overflow-wrap: anywhere; }
  .pp-sheet-reviews { gap: 6px; }
  .pp-sheet-reviews li { padding-bottom: 5px; border-bottom: 1px solid #ccc; }
  .pp-sheet-reviews li:last-child { padding-bottom: 0; border-bottom: 0; }
  .pp-sheet-small { font-size: 8.5pt; color: #333; }
  .pp-sheet-text { margin-top: 1px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .pp-sheet-none { margin: 0; color: #333; }
}
