/* The people on an incident page (WS3, the incident workspace, 14-15 Oct 2026): IncidentRosterComponent, IncidentConnectionsComponent and IncidentAgendaComponent, drawn to the approved mock
   (the incident workspace, "People", "How they connect", "Where they'll be next"). Number 22: reserved for this track in the build's brief; it loads before the component library (35), so every
   rule here is scoped to these components' own classes and nothing later is overridden by accident.

   * THE THREE PANELS are PanelComponent (54-person-page.css gives the box). Here their heads read as the mock's cards: the title in the display face on the panel's own surface, the note quiet
     at its end, and a soft shadow, so the people sit with the rest of the workspace.
   * THE ROSTER is a table, one `tbody` a person: the row (who, on this incident, lives, groups, history here, the button) and the record under it, boxes that fill the row and wrap. Under 760 px
     of the panel's own width (a container query, so it holds in a narrow column as on a phone) each person becomes a card: the name and the button on top, every cell under it with its column's
     name, so nothing scrolls sideways at 320 CSS px. The table keeps its roles in both (explicit `role`s in the markup), so a screen reader reads it as a table either way.
   * "NOT SHOWN" is a lock and the words, quiet, never a blank (a blank would read as "nothing"). Empty is said in words too, drawn plainer still: withheld is not empty.
   * THE DRAWING of how they connect is SVG whose fills and strokes are tokens: monograms in the hue AvatarComponent gives the same person (`--av-h`), lines and labels in the tone pairs.
   * Every state is said in words; a tone is a second signal (WCAG 1.4.1). Tokens only and logical properties only (test/styles/tokens_test.rb, test/styles/components_test.rb). Nothing pinned, no
     vh, no fixed width on text; controls are at least 24 CSS px and 44 on touch (WCAG 2.5.8). Motion honors prefers-reduced-motion. */

/* ── The panels ─────────────────────────────────────────────────────────── */

.panel.person-panel:is(.incident-roster, .incident-connections, .incident-agenda) {
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
}

.panel.person-panel:is(.incident-roster, .incident-connections, .incident-agenda) > .person-panel-head {
  align-items: center;
  padding: 0.8rem 1rem 0.55rem;
  border-block-end: 0;
  background: transparent;
}

.panel.person-panel:is(.incident-roster, .incident-connections, .incident-agenda) > .person-panel-head > .person-panel-title {
  color: var(--fg1);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
}

.panel.person-panel:is(.incident-connections, .incident-agenda) > .person-panel-body {
  padding: 0 1rem 0.85rem;
}

.panel.person-panel:is(.incident-roster, .incident-connections, .incident-agenda) > .person-panel-foot {
  padding: 0.5rem 1rem 0.7rem;
}

/* The lock and "Not shown": quiet, on one line with the lock. Shared by the three components. */
.incident-roster-withheld {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--fg2);
  font-weight: 500;
  font-style: normal;
  /* a short phrase beside its lock: in a narrow column it must not break to a letter a line (it made the row four lines tall) */
  white-space: nowrap;
}

.incident-roster-lock {
  flex: none;
  inline-size: 0.875rem;
  block-size: 0.875rem;
}

