.roles-page { max-width: 900px; margin: 0 auto; }
.role-color-section { margin-bottom: 24px; }
.role-color-picker { min-height: 48px; width: 100%; padding: 4px; cursor: pointer; }
.roles-page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin: 0 0 22px; padding: 4px 0 22px; border-bottom: 1px solid rgba(185, 255, 63, .2);
}
.roles-page-header h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -.035em; }
.roles-page-header p:last-child { max-width: 610px; margin: 0; color: var(--muted); line-height: 1.55; }
.roles-header-mark {
  display: grid; place-items: center; flex: 0 0 76px; height: 76px;
  border: 1px solid rgba(185, 255, 63, .3); border-radius: 24px;
  background: linear-gradient(145deg, rgba(185, 255, 63, .16), rgba(185, 255, 63, .025));
  color: var(--accent); transform: rotate(3deg);
}
.roles-header-mark span { font-size: 33px; font-weight: 800; letter-spacing: -.06em; }
.roles-guidance {
  margin: 0 0 22px; padding: 20px 22px;
  border: 1px solid rgba(185, 255, 63, .18); border-radius: 18px;
  background: linear-gradient(135deg, rgba(29, 48, 24, .58), rgba(8, 15, 9, .7));
}
.roles-guidance-heading { display: flex; align-items: center; gap: 13px; }
.roles-guidance-rule { display: block; align-self: stretch; width: 3px; min-height: 43px; border-radius: 4px; background: var(--accent); }
.roles-guidance-heading .eyebrow { margin-top: 0; }
.roles-guidance-heading h2 { margin: 0; font-size: 19px; }
.roles-guidance ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 26px; margin: 17px 0 0; padding: 0; list-style: none; }
.roles-guidance li { min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.roles-guidance li strong { color: var(--text); }
.roles-guidance code { color: var(--accent); font: inherit; font-weight: 700; }
.roles-error {
  display: flex; flex-direction: column; gap: 4px; margin: 0 0 18px; padding: 14px 16px;
  border: 1px solid rgba(218, 55, 60, .55); border-radius: 12px;
  background: rgba(218, 55, 60, .12); color: #ffaaa6; overflow-wrap: anywhere;
}
.roles-error strong { color: #ffd4d1; }
.roles-create-form { padding: clamp(18px, 3vw, 30px); }
.roles-form-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; }
.roles-form-heading h2 { margin: 0; font-size: 21px; }
.roles-step { padding: 6px 11px; border: 1px solid rgba(185, 255, 63, .2); border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.roles-step span { color: var(--accent); }
.roles-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(190px, .6fr); gap: 16px; }
.roles-fields .field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.roles-fields input { width: 100%; min-height: 44px; }
.roles-fields .muted { font-size: 12px; line-height: 1.45; }
.roles-display-options, .roles-permissions { min-width: 0; margin: 27px 0 0; padding: 20px 0 0; border: 0; border-top: 1px solid rgba(185, 255, 63, .15); }
.roles-display-options legend, .roles-permissions legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; font-size: 17px; font-weight: 700; }
.roles-display-options > *, .roles-permissions > * { clear: both; }
.roles-toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 8px; }
.role-toggle {
  display: flex; align-items: flex-start; gap: 12px; min-width: 0; min-height: 74px; padding: 14px;
  border: 1px solid rgba(185, 255, 63, .15); border-radius: 13px; background: rgba(3, 8, 4, .3); cursor: pointer;
}
.role-toggle:has(input:checked) { border-color: rgba(185, 255, 63, .48); background: rgba(185, 255, 63, .07); }
.role-toggle input, .role-permission input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.role-toggle span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.role-toggle strong { font-size: 14px; }
.role-toggle small { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.roles-permissions-intro { clear: both; padding-top: 7px; margin: 0 0 13px; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.roles-permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.role-permission {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 5px 11px; min-width: 0; min-height: 52px; padding: 14px;
  border: 1px solid rgba(185, 255, 63, .13); border-radius: 12px; background: rgba(3, 8, 4, .3); cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.role-permission:has(input:checked) { border-color: rgba(185, 255, 63, .43); background: rgba(185, 255, 63, .065); }
.role-permission:hover { border-color: rgba(185, 255, 63, .3); }
.role-permission.is-unavailable { cursor: not-allowed; opacity: .52; }
.role-permission-label { min-width: 0; color: var(--text); font-size: 13px; line-height: 1.4; overflow-wrap: normal; }
.role-permission-note { display: block; grid-column: 2; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: left; }
.roles-no-permissions { clear: both; margin: 8px 0 0; padding: 14px; border: 1px dashed rgba(185, 255, 63, .2); border-radius: 12px; color: var(--muted); font-size: 13px; }
.roles-form-footer {
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  margin-top: 24px; padding-top: 19px; border-top: 1px solid rgba(185, 255, 63, .12); text-align: center;
}
.roles-form-footer p { margin: 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.roles-submit { min-width: min(100%, 220px); min-height: 44px; }
@media (max-width: 640px) {
  .roles-page-header { align-items: flex-start; }
  .roles-header-mark { flex-basis: 56px; height: 56px; border-radius: 18px; }
  .roles-header-mark span { font-size: 25px; }
  .roles-guidance { padding: 17px; }
  .roles-guidance ul, .roles-fields, .roles-toggle-grid, .roles-permission-grid { grid-template-columns: minmax(0, 1fr); }
  .roles-guidance ul { gap: 9px; }
  .roles-form-heading { align-items: flex-start; }
  .role-permission { min-height: 58px; padding: 15px; }
  .roles-submit { width: 100%; }
}
