/* admin-v2 "Role permissions". The card, title, caption, rows, picker and legend are the shared
   hooks. What stays here has no shared recipe (foundation proposal F34): the gridded matrix with
   its sunken head, and the permission level tones - a fill in the matrix, a coloured word on a phone
   card - that the legend keys. */

#akashic-health-records-patient-portal-root .role-permissions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#akashic-health-records-patient-portal-root .role-permissions__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* The matrix meets the panel edge, as the deck draws it; its own gridlines are the frame. */
#akashic-health-records-patient-portal-root .role-permissions > .role-permissions__card {
  padding: 0;
}

#akashic-health-records-patient-portal-root .role-permissions__matrix {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: var(--ak-font-12-5);
}

#akashic-health-records-patient-portal-root .role-permissions__matrix th,
#akashic-health-records-patient-portal-root .role-permissions__matrix td {
  padding: 0;
  border: 1px solid var(--line-soft);
  background: var(--surface);
}

#akashic-health-records-patient-portal-root .role-permissions__matrix thead th {
  padding: 8px 4px;
  background: var(--sunken);
  color: var(--ink-muted);
  font-size: var(--ak-font-11);
  font-weight: var(--ak-heading-weight);
  line-height: var(--ak-line-tight);
  text-align: center;
  /* Sentence case, so each heading wraps between words: in capitals the narrow columns split them mid-word. */
  overflow-wrap: normal;
  vertical-align: bottom;
}

#akashic-health-records-patient-portal-root .role-permissions__matrix thead th:first-child {
  width: 180px;
  padding-left: 12px;
  text-align: left;
}

#akashic-health-records-patient-portal-root .role-permissions__matrix tbody th {
  padding: 9px 12px;
  color: var(--ink-strong);
  font-weight: var(--ak-heading-weight);
  text-align: left;
}

#akashic-health-records-patient-portal-root .role-permissions__who {
  display: block;
  color: var(--ink-muted);
  font-size: var(--ak-font-11-5);
  font-weight: var(--ak-body-weight);
}

#akashic-health-records-patient-portal-root .role-permissions__control {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: inherit;
  cursor: pointer;
}

#akashic-health-records-patient-portal-root .role-permissions__control:disabled {
  cursor: wait;
}

/* The permission being edited keeps the deck's primary outline while its picker is open. */
#akashic-health-records-patient-portal-root .role-permissions__control[data-state="open"] {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

#akashic-health-records-patient-portal-root .role-permissions__level {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 9px 4px;
  font-size: var(--ak-font-11-5);
  font-weight: 500;
  text-align: center;
}

#akashic-health-records-patient-portal-root .role-permissions__level--none {
  background: var(--surface);
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .role-permissions__level--view {
  background: var(--blue-soft);
  color: var(--primary);
}

#akashic-health-records-patient-portal-root .role-permissions__level--manage {
  background: var(--primary);
  color: #fff;
}

#akashic-health-records-patient-portal-root .role-permissions__level--required {
  background: var(--sunken);
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .role-permissions__scope {
  display: block;
  margin-top: 1px;
  font-size: var(--ak-font-10-5);
  font-weight: var(--ak-body-weight);
  font-style: italic;
  opacity: 0.85;
}

/* The phone card: the shared rows, with the level as a word at the right. */
#akashic-health-records-patient-portal-root .role-permissions__lines {
  margin: 8px 0 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
  list-style: none;
}

#akashic-health-records-patient-portal-root .role-permissions__line .role-permissions__control {
  width: auto;
  margin-left: auto;
  text-align: left;
}

#akashic-health-records-patient-portal-root .role-permissions__word .role-permissions__scope {
  font-style: normal;
}

#akashic-health-records-patient-portal-root .role-permissions__word {
  display: block;
  font-size: var(--ak-font-12);
  font-weight: 400;
}

#akashic-health-records-patient-portal-root .role-permissions__word--none,
#akashic-health-records-patient-portal-root .role-permissions__word--required {
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .role-permissions__word--view,
#akashic-health-records-patient-portal-root .role-permissions__word--manage {
  color: var(--primary);
}

#akashic-health-records-patient-portal-root .role-permissions__word--manage {
  font-weight: 500;
}

/* The picker's head and its second group sit inside the shared menu's 4px inset. */
#akashic-health-records-patient-portal-root .role-permissions__picker-head {
  padding: 6px 10px 4px;
}

#akashic-health-records-patient-portal-root .role-permissions__picker-group {
  margin-top: 4px;
  border-top: 1px solid var(--line-soft);
  padding-top: 4px;
}

#akashic-health-records-patient-portal-root .role-permissions__swatch {
  display: block;
  width: 22px;
  height: 14px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line-soft);
}