/* Only the roster's translated withheld-status words may wrap beside the lock. */
.incident-roster .incident-roster-withheld {
  max-inline-size: 100%;
  white-space: normal;
}
.incident-roster-withheld-copy {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.incident-roster-none {
  margin: 0;
  color: var(--fg2);
}

/* ── The roster ─────────────────────────────────────────────────────────── */

.panel.person-panel.incident-roster > .person-panel-body {
  padding: 0;
  gap: 0;
}

.incident-roster-frame {
  min-inline-size: 0;
}

.incident-roster-table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.incident-roster-caption {
  padding: 0 1rem 0.5rem;
  color: var(--fg2);
  font-size: var(--text-xs);
  text-align: start;
  caption-side: top;
}

.incident-roster-table thead th {
  padding: 0.45rem 0.6rem;
  border-block: 1px solid var(--rule);
  background: var(--surface-sunken);
  color: var(--fg2);
  font-size: var(--person-label, var(--text-xs));
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: start;
  text-transform: uppercase;
  white-space: nowrap;
}

.incident-roster-table :is(th, td):first-child {
  padding-inline-start: 1rem;
}

.incident-roster-table :is(th, td):last-child {
  padding-inline-end: 1rem;
}

.incident-roster-row > :is(th, td) {
  padding: 0.45rem 0.6rem;
  border-block-end: 1px solid var(--rule);
  font-weight: 400;
  text-align: start;
  vertical-align: top;
}

.incident-roster-person:last-of-type .incident-roster-row > :is(th, td),
.incident-roster-person.is-open .incident-roster-row > :is(th, td) {
  border-block-end-color: transparent;
}

.incident-roster-person.is-open:last-of-type .incident-roster-detail > td {
  border-block-end: 0;
}

.incident-roster-person.is-open .incident-roster-row > :is(th, td),
.incident-roster-row:hover > :is(th, td) {
  background: var(--surface-sunken);
}

/* A person withdrawn from the incident is drawn quieter, the name in the secondary ink; the badge says it in words. Never by opacity: a faded avatar or badge falls under 4.5:1 (WCAG 1.4.3). */
.incident-roster-person.is-withdrawn .incident-roster-name,
.incident-roster-person.is-withdrawn .incident-roster-name a {
  color: var(--fg2);
}

.incident-roster-who-in {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-inline-size: 9rem;
}

.incident-roster-who .avatar {
  border-radius: var(--radius-lg);
}

/* The small avatar's size: the names, not the portraits, are what a row is for, and the rows are many. */
.incident-roster-who .avatar-md {
  inline-size: 1.75rem;
  block-size: 1.75rem;
  font-size: 0.65rem;
}

.incident-roster-avatar-unknown {
  border: 1.5px dashed var(--tone-mute-line);
  background: var(--tone-mute-bg);
  color: var(--tone-mute-fg);
}

.incident-roster-who-text {
  display: grid;
  gap: 0.1rem;
  min-inline-size: 0;
}

.incident-roster-name {
  margin: 0;
  color: var(--fg1);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.incident-roster-name a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 2px;
}

.incident-roster-name a:hover,
.incident-roster-name a:focus-visible {
  text-decoration: underline;
}

.incident-roster-unidentified {
  color: var(--fg2);
  font-weight: 600;
}

.incident-roster-sub {
  display: block;
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.incident-roster-main {
  display: block;
  color: var(--fg1);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.incident-roster-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
}

.incident-roster-badges .pill {
  font-size: var(--text-xs);
}

.incident-roster-case {
  text-decoration: none;
}

.incident-roster-case:hover,
.incident-roster-case:focus-visible {
  text-decoration: underline;
}

.incident-roster-key {
  display: none;
}

.incident-roster-value {
  display: block;
  min-inline-size: 0;
}

.incident-roster-dash {
  color: var(--fg2);
}

.incident-roster-toggle-cell {
  inline-size: 1%;
  text-align: end;
}

/* The button that opens a person's record: a square at least 32 CSS px (44 on touch), its chevron turning when it is open. */
.incident-roster-toggle {
  display: inline-grid;
  place-items: center;
  inline-size: 2rem;
  block-size: 2rem;
  padding: 0;
  /* the chevron turns inside the square, and its box mid-turn is wider than the square: nothing in the button is ever outside it */
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--fg1);
  cursor: pointer;
}

.incident-roster-toggle:hover {
  background: var(--surface-sunken);
}

.incident-roster-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.incident-roster-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.incident-roster-toggle[aria-expanded="true"] .incident-roster-chevron {
  transform: rotate(180deg);
}

@media (pointer: coarse) {
  .incident-roster-toggle {
    inline-size: var(--target-min);
    block-size: var(--target-min);
  }
}

@media (prefers-reduced-motion: reduce) {
  .incident-roster-chevron {
    transition: none;
  }
}

/* The record under the row: boxes that fill the row and wrap, then the entry and its history, then what the reader may do. */
.incident-roster-detail > td {
  padding: 0.1rem 1rem 0.9rem;
  border-block-end: 1px solid var(--rule);
  background: var(--surface-sunken);
}

.incident-roster-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
  gap: 0.6rem;
}

