/* --- Users (modules/users/views/list.php), option B of the 2026-11-19 mock-up: the dashboard's greeting, then one tile
   (pages/dashboard.css) with the kinds of people as pills in its band, a search, and one row per person with their
   initials (pages/clients.css). Phones to 1199px: the role and status under the name, an arrow at the right.
   From 1200px: a table, Name | Role | Belongs to | Status. Loads after dashboard.css, so it can adapt the band. --- */

.users__head {
  align-items: flex-end;
  margin-bottom: var(--sp-6);
}

.users__head .dashboard__hello {
  margin-bottom: 0;
}

.users {
  gap: var(--sp-3);
  overflow: clip; /* the band follows the tile's round corners */
}

/* The kinds of people in the band: the same small pills as the dashboard's sort (white once chosen). Each is 24px high
   for a finger, reaching over the band's padding so the band keeps its height. Phones: under the title. */
.users .dashboard__head {
  flex-wrap: wrap;
}

.users .dashboard__head > .users__kinds {
  flex: 0 1 auto;
  min-width: 0;
}

.users__pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-block: calc(-1 * var(--sp-1));
}

.users__pill {
  display: block;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: var(--sp-4);
  color: var(--c-page);
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: background-color var(--duration-fast) var(--ease);
}

.users__pill:hover {
  background-color: var(--c-on-dark-hover);
}

.users__pill[aria-current="page"] {
  color: var(--c-anthracite);
  background-color: var(--c-page);
}

.users__pill:focus-visible {
  outline: var(--border-1) solid var(--c-page); /* the site's soft blue ring would not show on the dark band */
  outline-offset: var(--border-1);
}

@media (max-width: 575.98px) {
  .users .dashboard__head > .users__kinds {
    flex-basis: 100%;
    padding-bottom: var(--sp-1);
  }
}

/* A person: initials, name over email, the arrow; role (and status, when there is one) on the line under the name. */
.users__row {
  position: relative; /* holds its open button, which covers the whole row (.clients__open) */
  display: grid;
  grid-template-columns: var(--sp-8) minmax(0, 1fr) auto auto;
  grid-template-areas:
    "avatar who  who    chevron"
    "avatar role status chevron"
    "avatar org  org    chevron";
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  padding-block: var(--sp-2);
}

.users__row > .open {
  display: contents; /* its form takes no cell; the button inside covers the row */
}

.users__row + .users__row {
  border-top: var(--border-1) solid var(--c-line);
}

.users__row .clients__avatar { grid-area: avatar; }
.users__who { grid-area: who; }
.users__role { grid-area: role; justify-self: start; }
.users__status { grid-area: status; }
.users__chevron { grid-area: chevron; color: var(--c-text-muted); }

.users__org {
  grid-area: org;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.users__org--none,
.users__row:not(.users__row--status) .users__status {
  display: none; /* phones to 1199px: no dash for a login without a partner or clinic; "Active" goes without saying */
}

/* Their role: a pale blue chip. */
.users__role {
  padding-inline: var(--sp-2);
  font-size: var(--fs-xs);
  line-height: var(--sp-5);
  color: var(--c-accent-text);
  white-space: nowrap;
  background-color: var(--c-chip);
  border: var(--border-1) solid var(--c-chip-border);
  border-radius: var(--radius-pill);
}

/* Switched off: red; Invited and Not confirmed use Clients' amber "To contact" (.dashboard__tag--contact). */
.users__tag--off {
  color: var(--c-error);
  background-color: var(--c-error-bg);
}

.users__active {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.users__cols {
  display: none;
}

@media (hover: hover) {
  .users__row:has(.clients__open:hover) {
    background-color: var(--c-off-white);
  }
}

/* From 1200px: a table, with the column names in the band's small capitals above it. */
@media (min-width: 1200px) {
  .users__row,
  .users__cols {
    grid-template-columns: var(--sp-8) minmax(0, 3fr) minmax(0, 1.4fr) minmax(0, 2.4fr) minmax(0, 1.2fr) var(--sp-4);
    grid-template-areas: "avatar who role org status chevron";
  }

  .users__org--none,
  .users__row:not(.users__row--status) .users__status {
    display: block;
  }

  .users__org {
    font-size: inherit;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--c-text-muted);
  }

  .users__cols {
    display: grid;
    column-gap: var(--sp-3);
    padding-bottom: var(--sp-2);
    font-size: var(--fs-xxs);
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--c-anthracite);
    border-bottom: var(--border-1) solid var(--c-line);
  }

  .users__cols > :nth-child(2) { grid-column: 2; }
}
