.system-roles-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 auto;
  max-width: var(--system-admin-page-max-width, 1320px);
  padding: 18px 20px 96px;
}

.system-roles-workbar {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e1e7;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.system-roles-filters {
  align-items: end;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.system-roles-actions {
  align-items: end;
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.system-roles-summary {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.system-roles-metric {
  align-items: center;
  background: #f5f8fa;
  border: 1px solid #d8e1e7;
  border-radius: 6px;
  display: flex;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
}

.system-roles-metric span,
.system-roles-search span,
.system-roles-filter span {
  color: #5b6b76;
  font-size: 12px;
  font-weight: 700;
}

.system-roles-metric strong {
  color: #1d2b34;
  font-size: 15px;
  font-weight: 800;
}

.system-roles-search,
.system-roles-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.system-roles-search input,
.system-roles-filter select {
  background: #ffffff;
  border: 1px solid #c8d3db;
  border-radius: 6px;
  color: #1f2d36;
  font-size: 14px;
  min-height: 38px;
  padding: 8px 10px;
}

.system-roles-search input {
  width: 280px;
}

.system-roles-search input:focus,
.system-roles-filter select:focus,
.system-roles-field input:focus,
.system-roles-field textarea:focus {
  border-color: #1f7a6c;
  box-shadow: 0 0 0 3px rgba(31, 122, 108, 0.16);
  outline: none;
}

.system-roles-icon-button {
  flex: 0 0 auto;
  font-size: 18px;
  height: 38px;
  min-height: 38px;
  width: 38px;
}

.system-roles-table-section {
  background: #ffffff;
  border: 1px solid #c8d3db;
  border-radius: 8px;
  overflow: hidden;
}

.system-roles-section-header {
  align-items: center;
  background: #eef6f3;
  border-bottom: 1px solid #c4d7d1;
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.system-roles-section-header h2 {
  align-items: center;
  color: #173f38;
  display: flex;
  font-size: 17px;
  gap: 8px;
  margin: 0;
}

.system-roles-section-header h2::before {
  background: #1f7a6c;
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 18px;
  width: 4px;
}

.system-roles-table-wrap {
  overflow-x: auto;
}

.system-roles-table {
  border-collapse: collapse;
  min-width: 980px;
  table-layout: fixed;
  width: 100%;
}

.system-roles-table th,
.system-roles-table td {
  border-bottom: 1px solid #d4dee5;
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
}

.system-roles-table th:not(:last-child),
.system-roles-table td:not(:last-child) {
  border-right: 1px solid #d4dee5;
}

.system-roles-table th {
  background: #f5f8fa;
  color: #4f606c;
  font-size: 12px;
  font-weight: 800;
  position: static;
  top: auto;
  white-space: nowrap;
  z-index: auto;
}

.system-roles-table td {
  color: #22313b;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.system-roles-table th:nth-child(1),
.system-roles-table td:nth-child(1) {
  width: 150px;
}

.system-roles-table th:nth-child(2),
.system-roles-table td:nth-child(2) {
  width: 190px;
}

.system-roles-table th:nth-child(3),
.system-roles-table td:nth-child(3) {
  width: 88px;
}

.system-roles-table th:nth-child(4),
.system-roles-table td:nth-child(4) {
  width: 300px;
}

.system-roles-table th:nth-child(5),
.system-roles-table td:nth-child(5),
.system-roles-table th:nth-child(6),
.system-roles-table td:nth-child(6) {
  width: 84px;
}

.system-roles-table th:nth-child(7),
.system-roles-table td:nth-child(7) {
  width: 96px;
}

.system-roles-table td.system-roles-number-cell {
  text-align: right;
}

.system-roles-chip {
  background: #eef3f6;
  border: 1px solid #cfdbe3;
  border-radius: 999px;
  color: #41525e;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
}

.system-roles-chip.is-active {
  background: #e8f5f1;
  border-color: #9ccfc0;
  color: #166657;
}

.system-roles-chip.is-inactive {
  background: #f6eeee;
  border-color: #e1bcbc;
  color: #8b3434;
}

.system-roles-chip.is-attendance {
  background: #eaf4f7;
  border-color: #a7cbd6;
  color: #2c5f6f;
}

.system-roles-chip.is-feature {
  background: #f0f4ea;
  border-color: #bfd0a8;
  color: #4f6b25;
}

.system-roles-empty {
  color: #6a7882;
  height: 80px;
  text-align: center;
  vertical-align: middle;
}

.system-roles-row-actions {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.system-roles-row-button {
  align-items: center;
  background: #2c7892;
  border: 1px solid #25677d;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

.system-roles-row-button svg {
  height: 15px;
  width: 15px;
}

.system-roles-row-button:hover {
  background: #24677d;
  border-color: #205d72;
  color: #ffffff;
}

.system-roles-dialog {
  border: 1px solid #c8d3db;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(24, 36, 44, 0.28);
  color: #22313b;
  max-width: 720px;
  padding: 0;
  width: min(720px, calc(100vw - 28px));
}

.system-roles-dialog::backdrop {
  background: rgba(18, 28, 35, 0.42);
}

.system-roles-dialog form {
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100vh - 40px));
}

.system-roles-dialog-header,
.system-roles-dialog-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.system-roles-dialog-header {
  background: #eef6f3;
  border-bottom: 1px solid #d3e4df;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.system-roles-dialog-header h2 {
  align-items: center;
  color: #173f38;
  display: flex;
  font-size: 17px;
  gap: 8px;
  margin: 0;
}

.system-roles-dialog-header h2::before {
  background: #1f7a6c;
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 18px;
  width: 4px;
}

.system-roles-dialog-close {
  align-items: center;
  background: #2c7892;
  border: 1px solid #25677d;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.system-roles-dialog-close svg {
  height: 17px;
  width: 17px;
}

.system-roles-dialog-close:hover {
  background: #24677d;
  border-color: #205d72;
  color: #ffffff;
}

.system-roles-dialog-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow-y: auto;
  padding: 14px 16px 10px;
}

.system-roles-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.system-roles-field.is-wide {
  grid-column: 1 / -1;
}

.system-roles-field span {
  color: #5b6b76;
  font-size: 12px;
  font-weight: 800;
}

.system-roles-field input,
.system-roles-field textarea {
  background: #ffffff;
  border: 1px solid #c8d3db;
  border-radius: 6px;
  color: #1f2d36;
  font-size: 14px;
  min-height: 38px;
  padding: 8px 10px;
}

.system-roles-field textarea {
  min-height: 96px;
  resize: vertical;
}

.system-roles-field input[readonly] {
  background: #f5f8fa;
  color: #62727d;
}

.system-roles-dialog-footer {
  border-top: 1px solid #edf1f4;
  justify-content: flex-end;
}

.system-roles-dialog-footer .status {
  align-items: center;
  background: #eef3f6;
  border: 1px solid #cfdbe3;
  border-radius: 999px;
  color: #41525e;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  max-width: min(360px, 58vw);
  min-height: 28px;
  padding: 6px 10px;
}

.system-roles-dialog-footer .status.error {
  background: #f6eeee;
  border-color: #e1bcbc;
  color: #8b3434;
}

.system-roles-dialog-footer button[type="submit"] {
  background: #2c7892;
  border: 1px solid #25677d;
  border-radius: 6px;
  color: #ffffff;
  font-weight: 800;
  min-height: 34px;
  padding: 8px 14px;
}

.system-roles-dialog-footer button[type="submit"]:hover:not(:disabled) {
  background: #24677d;
  border-color: #205d72;
}

.system-roles-dialog-footer button[type="submit"]:disabled {
  opacity: 0.72;
}

@media (max-width: 900px) {
  .system-roles-workbar,
  .system-roles-filters,
  .system-roles-actions,
  .system-roles-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .system-roles-actions {
    margin-left: 0;
  }

  .system-roles-search input {
    width: 100%;
  }

  .system-roles-dialog-grid {
    grid-template-columns: 1fr;
  }
}
