.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.heroLeft h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.heroLeft p {
  font-size: 14.3px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}
.heroRight {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.statPill {
  background: var(--primary-light);
  border: 1px solid rgba(94, 114, 228, 0.25);
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 96px;
}
.statPill b {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.statPill span {
  font-size: 11.6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
}
.addBtn {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  font-size: 14.3px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.005em;
}
.addBtn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.searchBar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.searchInputWrap {
  position: relative;
  flex: 1;
}
.searchInputWrap i {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-main);
  opacity: 0.45;
  font-size: 15.4px;
}
.searchInput {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14.3px;
  background: var(--background);
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}
.searchInput:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.lightBtn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 13.2px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.lightBtn:hover {
  background: var(--background);
  border-color: var(--primary);
  color: var(--primary);
}
.primaryBtn {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  font-size: 13.2px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.primaryBtn:hover {
  background: var(--primary-hover);
}

.modGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.modCard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.modCard:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -16px rgba(0, 73, 202, 0.25);
}
/* Cycle three primary tints so adjacent cards never share a shade. */
.modGrid > .modCard:nth-child(3n + 1) .modHeader {
  background: color-mix(in srgb, var(--primary) 26%, var(--surface));
}
.modGrid > .modCard:nth-child(3n + 2) .modHeader {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
}
.modGrid > .modCard:nth-child(3n + 3) .modHeader {
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
}
.modHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 14%, transparent);
}
.modHeaderLeft {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.modIcon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16.5px;
  box-shadow: var(--shadow-sm);
}
.modName {
  font-size: 13.2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modCount {
  font-size: 12.1px;
  color: var(--primary);
  font-weight: 600;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.modBody {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.permRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background 0.12s ease;
  min-height: 40px;
}
.permRow:hover {
  background: var(--primary-faint);
}
.actionChip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 6px;
  flex-shrink: 0;
  min-width: 62px;
  text-align: center;
}
.chipCreate {
  background: rgba(22, 163, 74, 0.18);
  color: #14532d;
}
.chipRead {
  background: rgba(37, 99, 235, 0.18);
  color: #1e3a8a;
}
.chipUpdate {
  background: rgba(217, 119, 6, 0.2);
  color: #78350f;
}
.chipDelete {
  background: rgba(220, 38, 38, 0.18);
  color: #7f1d1d;
}
.chipOther {
  background: var(--border);
  color: var(--text-main);
}
.permDesc {
  flex: 1;
  font-size: 13.8px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.rowActions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.permRow:hover .rowActions {
  opacity: 1;
}
.iconBtn {
  background: transparent;
  border: none;
  color: var(--text-main);
  opacity: 0.55;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.iconBtn:hover {
  opacity: 1;
  background: var(--surface);
}
.iconBtnDanger:hover {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
}

.empty {
  text-align: center;
  padding: 48px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  opacity: 0.7;
}
.empty i {
  font-size: 39.6px;
  opacity: 0.4;
  display: block;
  margin-bottom: 10px;
}
