/* The people pages (row 2026-11-12-people-page): People, one person, Roles, one role, My access. Every colour, size and space is
   a token; the masks below are the page's own Lucide icons; nothing here sets a width or a colour from data. */

/* ---------- icons these places need (Lucide, self-hosted) */
.i-key-round { --icon: url(../static/key-round.svg); }
.i-user-plus { --icon: url(../static/user-plus.svg); }
.i-user-x { --icon: url(../static/user-x.svg); }
.i-minus { --icon: url(../static/minus.svg); }
.i-refresh-cw { --icon: url(../static/refresh-cw.svg); }
.i-trash-2 { --icon: url(../static/trash-2.svg); }
.i-building-2 { --icon: url(../static/building-2.svg); }
.i-log-out { --icon: url(../static/log-out.svg); }

/* ---------- shared parts */
.people-screen { max-width: 760px; }
.button.secondary, .button.quiet { border: 1px solid transparent; }
.button.secondary { border-color: var(--line-input); background: var(--surface); }
.button .ico, button .ico { width: 18px; height: 18px; margin-right: var(--space-2); }
.is-danger { color: var(--bad); }
.people-add { align-self: flex-start; }
.people-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.people-actions .note { flex-basis: 100%; }
.people-locked { cursor: not-allowed; opacity: 0.55; }

/* the can't-reach line shows beside write controls only while the shell's banner is up */
.people-cant { display: none; flex-basis: 100%; color: var(--bad); }
.banner:not([hidden]) ~ main .people-cant { display: block; }

/* ---------- the list */
a.panel.people-row { display: flex; align-items: center; gap: var(--space-3); }
.people-row .ico { margin-left: auto; color: var(--muted); }
.people-row-text { display: flex; flex-direction: column; min-width: 0; }
.people-row-name { font-weight: 650; overflow-wrap: anywhere; }
.people-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
                 border-radius: 50%; background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.people-profile { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.people-profile .status-chip { margin-left: auto; }

/* an invite: the four-step track */
.people-invite { display: flex; flex-direction: column; gap: var(--space-3); }
.people-invite.is-expired { border-color: var(--warn); }
.invite-track { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.invite-track li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--muted); }
.invite-track li.is-done { color: var(--ink); }
.invite-track li.is-done .ico { color: var(--ok); }
.status-chip.is-wait { background: var(--warn-soft); color: var(--warn); }
.status-chip.is-late { background: var(--bad-soft); color: var(--bad); }

/* ---------- lines, devices, the held card */
.people-lines { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.people-lines li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.people-lines .ico { width: 16px; height: 16px; }
.people-lines .is-gain .ico { color: var(--ok); }
.people-lines .is-loss .ico, .people-lines .is-no .ico { color: var(--bad); }
.people-lines .is-no { color: var(--ink-2); }
.people-devices { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.people-devices li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.people-held { display: flex; align-items: flex-start; gap: var(--space-3); background: var(--surface-2); }
.people-held .ico { color: var(--muted); margin-top: 2px; }
.people-scope { display: flex; align-items: center; gap: var(--space-2); }
.people-loss { display: flex; align-items: flex-start; gap: var(--space-2); color: var(--bad); font-weight: 600; }
.people-loss .ico { width: 18px; height: 18px; flex: none; }
.people-refused { display: flex; align-items: flex-start; gap: var(--space-2); color: var(--bad); font-weight: 600; }
.people-refused .ico { flex: none; }
.people-chat { overflow-wrap: anywhere; }

/* ---------- the forms and the preview panel */
.people-form { padding: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.people-field { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.people-field legend { padding: 0; margin-bottom: var(--space-2); font-weight: 700; }
.people-choice { display: flex; align-items: flex-start; gap: var(--space-3); min-height: var(--tap); padding: var(--space-2) 0; cursor: pointer; }
.people-choice input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.people-choice input:disabled + .people-choice-words { opacity: 0.6; }
.people-choice-words { display: flex; flex-direction: column; min-width: 0; }
.people-choice-line { color: var(--muted); font-size: var(--text-sm); }
.people-text { display: flex; flex-direction: column; gap: var(--space-1); font-weight: 700; }
.people-text input { min-height: var(--tap); padding: 0 var(--space-3); font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
                     border: 1px solid var(--line-input); border-radius: var(--radius-md); }
.people-panel { background: var(--surface-2); }
.people-shift { display: flex; flex-direction: column; gap: var(--space-1); }
.people-shift-name { font-weight: 650; }
.people-shift-name:empty { display: none; }
.people-answer:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Roles: the comparison table scrolls inside its card, never the page */
.people-table {
  --action-width: clamp(8rem, 40vw, 18rem);
  --head-min-height: 4.5rem;
  --head-height: var(--head-min-height);
  position: relative; /* contain the table's absolutely positioned .sr text */
  container-type: inline-size;
  /* Both axes scroll inside the card, so the headings can stay put while the table moves under them. */
  overflow: auto;
  max-height: 70vh;
  max-height: min(70dvh, 48rem);
  scroll-padding-inline-start: var(--action-width);
  padding: 0;
  /* The cover scrolls with the table and hides the short edge fade when the last column is in view. */
  background:
    linear-gradient(to left, var(--surface) 50%, transparent) right / var(--space-8) 100% no-repeat local,
    radial-gradient(ellipse 100% 50% at right, var(--line-input), transparent) right / var(--space-3) var(--space-14) no-repeat scroll,
    var(--surface);
}
.people-table table { border-collapse: separate; border-spacing: 0; width: 100%; overflow-wrap: normal; }
.people-table th, .people-table td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.people-table thead td, .people-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  width: var(--action-width);
  min-width: var(--action-width);
  background: var(--surface);
  overflow-wrap: anywhere;
}
/* The heading row sticks to the top (its corner cell also to the start); role headings sit centred over their marks. */
.people-table thead th, .people-table thead td {
  position: sticky;
  top: 0;
  z-index: 4;
  box-sizing: border-box;
  height: var(--head-min-height);
  background: var(--surface);
}
.people-table thead td { z-index: 5; }
.people-table thead th { font-weight: 650; text-align: center; overflow-wrap: anywhere; }
/* Leave room for the pinned labels and both cell paddings when a role name wraps. */
.people-table thead th a, .people-table thead th .note {
  display: block;
  width: max-content;
  max-width: calc(100cqi - var(--action-width) - 2 * var(--space-3));
  margin-inline: auto;
}
.people-table thead th a { scroll-margin-inline: var(--space-2); }
.people-table thead th .note { font-weight: 400; font-size: var(--text-sm); }
.people-table tbody th[scope="row"] { font-weight: 400; }
/* A group's heading row sticks under the role headings until the next group takes over (each group is its own tbody).
   The whole row sticks, not its cells, so the band is held by the row's own box and not by each cell's; the name cell
   still sticks to the start for the sideways scroll (the tbody th rule above). */
.people-table .people-group { position: sticky; top: calc(var(--head-height) - 1px); z-index: 2; }
.people-table .people-group > * { background: var(--surface-2); font-weight: 700; }
.people-table .people-group > th { z-index: 3; }
.people-table td { text-align: center; }
.people-table .is-yes .ico { color: var(--ok); }
.people-table .is-no .ico { color: var(--muted); }
