/* Permission control (static form): name + why-line + a three-state radiogroup
   (Inherit, Grant, Block). The three states read without colour: Inherit is an
   underlined neutral segment with an arrow and the inherited value in words;
   Grant is solid brand with a check; Block is inverse with a slashed circle and
   a struck label. Override rows carry a 3px bar and a faint ground; inherited
   rows recede. Locked rows are hatched, with a lock, "Always on" and the reason.
   Staged rows (not yet saved) carry the brand bar. Phone: the control drops
   under the name and spans the width with 44px segments. */

.pr-perms { margin: 0; padding: 0; list-style: none; }
.pr-perm {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: var(--pr-space-xs) var(--pr-space-lg);
  min-height: var(--pr-density-standard-row);
  padding: var(--pr-space-sm) var(--pr-space-md);
  border-bottom: var(--pr-border-hairline) solid var(--pr-border-subtle);
}
.pr-perm__name { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 500; color: var(--pr-text-primary); min-width: 0; }
.pr-perm__why { grid-column: 1; font-size: 0.75rem; line-height: 1.4; color: var(--pr-text-caption); }
.pr-perm__ctl { grid-column: 2; grid-row: 1 / span 2; }
.pr-perm.is-override { background: color-mix(in srgb, var(--pr-text-primary) 4%, transparent); box-shadow: inset 3px 0 0 var(--pr-text-primary); }
.pr-perm.is-staged { box-shadow: inset 3px 0 0 var(--pr-brand-text); }
.pr-perm.is-locked { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--pr-border-subtle) 8px 9px); }
.pr-perm--group { background: var(--pr-surface-nested); }
.pr-perm--group .pr-perm__name { font-weight: 600; }
.pr-perm__locked { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; color: var(--pr-text-primary); }
.pr-perm__summary { font-size: 0.75rem; color: var(--pr-text-caption); }

.pr-tri {
  display: inline-flex;
  border-radius: var(--pr-radius-sm);
  border: var(--pr-border-hairline) solid var(--pr-border-control);
  background: var(--pr-surface-nested);
  overflow: hidden;
}
.pr-tri__b {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 84px; height: var(--pr-density-dense-control);
  padding: 0 10px;
  border: 0; border-left: var(--pr-border-hairline) solid var(--pr-border-default);
  background: none;
  font-size: 0.75rem; font-weight: 500;
  color: var(--pr-text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
.pr-tri__b:first-child { border-left: 0; }
.pr-tri__b:hover { background: var(--pr-surface-hover); color: var(--pr-text-primary); }
.pr-tri__b:focus-visible { outline: var(--pr-border-focus) solid var(--pr-focus-ring); outline-offset: calc(var(--pr-border-focus) * -1); }
.pr-tri__b[aria-checked="true"], .pr-tri__b.is-on { color: var(--pr-text-primary); background: var(--pr-surface-hover); font-weight: 600; }
.pr-tri__b--grant[aria-checked="true"], .pr-tri__b--grant.is-on { background: var(--pr-brand-fill); color: var(--pr-text-on-brand); }
.pr-tri__b--block[aria-checked="true"], .pr-tri__b--block.is-on {
  background: var(--pr-surface-inverse); color: var(--pr-text-on-inverse);
  text-decoration: line-through; text-decoration-thickness: 1px;
}
.pr-tri__b--inherit[aria-checked="true"], .pr-tri__b--inherit.is-on { box-shadow: inset 0 -2px 0 var(--pr-text-secondary); }
/* Read-only (e.g. viewing as another user): unchecked segments grey out; the
   checked one keeps its fill and ink so the current state stays readable. */
.pr-tri__b[aria-disabled="true"] { cursor: not-allowed; }
.pr-tri__b[aria-disabled="true"]:not([aria-checked="true"]) { color: var(--pr-text-disabled); }
.pr-tri__b[aria-disabled="true"]:not([aria-checked="true"]):hover { background: none; }

@media (max-width: 768px) {
  .pr-perm { grid-template-columns: 1fr; padding: var(--pr-space-md) var(--pr-space-lg); }
  .pr-perm__ctl { grid-column: 1; grid-row: auto; margin-top: var(--pr-space-sm); }
  .pr-tri { display: flex; }
  .pr-tri__b { flex: 1 1 0; min-width: 0; height: var(--pr-touch-target); padding: 0 6px; gap: var(--pr-space-xs); font-size: 0.85rem; }
  .pr-tri__b--inherit { flex-grow: 1.4; }
}
