.roles-page {
  color: #10213d;
  font-size: 14px;
  line-height: 22px;
}

.roles-page .page-toolbar {
  min-height: 40px;
  margin-bottom: 16px;
}

.roles-page .page-actions {
  gap: 12px;
}

.roles-page .btn {
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
  line-height: 20px;
  border-radius: 6px;
  box-shadow: none;
}

.roles-page .btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px #e6f4ff, 0 0 0 4px #1677ff;
}

.roles-page .permission-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.roles-page .panel {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: none;
}

.roles-page .panel-head {
  min-height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid #e2e8f0;
}

.roles-page .panel-head h3 {
  color: #10213d;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.roles-page .panel-head > span {
  color: #526278;
  font-size: 12px;
  line-height: 18px;
}

.roles-page .roles-list-panel .panel-body {
  padding: 8px;
}

.roles-page .role-list {
  display: grid;
  gap: 4px;
}

.roles-page .role-item {
  min-height: 66px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
}

.roles-page .role-item:hover {
  background: #f8fafc;
}

.roles-page .role-item.active {
  background: #e6f4ff;
  border-color: #bae0ff;
}

.roles-page .role-item b {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #10213d;
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
}

.roles-page .role-item small {
  display: block;
  margin-top: 4px;
  color: #7a889c;
  font-size: 12px;
  line-height: 18px;
}

.roles-page .badge {
  min-height: 24px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 18px;
  border-radius: 12px;
}

.roles-page .roles-permission-panel .panel-body {
  padding: 0 20px 20px;
}

.roles-page .tabs {
  display: flex;
  gap: 28px;
  min-height: 53px;
  align-items: flex-end;
  margin: 0 0 16px;
  border-bottom: 1px solid #e2e8f0;
}

.roles-page .tab {
  position: relative;
  padding: 0 2px 13px;
  color: #7a889c;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

.roles-page .tab.active {
  color: #1677ff;
  font-weight: 600;
}

.roles-page .tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: #1677ff;
}

.roles-page .permission-tree {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.roles-page .permission-group {
  min-width: 0;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.roles-page .permission-group > b {
  display: block;
  padding-bottom: 10px;
  margin-bottom: 6px;
  color: #10213d;
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
}

.roles-page .check-row {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: #526278;
  font-size: 14px;
  line-height: 22px;
}

.roles-page .check-box {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  background: #1677ff;
  border: 1px solid #1677ff;
  border-radius: 4px;
}

.roles-page .check-box:empty {
  background: #fff;
  border-color: #cbd5e1;
}

.roles-page .roles-permission-panel .page-actions {
  padding-top: 16px;
  margin-top: 16px !important;
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 1180px) {
  .roles-page .permission-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .roles-page .permission-tree {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  html:has(.roles-page),
  body:has(.roles-page),
  #app:has(.roles-page) {
    min-width: 0;
  }

  body:has(.roles-page) {
    overflow-x: hidden;
    background: #f5f7fa;
  }

  .admin-shell:has(.roles-page) .sidebar {
    width: 64px;
  }

  .admin-shell:has(.roles-page) .sidebar :is(.brand > div, .nav-group__label, .nav-item > span:not(.nav-icon), .sidebar-foot) {
    display: none;
  }

  .admin-shell:has(.roles-page) .brand,
  .admin-shell:has(.roles-page) .nav-item {
    justify-content: center;
    padding-inline: 0;
  }

  .admin-shell:has(.roles-page) .main-shell {
    margin-left: 64px;
  }

  .admin-shell:has(.roles-page) .topbar {
    padding: 0 16px;
  }

  .admin-shell:has(.roles-page) .context-pill {
    width: 150px;
    min-width: 150px;
  }

  .admin-shell:has(.roles-page) .user-chip {
    padding-right: 5px;
  }

  .admin-shell:has(.roles-page) .user-chip b {
    display: none;
  }

  .admin-shell:has(.roles-page) .page-content {
    padding: 16px;
  }
}

@media (max-width: 840px) {
  .roles-page .permission-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .roles-page .role-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-shell:has(.roles-page) .top-actions .context-pill {
    display: none;
  }

  .roles-page .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .roles-page .page-toolbar .btn {
    flex: 1 1 140px;
    justify-content: center;
  }

  .roles-page .panel-head,
  .roles-page .roles-permission-panel .panel-body {
    padding-inline: 16px;
  }

  .roles-page .permission-tree {
    grid-template-columns: minmax(0, 1fr);
  }

  .roles-page .roles-permission-panel .page-actions {
    justify-content: stretch !important;
  }

  .roles-page .roles-permission-panel .page-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .admin-shell:has(.roles-page) .sidebar {
    width: 56px;
  }

  .admin-shell:has(.roles-page) .main-shell {
    margin-left: 56px;
  }

  .admin-shell:has(.roles-page) .topbar {
    padding-inline: 10px;
  }

  .admin-shell:has(.roles-page) .page-content {
    padding: 12px;
  }

  .roles-page .role-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .roles-page .tabs {
    gap: 18px;
    overflow-x: auto;
  }

  .roles-page .permission-group {
    padding-inline: 14px;
  }
}