.incident-roster-box {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-inline-size: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.incident-roster-box-title {
  margin: 0;
  color: var(--fg2);
  font-family: var(--font-sans);
  font-size: var(--person-label, var(--text-xs));
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.incident-roster-box-withheld {
  margin: 0;
}

.incident-roster-facts {
  display: grid;
  grid-template-columns: fit-content(40%) minmax(0, 1fr);
  gap: 0.2rem 0.75rem;
  margin: 0;
}

.incident-roster-facts dt {
  min-inline-size: 0;
  color: var(--fg2);
  overflow-wrap: anywhere;
}

.incident-roster-facts dd {
  margin: 0;
  min-inline-size: 0;
  color: var(--fg1);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.incident-roster-items {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-wrap: anywhere;
}

.incident-roster-items .incident-roster-main {
  font-weight: 600;
}

.incident-roster-source {
  margin: 0.15rem 0 0;
  color: var(--fg2);
  font-size: var(--text-xs);
}

.incident-roster-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin-block-start: 0.6rem;
  color: var(--fg2);
  font-size: var(--text-xs);
}

.incident-roster-recorded {
  margin: 0;
}

.incident-roster-history summary {
  min-block-size: 1.5rem;
  color: var(--accent-text);
  cursor: pointer;
}

.incident-roster-history ol {
  margin: 0.25rem 0 0;
  padding-inline-start: 1.25rem;
}

/* flex-start: an open menu makes its own column taller, never the buttons beside it */
.incident-roster-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.4rem;
  margin-block-start: 0.6rem;
}

.incident-roster-refer {
  position: relative;
}

.incident-roster-refer > summary {
  list-style: none;
  cursor: pointer;
}

.incident-roster-refer > summary::-webkit-details-marker {
  display: none;
}

.incident-roster-refer > summary .icon {
  inline-size: 1rem;
  block-size: 1rem;
  transition: transform 120ms ease;
}

.incident-roster-refer[open] > summary .icon {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .incident-roster-refer > summary .icon {
    transition: none;
  }
}

.incident-roster-refer-list {
  display: grid;
  gap: 0.15rem;
  margin: 0.35rem 0 0;
  padding: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  list-style: none;
}

.incident-roster-refer-list a {
  display: block;
  min-block-size: 1.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* The Edit entry menu sits under the part's badge, on the row; its list is the referral menu's */
.incident-roster-edit {
  margin-block-start: 0.35rem;
}

.incident-roster-edit > summary {
  display: inline-flex;
}

.incident-roster-add {
  padding: 0.7rem 1rem 0.9rem;
}

/* ── The roster on a phone, or in a narrow column: each person a card ─────── */

@container panel (inline-size < 760px) {
  .incident-roster-table,
  .incident-roster-table > tbody,
  .incident-roster-table > tbody > tr,
  .incident-roster-table > tbody > tr > :is(th, td),
  .incident-roster-caption {
    display: block;
    inline-size: auto;
  }

  /* The column names stay for a screen reader (each card shows its own beside each value), out of the layout: every part of the head is a 1 px box. */
  .incident-roster-table > thead,
  .incident-roster-table > thead > tr,
  .incident-roster-table > thead > tr > th {
    display: block;
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .incident-roster-person {
    border-block-end: 1px solid var(--rule);
  }

  .incident-roster-person:last-of-type {
    border-block-end: 0;
  }

  .incident-roster-table > tbody > tr.incident-roster-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 0.6rem;
    padding: 0.8rem 1rem;
  }

  .incident-roster-table > tbody > tr.incident-roster-detail[hidden] {
    display: none;
  }

  .incident-roster-row > :is(th, td) {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .incident-roster-person.is-open .incident-roster-row,
  .incident-roster-row:hover {
    background: var(--surface-sunken);
  }

  .incident-roster-person.is-open .incident-roster-row > :is(th, td),
  .incident-roster-row:hover > :is(th, td) {
    background: transparent;
  }

  .incident-roster-table :is(th, td):first-child,
  .incident-roster-table :is(th, td):last-child {
    padding-inline: 0;
  }

  .incident-roster-who {
    grid-column: 1;
    grid-row: 1;
  }

  .incident-roster-who-in {
    min-inline-size: 0;
  }

  .incident-roster-toggle-cell {
    grid-column: 2;
    grid-row: 1;
    inline-size: auto;
  }

  .incident-roster-table > tbody > tr > td.incident-roster-cell {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(5.5rem, 34%) minmax(0, 1fr);
    gap: 0.5rem;
  }

  /* Staff and someone nobody identified are not asked where they live: on a card the three empty lines are left out. */
  .incident-roster-table > tbody > tr > td.incident-roster-cell.is-blank {
    display: none;
  }

  .incident-roster-key {
    display: block;
    padding-block-start: 0.1rem;
    color: var(--fg2);
    font-size: var(--person-label, var(--text-xs));
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .incident-roster-detail > td {
    padding: 0.2rem 1rem 0.9rem;
    border-block-end: 0;
  }
}

/* ── How they connect ───────────────────────────────────────────────────── */

.incident-connections-alerts {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident-connections-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--alert-line);
  border-radius: var(--radius-lg);
  background: var(--alert-bg);
  color: var(--fg1);
  font-size: var(--text-sm);
}

.incident-connections-alert p {
  margin: 0;
  color: var(--fg1);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.incident-connections-alert-icon {
  flex: none;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  margin-block-start: 0.05rem;
  color: var(--alert-fg);
}

.incident-connections-alert[data-tone="bad"] {
  --alert-bg: var(--tone-bad-bg);
  --alert-fg: var(--tone-bad-fg);
  --alert-line: var(--tone-bad-line);
}

.incident-connections-alert[data-tone="warn"] {
  --alert-bg: var(--tone-warn-bg);
  --alert-fg: var(--tone-warn-fg);
  --alert-line: var(--tone-warn-line);
}

.incident-connections-alert[data-tone="info"] {
  --alert-bg: var(--tone-info-bg);
  --alert-fg: var(--tone-info-fg);
  --alert-line: var(--tone-info-line);
}

.incident-connections-alert[data-tone="good"] {
  --alert-bg: var(--tone-good-bg);
  --alert-fg: var(--tone-good-fg);
  --alert-line: var(--tone-good-line);
}

.incident-connections-map {
  padding-block: 0.25rem;
}

.incident-connections-svg {
  display: block;
  inline-size: 100%;
  max-inline-size: 24rem;
  block-size: auto;
  margin-inline: auto;
  overflow: visible;
  font-family: var(--font-sans);
}

.incident-connections-edge {
  stroke: var(--rule-strong);
  stroke-width: 2;
}

.incident-connections-edge[data-tone="bad"] {
  stroke: var(--tone-bad-fg);
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
}

.incident-connections-edge[data-tone="warn"] {
  stroke: var(--tone-warn-fg);
  stroke-dasharray: 6 4;
}

.incident-connections-edge[data-tone="accent"] {
  stroke: var(--tone-accent-fg);
}

.incident-connections-edge[data-tone="info"] {
  stroke: var(--tone-info-fg);
}

.incident-connections-label rect {
  fill: var(--label-bg, var(--tone-mute-bg));
  stroke: var(--label-line, var(--tone-mute-line));
}

.incident-connections-label text {
  fill: var(--label-fg, var(--tone-mute-fg));
  font-size: 11px;
  font-weight: 750;
}

.incident-connections-label[data-tone="bad"] {
  --label-bg: var(--tone-bad-bg);
  --label-fg: var(--tone-bad-fg);
  --label-line: var(--tone-bad-line);
}

.incident-connections-label[data-tone="warn"] {
  --label-bg: var(--tone-warn-bg);
  --label-fg: var(--tone-warn-fg);
  --label-line: var(--tone-warn-line);
}

.incident-connections-label[data-tone="info"] {
  --label-bg: var(--tone-info-bg);
  --label-fg: var(--tone-info-fg);
  --label-line: var(--tone-info-line);
}

.incident-connections-label[data-tone="accent"] {
  --label-bg: var(--tone-accent-bg);
  --label-fg: var(--tone-accent-fg);
  --label-line: var(--tone-accent-line);
}

.incident-connections-node circle {
  fill: hsl(var(--av-h) var(--avatar-bg));
  stroke: hsl(var(--av-h) var(--avatar-line));
  stroke-width: 1.5;
}

.incident-connections-initials {
  fill: hsl(var(--av-h) var(--avatar-fg));
  font-size: 13px;
  font-weight: 800;
}

.incident-connections-name {
  fill: var(--fg2);
  paint-order: stroke;
  stroke: var(--surface-raised);
  stroke-width: 4px;
  stroke-linejoin: round;
  font-size: 11.5px;
  font-weight: 650;
}

.incident-connections-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident-connections-item {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) minmax(0, 1fr);
  align-items: start;
  gap: 0.6rem;
  font-size: var(--text-sm);
}

.incident-connections-item > .pill {
  justify-self: start;
  font-size: var(--text-xs);
}

.incident-connections-text {
  display: grid;
  gap: 0.05rem;
  min-inline-size: 0;
}

.incident-connections-text p {
  margin: 0;
  overflow-wrap: anywhere;
}

.incident-connections-share {
  margin: 0;
  color: var(--fg1);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.incident-connections-pair {
  color: var(--fg1);
  font-weight: 650;
}

.incident-connections-detail {
  color: var(--fg1);
}

.incident-connections-source {
  color: var(--fg2);
  font-size: var(--text-xs);
}

.incident-connections-none {
  margin: 0;
  color: var(--fg2);
}

@container panel (inline-size < 22rem) {
  .incident-connections-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }
}

/* ── Where they'll be next ──────────────────────────────────────────────── */

.incident-agenda-days {
  display: grid;
  gap: 0.75rem;
}

.incident-agenda-day {
  display: grid;
  gap: 0.2rem;
}

.incident-agenda-day-heading {
  margin: 0;
  color: var(--fg2);
  font-family: var(--font-sans);
  font-size: var(--person-label, var(--text-xs));
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.incident-agenda-list {
  display: grid;
  grid-template-columns: minmax(4.75rem, max-content) minmax(0, 1fr);
  column-gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident-agenda-event {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  padding-block: 0.5rem;
  border-block-start: 1px solid var(--rule);
  font-size: var(--text-sm);
}

.incident-agenda-event:first-child {
  border-block-start: 0;
}

.incident-agenda-event.is-together {
  position: relative;
}

.incident-agenda-when {
  display: grid;
  align-content: start;
  margin: 0;
  color: var(--fg1);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.incident-agenda-until {
  color: var(--fg2);
  font-size: var(--text-xs);
  font-weight: 500;
}

.incident-agenda-what {
  display: grid;
  gap: 0.15rem;
  min-inline-size: 0;
}

.incident-agenda-what p {
  margin: 0;
  overflow-wrap: anywhere;
}

.incident-agenda-title {
  color: var(--fg1);
  font-weight: 700;
}

.incident-agenda-place,
.incident-agenda-together {
  color: var(--fg2);
  font-size: var(--text-xs);
}

.incident-agenda-together {
  font-weight: 650;
}

.incident-agenda-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
}

/* A person in an event: their first name on their monogram's tint, so they read the same as in the roster and the drawing. */
.incident-agenda-person {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.5rem;
  border: 1px solid hsl(var(--av-h) var(--avatar-line));
  border-radius: 999px;
  background: hsl(var(--av-h) var(--avatar-bg));
  color: hsl(var(--av-h) var(--avatar-fg));
  font-size: var(--text-xs);
  font-weight: 750;
}

.incident-agenda-none,
.incident-agenda-withheld {
  margin: 0;
  color: var(--fg2);
}

@container panel (inline-size < 16rem) {
  .incident-agenda-list,
  .incident-agenda-event {
    grid-template-columns: minmax(0, 1fr);
  }
}
